Philip Pemberton wrote: > Nicely done.. Only one thing though: > > > const uint8 fixbits[8] = {0x00, 0x90, 0xA0, 0x81, > > 0xC0, 0x82, 0x84, 0x88} > > > > uint8 receive(uint8 x) > > { > > return x ^ fixbits[(encode[x & 0x0F] ^ x) >> 4]; > > } > > You're declaring fixbits as an 8-byte array. That means your array > elements are numbered 0 to 7. Now, if x = 10 (say), because you're > ANDing by 0x0F (to get the low nibble), this code will try and get the > low 4 bits (range 0-15), meaning it'll try and get entry 10 from > fixbits[8]. Which doesn't exist. End result? The program jumps off > into never-never land. Phil: You've misread my code. If x = 10, then the code will try to get entry 10 from the encode[16] array, not from the fixbits[8] array. Since all the entries in the encode[] array have bit 7 cleared to 0, and x also has bit 7 cleared to 0, the "^x" will leave bit 7 cleared, and the ">> 4" is guaranteed to produce a number in the range 0-7... And it's THAT number that gets used as an index into the fixbits[8] array. -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