Skip to main content

10.2 Digital-to-Digital Encoding: NRZ, Manchester & Differential Manchester

📚Module 10: Physical Layer Devices & Wireless NetworksTopic 10.2⏱️15 min read
🎯High-Yield For:Semester Exams (All Universities) • Placement Technical Rounds • Engineering Foundations

💡 Core Intuition: The Metronome and the Flashing Lantern​

🍳 The Everyday Analogy: Communicating Across a Dark Valley​

Imagine two signalers stationed on opposite mountain peaks at midnight communicating with a hand lantern:

  1. The Static Light (NRZ Scheme): To send a 1, you keep the lantern ON for 1 second. To send a 0, you turn it OFF for 1 second. If you need to send sixty consecutive 1s, you keep the lantern turned ON continuously for 60 seconds. However, if the receiver's wristwatch runs 2%2\% slower than yours, they count 59 seconds and misread your message as fifty-nine 1s! You lost Clock Synchronization.
  2. The Pulsing Metronome (Manchester Encoding): Instead of holding the light steady, you synchronize with a rhythmic beat. Every single second is split in half. For a 0, you shine the light in the first half-second and turn it off in the second half. For a 1, you start in the dark and turn the light ON in the second half.
  3. The Embedded Clock: Because the lantern always flips state in the exact middle of every second, the receiver uses the flashes to recalibrate their watch on every single bit. Clock drift is permanently eliminated.

💻 Bridging to Computer Science​

In network physical layer hardware:

  • Line Coding is the process of converting a sequence of digital bits (0,10, 1) into physical voltage pulses on a copper cable or light pulses in an optical fiber.
  • Naive voltage encoding suffers from Baseline Wandering and Clock Drift. Advanced encoding schemes (like Manchester in 10 Mbps Ethernet and Differential Manchester in Token Ring) embed the transmitter's clock signal directly into the data waveform.


⚠️ The Three Physical Challenges of Line Coding​

Before comparing encoding formats, we must understand the three physical hazards that degrade electrical signals on transmission lines.

The 3 Fundamental Physical Layer Signal Hazards

The electrical transmission hazards that robust line coding schemes must neutralize

📈

1. Baseline Wandering

Dynamic Threshold Drift
  • The receiver determines bit values by comparing incoming voltage to a running average baseline.
  • A long string of consecutive 0s or 1s shifts the average voltage baseline upward or downward.
  • Causes the receiver to misinterpret subsequent voltage levels, producing burst bit errors.
⚡

2. DC Component

Direct Current Attenuation
  • Constant voltage levels create low-frequency energy centered at 0 Hz (Direct Current).
  • DC energy cannot pass through AC-coupled transformers or capacitors on network interfaces.
  • Trapped DC energy dissipates as heat, distorting signal integrity over long cable runs.
⏱️

3. Loss of Synchronization

Clock Drift & Phase Skew
  • Transmitter and receiver maintain independent crystal quartz clocks that inevitably drift apart.
  • Without frequent voltage transitions, the receiver loses track of bit boundary intervals.
  • Forces the line code to be self-clocking: embedding transitions within every bit.
📊

4. Bandwidth Efficiency

Baud-to-Bit Ratio
  • Signal rate r = Data bits / Signal elements.
  • High transition density prevents clock drift but increases the required channel bandwidth.
  • Engineering goal: maximize clock transitions while minimizing frequency spectral width.

📜 Line Coding Taxonomy: From NRZ to Biphase​

Digital line coding schemes are categorized based on their voltage polarities and transition behavior:

CategoryRepresentative CodesOperational Characteristics
UnipolarUnipolar NRZAll signal levels are on one side of zero (+V+V and 0V0\text{V}). Severe DC component.
PolarNRZ-L, NRZ-ISignal levels span both sides of zero (+V+V and −V-V). Reduces average DC voltage.
BipolarBipolar AMI, PseudoternaryUses three distinct voltage levels: +V+V, 0V0\text{V}, and −V-V. Zero DC component.
BiphaseManchester, Differential ManchesterMandatory voltage transition at the exact midpoint of every bit interval.

🔌 Polar Non-Return to Zero (NRZ) Schemes​

