Escaped Characters In Api Frames - Digi XBee S2C 802.15.4 User Manual

Radio frequency module
Table of Contents

Advertisement

Operate in API mode
Byte(s)
48 65 6C 6C 6F
B8
To calculate the check sum you add all bytes of the packet, excluding the frame delimiter 7E and the
length (the second and third bytes):
7E 00 0A 01 01 50 01 00 48 65 6C 6C 6F B8
Add these hex bytes:
01 + 01 + 50 + 01 + 00 + 48 + 65 + 6C + 6C + 6F = 247
Now take the result of 0x247 and keep only the lowest 8 bits which, in this example, is 0x47 (the two
far right digits). Subtract 0x47 from 0xFF and you get 0xB8 (0xFF - 0x47 = 0xB8). 0xB8 is the checksum
for this data packet.
If an API data packet is composed with an incorrect checksum, the XBee/XBee-PRO S2C 802.15.4 RF
Module will consider the packet invalid and will ignore the data.
To verify the check sum of an API packet add all bytes including the checksum (do not include the
delimiter and length) and if correct, the last two far right digits of the sum will equal FF.
01 + 01 + 50 + 01 + 00 + 48 + 65 + 6C + 6C + 6F + B8 = 2FF

Escaped characters in API frames

If operating in API mode with escaped characters (AP parameter = 2), when sending or receiving a
serial data frame, specific data values must be escaped (flagged) so they do not interfere with the
data frame sequencing. To escape an interfering data byte, insert 0x7D and follow it with the byte to
be escaped (XOR'ed with 0x20).
The following data bytes need to be escaped:
0x7E: start delimiter
n
0x7D: escape character
n
0x11: XON
n
0x13: XOFF
n
To escape a character:
1. Insert 0x7D (escape character).
2. Append it with the byte you want to escape, XOR'ed with 0x20.
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.
XBee/XBee-PRO S2C 802.15.4 RF Module User Guide
Description
Data packet
Checksum
Escaped characters in API frames
110

Advertisement

Table of Contents
loading

This manual is also suitable for:

Xbee-pro s2c 802.15.4

Table of Contents