Re: Manchester coding
Hi, just thought I'd add my $0.02
I've used manchester (similar to biphase) coding in a PIC16F818 to test the BER of an RF link. I did it by splitting my input byte into two 4-bit nibbles, and used a LUT of 16 entries (1 for every possible 4-bit combination). I think its only used a total of 10 lines of code, plus the LUT.
Pseudocode:
Move inbyte to temp register
Move to W
And with 00001111 ; gets rid of the four MSB's
Call look-up table
Move result to outbyte1
Swap nibbles in temp (swapf temp,W)
And with 00001111
Call look-up table
Move result to outbyte2
Note: outbyte2 is the 4-MSB, outbyte1 the 4-LSB.
And there it is, the LUT is simple as well: ie: 00000000 -> 10101010
with the last entry being: 00001111 -> 01010101
If you're unsure what to put in the LUT, theres plenty of info on the net about manchester encoding.
I think thats right, but I'm rusty. I did it ages ago, and maganged to get 1.5MB/s out of the PIC (with the aid of a shift register).
As for decoding, bit more tricky. A clever use of interupts could be used, since a '1' is an upward transistion, and a '0' a downward one. You'll need to add a preamble in your packet to train your decoder so it knows where to sample. (check for rising edge and transmit all 1's).
Hope this helps,
BuriedCode