Analog and digital I/O lines
When a data packet is received, if you set P0 to enable the RSSI/PWM feature, the RSSI PWM output
adjusts based on the RSSI of the last packet. The RSSI/PWM output is enabled for a time based on the
RP command. Each time the device receives an RF packet, the RSSI/PWM output adjusts based on the
RSSI of the new packet, and resets the RSSI timer. If the RSSI timer expires, the RSSI/PWM pin drives
low. RP is measured in 100 ms units and defaults to a value of 40 (4 seconds).
The RSSI PWM runs at 12 MHz and has 2400 total counts (200 µs period). RSSI (in dBm) is converted to
PWM counts using the following equation:
PWM counts = (41 * RSSI_Unsigned) - 5928
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 D1 command with a parameter of 3 ("ATD13"). To enable
pull-up resistors on the same pin, issues the PR command with bit 3 set (for example, PR8, PR1FFF,
and so on).
Issue the D2 command with a parameter of 2 to enable the analog input ("D22"). Finally, set DIO4 as
an output, driving high by issuing the D4 command with a parameter value of 5 ("D45").
After issuing these commands, apply the changes before the module I/O pins update to the new
states. Issue the AC or CN commands to apply changes (for example, AC).
Example 2: Calculate the PWM counts for a packet received with an RSSI of -84
dBm
RSSI = -84 = 0xAC = 172 decimal (unsigned)
n
PWM counts = (41 * 172) - 5928
n
PWM counts = 1124
n
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, make sure 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 using the AC command.
After applying changes, all received RF data packets set the RSSI timer for 2 seconds.
PWM1
When you configure P1 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 PWM output provides a clock for
the PLUS processor, although it may also be used for other purposes.
When you enable this feature, the RSSI PWM output is automatically disabled, even if it is configured.
XBee/XBee-PRO® S2C Zigbee® RF Module User Guide
PWM1
168
Need help?
Do you have a question about the XBee S2C Zigbee and is the answer not in the manual?