Calculate And Verify Checksums; Escaped Characters In Api Frames - Digi XBee XTC User Manual

Radio frequency module
Hide thumbs Also See for XBee XTC:
Table of Contents

Advertisement

Data contains the data itself. This information and its order depend on the what type of
l
frame that the Frame type field defines.
The Frame Type byte indicates which API messages the data bytes (Identifier-specific data) will contain.
Checksum
The value 0xFF minus the 8-bit sum of bytes from offset 3 to this byte. Checksum is the last byte of the
frame and helps test data integrity.
The device does not process frames sent through the serial interface with incorrect checksums, and
ignores their data.

Calculate and verify checksums

To calculate the checksum of an API frame:
1. Add all bytes of the packet, excluding the start delimiter 0x7E and the length (the second
and third bytes).
2. Keep only the lowest 8 bits from the result.
3. Subtract this quantity from 0xFF.
To verify the checksum of an API frame:
1. Add all bytes including the checksum; do not include the delimiter and length.
2. If the checksum is correct, the last two digits on the far right of the sum will equal 0xFF.

Escaped characters in API frames

If operating in API mode with escaped characters (AP parameter = 2), when you send or receive an API
frame, you must escape (flag) specific data values so they do not interfere with data frame sequencing. In
API operating mode with escaped characters, you must escape the following data bytes:
0x7E: start delimiter
l
0x7D: escape character
l
0x11: XON
l
0x13: XOFF
l
API operating mode with escaped characters guarantees that all the 0x7E bytes a device receives are
start delimiters: this character cannot be part of any of the other frame fields (length, data, or checksum)
since you must escape it.
To escape a character:
1. Insert 0x7D, the escape character.
2. Append it with the byte you want to escape, XORed with 0x20.
XBee/XBee-PRO XTend Compatible (XTC) RF Module User Guide
API mode overview
90

Advertisement

Table of Contents
loading

This manual is also suitable for:

Xbee-pro xtc

Table of Contents