User Manual
Bobcat 320 Gated
Company confidential.
This document is the property of Xenics. It may not be reproduced – completely or partially – or passed to a third
party without written permission from Xenics.
Xenics nv
T +32 16 38 99 00
Doc Ref: ENG-2012-UMN016
Ambachtenlaan 44
F +32 16 38 99 01
Issue: 002
BE-3001 Leuven
Belgium
www.xenics.com
Date: 09/11/2012
XF-104_02/20-01-2012
Page 24 of 34
Take the following into account to avoid synchronization issues:
If any of the following characters (STX (0x02), ETB (0x17), DLE (0x10), CR
(0x0D)) appear in the Packet Tag, Message ID, Payload length, Payload and
CRC, then a DLE character must precede this character.
This stuffing does not influence the payload size value. The stuffing is
removed at the receiver before the character is evaluated.
5.1.1.1. Payload Contents
Table 5-2
lists the payload contents.
Message
ID
Meaning
Payload
contents
Size
Description
0x81
Write data
Address
4
32 bit address to write (least significant byte first)
Data
Num x 4
32 bit data (LSB first)
Payload size = 4 + Num x 4.
0x82
Read data
Address
4
32 bit address to read (least significant byte first)
Number of
words
4
Number of 32 bit words to read
Payload size = 8
Table 5-2 Payload contents
5.1.1.2. CRC Calculation
The CRC is a CRC8 algorithm with a polynomial value of 0x31. The implemented algorithm
is shown below:
byte
CRC
(
byte
*
chMessage
,
unsigned
int
uiLength
)
{
unsigned
char
crc
= 255;
unsigned
int
i
,
j
;
int
poly
= 0x31;
for
(
i
= 0;
i
<
uiLength
;
i
++)
{
crc
=
crc
^
chMessage
[
i
];
for
(
j
=1;
j
<=7;
j
++)
{
if
(
crc
& 128)
{
crc
= ((
crc
& 0x7f) * 2) ^ (
poly
& 0xff);
}
else
{
!