Hi Simpi
http://ww1.microchip.com/downloads/en/D ... 22003b.pdf
I haven’t used this device but I have had a look at the datasheet, its slightly confusing if not familiar with I2C. Here is what I can get from it.
The slave address is $68, though it is possible to order the device with a different address (add 1 to 7), see bottom of page 12
The correct address to be used in I2C is the $68 <<1 (left shift), for a write operation use this and for a read operation add 1 to the address. i.e. write operation address is $D0 and read is $D1.
page 11 describes the configuration register. The key point about this register is bit 7 , this is used to start a conversion in one shot and is used to show that a conversion has taken place in continuous mode.
One shot mode (config 10001000, One shot, 15sps, 1v/v)
- MI2C_Start
MI2C_Transmit_Byte($D0)
MI2C_Transmit_Byte($88)
MI2C_Stop
Delay(1/15)
MI2C_Start
MI2C_Transmit_Byte($D1)
MI2C_Receive_Byte-hi byte
MI2C_Receive_Byte-lo byte
MI2C_Receive_Byte-config byte
MI2C_Stop
MI2C_Recieve_Byte
For continuous conversion
- MI2C_Start
MI2C_Transmit_Byte($D0)
MI2C_Transmit_Byte($18)
MI2C_Stop
Delay(1/15)
MI2C_Start
MI2C_Transmit_Byte($D1)
MI2C_Receive_Byte-hi byte
MI2C_Receive_Byte-lo byte
MI2C_Receive_Byte-config byte
MI2C_Stop
In 18 bit mode there are three bytes of data plus the config byte.
- MI2C_Receive_Byte-hi byte
MI2C_Receive_Byte-mid byte
MI2C_Receive_Byte-lo byte
Using table 5-2 you would be able to determine if the data received was from a new conversion, if it is not new then read again.
Hope this helps
Gary