AG Electronica XBee 2 Series Manual page 59

Table of Contents

Advertisement

www.agelectronica.com
XBee Series 2 ZigBee OEM RF Modules v1.x2x  [2007.07.019]
www.agelectronica.com
Constructing API Frames
Example: Create an API AT command frame to configure an XBee to allow joining (set NJ to
0xFF). The frame should look like:
0x7E 0x00 0x05 0x08 0x01 0x4E 0x4A 0xFF 5F
Where 0x0005 = length
0x08 = AT Command API frame type
0x01 = Frame ID (set to non-zero value)
0x4E4A = AT Command ('NJ')
0xFF = value to set command to
0x5F = Checksum
The checksum is calculated as [0xFF - (0x08 + 0x01 + 0x4E + 0x4A + 0xFF)]
Example: Send a transmission to a module with destination address 0x0013A200 40014011,
payload "TxData1B". If escaping is disabled, (AP=1), the frame should look like:
0x7E 0x00 0x16 0x10 0x01 0x00 0x13 0xA2 0x00 0x40 0x0A 0x01 0x27 0xFF
0xFE 0x00 0x00 0x54 0x78 0x44 0x61 0x74 0x61 0x30 0x41 0x13
Where 0x16 = length (22 bytes excluding checksum)
0x10 = ZigBee Transmit Request API frame type
0x01 = Frame ID (set to non-zero value)
0x0013A200400A0127 = 64-bit Destination Address
0xFFFE = 16-bit Destination Address
0x00 = Broadcast radius
0x00 = Options
0x5478446174613041 = Data payload ("TxData0A")
0x64 = Checksum
If escaping is enabled (AP=2), the frame should look like:
0x7E 0x00 0x16 0x10 0x01 0x00 0x7D 0x33 0xA2 0x00 0x40 0x0A 0x01 0x27
0xFF 0xFE 0x00 0x00 0x54 0x78 0x44 0x61 0x74 0x61 0x30 0x41 0x7D 0x33
The checksum is calculated (on all non-escaped bytes) as [0xFF - (sum of all bytes from API
frame type through data payload)].
Example: Send a transmission to the coordinator without specifying the coordinator's 64-bit
address. The API transmit request frame should look like:
0x7E 0x00 0x16 0x10 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xFF 0xFE
0x00 0x00 0x54 0x78 032 0x43 0x6F 0x6F 0x72 0x64 0xFC
Where 0x16 = length (22 bytes excluding checksum)
0x10 = ZigBee Transmit Request API frame type
0x01 = Frame ID (set to non-zero value)
0x0000000000000000 = Coordinator's address (can be replaced with coordinator's actual
64-bit address if known
0xFFFE = 16-bit Destination Address
0x00 = Broadcast radius
0x00 = Options
0x547832436F6F7264 = Data payload ("Tx2Coord")
0xFC = Checksum
© 2007 Digi International, Inc.
www.agelectronica.com
Chapter 8 ‐ Examples
     58
www.agelectronica.com

Advertisement

Table of Contents
loading

This manual is also suitable for:

Xb24-buit-004

Table of Contents