I can see the advantage of Manchester code over NRZ: you get clock and data in one signal combined. But what does differential Manchester add to that?
Electronic – the advantage of differential Manchester
communicationencodermanchester-codingtransmitter
Related Solutions
No, you don't need a PLL to decode manchester. That's only one way. In fact a PLL doesn't by itself decode anything, it only provides a clock at which you can reliably sample the manchester half-bits. If the bit rate of the manchester stream can vary, then something like a PLL that can adjust to the incoming frequency may be useful.
I have done several manchester decoders and none of them used a PLL. The first time I did this, my thought was to measure the time between edges by capturing a timer, and then decode the bitstream from there. That worked fine, but in subsequent projects I used a different scheme that allowed for higher manchester bit rate relative to the instruction rate. In these projects I simply sampled the incoming stream at regular intervals. The periodic interrupt counts how many successive samples the input is high or low and passes that to the next level up decoding logic. That then classifies each level as long, short, or invalid, which is then decoded up the protocol chain usually ending in fully received and validated packets.
Since manchester is usually used because data needs to be transmitted accross some analog medium (it's a bit silly to use manchester between two digital chips on the same board, for example), the raw input signal is often analog. Above I mentioned that I now usually sample the manchester signal at some multiple (like 8-12) of the expected bit rate. This is actually usually done with a A/D. By doing this you eliminate the need for analog data slicers.
Digital data slicers can easily be quite a bit better than analog ones of reasonable complexity. All you need to do externally is to low pass filter the signal to prevent aliasing at the fast sample rate. Since the manchester signal is being sampled around 8-12 times faster than the bit rate, such a filter won't cut into the real signal much at all. Usually two poles of R-C is good enough.
My digital data slicers work by keeping the last two bit times of samples in memory. For example, if the manchester data is being sampled 8x the bit rate, then this would mean the last 16 samples are kept in a rolling buffer. The reason for two whole bit times is that this is the minimum time for two full successive levels of opposite polarity (imagine a 101010... pattern). The data slicer computes the average of the max and min values in the buffer, and uses that as the high/low comparison threshold.
Another trick is to do a little low pass filtering on the string of A/D samples before data slicing. This is one of the few cases where a box filter is actually a good answer, as apposed to the usual knee jerk reaction of those that didn't pay attention in signal processing class. The convolution window width is simply the number of samples in a half-bit. Think of the case where the input is a perfectly clean digital signal. This signal will always have levels lasting either 1/2 bit or 1 bit time. The box filter ("moving average" for the knee jerkers) will turn the edges into ramps lasting 1/2 bit time each. A signal with a sequence of short levels therefore becomes a triangle wave. A sequence of long levels therefore a trapezoid with ramps last 1/2 bit time and solid levels between also 1/2 bit time long. Note that data slicing this signal to the average of its max and min value yields the same resulting stream as doing it on the unfiltered input.
So why filter? Because you get better noise immunity. As described above, a perfect signal isn't effected by this filter. However, a noisy signal is. The effect on the resulting 1s and 0s stream out of the data slicer from random noise added to the input samples is less with the filtering. I have implemented this algorithm in a dsPIC sampling at 9x the bit rate with a 12 bit A/D right from a analog RF receiver. This system was able to decode valid packets from RF transmissions that I could barely see on a scope by looking at the same signal going into the A/D. "Valid" packet means that no manchester violations were found, the bit stream decoded, and a 20 bit CRC checksum test passed. This stuff really works.
Your representation is correct. Differential Manchester encodes each data bit as follow:
- If it has the same value as the data bit before --> High to Low transition (that would be a '0' in non-differential Manchester)
- If it has a different value than the data bit before --> Low to High Transition (that would be a '1' in non-differential Manchester).
The very first bit of the transmission would not be specified, you may choose to encode it as normal Manchester.
You may also first calculate the "differential data stream" and then perform a normal Manchester encoding of this differential data stream. The differential data stream would be defined as: \${\text{diff}}_i={\text{data}}_i \oplus {\text{data}}_{i-1}\$.
For example if your data is 00110110 you would get X0101101 and then encode it as normal Manchester.
The decoding of the data stream is just the same. You may decode it first as normal Manchester and then apply \${\text{data}}_i={\text{decoded}}_i \oplus {\text{decoded}}_{i-1}\$
Related Topic
- Electronic – Why does timing change in dataframe using Manchester encoding
- Quick digital receiver for Manchester encoded data
- Electronic – how to design an electronic circuit that convert a binary sequence to Manchester code
- Electrical – Self-clocking driver / transceiver
- Electronic – problem with NRZ and how manchester line coding handles out of sync tx and rx clocks.
- Electronic – Hardware/software needed to decode Differential Manchester
Best Answer
According to wiki answers: -
That sounds a nice feature to me.
On another wiki answer it says it gives better noise immunity than normal M-encoding. And on another it explains how it achieves it: -
Following a little trawl on the web I thought I'd put this drawing in that I modified to show how the bit transitions indicated logic 1 and logic 0 data: -
This is why the data stream can be inverted and you can still decode correctly.