This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

writing integer on I2C device.

I want to write/read a integer/ long integer on a I2C device, but all the routines I have supports only character(single byte) writing/ reading from I2C device. Can anyone help me?

Parents
  • That's how the protocol of I2c is defined. You can send only one byte at a time, if it is now the device address, the subaddress or just data. The 9th bit in the protocol is reserved for the acknowledge, so only 8 bits can be send.
    However, you can send as many bytes as you want (there's in theory no limit in the amount of bytes). So, your integer could be divided into two bytes to send on the bus, as Stephan suggests.

    --Geert

Reply
  • That's how the protocol of I2c is defined. You can send only one byte at a time, if it is now the device address, the subaddress or just data. The 9th bit in the protocol is reserved for the acknowledge, so only 8 bits can be send.
    However, you can send as many bytes as you want (there's in theory no limit in the amount of bytes). So, your integer could be divided into two bytes to send on the bus, as Stephan suggests.

    --Geert

Children