PROGRAM CRCTable; {CRCTable generates the table of constants needed for byte-wise CRC-16 calculations. The constants are formatted for inclusion in the CRC UNIT. (C) Copyright 1989, Earl F. Glynn, Overland Park, KS. Compuserve 73257,3527. All Rights Reserved. This Turbo Pascal 5.5 PROGRAM may be freely distributed for non-commercial use. This program was derived from the CRCV FORTRAN 77 program given in "Byte-wise CRC Calculations" by Aram Perez in IEEE Micro, June 1983, pp. 40-50. The constants here are for the CRC-16 generator polynomial X^16 + X^15 + X^2 + 1. Other generator polynomials could be used but a new derivation would be needed to calculate the 'v' variables below.} CONST hexdigit: ARRAY[0..15] OF CHAR = '0123456789ABCDEF'; v : ARRAY[1..16] OF 0..1 = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); VAR count: 0..256; i,j : 1..4; k,sum: 0..16; x,x1,x2,x3,x4,x5,x6,x7,x8: 0..1; BEGIN count := 0; FOR x8 := 0 TO 1 DO FOR x7 := 0 TO 1 DO FOR x6 := 0 TO 1 DO FOR x5 := 0 TO 1 DO FOR x4 := 0 TO 1 DO FOR x3 := 0 TO 1 DO FOR x2 := 0 TO 1 DO FOR x1 := 0 TO 1 DO BEGIN x := x7 XOR x6 XOR x5 XOR x4 XOR x3 XOR x2 XOR x1; v[16] := x8 XOR x; v[15] := x; v[14] := x8 XOR x7; v[13] := x7 XOR x6; v[12] := x6 XOR x5; v[11] := x5 XOR x4; v[10] := x4 XOR x3; v[ 9] := x3 XOR x2; v[ 8] := x2 XOR x1; v[ 7] := x1; v[ 1] := x8 XOR x; k := 16; WRITE ('$'); FOR i := 1 TO 4 DO BEGIN FOR j := 1 TO 4 DO BEGIN IF j = 1 THEN sum := v[k] ELSE sum := 2*sum + v[k]; DEC (k) END; WRITE (hexdigit[sum]) END; WRITE (','); INC (count); IF count MOD 11 = 0 THEN WRITELN END END {CRCTable}.