In Non-Return to Zero (NRZ), the voltage signal remains constant throughout the entire bit duration; it does not return to zero in the middle of the bit.

1. NRZ-L (Non-Return to Zero-Level)​

  • Rule: The voltage level determines the value of the bit.
    • Bit 0 is represented by positive voltage (+V+V).
    • Bit 1 is represented by negative voltage (−V-V).
  • Weakness: A long string of consecutive 0s produces a continuous positive voltage; a long string of 1s produces a continuous negative voltage. The receiver experiences severe baseline wandering and loses clock synchronization.

2. NRZ-I (Non-Return to Zero-Invert)​

  • Rule: A transition at the beginning of the bit interval represents a 1. No transition represents a 0.
    • If the bit is 1, the voltage inverts (toggles from +V→−V+V \to -V or −V→+V-V \to +V).
    • If the bit is 0, the voltage stays at its current level.
  • Advantage over NRZ-L: A long string of consecutive 1s generates continuous transitions, maintaining perfect clock synchronization.
  • Fatal Weakness: A long string of consecutive 0s produces zero transitions, completely breaking receiver clock synchronization!

⚡ Biphase Encoding: Manchester & Differential Manchester​

To solve the synchronization problem completely, Biphase encoding mandates a voltage transition in the exact center of every bit cell.

Manchester vs Differential Manchester Encoding

Contrasting midpoint level direction against bit-boundary transition triggers

IEEE 802.3 Standard

Manchester Encoding (Ethernet)

⚡
Dominant Architecture / DomainClassic 10BASE-T Ethernet (10 Mbps)
  • •Midpoint transition serves simultaneously as data representation and clock tick.
  • •Bit 0: High-to-Low transition (+V -> -V).
  • •Bit 1: Low-to-High transition (-V -> +V).
  • •100% self-clocking and perfect DC balance (zero net DC bias).
  • •Trade-off: Requires 2 signal elements per bit; Baud rate = 2 x Bit rate.
"Midpoint transition direction directly dictates the bit value."
IEEE 802.5 Standard

Differential Manchester (Token Ring)

🔄
Dominant Architecture / DomainToken Ring Networks & Magnetic Storage
  • •Midpoint transition is ALWAYS present strictly for clock synchronization.
  • •Bit 0: Transition present at the START of the bit interval.
  • •Bit 1: NO transition at the START of the bit interval.
  • •Polarity Invariant: Inverting the physical copper wires does not corrupt data!
  • •Double bandwidth overhead identical to standard Manchester.
"Presence or absence of transition at bit boundary dictates the bit value."

1. Manchester Encoding (IEEE 802.3 Ethernet)​

In Manchester Encoding, the transition at the center of the bit provides both clocking and data:

  • Bit 0: Transition from High to Low (↓\downarrow).
  • Bit 1: Transition from Low to High (↑\uparrow).

(Note: Some European literature follows the Thomas convention where 0 is Low-to-High; IEEE 802.3 strictly standardizes High-to-Low for 0).

Why Manchester Solves the Core Hazards​

  1. Guaranteed Synchronization: Regardless of the data sequence (even a million consecutive 0s or 1s), there is at least one transition in every single bit cell. The receiver can never lose clock lock.
  2. Zero DC Component: Because every bit spends exactly 50%50\% of its duration at +V+V and 50%50\% at −V-V, the average DC voltage of any transmission is mathematically zero.

The Cost of Manchester: 50% Bandwidth Inefficiency​

Because every bit requires two signal levels (one transition per bit), the baud rate is doubled:

Baud Rate=2×Bit Rate\mathbf{\text{Baud Rate} = 2 \times \text{Bit Rate}}

To transmit at 10 Mbps10\text{ Mbps} (10BASE-T), the physical medium must support 20 Megabaud20\text{ Megabaud} (a frequency of 10 MHz10\text{ MHz}). This is why Gigabit Ethernet (1000BASE-T) could not use Manchester encoding—it would require an unaffordable 2 GHz2\text{ GHz} bandwidth on copper cables!


2. Differential Manchester (IEEE 802.5 Token Ring)​

