71
Modbus RTU control (RS-485 communication)
z
Calculation example of CRC-16
The table shows a calculation example when setting the slave address of the rst byte to 02h and the function code of
the second byte to 07h.
The result of actual CRC-16 calculation is calculated including the data on and after the third byte.
Description Result Bit shifted out
CRC register initial value FFFFh 1111 1111 1111 1111 −
Lead byte 02h 0000 0000 0000 0010 −
Initial value FFFFh and XOR 1111 1111 1111 1101 −
First time of right shift 0111 1111 1111 1110 1
A001h and XOR
1010 0000 0000 0001
1101 1111 1111 1111
−
Second time of right shift 0110 1111 1111 1111 1
A001h and XOR
1010 0000 0000 0001
1100 1111 1111 1110
−
Third time of right shift 0110 0111 1111 1111 0
Fourth time of right shift 0011 0011 1111 1111 1
A001h and XOR
1010 0000 0000 0001
1001 0011 1111 1110
−
Fifth time of right shift 0100 1001 1111 1111 0
Sixth time of right shift 0010 0100 1111 1111 1
A001h and XOR
1010 0000 0000 0001
1000 0100 1111 1110
−
Seventh time of right shift 0100 0010 0111 1111 0
Eighth time of right shift 0010 0001 0011 1111 1
A001h and XOR
1010 0000 0000 0001
1000 0001 0011 1110
−
Next byte 07h and XOR
0000 0000 0000 0111
1000 0001 0011 1001
−
First time of right shift 0100 0000 1001 1100 1
A001h and XOR
1010 0000 0000 0001
1110 0000 1001 1101
−
Second time of right shift 0111 0000 0100 1110 1
A001h and XOR
1010 0000 0000 0001
1101 0000 0100 1111
−
Third time of right shift 0110 1000 0010 0111 1
A001h and XOR
1010 0000 0000 0001
1100 1000 0010 0110
−
Fourth time of right shift 0110 0100 0001 0011 0
Fifth time of right shift 0011 0010 0000 1001 1
A001h and XOR
1010 0000 0000 0001
1001 0010 0000 1000
−
Sixth time of right shift 0100 1001 0000 0100 0
Seventh time of right shift 0010 0100 1000 0010 0
Eighth time of right shift 0001 0010 0100 0001 0
Result of CRC-16 0001 0010 0100 0001 −