Difference between revisions of "Firmware-811 Message-010"
Line 26: | Line 26: | ||
The WiDig has function Orient3D, method 1, enabled an Orient3D sensor with device address 96 connected to I2C port 1. The WiDig acquires the value 90 (heading east), 45 (pitch down), and -45 (roll to the right). The WiDig sends the following message in host mode: | The WiDig has function Orient3D, method 1, enabled an Orient3D sensor with device address 96 connected to I2C port 1. The WiDig acquires the value 90 (heading east), 45 (pitch down), and -45 (roll to the right). The WiDig sends the following message in host mode: | ||
− | :240, 125, 0 {DEV}, 10 {I2C DATA}, 0 {I2C port}, 96 (address of device}, 125 {Orient3D}, 1 {heading/pitch/roll}, 0 { | + | :240, 125, 0 {DEV}, 10 {I2C DATA}, 0 {I2C port}, 96 (address of device}, 125 {Orient3D}, 1 {heading/pitch/roll}, 0 {MSB nibble of heading 1st byte}, 10 {LSB nibble of heading 1st byte}, 8 {MSB nibble of heading 2nd byte}, 12 {LSB nibble of heading 2nd byte}, 2 {MSB nibble of pitch}, 0 {LSB nibble of pitch}, 13 {MSB nibble of roll}, 15 {LSB nibble of roll}, 247 (F0h, 7Dh, 00h, 0Ah, 00h, 64h, 7Dh, 01h, 00h, 0Ah, 08h, 0Ch, 02h, 00h, 0Dh, 0Fh, F7h) |
The heading value from the Orient3D is ( 0 * 16 (ie. 4-bit shift) + 10 ) * 256 (ie. 8-bit shift) + 8 * 16 (i.e. 4-bit shift) + 12 = 2700, corresponding to 270.0 degrees. | The heading value from the Orient3D is ( 0 * 16 (ie. 4-bit shift) + 10 ) * 256 (ie. 8-bit shift) + 8 * 16 (i.e. 4-bit shift) + 12 = 2700, corresponding to 270.0 degrees. |
Latest revision as of 02:20, 17 September 2022
I2C DATA (10, 0Ah)
In host mode the WiDig sends digital (I2C) sensor values, after being activated through a FUNCTION command, in the I2C DATA message.
The [BODY] of the I2C DATA message contains a list of sensor values as specified in the function’s method. 8-bit values are sent as two nibbles inside a byte each:
00000yyy: | yyy = [0..7]; sensor input number, where the first input number = 0 and the last (8th) input number = 7 |
0ddddddd: | ddddddd = [0-127]; I2C device address |
0nnnnnnn: | nnnnnnn = [0-127]; function number |
0ppppppp: | ppppppp = [0-127]; function method or parameter |
0ddddddd: | ddddddd = [0..127]; data byte (number and encoding of data bytes dependent on function) |
Example:
The WiDig has function Orient3D, method 1, enabled an Orient3D sensor with device address 96 connected to I2C port 1. The WiDig acquires the value 90 (heading east), 45 (pitch down), and -45 (roll to the right). The WiDig sends the following message in host mode:
- 240, 125, 0 {DEV}, 10 {I2C DATA}, 0 {I2C port}, 96 (address of device}, 125 {Orient3D}, 1 {heading/pitch/roll}, 0 {MSB nibble of heading 1st byte}, 10 {LSB nibble of heading 1st byte}, 8 {MSB nibble of heading 2nd byte}, 12 {LSB nibble of heading 2nd byte}, 2 {MSB nibble of pitch}, 0 {LSB nibble of pitch}, 13 {MSB nibble of roll}, 15 {LSB nibble of roll}, 247 (F0h, 7Dh, 00h, 0Ah, 00h, 64h, 7Dh, 01h, 00h, 0Ah, 08h, 0Ch, 02h, 00h, 0Dh, 0Fh, F7h)
The heading value from the Orient3D is ( 0 * 16 (ie. 4-bit shift) + 10 ) * 256 (ie. 8-bit shift) + 8 * 16 (i.e. 4-bit shift) + 12 = 2700, corresponding to 270.0 degrees.
The pitch value from the Orient3D is 2 * 16 (i.e. 4-bit shift) + 0 = 32 unsigned, so that the two’s complement signed value is also 32, corresponding to 32 * 359 / 255 = 45 degrees.
The roll value from the Orient3D is 13 * 16 (i.e. 4-bit shift) + 15 = 223 unsigned, so that the two’s complement signed value is 223 – 256 = -32. Corresponding to -32 * 359 / 255 = -45 degrees.