
31
12.3 Communication Procedure
The communication can be initiated only by the master unit; the slave units can transmit only
after a query has been received from the master. The general format for the transmission from
master to slave is the following:
Range
Byte
Slave address
1
Function code
1
Data
n
Error check (CRC-16) (low byte)
1
Error check (CRC-16) (high byte)
1
The slave detects the start of a query frame when the delay time between two characters is
greater than 3.5 T.U. (Time Unit = Time necessary to transmit one character).
12.4 Error Check (CRC-16 Cyclical Redundancy Check)
The CRC-16 value is calculated by the transmitting device. This value is appended to the
message. The receiving device recalculates a CRC-16 and compares the calculated value to the
received value. The two values must be equal.
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.