User's Manual

Table Of Contents
Symeo LPR
®
-System
LPR
®
-2DB
Product Documentation
Symeo 2D Protocol
Copyright © Symeo 2012
Page 125 of 132
Figure 64 - Mapping Bitmask Data fields
10.5 CRC Calculation
To detect errors during data transmission, the data field CRC can be activated. For CRC the
CRC-16-IBM is used with the polynomial x
16
+x
15
+x
2
+1. The CRC is applied to all previous
data fields of the data packet except the data field START.
Example source code for CRC calculation in C:
// Holds a table to calculate crc16 values
static Uint16 crc_table[256];
// Initializes the CRC table
// MUST BE RUN before first crc calculation
Void InitCRCtable( void )
{
int i, j;
Uint16 k;
for (i = 0; i < 256; i++)
crc_table[i] = i;
for (i = 0; i < 256; i++)
{
k = 0xC0C0;
for (j = 1; j < 256; j <<= 1)
{
if (i & j)
crc_table[i] ^= k;
k = ((k & 0x7FFF) << 1) ^ 0x4003;
}
}
}
25
-
9
CRC
24
-
8
SYSTEM-ERROR
23
-
7
USER-DATA
22
-
6
ORIENTATION-ERROR
21
-
5
VELOCITY-ERROR
20
-
4
POSITION-ERROR
19
-
3
ORIENTATION
18
-
2
VELOCITY
17
-
1
POSITION
16
-
0
TIMESTAMP