You can use IS (Force Sample) to query the current state of all digital input and ADC lines on the device. If no inputs are defined, the command returns an ERROR.
If you send the IS command from Command mode, then the device returns a carriage return delimited list containing the following fields.
Field | Name | Description |
---|---|---|
1 | Sample sets | Number of sample sets in the packet. Always set to 1. |
2 | Digital channel mask |
Indicates which digital I/O lines have sampling enabled. Each bit corresponds to one digital I/O line on the device.
For example, a digital channel mask of 0x002F means DIO0, 1, 2, 3 and 5 are enabled as digital I/O. |
1 | Analog channel mask |
Indicates which lines have analog inputs enabled for sampling. Each bit in the analog channel mask corresponds to one analog input channel.
|
Variable | Sampled data set |
If you enable any digital I/O lines, the first two bytes of the data set indicate the state of all enabled digital I/O. Only digital channels that you enable in the digital channel mask bytes have any meaning in the sample set. If you do not enable any digital I/O on the device, it omits these two bytes. Following the digital I/O data (if there is any), each enabled analog channel returns two bytes. The data starts with AD0 and continues sequentially for each enabled analog input channel up to AD3. |
If you issue the IS command using a local or remote AT Command API frame, then the device returns an AT Command Response (0x88 or 0x97) frame with the I/O data included in the command data portion of the packet.
Example | Sample AT response |
---|---|
0x01 | [1 sample set] |
0x0C0C | [Digital inputs: DIO 2, 3, 10, 11 enabled] |
0x03 | [Analog inputs: A/D 0, 1 enabled] |
0x0408 | [Digital input states: DIO 3, 10 high, DIO 2, 11 low] |
0x03D0 | [Analog input: ADIO 0 = 0x3D0] |
0x0124 | [Analog input: ADIO 1 = 0x120] |