DAEnetIP3
User Manual
-
72
-
17.6.
CRC16 (Modbus)
17.6.1.
CRC16 case studies
DAEnetIP3 supports CRC16 (Modbus modification) algorithm for prevention of
errors during serial communications. On figure 63 is shown how DAEnetIP3
encode/decode the CRC16 checksum.
Figure 63.
CRC case studies
The sockInData is the data stream that comes in to the user defined socket.
sockOutData is the data stream that comes out from the user defined socket.
serialOutData is the data stream that comes out to the UART interface. The
serialInData is the incomi
ng data in to the UART port. With “X” is marked if the CRC
is enabled or disabled. We
On table 16 are shown different situations for CRC16 checking. With brackets [] is
marked which is the first, second, third and fourth event. It is used the ASG
command, which gets the digital outputs (Port A) states.
Legend:
o
– Serial address.
o
– PDU (command)
o
– CRC16 checksum
o
– Wrong byte (during communication some bit is inverted)
o
– Error code
Table 16.
Examples of CRC16 calculation
Example N
sockInData
sockOutData
serialOutData
serialInData
X
1
00
ASG=?
;[1]
00
ASG=0000
;[3]
00
ASG=0000
A9FB
;[2]
…
yes
2
00
ASG=?
;[1]
00
ASG=0000
;[3]
00
ASG=0000
;[2]
…
no
3
01
ASG=?
;[1]
01
ASG=0000;[4]
01
ASG=0000
39F6
;[2]
01
ASG=0000
39F6
;[3]
yes
4
01
ASG=?
;[1]
01
E3
6E2C
;[4]
01
ASG=0000
39F6
;[2]
01
ASG=000
1
39F6
;[3]
yes
5
01
ASG=?
;[1]
01
E3
6E2C
;[4]
01
ASG=000
1
39F6
;[2]
01
E3
6E2C
;[3]
yes
6
01
ASG=?
;[1]
01
E3
6E2C
;[4]
01
ASG=?
;[2]
01
E3
6E2C
;[3]
no
7
…
00
ASG=0000
;[2]
00
ASG=0000
A9FB
;[3]
00
ASG=?
2DE3
;[1]
yes
8
…
02
ASG=?
;[2]
…
02
ASG=?
FCE2
;[1]
yes
Comments for the examples:
Example 1: CRC16 for DAEnetIP3 [00] is enabled. DAEnetIP3 [00]
receives TCP/IP data with serial address 00. Data is sent over the serial
line to DAEnetIP3 [01] with added CRC16 checksum. DAEnetIP3 [00]
performs respond. DAEnetIP3 [00] receives the response over the serial
network and send it over the TCP/IP.