(X
16
+X
15
+X
2
+1), which can be expressed as a binary data 11000000000000101. The
quotient is ignored and the 16-bit remainder is the checksum and is appended to end
of the packet. The receiving device performs the same operation on the entire packet
including the checksum. The packet, when divided by the generator polynomial,
should give a zero remainder if no transmission errors have occurred. In calculating
the CRC, all arithmetic operations (additions and subtractions) are performed using
MODULO TWO, or EXCLUSIVE OR operation.
Steps for generating the CRC-16 checksum:
1) Form a new polynomial by dropping the MSB (Most Significant Bit) of the generator
polynomial and reversing the bit sequence. This yields the binary number 1010 0000
0000 0001 or A0 01 Hex.
2) Load a 16-bit register with initial value FF FF Hex.
3) Exclusive OR the first data byte with the loworder byte of the 16-bit register, storing
the result in the 16-bit register.
4) Shift the 16-bit register one bit to the right.
5a) If the bit shifted out to the right is one, Exclusive OR the 16-bit register with the
new generator polynomial, with result stored in the16-bit register. Return to step 4.
5b) If the bit shifted out to the right is zero, return to step 4.
6) Repeat steps 4 and 5 until 8 shifts have been performed.
7) Exclusive OR the next data byte with the 16-bit register.
8) Repeat steps 4 through 7 until all bytes of the packet have been Exclusive ORed