In Differential Manchester, the midpoint transition is retained purely for clock recovery. The actual data is encoded by what happens at the start of the bit interval:

  • Bit 0: A transition occurs at the beginning of the bit cell.
  • Bit 1: No transition occurs at the beginning of the bit cell.

The Revolutionary Advantage: Polarity Inversion Immunity​

In physical Ethernet twisted-pair cabling, a technician might accidentally swap the two wires (reversing +V+V and −V-V).

  • In standard Manchester, swapping the wires inverts all High-to-Low transitions into Low-to-High transitions, inverting every single bit from 0 to 1 and destroying the message!
  • In Differential Manchester, the receiver looks only for the presence or absence of a transition at the boundary. Whether the transition is rising or falling is irrelevant! Differential Manchester is completely immune to physical cable wire transposition.

🧱 Overcoming the Manchester Penalty: Block Coding (4B/5B)​

To avoid doubling the required physical bandwidth on Fast Ethernet (100 Mbps100\text{ Mbps}), engineers introduced Block Coding:

The 4B/5B Encoding Scheme (100BASE-TX)​

Instead of doubling the baud rate using Manchester (100 Mbps  ⟹  200 MHz100\text{ Mbps} \implies 200\text{ MHz}), Fast Ethernet maps 4 bits of data into a 5-bit block:

  1. There are 24=162^4 = 16 possible 4-bit data nibbles.
  2. There are 25=322^5 = 32 possible 5-bit code words.
  3. The standard selects 16 code words that contain at most three consecutive zeros and at least two ones.
  4. The 5-bit output is then modulated using NRZ-I. Because no 5-bit code word has more than three consecutive zeros, the signal guarantees frequent transitions!
  5. Bandwidth Overhead: The clock overhead is only 5−44=25%\frac{5 - 4}{4} = \mathbf{25\%} (requiring 125 MHz125\text{ MHz} instead of 200 MHz200\text{ MHz})!

📊 Comprehensive Line Coding Comparison Matrix​

SchemeSignal Elements / Bit (rr)Self-Clocking?DC Component?Bandwidth RequirementChief Application
Unipolar NRZ11❌ No (Drifts on runs)❌ High DC biasLow (B/2B/2)Internal chip buses
NRZ-L11❌ No (Drifts on runs)⚠️ Moderate DCLow (B/2B/2)RS-232 serial ports
NRZ-I11⚠️ Partial (Drifts on 0s)⚠️ Moderate DCLow (B/2B/2)USB 2.0 (with bit-stuffing)
Bipolar AMI11⚠️ Partial (Drifts on 0s)✅ Zero DC biasLow (B/2B/2)T1 / E1 carrier lines
Manchester1/21/2✅ 100% Guaranteed✅ Zero DC biasHigh (BB)10BASE-T Ethernet
Diff. Manchester1/21/2✅ 100% Guaranteed✅ Zero DC biasHigh (BB)Token Ring (802.5)
4B/5B + NRZ-I4/54/5✅ Guaranteed⚠️ Low DC biasModerate (1.25×B1.25 \times B)Fast Ethernet (100BASE-TX)

🏭 Real-World Production Context: Legacy 10BASE-T Ethernet, Token Ring & High-Speed PCIe 8b/10b Line Coding​

1. Classical 10BASE-T Ethernet & IBM Token Ring​

  • 10BASE-T Ethernet (IEEE 802.3): When twisted-pair Ethernet was standardized in 1990, transceiver silicon was primitive. By deploying Manchester encoding, network cards operated without expensive crystal oscillators or dedicated clock synchronization lines—the receiver extracted clock timing directly from the mid-bit transitions of every single received frame.
  • IBM Token Ring (IEEE 802.5): Deployed Differential Manchester encoding across enterprise mainframe rings. In massive corporate buildings where thousands of unshielded twisted-pair (UTP) wires were punched down into punch blocks by manual technicians, accidental wire polarity flips were frequent. Differential Manchester ensured that flipped conductor pairs did not cause bit-inversion catastrophic failures.

2. High-Speed SerDes: 8b/10b & 64b/66b Block Coding (PCIe, SATA & Gigabit Ethernet)​

