Manchester decoding » History » Version 3
ABDALLAH, Hussein, 03/14/2016 10:31 PM
1 | 1 | ABDALLAH, Hussein | h1. Manchester decoding |
---|---|---|---|
2 | 1 | ABDALLAH, Hussein | |
3 | 1 | ABDALLAH, Hussein | 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. |
4 | 1 | ABDALLAH, Hussein | Some common steps are needed in all approaches; |
5 | 1 | ABDALLAH, Hussein | |
6 | 1 | ABDALLAH, Hussein | • We should Know or discover the data rate clock |
7 | 1 | ABDALLAH, Hussein | • We should synchronize to the clock to separate a bit edge from a mid-bit transition |
8 | 1 | ABDALLAH, Hussein | • Process the incoming stream and recover the data using the previous two steps |
9 | 1 | ABDALLAH, Hussein | • Store this data for further processing |
10 | 1 | ABDALLAH, Hussein | |
11 | 1 | ABDALLAH, Hussein | All these steps should be implemented in software taking into account that we have 2 options based on timing and sampling. |
12 | 2 | ABDALLAH, Hussein | |
13 | 2 | ABDALLAH, Hussein | *Timing based Manchester code* |
14 | 2 | ABDALLAH, Hussein | |
15 | 2 | ABDALLAH, Hussein | 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; |
16 | 2 | ABDALLAH, Hussein | |
17 | 2 | ABDALLAH, Hussein | 1. Set up timer to interrupt on every edge |
18 | 2 | ABDALLAH, Hussein | 2. Interrupt service routine ISR should flag the edge occurred and store count value |
19 | 2 | ABDALLAH, Hussein | 3. Start timer, capture first edge and discard this. |
20 | 2 | ABDALLAH, Hussein | 4. Capture next edge and check if stored count value equal 2T (T = ½ data rate) |
21 | 2 | ABDALLAH, Hussein | 5. Repeat step 4 until count value = 2T (This is now synchronized with the data clock) |
22 | 2 | ABDALLAH, Hussein | 6. Read current logic level of the incoming pin and save as current bit value (1 or 0) |
23 | 2 | ABDALLAH, Hussein | 7. Capture next edge |
24 | 2 | ABDALLAH, Hussein | a. Compare stored count value with T |
25 | 2 | ABDALLAH, Hussein | b. If value = T |
26 | 2 | ABDALLAH, Hussein | ● Capture next edge and make sure this value also = T (else error) |
27 | 2 | ABDALLAH, Hussein | ● Next bit = current bit |
28 | 2 | ABDALLAH, Hussein | ● Return next bit |
29 | 2 | ABDALLAH, Hussein | c. Else |
30 | 2 | ABDALLAH, Hussein | if value = 2T |
31 | 2 | ABDALLAH, Hussein | ● Next bit = opposite of current bit |
32 | 2 | ABDALLAH, Hussein | ● Return next bit |
33 | 2 | ABDALLAH, Hussein | d. Else |
34 | 2 | ABDALLAH, Hussein | ● Return error |
35 | 2 | ABDALLAH, Hussein | 8. Store next bit in buffer |
36 | 2 | ABDALLAH, Hussein | 9. If the desired number of bits is decoded; exit to continue further processing |
37 | 2 | ABDALLAH, Hussein | 10. Else set current bit to next bit and loop to step 7 |
38 | 2 | ABDALLAH, Hussein | It should also be noted that the timer’s value will not be exactly matched to T or 2T times. |
39 | 3 | ABDALLAH, Hussein | |
40 | 3 | ABDALLAH, Hussein | !Timing_Manchester.jpg! |