
CV3100 series and MINI series high performance general purpose inverter instruction manual
9-25
unsigned int crc_chk(unsigned char* data, unsigned char length)
{
int j;
unsigned int reg_crc=0xffff;
while(length--)
{
reg_crc ^= *data++;
for(j=0;j<8;j++)
{
if(reg_crc & 0x01)
{ /* LSB(b0)=1 */
reg_crc=(reg_crc>>1) ^ 0Xa001;
}
Else
{
reg_crc=reg_crc >>1;
}
}
}
return reg_crc;//
finally,pass back the value pf CRC register
}