XBee®/XBee‐PRO® ZB SMT RF Modules
I/O Examples
Example 1: Configure the following I/O settings on the XBee.
Configure AD1/DIO1 as a digital input with pullup resistor enabled
Configure AD2/DIO2 as an analog input
Configure DIO4 as a digital output, driving high.
To configure AD1/DIO1 as an input, issue the ATD1 command with a parameter of 3 ("ATD13"). To enable pull-
up resistors on the same pin, the PR command should be issued with bit 3 set (e.g. ATPR8, ATPR1FFF, etc.).
The ATD2 command should be issued with a parameter of 2 to enable the analog input ("ATD22"). Finally, DIO4
can be set as an output, driving high by issuing the ATD4 command with a parameter value of 5 ("ATD45").
After issuing these commands, changes must be applied before the module IO pins will be updated to the new
states. The AC or CN commands can be issued to apply changes (e.g. ATAC).
Example 2: Calculate the PWM counts for a packet received with an RSSI of -84dBm.
RSSI = -84 = 0xAC = 172 decimal (unsigned)
PWM counts = (41 * 172) - 5928
PWM counts = 1124
With a total of 2400 counts, this yields an ON time of (1124 / 2400) = 46.8%
Example 3: Configure the RSSI/PWM pin to operate for 2 seconds after each received RF packet.
First, ensure the RSSI/PWM functionality is enabled by reading the P0 (P-zero) command. It should be set to 1
(default).
To configure the duration of the RSSI/PWM output, set the RP command. To achieve a 2 second PWM output, set
RP to 0x14 (20 decimal, or 2 seconds) and apply changes (AC command).
After applying changes, all received RF data packets should set the RSSI timer for 2 seconds.
PWM1
When P1 is configured for peripheral operation by setting the value to 1, it outputs a 50% duty cycle PWM with
a clock rate of 32,787 Hz, which is a period of 30.5 s. The main purpose of the PWM output is to provide a
clock for the PLUS processor, although it may also be used for other purposes.
*When this feature is enabled, the RSSI PWM output is automatically disabled, even if it is configured.
© 2010 Digi International, Inc.
95