Appendix I
148
Ap
p
en
d
ix
I
Data F002H high-order
00H
Data F002H low-order
01H
Data F003H high-order
00H
Data F003H low-order
01H
CRC CHK low-order
CRC CHK values are to be calculated
CRC CHK high-order
Command Code: 06H, write a word. For example: Write 5000(1388H)into the address F013H of
the inverter with slave address 02H.
Master command information
ADR
02H
CMD
06H
Data address high-order
F0H
Data address low-order
13H
Data content high-order
13H
Data content low-order
88H
CRC CHK low-order
CRC CHK values are to be calculated
CRC CHK high-order
Slave responding information
ADR
02H
CMD
06H
Data address high-order
F0H
Data address low-order
13H
Data content high-order
13H
Data content low-order
88H
CRC CHK low-order
CRC CHK values are to be calculated
CRC CHK high-order
I-2 Check mode:
Check mode - CRC mode: CRC (Cyclical Redundancy Check) adopts RTU frame format, the
message includes an error-checking field that is based on CRC method. The CRC field checks the
whole content of message. The CRC field has two bytes containing a 16-bit binary value. The CRC
value calculated by the transmitting device will be added into to the message. The receiving device
recalculates the value of the received CRC, and compares the calculated value to the Actual value of
the received CRC field, if the two values are not equal, then there is an error in the transmission.
The CRC firstly stores 0xFFFF and then calls for a process to deal with the successive eight-bit
bytes in message and the value of the current register. Only the 8-bit data in each character is valid to
the CRC, the start bit and stop bit, and parity bit are invalid.
During generation of the CRC, each eight-bit character is exclusive OR(XOR) with the register
contents separately, the result moves to the direction of least significant bit(LSB), and the most
significant bit(MSB) is filled with 0. LSB will be picked up for detection, if LSB is 1, the register will
be XOR with the preset value separately, if LSB is 0, then no XOR takes place. The whole process is
repeated eight times. After the last bit (eighth) is completed, the next eight-bit byte will be XOR with
the register's current value separately again. The final value of the register is the CRC value that all
the bytes of the message have been applied.
When the CRC is appended to the message, the low byte is appended firstly, followed by the
high byte. CRC simple functions is as follows:
unsigned int crc_chk_value(unsigned char *data_value,unsigned char length)
{
unsigned int crc_value=0xFFFF;
int i;