The Message Format 6-13
CRC-16 Calculation Example:
A two byte message for a read-out of a
specified coil status is as follows.
0000 0010
Slave Address = 2
0000 0111
Function Code = 7
The actual CRC calculation would look like
this:
CRCTMP
FLAG
1111 1111 1111 1111
Initial Value
0000 0010
Slave Address
1111 1111 1111 1101
Result of EX OR
0111 1111 1111 1110
1 Shift #1
1010 0000 0000 0001
CRC-16 Lower 16
1101 1111 1111 1111
Result of EX OR
0110 1111 1111 1111
1 Shift #2
1010 0000 0000 0001
CRC-16 Lower 16
1100 1111 1111 1110
Result of EX OR
0110 0111 1111 1111
0 Shift #3
0011 0011 1111 1111
1 Shift #4
1010 0000 0000 0001
CRC-16 Lower 16
1001 0011 1111 1110
Result of EX OR
0100 1001 1111 1111
0 Shift #5
0010 0100 1111 1111
1 Shift #6
1010 0000 0000 0001
CRC-16 Lower 16
1000 0100 1111 1110
Result of EX OR
0100 0100 0111 1111
0 Shift #7
0010 0001 0011 1111
1 Shift #8
1010 0000 0000 0001
CRC-16 Lower 16
1000 0001 0011 1110
Result of EX OR
0000 0111
Function Code
1000 0001 0011 1001
Result of EX OR
0100 0000 1001 1100
1 Shift #1
1010 0000 0000 0001
CRC-16 Lower 16
1110 0000 1001 1101
Result of EX OR
0111 0000 0100 1110
1 Shift #2
1010 0000 0000 0001
CRC-16 Lower 16
1101 0000 0100 1111
Result of EX OR
0110 1000 0010 0111
1 Shift #3
1010 0000 0000 0001
CRC-16 Lower 16
1100 1000 0010 0110
Result of EX OR
0110 0100 0001 0011
0 Shift #4
0011 0010 0000 1001
1 Shift #5
1010 0000 0000 0001
CRC-16 Lower 16
1001 0010 0000 1000
Result of EX OR
0100 1001 0000 0100
0 Shift#6
0010 0100 1000 0010
0 Shift #7
0001 0010|0100 0001
0 Shift #8
1 2 | 4 1
|
|
|
After calculating the CRC-16 upper and lower
values they are inserted into the message
format as shown below.
0000 0010
Slave Address = 2
0000 0111
Function Code = 7
0100 0001
CRC-16 Lower = 41h
0001 0010
CRC-16 Lower = 12h
CRC-16
(Upper 8)
CRC-16
(Lower
8)
Содержание GPD 506/P5
Страница 1: ...GPD 506 Modbus RTU Technical Manual...
Страница 10: ...RS 232 C D Serial Communication 2 3 pin out for devices other than a computer PC such as a PLC may vary...
Страница 47: ...7 13 Registers 29 Up Down Command 1...
Страница 49: ...7 15 Registers 15 Closed by Serial Communications 16 PID Feedback Loss...
Страница 51: ...7 17 Registers 7 to 9 asynchronous...
Страница 60: ...Error Codes and Troubleshooting 8 3...