
Serial data format and protocol frames
4.1 CRC16 calculation algorithm
RF290R
20
Configuration Manual, 09/2014, C79000-G8976-C377-01
Function
Description
DATA
Is an optional data field with a variable length. The number of the DATA byte
depends on the command. The data is always sent first as MSB if the reader is
in the ISO host command mode.
CRC16
Cyclic redundancy check of the protocol bytes of 1 to n-2, as specified by
CCITT-CRC16
•
Polynomial: x
16
+ x
12
+ x
5
+ 1 (0x8408)
•
Start value: 0xFFFF
•
Direction: Backward
1)
You will find further information on STATUS in the appendix "Index of the status bytes
(Page 104)".
Data format
●
Baud rate: 38,400 (default)
●
Data bits: 8
●
Stop bits: 1
●
Parity:
–
even (default)
–
odd
–
none
4.1
CRC16 calculation algorithm
Polynomial:
x
16
+ x
12
+ x
5
+ 1
⇒ CRC_POLYNOM = 0x8408;
Start value:
0xFFFF
⇒ CRC_PRESET = 0xFFFF;
Example in C:
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);
}
}