module and placed it in a
breadboard with the circuits shown
in Figure 6. After I saved the
configuration information in the
LOCAL module, however, I left it
attached to my PC via a USB-to-XBee adapter. By opening the X-CTU Terminal window and selecting
“Show Hex,” I could monitor
information received by the LOCAL
module from the digital and analog
inputs on my REMOTE XBee
module. About five seconds after I
powered the REMOTE module, the
Terminal window showed the
information in Figure 7. I then
turned off power at the REMOTE
module so I would see only one transmission.
Although this series of hex values might seem like
nonsense, you can use the information in Table 4 to
interpret it. The number-of-bytes-in-transmission value
(000C, or 1210) refers to the highlighted bytes in Table 4.
The table indicates my LOCAL module received one sample
from an XBee module with the two-byte address FE54 — my
REMOTE module. The active signal bytes indicate which
analog and digital inputs are configured for the REMOTE
module. You interpret these bytes as shown in Table 5.
The bits set for A4 and D2 reflect the settings I made
for the AD2-DIO2 and AD4-DIO4 pins on my REMOTE
module. The next two bytes in the received data represent
the digital data followed by the analog data. At first, I had
a logic-0 input at the AD2-DIO2 pin and a ground at the
AD4-DIO4 pin. When I changed the digital input to a logic-1
and set the potentiometer about half way between its
extremes, I saw the digital and analog bytes in the data
from my REMOTE module as shown in Table 6.
The active signal bytes remain the same. The 00 04
indicates a logic-1 at the AD2-DIO2 pin on the REMOTE
module (00000000 00000100) and a value of 01B1 from
the ADC. Because I used a 3. 3 volt reference for the ADC, I
can convert this value into a voltage: 01B1 = 43310 because
the ADC has 1,023 voltage “steps;” the 433 value indicates
the unknown voltage is at step 433. The proportion of
433/1023 yields about 0.42. Thus, the unknown voltage
equals 0.42 times the reference voltage, 3. 3 volts, or 1.4
volts. I measured the voltage at the potentiometer
independently with a DVM and
found 1.44 volts. If you decide to
take more samples for each
transmission, you will see the data
for each sample in this sequence:
FIGURE 6. An XBee circuit that shows a remote module with one analog and one
digital input. Received data comes out the UART pin and goes to a microcontroller
or appears in a terminal window.
Table 3. Settings for remote transmission of
analog and digital data.
LOCAL REMOTE
DL 12AB
MY FE54
IA 3-DI
NI 2-ADC
1
1388
FFFF
REMOTE
FE54
Bytes
7E
00 0C
83
FE 54
46
00
01
20 04
00 00
00 00
BF
Sample 1 digital data bytes
Sample 1 analog data bytes
Sample 2 digital data bytes
Sample 2 analog data bytes
FIGURE 7. Information received
from my REMOTE XBee module
with an active digital and an active
analog input.
48 SERVO 01.2013