PDA

View Full Version : max 128 + pic 16f877



supernono
- 8th March 2009, 10:12
hello
i want to use a max 128 (a i2c adc converter)with a pic 16f877 but i have a problem:
the adress is a byte(8 bit) and the result is a world(16 bit)
i don't know how i can do this :confused:
have you an idea for me ???

i link you the max 128 datasheet
http://www.datasheetcatalog.org/datasheet/maxim/MAX127-MAX128.pdf
look page 10_13

excuse my english but i'm french :)

supernono
- 8th March 2009, 13:45
hello it's me again

may be i can use a byte adress and two byte value for the result, like this



DPIN var PORTA.0 ' I2C data pin
CPIN var PORTA.1 ' I2C clock pin
adres var byte ' I2C adress
ctrol var byte ' I2C control
B0 var word
B1 var byte
B2 var byte


I2CREAD DPIN,CPIN,ctrol,adres,[B1,B2] ' Read 2 locations in a row
B0.highbyte = B1 ' Move HIGH byte of result to B0
B0.lowbyte = B2 ' Move LOW byte of result to B0