Manchester decoding » History » Version 3

« Previous - Version 3/8 (diff) - Next » - Current version
ABDALLAH, Hussein, 03/14/2016 10:31 PM


Manchester decoding

This part seems to be critical for a lot of workers in the Manchester code. To decode the signal we have several approaches with different benefices for each one.
Some common steps are needed in all approaches;

• We should Know or discover the data rate clock
• We should synchronize to the clock to separate a bit edge from a mid-bit transition
• Process the incoming stream and recover the data using the previous two steps
• Store this data for further processing

All these steps should be implemented in software taking into account that we have 2 options based on timing and sampling.

Timing based Manchester code

In this method, we detect the time between each transition coming from the demodulator circuit. To do this, we can use a micro-controller which contains an Input capture function. This function is used to deal with input signals in embedded systems (record time-stamp and set a flag indicating that an input has been captured). Moreover, it generates an interrupt, precise the time measurement and allow decision processing. To implement this method, we need the steps below;

1. Set up timer to interrupt on every edge
2. Interrupt service routine ISR should flag the edge occurred and store count value
3. Start timer, capture first edge and discard this.
4. Capture next edge and check if stored count value equal 2T (T = ½ data rate)
5. Repeat step 4 until count value = 2T (This is now synchronized with the data clock)
6. Read current logic level of the incoming pin and save as current bit value (1 or 0)
7. Capture next edge
a. Compare stored count value with T
b. If value = T
● Capture next edge and make sure this value also = T (else error)
● Next bit = current bit
● Return next bit
c. Else
if value = 2T
● Next bit = opposite of current bit
● Return next bit
d. Else
● Return error
8. Store next bit in buffer
9. If the desired number of bits is decoded; exit to continue further processing
10. Else set current bit to next bit and loop to step 7
It should also be noted that the timer’s value will not be exactly matched to T or 2T times.