I/O support
I/O sampling
XBee Wi-Fi RF Module User Guide
72
I/O sampling
The XBee Wi-Fi RF Module has the ability to monitor and sample the analog and digital I/O lines. I/O
samples indicate the current state of I/O lines. These samples may be output on the local (serial) port,
transmitted to a remote device, or sent to Remote Manager.
There are three ways to obtain I/O samples, either locally or remotely:
n
Queried sampling
n
Periodic sampling
n
Change detection sampling
I/O sample data is formatted as shown in following table.
Bytes
Name
Description
1
Sample Sets
Number of sample sets in the packet. Always set to 1.
2
Digital channel mask Digital I/O line on the device.
bit 0 = DIO0
bit 1 = DIO1
bit 2 = DIO2
bit 3 = DIO3
bit 4 = DIO4
bit 5 = DIO5
bit 6 = DIO6
bit 7 = DIO7
bit 8 = DIO8
bit 9 = DIO9
bit 10 = DIO10
bit 11 = DIO11
bit 12 = DIO12
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.
bit 0 = AD0
bit 1 = AD1
bit 2 = AD2
bit 3 = AD3
Variable Sampled data set
If any digital I/O lines are enabled, the first two bytes of the data
set indicate the state of all enabled digital I/O. Only digital
channels that are enabled in the Digital channel mask bytes have
any meaning in the sample set. If no digital IO is enabled on the
device, these two bytes will be omitted.
Following the digital I/O data (if any), each enabled analog channel
will return two bytes. The data starts with AD0 and continues
sequentially for each enabled analog input channel up to AD3.
The sampled data set includes two bytes of digital I/O data only if one or more I/O lines on the device
are configured as digital I/O. If no pins are configured as digital I/O, these two bytes are omitted.
The digital I/O data is only relevant if the same bit is enabled in the digital I/O mask.