标签:
unsigned short CRC16_Modbus ( unsigned char *pdata, int len)
{
unsigned short crc=0xFFFF;
int i, j;
for ( j=0; j<len;j++)
{
crc=crc^pdata[j];
for ( i=0; i<8; i++)
{
if( ( crc&0x0001) >0)
{
crc=crc>>1;
crc=crc^ 0xa001;
}
else
crc=crc>>1;
}
}
return crc;
}
标签:
原文地址:http://www.cnblogs.com/lort/p/5579558.html