Firmware-72 Message-000

From I-CubeX Wiki
Jump to: navigation, search

STREAM DATA (0, 00h)

In host mode the USB–microDig sends analog sensor input values, after being activated through a STREAM command, in the STREAM DATA message.

The [BODY] of the STREAM DATA message contains a list of sensor values from all active (turned on) sensors, in ascending order. Inactive sensors are not included in the list. Both 7-bit and 10-bit sensor values are packed together - 10-bit values are sent using two bytes, where the first byte contains the first 7 bits of the sensor value and the second byte contains the last 3 bits of the sensor value:

7-bit lo-res mode

0yyyyyyy: yyyyyyy = [0..127]; the most significant bits

10-bit hi-res mode

0yyyyyyy: yyyyyyy = [0..127]; the most significant bits
000zzz00: zzz = [0..7]; the 3 least significant bits

Example:

The USB-microDig has sensor input 1 turned on in lo-res mode (7-bit), sensor input 5 turned on in hi-res mode (10-bit), and sensor input 8 turned on in lo -res mode (7-bit). All other sensor inputs are turned off. The USB-microDig acquires the value 100 (sensor input 1), 1000 (sensor input 5), and 21 on (sensor input 8). The USB-microDig sends the following message:

240, 125, 0 {DEV}, 0 {STREAM DATA}, 100 {yyyyyyy of sensor input 1}, 125 {yyyyyyy of sensor input 5}, 0 {zzz of sensor input 5}, 21 {yyyyyyy of sensor input 8}, 247 (F0h, 7Dh, 00h, 00h, 64h, 7Dh, 00h, 15h, F7h)

The sampled value from sensor input 5 is 125 * 8 (i.e. 3 bit shift) + 0 = 1000