Why do modern high-speed protocols reject Manchester encoding?

  • In a 10 Gbps10\text{ Gbps} or 100 Gbps100\text{ Gbps} link, doubling the baud rate to 20 Gbaud20\text{ Gbaud} or 200 Gbaud200\text{ Gbaud} (as Manchester requires) is physically impossible over standard copper traces due to skin effect and dielectric loss.
  • 8b/10b Encoding (Gigabit Ethernet 1000BASE-X, SATA, USB 3.0, PCIe Gen 1/2): Maps 8-bit bytes into 10-bit symbols. It enforces a strict Running Disparity (RD) counter: if the line accumulates a positive DC offset, the encoder flips to an alternate symbol with negative disparity, guaranteeing perfect DC neutrality while reducing bandwidth overhead to 25%25\% (compared to Manchester's 100% overhead).
  • 64b/66b Encoding (10GbE, 40GbE, 100GbE, PCIe Gen 3+): Further slashes the line overhead down to a negligible 3.125%3.125\% (2 sync bits/64 data bits2\text{ sync bits} / 64\text{ data bits}) by coupling scramblers with lightweight synchronization headers.

📐 Numerical Applications & Worked Examples​

Example 1: Baud Rate & Minimum Bandwidth for NRZ vs Manchester​

Problem Statement: A digital telemetry system transmits data at a bit rate of N=20 MbpsN = 20\text{ Mbps}.

  1. Calculate the baud rate and minimum theoretical Nyquist channel bandwidth (BB) if transmission uses Polar NRZ-L (r=1r = 1).
  2. Calculate the baud rate and minimum theoretical Nyquist channel bandwidth (BB) if transmission uses Manchester encoding (r=1/2r = 1/2).

Step-by-Step Solution:

  1. Polar NRZ-L Analysis:
    • In NRZ-L, each signal element carries 1 data bit (r=1r = 1).
    • Baud Rate: Baud Rate=Nr=20 Mbps1=20 Mbaud\text{Baud Rate} = \frac{N}{r} = \frac{20\text{ Mbps}}{1} = \mathbf{20\text{ Mbaud}}
    • The worst-case alternating bit pattern (101010...) creates a square wave of fundamental frequency: Bmin⁡=Baud Rate2=20 MHz2=10 MHzB_{\min} = \frac{\text{Baud Rate}}{2} = \frac{20\text{ MHz}}{2} = \mathbf{10\text{ MHz}}
  2. Manchester Encoding Analysis:
    • In Manchester encoding, each data bit requires two signal voltage elements (r=1/2r = 1/2).
    • Baud Rate: Baud Rate=Nr=20 Mbps1/2=40 Mbaud\text{Baud Rate} = \frac{N}{r} = \frac{20\text{ Mbps}}{1/2} = \mathbf{40\text{ Mbaud}}
    • The minimum theoretical bandwidth required to pass the fundamental frequency of this signal is: Bmin⁡=Baud Rate2=40 MHz2=20 MHzB_{\min} = \frac{\text{Baud Rate}}{2} = \frac{40\text{ MHz}}{2} = \mathbf{20\text{ MHz}}
    • Conclusion: Manchester encoding requires exactly double the channel bandwidth (20 MHz20\text{ MHz} vs 10 MHz10\text{ MHz}) compared to NRZ-L to achieve the identical bit rate.

Example 2: Spectral Efficiency and Overhead in 4B/5B vs Manchester​

Problem Statement: Fast Ethernet transmits at a bit rate of 100 Mbps100\text{ Mbps}.

  1. If standard Manchester encoding were used, what baud rate would the physical transceiver have to sustain?
  2. Fast Ethernet instead deploys 4B/5B block coding combined with NRZ-I. Calculate the output baud rate and compute the bandwidth savings compared to Manchester.

Step-by-Step Solution:

  1. Manchester Scenario: Baud Rate=2×Bit Rate=2×100 Mbps=200 Mbaud\text{Baud Rate} = 2 \times \text{Bit Rate} = 2 \times 100\text{ Mbps} = \mathbf{200\text{ Mbaud}} This would demand Category 5 cables capable of supporting frequencies up to 100 MHz100\text{ MHz}, exceeding 1995 cable testing ratings.
  2. 4B/5B + NRZ-I Scenario:
    • The 4B/5B block encoder takes 100 Mbps100\text{ Mbps} of payload and expands every 4 bits into 5 encoded bits: Encoded Bit Rate=100 Mbps×54=125 Mbps\text{Encoded Bit Rate} = 100\text{ Mbps} \times \frac{5}{4} = \mathbf{125\text{ Mbps}}
    • The encoded stream is modulated onto copper using NRZ-I (r=1r = 1 signal element per encoded bit): Baud Rate=125 Mbps1=125 Mbaud\text{Baud Rate} = \frac{125\text{ Mbps}}{1} = \mathbf{125\text{ Mbaud}}
  3. Bandwidth Savings Calculation: Bandwidth Savings=200 Mbaud−125 Mbaud200 Mbaud×100%=75200×100%=37.5%\text{Bandwidth Savings} = \frac{200\text{ Mbaud} - 125\text{ Mbaud}}{200\text{ Mbaud}} \times 100\% = \frac{75}{200} \times 100\% = \mathbf{37.5\%} 4B/5B encoding slashes the transceiver baud rate by 37.5%37.5\%, allowing 100 Mbps100\text{ Mbps} transmission over standard 100 MHz100\text{ MHz} Cat5 cabling.

Example 3: Consecutive Bit Run-Length in 4B/5B Code Words​

Problem Statement: In 4B/5B block coding, an engineer must ensure that the NRZ-I line code never loses clock synchronization.

  1. What is the maximum number of consecutive zeros allowed across any combination of 4B/5B valid code words?
  2. If the clock runs at 125 MHz125\text{ MHz}, what is the maximum duration the receiver's phase-locked loop (PLL) must survive without seeing a voltage transition?

Step-by-Step Solution:

  1. Maximum Consecutive Zeros Analysis:
    • The 4B/5B table guarantees that no individual 5-bit code word has more than one leading zero and more than two trailing zeros (or vice versa).
    • In the worst-case concatenation of two consecutive code words: Trailing Zeros of Word1+Leading Zeros of Word2≤2+1=3 consecutive zeros\text{Trailing Zeros of Word}_1 + \text{Leading Zeros of Word}_2 \le 2 + 1 = \mathbf{3\text{ consecutive zeros}}
  2. Maximum Transition-Free Time Duration:
    • Because NRZ-I transitions only on a bit 1, a sequence of 3 consecutive zeros produces 3 bit-intervals without a transition.
    • At 125 MHz125\text{ MHz}, the duration of one encoded bit interval is: Tb=1125×106 Hz=8 nsT_b = \frac{1}{125 \times 10^6\text{ Hz}} = 8\text{ ns}
    • The maximum time without a transition is: Tmax⁡=(3+1)×Tb=4×8 ns=32 nsT_{\max} = (3 + 1) \times T_b = 4 \times 8\text{ ns} = \mathbf{32\text{ ns}}
    • The receiver's clock recovery circuit is guaranteed to receive an edge transition at least once every 32 nanoseconds32\text{ nanoseconds}, preventing phase drift.

🎯 Exam & Interview Pitfall Check​

Core Conceptual Questions
  • What is Bit Stuffing in NRZ-I?: Because NRZ-I produces zero transitions during long runs of consecutive 0s, USB 2.0 uses Bit Stuffing: the transmitter automatically injects an artificial 0 after any sequence of six consecutive 1s (to force a transition) and the receiver automatically discards the stuffed bit upon reception.
  • Why does Bipolar AMI use three voltage levels?: Alternate Mark Inversion (AMI) uses +V+V and −V-V alternately for 1s, and 0V0\text{V} for 0s. Because consecutive 1s cancel each other out, the net DC voltage is zero, and a single bit error violates the alternating pattern, providing native physical-layer error detection!
Common Interview Traps
  • Trap: Confusing Bit Rate with Baud Rate in Manchester Encoding: In Manchester encoding, transmitting 10 Mbps10\text{ Mbps} requires 20 Megabaud20\text{ Megabaud} (signal transitions per second). The baud rate is double the bit rate, NOT half.
  • Trap: Believing NRZ-I Inverts on Zero: Remember the rule: NRZ-I inverts on ONE, stays constant on ZERO. (Think: Invert on 1).

💬

Discussion & Doubts