//crc 之前数据,数据长度
unsigned short CRC16(unsigned char const *buf, unsigned int len)
{
unsigned short Crc=0xffff;
int i;
for(i=0; i
{
Crc = ((Crc >> 8) & 0xFF) ^ CRC16Table [(Crc^ *buf++) & 0xFF];
}
return Crc;
}
//crc 之前数据,数据长度
unsigned short CRC16(unsigned char const *buf, unsigned int len)
{
unsigned short Crc=0xffff;
int i;
for(i=0; i
{
Crc = ((Crc >> 8) & 0xFF) ^ CRC16Table [(Crc^ *buf++) & 0xFF];
}
return Crc;
}
http://blog.sina.com.cn/s/blog_3e28c8a50102vcp4.html
自已把0x0000改成0xffff就行了