Super Systems AC20 RS485 Modbus User Manual

Page 5

Advertising
background image

Page 5/59

TITLE: MODBUS/J-BUS Protocol for SSi’s- AC20 ENG. 824E REV. 1

The CRC-16 is started by first pre-loading a 16-bit register to all 1's. Then a process begins
of applying successive the bytes of the message to the current contents of the register.
Only the eight bits of data in each character are used for generating the CRC-16. Start and
stop bits, and the parity bit if one is used, do not apply to the CRC-16.
During generation of the CRC-16, each byte is exclusive ORed with the register contents.
Then the result is shifted to the right , with a zero filled into the most significant bit (MSB)
position. If the LSB was a 1, the register is then exclusive ORed with a preset, fixed value.
If the LSB was a 0, no exclusive OR takes place.
This process is repeated until eight shifts have been performed. After the last shift, the
next byte is exclusive ORed with the register's current value, and the process repeats for
eight more shifts as described above. The final contents of the register, after all the
characters of the message have been applied, is the CRC-16 value.

A procedure for generating a CRC-16 is:

1) Load a 16-bit register (CRC-16 register) with FFFFh (all 1's).

2) Exclusive OR the first byte of the message with the low byte of the CRC-16

register. Put the result in the CRC-16 register.

3) Shift the CRC-16 register one bit to the right (toward the LSB), zero-filling the

MSB. Extract and examine the LSB.

4) (If the LSB was 0): Repeat Step 3 (another shift).
(If the LSB was 1): Exclusive OR the CRC-16 register with the polynomial
value A001h (1010 0000 0000 0001b).

5) Repeat Steps 3 and 4 until 8 shifts have been performed. When this is done,

a complete byte will have been processed.

6) Repeat Steps 2 through 5 for the next byte of the message.
Continue doing this until all bytes have been processed.

7) The final contents of the CRC-16 register is the CRC-16 value.

When the CRC-16 (16 bytes) is transmitted in the message, the low byte
will be transmitted first, followed by the high byte

N.B. : the numerical value present in this text are expressed as:

binary value if they are followed by b
decimal value if they are not followed by any letter
hexadecimal value if they are followed by h

Advertising