计算法 CRC8校验
unsigned char crc8(unsigned char *vptr,unsigned char len)
{
const unsigned char *data=vptr;
unsigned char crc=0;
int i,j;
for(j=len;j;j–,data++)
{
crc ^=(*data<<8);
for(i=8;i;i–)
{
if(crc&0x1070<<3);
crc<<=1;
}
}
return (unsigned char)(crc>>8);
}