EXPERT Standard Series User Manual
229
0x0055,0xC195,0x8194,0x4054,0x019C,0xC05C,0x805D,0x419D,0x005F,0xC1
9F,0x819E,0x405E,
0x005A,0xC19A,0x819B,0x405B,0x0199,0xC059,0x8058,0x4198,0x0188,0xC04
8,0x8049,0x4189,
0x004B,0xC18B,0x818A,0x404A,0x004E,0xC18E,0x818F,0x404F,0x018D,0xC0
4D,0x804C,0x418C,
0x0044,0xC184,0x8185,0x4045,0x0187,0xC047,0x8046,0x4186,0x0182,0xC042
,0x8043,0x4183,
0x0041,0xC181,0x8180,0x4040}
If CRC checksum of each sending byte is calculated online, it will take a long time,
but could save program space occupied by tables.CRC codes to be calculated on line
are as follows:
unsigned int crc_check(unsigned char *data,unsigned char length)
{
int i;
unsigned crc_result=0xffff;
while(length--)
{
crc_result^=*data++;
for(i=0;i<8;i++)
{
if(crc_result&0x01)
crc_result=(crc_result>>1)^0xa001;
else
crc_result=crc_result>>1;
}
}
return (crc_result=((crc_result&0xff)<<8)|(crc_result>>8));
}