
Analog and digital I/O lines
I/O sampling
XBee/XBee-PRO® S2C ZigBee® RF Module
146
A floating input is appropriate if the pin is attached to an output that always drives the line. In this
case, a pull-up or pull-down resistor draws more current.
A pulled-up input is useful where there might not always be an external source to drive the pin and it is
desirable to have the line read high in the absence of an external driver.
Likewise, a pulled-down input is useful when there is not always an external source to drive the pin
and it is desirable to have the line read low in the absence of an external driver.
Two commands are available to configure the input type:
n
PR
determines whether or not to pull an input. If the corresponding bit in
PR
is set, the signal
pulls. If it is clear, then the signal floats.
n
PD
determines the pull direction. It only applies when the corresponding bit in
PR
is set. Set the
bit in PD to enable an internal pull-up resistor; clear it to enable an internal pull-down resistor.
I/O sampling
The XBee/XBee-PRO ZigBee RF Modules have the ability to monitor and sample the analog and digital
I/O lines. I/O samples can be read locally or transmitted to a remote device to provide an indication of
the current I/O line states. You must enable API mode on the receiving device to send I/O samples out
the serial port. If you do not enable this mode, the device discards the remote I/O samples.
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 the following table:
Bytes
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.
bit 0 = AD0/DIO0
bit 1 = AD1/DIO1
bit 2 = AD2/DIO2
bit 3 = AD3/DIO3
bit 4 = DIO4
bit 5 = ASSOC/DIO5
bit 6 = RTS/DIO6
bit 7 = CTS/GPIO7
bit 8 = SLP_RQ/DIO8
bit 9 = ON_SLP/DIO9
bit 10 = RSSI/DIO10
bit 11 = PWM/DIO11
bit 12 = CD/DIO12
bit 13 = DOUT/DIO13
bit 14 = DIN/DIO14
For example, a digital channel mask of 0x002F means DIO0,1,2,3,
and 5 are enabled as digital I/O.