CDE360 Vector Control AC Drive Chapter 8 Communication Protocol
3. Communication error code
If there is a communication error occurs, the master should response an error code, the error
code value is “request function code ” + 0x80.
4. Communication error function code
When there is an error frame comes, the slave will give an exception code to indicate the error
type. Such as error function code, or error value etc.
Error code
Function
01H
Invalid function code
02H
Invalid address
03H
Operate number over range
04H
Operation error
05H
Frame length error
5. CRC check
The RTU frame include a CRC check field. CRC used to check the correctness of the whole frame.
It include two bytes filed. The master calculates the CRC and padding to the end of the frame, and
the slave re-calc
ulates it again. If the twice result isn’t the same, it indicates a transmit error.
We adapt an international standard CRC check method, when user program the CRC algorithm,
can reference the following C procedure.
unsigned int crc_check(Uint16 len)
{
unsigned int crc_value=0xffff;
unsigned int i,j;
for(j=0;j<len;j++)
{
crc_value^=data_buf[j];
for(i=0;i<8;i++)
{
if(crc_value &0x0001)
crc_value=(crc_value>>1)^0xa001;
else
crc_value=crc_value>>1;
}
}
return (crc_value);
}