CHAPTER 13 RS-485 COMMUNICATIONS
Modbus RTU Communications 13-29
13
(3) CRC-16 calculation example
The [Table 13-7] is the result obtained from CRC-16 calculated according to its algorithm using
the query to read parameters PA1_41 to 47 (7 pcs). The last data No.52: C651h will be added to
the end of the frame in order of digits from lower to upper.
Station No. FC Address No. of registers CRC check
01h 03h 40h 28h 00h 0Eh 51h C6h
[Table 13-7] calculation examples
bit
No. Calculations
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Shift carry
1 CRC (initial value) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 POLY (initial value) 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1
3 DT[0] (station no.) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
4 CRC = No.1 XOR No.3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
5
Shift CRC by 2 bits to the right
(until shift-carry occurs.)
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
6 CRC = No.5 XOR No.2 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0
7 Shift CRC by 2 bits to the right 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1
8 CRC = No.7 XOR No.2 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0
9 Shift CRC by 2 bits to the right 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1
10 CRC = No.9 XOR No.2 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0
11
Shift CRC by 2 bits to the right
(Finished with sht =8.)
0 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1
12 CRC = No.11 XOR No.2 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0
13 DT[1] (FC) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
14 CRC = No.12 XOR No.13 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1
15 Shift CRC by 1 bit to the right 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1
16 CRC = No.15 XOR No.2 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1
17 Shift CRC by 1 bit to the right 0 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1
18 CRC = No.17 XOR No.2 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1 0
19 Shift CRC by 2 bits to the right 0 0 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1
20 CRC = No.19 XOR No.2 1 0 0 1 0 1 0 0 0 0 0 0 0 1 1 0
21 Shift CRC by 2 bits to the right 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 1
22 CRC = No.21 XOR No.2 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0
23 Shift CRC by 2 bits to the right 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0
24 DT[2] (Address (H)) 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
25 CRC = No.23 XOR No.24 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0
26 Shift CRC by 8 bits to the right 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1
27 DT[3] (Address (L)) 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0
28 CRC = No.26 XOR No.27 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
29 Shift CRC by 1 bit to the right 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
30 CRC = No.29 XOR No.2 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1
31 Shift CRC by 1 bit to the right 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1
32 CRC = No.31 XOR No.2 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1
33 Shift CRC by 1 bit to the right 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1
34 CRC = No.33 XOR No.2 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0
35 Shift CRC by 5 bits to the right 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0
36 DT[4] (No. of registers (H)) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
37 CRC = No.35 XOR No.36 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0
38 Shift CRC by 7 bits to the right 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1
39 CRC = No.38 XOR No.2 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0
40 Shift CRC by 1 bit to the right 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0