Cyclic redundancy check (crc) – Watlow CLS200, MLS300 and CAS200 User Manual
Page 15
Chapter 1: ANAFAZE/AB Protocol
Communications Specification 9
For instance, the block read example shown in the examples section,
adds x08 00 01 00 00 80 02 10. Note that the x10 representing DLE
has been left out of the calculation. The sum should come to x9B.
Cyclic Redundancy Check (CRC)
CRC is a more secure error check method than BCC. It provides a very
high level of data security. It can detect:
•
All single-bit and double-bit errors.
•
All errors of odd numbers of bits.
•
All burst errors of 16 bits or less.
•
99.997% of 17-bit error bursts.
•
99.998% of 18-bit and larger error bursts.
The CRC is calculated using the value of the data bytes and the ETX
byte. At the start of each message packet, the transmitter must clear a
16-bit CRC register.
When a byte is transmitted, it is exclusive-ORed with the right 8 bits of
the CRC register and the result is transferred to the right 8 bits of the
CRC register. The CRC register is then shifted right 8 times by inserting
0’s on the left.
Each time a 1 is shifted out on the right, the CRC register is Exclusive-
ORed with the constant value xA001. After the ETX value is
transmitted, the CRC value is sent, least significant byte (LSB) first.
Below is a structured English procedure from AB Manual:
data_byte = all application layer data, ETX
CLEAR CRC_REGISTER
FOR each data_byte
GET data_byte
XOR (data_byte, right eight bits of CRC_REGISTER)
PLACE RESULT in right eight bits of CRC_REGISTER
DO 8 times
Shift bit right, shift in 0 at left
IF bit shifted =1
XOR (CONSTANT, CRC_REGISTER)
PLACE RESULT in CRC_REGISTER
END IF
END DO
END FOR
TRANSMIT CRC_REGISTER as 2-byte CRC field
1001 1011 = x9B
0110 0100 = 1’s complement
+1 = 2’s complement
0110 0101 = x65