I have an 8-bit CRC routine that should be good over a short message. I've used it to protect a four byte message (32 data bits, 40 total bits with CRC) in a moderately noisy environment with no problems. Here is the code... ;========================================================================== ; Macro for updating the CRC - input is 4 bit nibble in lsbits of W to be added to CRC crc_update MACRO crcreg xorwf crcreg,W ;[1] W = Table[ crc[3..0]^data[3..0] ] call crc_table_lookup ;[2-8] movwf temp ;[9] Save table value swapf crcreg ;[10] andlw 0x0F ;[11] Old crc msb's in lsb's of W xorwf int_temp,W ;[12] movwf crcreg ;[13] endm ======================== helper routine to lookup CRC bits. Make sure the addwf PCL,F instruction won't wrap beyond a 256-byte page. crc_table_lookup: ;[1-2] Call to get here andlw 0x0F ;[3] Extract only one nibble addwf PCL,F ;[4-5] dt 0x00,0x98,0x83,0x1B ;[6-7] Precomputed CRC lookup table dt 0xB5,0x2D,0x36,0xAE dt 0xD9,0x41,0x5A,0xC2 dt 0x6C,0xF4,0xEF,0x77 =================== to initialize: movlw 0xD9 ; Initial value for CRC accumulator movwf crcreg =================== to add a byte to the CRC movf databyte,W crc_update swapf databyte,W crc_update =================== to add a nibble to the CRC movf datanibble,W crc_update =================== if the receiver accumulates the entire message, including the CRC, into the crc register, then the CRC register will be zero if there were no errors. =================== Bob Ammerman RAm Systems -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.