7 Appendix
7.1 8-Bit CRC Algorithm
// 8 bits crc calculation. Initial value is 0.
// polynomial = X8 + X5 + X4 + 1
// data is an 8 bit number; crc is a 8 bit number
unsigned char eight_bit_crc(unsigned char crc, unsigned char data)
{
unsigned char index;
unsigned char fb;
// shift counter
index = 8;
do
// initialise the shift counter
{
fb = (crc ^ data) & 0x01;
data >>= 1;
crc >>= 1;
If(fb)
{
}
crc ^= 0x8c;
} while(--index);
return crc;
}
A CRC calculator for Windows is available free of charge from Quantum Research.
lQ
26
QT60248-AS R4.02/0405