Length Field; Frame Data; Calculate And Verify Checksums - Digi XBee SX User Manual

Radio frequency (rf) module
Hide thumbs Also See for XBee SX:
Table of Contents

Advertisement

Operate in API mode
In API mode with escaped characters, the length field does not include any escape characters in the
frame and the firmware calculates the checksum with non-escaped data.
Example: escape an API frame
To express the following API non-escaped frame in API operating mode with escaped characters:
Start delimiter Length Frame type
7E
00 0F 17
You must escape the 0x13 byte:
1. Insert a 0x7D.
2. XOR byte 0x13 with 0x20: 13 ⊕ 20 = 33
The following figure shows the resulting frame. Note that the length and checksum are the same as
the non-escaped frame.
Start delimiter Length Frame type
7E
00 0F 17
The length field has a two-byte value that specifies the number of bytes in the frame data field. It does
not include the checksum field.

Length field

The length field is a two-byte value that specifies the number of bytes contained in the frame data
field. It does not include the checksum field.

Frame data

This field contains the information that a device receives or will transmit. The structure of frame data
depends on the purpose of the API frame:
Start
delimiter
1
0x7E
MSB
Frame type is the API frame type identifier. It determines the type of API frame and indicates
n
how the Data field organizes the information.
Data contains the data itself. This information and its order depend on the what type of frame
n
that the Frame type field defines.
Multi-byte values are sent big-endian.

Calculate and verify checksums

To calculate the checksum of an API frame:
XBee®/XBee-PRO SX RF Module User Guide
Frame Data
Data
01 00 13 A2 00 40 AD 14 2E FF FE 02 4E 49 6D
Frame Data
Data
01 00 7D 33 A2 00 40 AD 14 2E FF FE 02 4E 49 6D
Frame
Length
type
2
3
4
API frame type
LSB
Frame data
Data
5
6
7
8
9
...
Data
API frame format
Checksum
Checksum
Checksum
n
n+1
Single byte
114

Advertisement

Table of Contents
loading

This manual is also suitable for:

Xbee-pro sx

Table of Contents