unsigned short int cal_crc(unsigned char *ptr, unsigned int len)
{
unsigned char i;
unsigned int crc=0;
while(len--!=0)
{
for(i=0x80; i!=0; i/=2)
{
if((crc&0x8000)!=0)
{
crc*=2;
crc^=0x18005;
}
else
{
crc*=2;
}
if((*ptr&i)!=0)
crc^=0x18005;
}
ptr++;
}
return(crc);
If your goal is to calculate the CRC for a given string or file, perhaps this would work:
http://www.freevbcode.com/ShowCode.asp?ID=655
Also, FMS Total Visual Sourcebook has functions that do this. TVS is a purchased product, but it has a LOT of code and can save you tons of time:
https://www.fmsinc.com/MicrosoftAccess/modules/index.asp
Kindly see below the information provided from the INSPUR ESD Device below:
»bp