4. MODBUS COMMUNICATION PROTOCOL
IMR02F04-E1
31
4.5 Calculating CRC-16
The Cyclic Redundancy Check (CRC) is a 2 byte (16-bit) error check code. After constructing the data
message, not including start, stop, or parity bit, the master calculates a CRC code and appends this to the
end of the message. The slave will calculate a CRC code from the received message, and compare it with
the CRC code from the master. If they do not coincide, a communication error has occurred and the slave
does not respond.
The CRC code is formed in the following sequence:
1.
Load FFFFH to a 16-bit CRC register.
2.
Exclusive OR
(
) the first byte (8 bits) of the message with the CRC register. Return the result to the
CRC register.
3.
Shift the CRC register 1 bit to the right.
4.
If the carry flag is 1,
exclusive OR
the CRC register with A001 hexadecimal and return the result to
the CRC register. If the carry flag is 0, repeat step
3
.
5.
Repeat step
3
and
4
until there have been 8 shifts.
6.
Exclusive OR
the next byte (8 bits) of the message with the CRC register.
7.
Repeat step
3
through
6
for all bytes of the message (except the CRC).
8.
The CRC register contains the 2 byte CRC error code. When they are appended to the message, the
low-order byte is appended first, followed by the high-order byte.
Содержание PG500
Страница 1: ...IMR02F04 E1 PG500 Communication Instruction Manual RKC INSTRUMENT INC Pressure Indicator...
Страница 68: ...62 IMR02F04 E1 MEMO...
Страница 69: ...The first edition JUN 2014 IMQ00...