[an error occurred while processing this directive]
|
/*--------------------------------------------------------------------------
* Calculate a new CRC16 from the input data shorteger. Return the current
* CRC16 and also update the global variable CRC16.
*/
flash short oddparity[16] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 };unsigned short docrc16(unsigned short data)
{
data = (data ^ (CRC16 & 0xff)) & 0xff;
CRC16 >>= 8;
if (oddparity[data & 0xf] ^ oddparity[data >> 4])
CRC16 ^= 0xc001;data <<= 6;
CRC16 ^= data;
data <<= 1;
CRC16 ^= data;
return CRC16;
}