CHAPTER 13 RS-485 COMMUNICATIONS
(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
01h
03h
Address
40h
28h
No. of registers
00h
0Eh
CRC check
51h
C6h
[Table 13-7] calculation examples
No.
Calculations
15 14 13 12 11 10 9
bit
87
6
5
4
3
2
1
0 Shift carry
1
CRC (initial value)
11 1 11 1 1 11 1 1 1 111 1
2
POLY (initial value)
10 1 00 0 0 00 0 0 0 000 1
3
DT[0] (station no.)
00 0 00 0 0 00 0 0 0 000 1
4
CRC = No.1 XOR No.3
11 1 11 1 1 11 1 1 1 111 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
10 0 11 1 1 11 1 1 1 111 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
10 0 00 1 1 11 1 1 1 111 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)
00 0 00 0 0 00 0 0 0 001 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))
00 0 00 0 0 00 1 0 0 000 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))
00 0 00 0 0 00 0 1 0 100 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
Modbus RTU Communications 13-29
13