Firmware-811 Message-127
I2C READ (127, 7Fh)
The I2C READ message is a reply from the I2C READ command. This message indicates that the I2C device supplied data according to the I2C READ command. The [BODY] of the I2C READ message indicates the I2C address of the device, the register number, the number of bytes transferred from the device and the bytes of data.
The I2C READ message [BODY] is:
00000xxx: | xxx = [0..6]; I2C port number |
0aaaaaaa: | aaaaaa = [0..127]; I2C address of device |
0000bbbb: | |
0000cccc: | bbbbcccc = [0..255]; register number of device |
0ddddddd: | ddddddd = [1..127]; number of bytes read |
0000eeee: | |
0000ffff: | eeeeffff = [0..255]; data byte #1 |
0000gggg: | |
0000hhhh: | gggghhhh = [0..255]; data byte #2 etc. if more than 1 byte requested |
Example:
- 240, 125, 0 {DEV}, 127 {I2C READ}, 03 {port number}, 56 {address of device}, 0, 0 {register 0 = 0*16+0}, 2 {number of bytes read 2}, 10, 11 {data byte #1 171 = 10*16+11}, 4, 7 {data byte #2 71 = 4*16+7}, 247 (F0h, 7Dh, 00h, 7Fh, 03h, 38h, 00h, 00h, 01h, 0Ah, 0Bh, 04h, 07h, F7h)
If the device responded to the provided I2C address “aaaaaaa” (I2C devices always acknowledge when it’s address is called) then the WiDig will respond with a I2C READ message identical to the I2C READ command sent. If there was no acknowledgement from the device within 100 ms (eg. wrong address or device not present) then the WiDig will respond with an I2C NO RESPONSE message (F0h, 00h, 7Bh, 05h, 38h, F7h). If the I2C port on the WiDig was not opened the WiDig will respond with a I2C PORT “port not opened” message (F0h 7Dh 00h 7Dh xx F7h, where xx is the requested port).