114
The following CRC value by C language. This function requires two parameters:
Unsigned char * data; / / data source address, used to calculate the CRC value
Unsigned char length; / / data length
This function returns the unsigned integer type of CRC value.
unsigned int crc_chk(unsigned char * data,unsigned char length)
{
int i,j;
unsigned int crc_reg=oxFFFF;
While(length- -)
{
Crc_ reg ^=*data++;
for(j=0;j<8;j++)
{
If(crc_reg & 0x01)
{
crc_reg=( crc_reg >>1)^0xA001;
}else
{
crc_reg
=
crc_reg >>1;
}
}
}
return crc_reg;
}
7.3.6
Abnormal code
In the process of communication, may create a communication error, common error event in the following table:
Communication error event
Servo driver approach
Read/write parameters, data address is not correct;
The request for processing, and abnormal return an error code
Write parameters, data number
The request for processing, and abnormal return an error code