KE300A Inverter MODBUS Communication Protocol
178
The CRC is started by 0xFFFF. Then a process begins of applying successive eight-bit bytes of the
message to the current contents of the register. Only the eight bits of data in each character are used for
generating the CRC. Start and stop bits, and the parity bit, do not apply to the CRC.
During generation of the CRC, each eight-bit character is exclusive ORed with the register contents. Then
the result is shifted in the direction of the least significant bit (LSB), with a zero filled into the most
significant bit (MSB) position. The LSB is extracted and examined. If the LSB was a 1, the register is then
exclusive ORed with a preset, fixed value. If the LSB was a 0, no exclusive OR takes place. This process is
repeated until eight shifts have been performed. After the last (eighth) shift, the next eight-bit byte is
exclusive ORed with the register's current value, and the process repeats for eight more shifts as
described above. The final contents of the register, after all the bytes of the message have been applied, is
the CRC value.
When the CRC is appended to the message, the low byte is appended first, followed by the high byte. The
following are C language source code for CRC-16.
unsigned int crc_cal_value(unsigned char *data_value,unsigned char data_length)
{
int i;
unsigned int crc_value = 0xffff;
while(data_length--)
{
crc_value ^= *dat+;
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);
}
9.6.4 Address definition of communication parameter
Here is about address definition of communication parameter. It’s used to control the inverter operation,
status and related parameter setting.
(1) The mark rules of function code parameters address:
The group number and mark of function code is the parameter address for indicating the rules.
P0~PF group parameter address:
High byte: F0 to FF, low byte: 00 to FF
A0 group parameter address:
High byte: A0, low byte: 00 to FF
U0 group parameter address:
High byte: 70H, low byte: 00 to FF
For example: P3-12, address indicates to F30C
PC-05, address indicates to FC05
A0-01, address indicates to A001
U0-03, address indicates to 7003