on Wed, 21 May 1997 06:44:13 -0700 Dan Mulally wrote > I've been seeing the messages on various error checking routines such as > Hamming and CRC. I had a project that uses 32 bit "packets" to transfer I have dabbled with Hamming, CRC, and checksums -SNIP- > best way but it was easy. I've read that the checksum method is not as > sensitive to detecting errors as other methods and I have no idea of the > odds of this method giving a correct checksum with errors in the data. If you just fed random numbers into your system as described you would get bad data slipping through every 1 in 256 times. As your checksum could hold any of 256 combinations and one of them must be correct. Because of this I have used 16bit checksums to cut down on the chances of this happening. > > Here is the code that does the checksum checking: > > ;***************************************************** > ;Checksum Sub > ;***************************************************** > chksum bcf flags, chksum_ok ;clear checksum flag > movf frame0, 0 ;move frame0 to W > addwf frame1, 0 ;add frame1 to W > addwf frame2, 0 ;add frame2 to W > addwf frame3, 0 ;add frame3 to W > xorwf frame4, 0 ;XOR checksum frame with W > btfsc status, z ;result = 0? q=yes > bsf flags, chksum_ok ;if yes, set checksum flag > retlw null ;return with null > I would be more inclined to XOR all the numbers in the frame together but otherwise I have used a 16bit version of what you show above. I have also heard that CRC is more robust. It is supposed to be less susceptible to added leading zeros on your message. Though this would not apply in your fixed message length case. But as far as hard facts regarding how sensitive CRC is at detecting errors - I am as interested as you - If anyone out there knows this I would like to hear. TIA p.s. I have a CRC routine written in 6502 if you are interested!!! ---------------------------------------- Martin Lane Computer Manager Metrol Technology Ltd Tel. +44 1224 772771 Fax. +44 1224 772660 Home mailto:martin@mudtower.demon.co.uk