Home WTI User's Guides
cover
1. Introduction
2. Binary Block Read Mode and Structure
2.1. Compressed Binary Block Read Sequence
2.2. Compressed Binary Block Structure
2.2.1. Data Block Structure
2.2.2. Record String Structure
3. Compression Decompression Methods
3.1. Table Decompression
3.1.1. Nibble Positioning
3.1.2. Record String Format
3.1.2.1. Data Decompression Considerations
3.1.3. Table Decompression Example
3.2. Space Compression
4. DLE Stuffing
5. The Cyclic Redundancy Check Option
5.1. Calculation
6. Customer Service
PollCat Series

5.1. Calculation

 

There are two methods of CRC calculation on an incoming string of data:

Method 1: Calculate the transmitted CRC on the string of data, excluding the CRC code, and compare the resulting CRC with the received CRC. In this case, two bytes of "00" are appended to the received data before calculation.

Method 2: Calculate the CRC on the transmitted string of data, including the CRC code, and compare the resulting new CRC code to "00 00".

The example calculations for Method 1 and 2 are performed on a single ASCII character "T" (54 HEX).

 

 

Example calculation using Method #2:

$54 $1� $�1 Message M(x) 01010100 00011010 01110001 Constant P(x) 1000100 00001000 01

 

R(x) . 00000000 00000000 � 0000 HEX

Note: The "." in the above examples is used to replace the 17th bit of the remainder. This bit is always the result of an XOR between the 17th bit of the constant and a "1" bit in the message data. It is always equal to 0. This bit is not considered part of the CRC code.

Although it may seem that the 17 bit XOR function must be performed in this calculation, a 16 bit accumulator or two eight bit accumulators are all that are needed. The first two bytes of the message are loaded in the 16 bit accumulator and shifted left until a "1" bit shifts into the carry. Then a 16 bit XOR is performed on the data using the constant 1021 HEX. The 17th bit will always be 0 and can be ignored. Each time the accumulator is shifted left, the rest of the message is also shifted, MSB first, into the right side of the accumulator.

Note: When CRC checking is used in one of the ASCII modes, the modem port should be set to eight bits, no parity in order to receive all bits of the CRC.

The procedure for verifying CRC code on seven bit data is as follows:

1                     Calculate the CRC of the data bytes with the eighth bit stripped off (eighth bit = 0).

2                     Method #2 above must be used for the CRC calculation because the full 16 bits of the CRC code are not transmitted.

3                     When the CRC bytes are calculated, compare them to the received CRC bytes excluding the eighth bit of each byte. Mask off the eighth bit of both the calculated and received CRC bytes and compare the remaining seven bits of each byte.