Hi, here is an implementation for your convenience. Remarks: - poly is a CRC polynomial, e.g. 0x1021 - crcval is Maybe the implementation is not optimal, but I use it extensively, w/o any problems. Imre On Mon, 30 Nov 1998, Ohtsji, Randie wrote: > Hello, > > I have seen a few implementations of generating CRC values but I wanted to > know if there is some known values which can be used to check if the CRC > algorithm is correct, as all the routines I have come across generate > different CRC values. > > For example, if the CRC is to be generated on a single byte, in this case > the value 'FF', what should the CRC value be? > > Also, if the CRC is to be generated on a string of bytes, such as, 'A0', > 'FF', '05', '02', '00', 'DE' etc. what should the end CRC value be? > > I am looking for a list inputs and outputs from a known good CRC-16 > generator. > > I think the poly for CRC-16 is X16, X15, X2, and X0. > > I am trying to do this on a 16C63. > > Any help would be appreciated. > > Randie > randie.ohtsji@glenayre.com > > Content-Type: TEXT/PLAIN; charset=US-ASCII; name="crc16.inc" Content-ID: Content-Description: ;This subroutine calculates a 16-bit CRC ;-------- ; CrcUpd: update using ; ; CBLOCK crcblk crch crcl saved oldcch i ENDC CrcUpd movwf saved ; j = W movlw d'8' ; W = 8 movwf i ; i = W _loop movfw crch movwf oldcch ; temporary save clrc ; clear carry for rlf rlf crcl ; crc << 1 rlf crch movfw saved ; the char read xorwf oldcch,F ; test with old high btfss oldcch,7 ; if bit set, apply mask b _notset ; otherwise skip movlw poly0 xorwf crcl,F movlw poly1 xorwf crch,F _notset clrc ; for rlf rlf saved,F ; next bit of saved decfsz i,F b _loop return ; ; End CrcUpd