Escaped Characters In Api Frames - Digi XBee XTC User Manual

Digimesh radio frequency (rf) module
Hide thumbs Also See for XBee XTC:
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 0xC4 (the two
far right digits). Subtract 0x47 from 0xFF and you get 0x3B (0xFF - 0xC4 = 0x3B). 0x3B is the checksum
for this data packet.
If an API data packet is composed with an incorrect checksum, the XTC 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 XTend Compatible (XTC) DigiMesh RF Module User Guide
Description
Data packet
Checksum
API mode overview
62

Advertisement

Table of Contents
loading

This manual is also suitable for:

Xbee-pro xtc

Table of Contents