我要用C语言编写CRC16效验码。通过输入一个串然后计算出CRC16效验码。例如:输入010600001388计算得到849C
我要用C语言编写CRC16效验码。通过输入一个串然后计算出CRC16效验码。例如:输入010600001388计算得到849C
日期:2011-04-20 09:40:58 人气:3
int cal_crc(unsigned char *ptr, unsigned char len)
{
unsigned char i;
unsigned int crc_value =0;
while(len--)
{
for(i=0x80; i!=0; i>>=1 )
{
if (crc_value&0x8000)
crc_value = (crc_value << 1) ^0x8005 ;
else
crc_value = crc_value <