Firmware-72 Command-003

From I-CubeX Wiki
Jump to: navigation, search

INTERVAL (3, 03h)

The USB-microDig’s sampling interval is the time that the USB-microDig must wait until it samples again the enabled inputs. For example if the sampling interval is set to 100ms the USB-microDig will sample all of its enabled inputs and can be set to speed up or slow down data acquisition.

The sample interval applies to all sensor inputs, ie. it is not possible to set a different sample interval for each sensor input. The interval is set in milliseconds with 1ms being the lowest (ie. highest sampling rate), and 16383ms (about 16 seconds) being the highest (ie. lowest sampling rate).

When the INTERVAL command is sent in host mode the sampling interval is stored in volatile memory, while in stand-alone mode it is stored in both volatile as well as non-volatile memory. After a RESET in host mode, the sampling interval is set to its default value (see the RESET command), while in stand-alone mode it is retrieved from non-volatile memory.

The INTERVAL command [BODY] is composed of 2 bytes each containing a 7-bit number. The first byte is the most significant byte, while the second byte is the least significant byte. Upon completion of the command the USB-microDig sends out the same command.

The [BODY] of the INTERVAL command:

0xxxxxxx: xxxxxxx = [0..127]; sample interval MSB
0yyyyyyy: yyyyyyy = [0..127]; sample interval LSB

where sample interval = xxxxxxx * 128 + yyyyyyy

Example:

In order to set the sampling interval to 1 second (1000 ms), the following command is sent:

240, 125, 0 {DEV}, 3 {INTERVAL}, 7 {xxxxxxx}, 104 {yyyyyyy}, 247 (F0h, 7Dh, 00h, 03h, 07h, 68h, F7h)

The sample interval is 7 * 128 + 104 = 1000