ByteOut.0[Index] = ~Manch.0[Index<<1]
This just shifts the bit index pointer left by 1. If you run this with a serial connection, MCS ICD, or through MPLAB sim you can see how everything is working.
ByteOut.0[Index] = ~Manch.0[Index<<1]
This just shifts the bit index pointer left by 1. If you run this with a serial connection, MCS ICD, or through MPLAB sim you can see how everything is working.
to if index starts off and is equal to 0, this is shifted left to 1 and invert the value at 1 to give you the value for 0? this done each time to make up the 8bits.
If you take the encoded bit stream(example): 100110 and run it through the code it will come out like this: 100 (this is wrong as it should be 101)?
many thanks
How did you get 100 from %00100110?
The routines I posted take an 8-bit number as the input, and return a 16-bit encoded result.
ASCII characters A to F
..................... input............encoded output..........
Encoded A = %01000001 = %01 10 01 01 01 01 01 10
Encoded B = %01000010 = %01 10 01 01 01 01 10 01
Encoded C = %01000011 = %01 10 01 01 01 01 10 10
Encoded D = %01000100 = %01 10 01 01 01 10 01 01
Encoded E = %01000101 = %01 10 01 01 01 10 01 10
Encoded F = %01000110 = %01 10 01 01 01 10 10 01
If I feed in your value %00100110. I get %0101100101101001
i going from encoded to decoding..
the code says at counter 0 put into byteout.0 = invert of index pointer left 1.
this inverts a 1 to give you 0 when it should be 1.
it seems that you need to invert the first bit of the encoded data before you start moving through the rest of the code with <<1
regards
andrew
Encode:
For d = 0 to 3 ' 4 bit
if v.0[d]=0 Then
encoded.0[d*2]=0
encoded.0[d*2+1]=1
else
encoded.0[d*2]=1
encoded.0[d*2+1]=0
endif
next
serout2 portb.0,396,[%1000,encoded]
goto basla
'd: number of bits to encode (8 bits)
'v: byte to BE encoded
'encoded: WORD sized variable holding the encoded
'byte v.
im using this manchester encoding but i didnt decode this pls help..
Here are the two subroutines to encode and decode the bi-phase or manchester scheme.
It works for sure.
Ioannis
Even after years still usefull... I was reading this topic, cause I am searching for a true solution. In this topic I miss the 90 degrees phase shifting, I think only bytesize is doubled here. I read somewhere else that Manchester code is a bi-phase code with not only transitions on the beginning of a bit, but at the center of a bit as well. It is defined as a transition orientated code, not a bit orientated. But maybe I am wrong here, cause I am quite new to this, so can anyone explain me please ?
Bookmarks