This Tech Tip is brought to you by Digi Applications Engineer Mark Grierson.
Be sure to answer the XBee Puzzler at the end of this entry for a chance to win a free XBee-PRO 900HP S3B Development Kit!
Recently a customer asked me if they could send a single command to a remote module to set the states of multiple Digital outputs. Well if you are using the XBee/XBee-PRO 802.15.4 modules the answer is, “Yes!”
Let us introduce you to the IO AT command.
The IO command is only available on the XBee/XBee-PRO 802.15.4 modules but provides some powerful IO features not available on other modules. With the IO command it is possible to change the states of multiple Digital output pins with a single AT command, either on a local module, using API Mode or Command Mode, or on a remote module, using API Mode.
To change the States of your local modules digital outputs, first set 1 or more IOs as digital outputs, either high or low. In this example I have set them to a low state (Dx=4).
You can then change those states by issuing an IO command. The command is followed by a bitmask where a 1 will set the state of a pin high and 0 will set the state low. Sending an
ATIO with no bitmask will set all outputs low and is the equivalent of sending an ATIO0.
A local module’s IO pins can be set using the IO feature in AT command mode.
In the X-CTU terminal screen
Use +++ to enter Command Mode
Enter ATIO7 to set D0, D1, and D2 to a high state
Enter ATIO to set all Digital outputs low. Your screen should look like the following.
The local modules Digital outputs can also be set using API Mode.
The following are some sample API frames using the IO command to set the local module’s DO 1,2, and 3 high and low.
7E 00 05 08 01 49 4F 07 57 Set D0, D1, and D2 on
7E 00 05 08 01 49 4F 00 5E Set all Do’s off
To change the States of a remote module’s Digital outputs API Mode must be used on the base module. The remote module can be in either API Mode or Transparent Mode. First set one or more of the remote module’s IOs as Digital outputs, either high or low. You can then change those states by issuing a remote AT (IO) command from another module on the network that is running in API Mode. The remote module can be in either AT Mode or API Mode.
Using Remote AT Command examples:
7E 00 10 17 01 00 13 A2 00 40 08 4E 3C FF FE 02 49 4F 07 C2 – TURN D0,D1,D2 ON
7E 00 10 17 01 00 13 A2 00 40 08 4E 3C FF FE 02 49 4F 00 C9 – TURN OFF ALL DO
Your frames will be slightly different due to differences in the remote modules 64 bit address. For more information on API mode and transparent mode please use the following links.
The first 3 responses with the correct answer will receive a free XBee-PRO 900HP S3B Development Kit. Good luck!
Using the IO command, what would be the correct API frame, including checksum, to set a locally connected XBee 802.15.4 module to the following digital output settings?
This Puzzler contest is now closed. Correct answer:
For API mode 1: 7E 00 05 08 01 49 4F 13 4B
For API mode 2: 7E 00 05 08 01 49 4F 7D 33 4B
Congratulations to our XBee-PRO 900HP S3B Development Kit winners: Sergio Alonso, Evan Farthing and Thomas Tracy Allen Ph.D.
Check back in November for our next Puzzler!Tags: Tech Tip, xbee, XBee PRO, XBee Puzzler