1-4
1.5: CRC (Error Checksum) Algorithm
QThe Cyclic Redundancy Check (CRC) field is an error checksum calculation that enables a Slave
device to determine if a request packet has been corrupted during transmission.
QEvery request packet transmitted from Master to Slave includes a special 16-bit value derived from a
CRC-16 algorithm performed on the packet’s contents. When an EPM Slave receives a packet, it
performs a CRC-16 calculation and compares the value with the one included in the request packet.
If the two values do not match, the Slave will ignore the packet.
QThe following is the pseudocode for calculating the 16-bit CRC:
Initialize a 16-bit register to FFFFH.
Initialize the generator polynomial to A001H.
Slave Address 01H Slave Address 01H
Function Code 10H Function Code 10H
Data Starting Address-Hi E0H Data Starting Address-Hi E0H
Data Starting Address-Lo 01H Data Starting Address-Lo 01H
Number of Setpoints-Hi 00H Number of Setpoints-Hi 00H
Number of Setpoints-Lo 03H Number of Setpoints-Lo 03H
Byte Count 06H CRC-Lo E6H
Data #1-Hi 00H CRC-Hi 08H
Data #1-Lo 01H
Data #2-Lo 00H
Data #2-Hi 01H
Data #3-Lo 00H
Data #3-Hi 01H
CRC-Lo 4DH
CRC-Hi 46H
Master Packet Slave Packet
Table 1.4: Function Code 10 Example