
OBID
®
classic-pro
Manual
ID CPR.03.20-CD
FEIG ELECTRONIC GmbH
Page 27 of 40
H60100-5e-ID-B.doc
5.2.1. CRC16 Calculation Algorithm
The CRC16 algorithm for calculation of ConfigCard CRC16 is equal like used in ISO15693. After
the CRC calculation the one's complement has to be built.
Polynomial:
x
16
+ x
12
+ x
5
+ 1
⇒
CRC_POLYNOM = 0x8408;
Preset Value:
0xFFFF
⇒
CRC_PRESET = 0xFFFF;
C-Example:
unsigned int crc = CRC_PRESET;
for (i = 0; i < cnt; i++) // cnt = number of protocol bytes without CRC
{
crc ^= DATA[i];
for (j = 0; j < 8; j++)
{
if (crc & 0x0001)
crc = (crc >> 1) ^ CRC_POLYNOM;
else
crc = (crc >> 1);
}
crc = ~crc; // one's complement
}