App note: Reading two bytes of data over I2C
Some I2C sensors and devices store more then one byte of data that needs to be read by a microcontroller. Many of these devices change the data once a stop bit has been received.
Problems might occur if the data is read by the microcontroller in two consecutive 1byte transactions. If so, the microcontroller will send a stop bit between two data transmissions, thus prompting the device to update it’s data and corrupt the second byte.
Here is a app note from Maxim explaining how to properly read two bytes without any data corruption. Instead of sending a stop bit after the first byte is received, a repeated start should be sent by the master, thus insuring no data corruption will occur.This entry was posted in app notes and tagged I2C, reading 2 bytes, sensor.