beautypg.com

B&B Electronics MODSCAN32 - Manual User Manual

Page 11

background image

11

The step by step procedure to form the CRC-16 is as follows:

1.

Load a 16-bit register with all 1’s.


2.

Exclusive OR the first 8-bit byte with the high order byte of the 16-bit register, putting the result in

the 16-bit register.

3.

Shift the 16-bit register one bit to the right.


4a.

If the bit shifted out to the right is one, exclusive OR the generating polynomial 1010 0000 0000

0001 with the 16-bit register.

4b.

If the bit shifted out to the right is zero; return to step 3.


5.

Repeat steps 3 and 4 until 8 shifts have been performed.


6.

Exclusive OR the next 8-bit byte with the 16-bit register.


7.

Repeat step 3 through 6 until all bytes of the message have been exclusive OR’rd with the 16-bit

register and shifted 8 times.

8.

The contents of the 16-bit register are the 2 byte CRC error check and is added to the message

most significant bits first.

16-BIT REGISTER

MSB

Flag

(Exclusive OR)

1111

1111

1111

1111

02

0000

0010

1111

1111

1111

1101

Shift 1

0111

1111

1111

1110

1

Polynomial

1010

0000

0000

0001

1101

1111

1111

1111

Shift 2

0110

1111

1111

1111

1

Polynomial

1010

0000

0000

0001

1100

1111

1111

1110

Shift 3

0110

0111

1111

1111

0

Shift 4

0011

0011

1111

1111

1

Polynomial

1010

0000

0000

0001

1001

0011

1111

1110

Shift 5

0100

1001

1111

1111

0

Shift 6

0010

0100

1111

1111

1

Polynomial

1010

0000

0000

0001

1000

0100

1111

1110

Shift 7

0100

0010

0111

1111

0

Shift 8

0010

0001

0011

1111

1

Polynomial

1010

0000

0000

0001

1000

0001

0011

1110

07

0000

0111

1000

0001

0011

1001