This article builds upon the introductory article about baseband modulation where Manchester code was explained, and hopefully understood and accepted by the reader as a viable code.
There are many, many "simple" codes. By "simple", I mean a code that can be implemented by a simple hardware circuit. More sophisticated codes like "m-to-n" and chirp codes are product of recent technology advancements.
Among the simple codes, one of the most efficient and beautiful is Miller code. It belongs to the group of delay codes, since they signal a bit by a delay in the transition from low to high or vice-versa.
The rules of Miller code are:
0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
As can be realized visually, the Miller waveform has few transitions. This characteristic saves bandwidth. Miller spectrum is better even than the original NRZ message; most energy is concentrated in the middle of spectrum (e.g. 600Hz for a 1200bps stream), and almost no DC bias.
Miller code is also "differential out-of-the box", immune to polarity inversion, since the message bits are naturally encoded in terms of inversions (or transitions), not in terms of absolute levels.
A very interesting characteristic of Miller code is the relationship with Manchester code. A Miller stream can be derived from Manchester just "dividing it by two", that is, by discarding every other transition in Manchester waveform.
0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
So, at least for the TX side, the Miller encoder has an obvious implementation: a Manchester encoder followed by a flip-flop.
To decode Miller, the RX side can pay attention to the relative lengths of each transition (1x, 1.5x and 2x). The common denominator is the data rate, so it does not have to be agreed upon in advance.
In particular, the longest transition (2x) can only happen when the bit sequence is "101", and its edges fall in the middle of "1" bits. Given this fact, it is easy to recover the clock.
A code similar to Miller is the MFM (Modified Frequency Modulation), used in floppy disks and hard disks. Back in the day, it was a big thing since it allowed to double the magnetic storage density over FM encoding.