XBee API Commands
XBee API Commands
COM
REV 041710
One useful trick to remember is that even though API mode is enabled, the XBee module
still responds to AT commands. This makes it easy to change back to non-API mode
without using the more complicated API commands.
RnDWAREHOUSE.COM
REV 041710
The diagram shows the common structure of all API commands above the command.
Start of API command Every API begins with 0x7E. Everything before it is
ignored.
Command length The next two bytes contain the length of the rest of the
command, excluding the checksum.
Command body The rest of the bytes, excluding the checksum, contain a
specific API command.
Checksum The sum of all the bytes after the command length, including the
checksum, should be 0xFF. To calculate the checksum, sum all of the bytes after
the command length, keep only the least significant 8 bits and subtract from 0xFF.
And the diagram shows the structure of the remote AT command request below the
command.
Remote AT command request All remote AT command requests begin with
0x17.
RnDWAREHOUSE.COM
REV 041710
RnDWAREHOUSE.COM
REV 041710
RnDWAREHOUSE.COM
REV 041710
RnDWAREHOUSE.COM
REV 041710
RnDWAREHOUSE.COM
REV 041710
RnDWAREHOUSE.COM
REV 041710
RnDWAREHOUSE.COM
REV 041710
RnDWAREHOUSE.COM
REV 041710
10
RnDWAREHOUSE.COM
REV 041710
11
RnDWAREHOUSE.COM
REV 041710
12
RnDWAREHOUSE.COM
REV 041710
When both base and remote modules are in AT command mode, all serial data send to the
base module from the host (except for AT commands) is sent to the remote module.
Things are more difficult when the base module is in API mode.
In API mode, you must use either the 64-bit address transmit request or 16-bit address
transmit request to send serial data to a remote XBee module.
Notice that we are using the 0x00 API command in this example instead of the 0x17 API
command used in the previous examples.
This command sends the ASCII string Hello world! to an external device attached to a
remote XBee module using the 64-bit transmit request command:
7E 00 17 00 05 00 13 A2 00 40 4B ED 83 00 48 65 6C 6C 6F 20 77 6F
72 6C 64 21 ED
13
RnDWAREHOUSE.COM
REV 041710
RnDWAREHOUSE.COM
REV 041710
References
XBee/XBee-PRO OEM RF Modules
http://ftp1.digi.com/support/documentation/90000982_A.pdf
What is API (Application Programming Interface) Mode and how does it work?
http://www.digi.com/support/kbase/kbaseresultdetl.jsp?kb=184
XBee Digital Input/Output Line Passing
http://www.digi.com/support/kbase/kbaseresultdetl.jsp?kb=188
Analog to Digital Conversion on the XBee 802.15.4
http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=2180
Converting the XBee PWM to an analog voltage for DAC (Digital to Analog
Conversion)
http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=2202
15