To ensure this error rate is not exceeded, the host must enable parity and adhere closely to the timing
specifications discussed previously in this chapter in the “Timing and Synchronization” section.
CRC Calculation
The CRC used by the ECP is based on a 16-bit algorithm. The algorithm, as implemented, operates on
eight-bit characters, for example, seven-bit ASCII character plus one optional parity bit. The 16-bit result
is converted to four ASCII hex characters and is appended to messages transmitted by the Encompass 4
Reader.
The Encompass 4 Reader accepts four ASCII < ` > characters (60 hex) as a wild card CRC value in lieu of a
valid four-character CRC value to facilitate testing and diagnostic checkout.
The Encompass 4 Reader implements the algorithm with a 512-byte lookup table to reduce the processing
overhead requirements.
To simplify the implementation of the CRC algorithm by host software developers, several examples of the
calculation are provided in C source code on the following pages. The calculation may be performed with
or without a lookup table, depending on the trade-o between code memory and processing overhead.
Example 1 presents an example of a function (CALCCRC) that calculates the CRC value through a call to a
separate function (UPDCRC).
unsigned short calccrc(char *message)
{
unsigned short crc = 0;
for ( ; *message !=
(char)0;message++) crc =
updcrc(*message & 0x, crc);
return (crc)
}
Chapter 6 Communications Protocols
TransCore Proprietary
6–81