Michael Rigby-Jones wrote: > > Just wrote this for a friend who needed to do simple error- > > correction. > > That's been added to my usefull code snippets collection, thanks for > posting! Maybe a stupid question, but if bit 7 is set after calling > receive(), how would you tell if the data had been corrected or was > garbage? Mike: Not a stupid question at all. The answer is... You don't; you can use the code to correct one-bit errors OR you can use it to detect one- and two-bit errors. You can't do both, because a two-bit error in one codeword can look identical to a one-bit error in another. For example: From the encode[] array, you can see that the codeword for "0000" is 0000 0000, and the codeword for "0001" is 0011 0001. If we receive 0011 0000, is that: 0011 0001 with a one-bit error in bit 0, or 0000 0000 with an error in both bit 4 and bit 5? -Andy === Andrew Warren - fastfwd@ix.netcom.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist