Difference between revisions of "Firmware-811 Command-126"
(Copied from Firmware-810 Command-126, revision 4401) |
|||
Line 29: | Line 29: | ||
:240, 125, 0 {DEV}, 126 {I2C WRITE}, 4 {port number}, 56 {address of device}, 0, 3 {register 3 = 0*16+3}, 1, 2 {data byte 18 = 1*16+2}, 247 (F0h, 7Dh, 00h, 7Eh, 04h, 38h, 00h, 03h, 01h, 02h, F7h) | :240, 125, 0 {DEV}, 126 {I2C WRITE}, 4 {port number}, 56 {address of device}, 0, 3 {register 3 = 0*16+3}, 1, 2 {data byte 18 = 1*16+2}, 247 (F0h, 7Dh, 00h, 7Eh, 04h, 38h, 00h, 03h, 01h, 02h, 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 [[Firmware- | + | 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 [[Firmware-811_Message-126 |I2C WRITE message]] identical to the I2C WRITE 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 [[Firmware-811_Message-123 |I2C NO RESPONSE message]] (ie. in the above case the response would be F0h, 00h, 7Bh, 04h, 38h, F7h). If the I2C port on the WiDig was not opened the WiDig will respond with an [[Firmware-811_Message-125 |I2C PORT message]] indicating the port was not opened (F0h 7Dh 00h 7Dh 04h F7h, where the port number is 4). |
Latest revision as of 16:10, 16 April 2019
I2C WRITE (126, 7Eh)
The I2C WRITE command can be used to transfer data to a I2C device. Unless the I2C device has no pull-up resistors it is not necessary to use the I2C PORT command before sending the I2C WRITE command. The command can be used in both host and stand-alone modes of operation.
The I2C WRITE command [BODY] is:
00000xxx: | xxx = [0..7]; I2C port number |
0aaaaaaa: | aaaaaa = [0..127]; I2C address of device |
0000bbbb: | |
0000cccc: | bbbbcccc = [0..255]; register number of device |
0000dddd: | |
0000eeee: | ddddeeee = [0..255]; data to write to register bbbbcccc |
Example:
- 240, 125, 0 {DEV}, 126 {I2C WRITE}, 4 {port number}, 56 {address of device}, 0, 3 {register 3 = 0*16+3}, 1, 2 {data byte 18 = 1*16+2}, 247 (F0h, 7Dh, 00h, 7Eh, 04h, 38h, 00h, 03h, 01h, 02h, 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 WRITE message identical to the I2C WRITE 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 (ie. in the above case the response would be F0h, 00h, 7Bh, 04h, 38h, F7h). If the I2C port on the WiDig was not opened the WiDig will respond with an I2C PORT message indicating the port was not opened (F0h 7Dh 00h 7Dh 04h F7h, where the port number is 4).