
9
2.4. LRC checking
The LRC is calculated by adding together successive 8-bit bytes of
the message, discarding any carries, and then two is complemen-
ting the result. It is performed on the ASCII message field contents
excluding the ,,colon character that begins the message, and
excluding the CR, LF pair at the end of the message. The 8-bit value
of the LRC sum is placed at the frame end as two ASCII characters,
first the character containing the higher tetrad, and after it, the
character containing the lower LRC tetrad.
2.5. CRC checking
The generating procedure of CRC is realised according the
following algorythm:
1. Load a 16-bit register with FFFFh. Call this the CRC register.
2. Take the byte from the data block and execute the EXOR
operation with the low-order byte of the CRC register. Place the
result into the CRC register.
3. Shift the CRC register contents one bit to the right (towards the
LSB), write 0 on the most significant bit (MSB=0).
4. Check the state of the lowest order bite (LSB) extracted from
the CRC register in the previous step. If its state is equal 0, then
follows a return to the step 3 (another shift).
If the LSB is equal 1, the operation EXOR of the CRC register is
executed with the polynomial value A001h.
5. Repeat steps 3 and 4 until 8 shifts have been performed. When
this is done, a complete 8-bit byte will have been processed.
6. Repeat steps 2 through 5 for the next 8-bit byte of the message.
Continue doing this until all bytes of the message have been
processed.
7. The final contents of the CRC register is the searched CRC
value.
8. When the CRC is placed into the message, its upper and lower
bytes must be swapped as described below.
Summary of Contents for RE15
Page 1: ...1 USER S MANUAL SERIAL INTERFACE WITH MODBUS PROTOCOL MICROPROCESSOR CONTROLLER RE15...
Page 2: ...2...
Page 27: ...27...