Comm Notes
Line coding schemes for baseband digital transmission including NRZ, RZ, Manchester, AMI, and HDB3
Line Coding Techniques: Shaping Digital Signals for Transmission
When we transmit digital data over a physical medium — copper wire, coaxial cable, or printed circuit board traces — we cannot simply send raw binary ones and zeros. We need to convert these abstract bits into actual electrical waveforms with specific properties. This conversion process is called line coding, and choosing the right line code is crucial for reliable baseband communication.
Why Do We Need Line Coding?
Think of it this way: suppose you represent "1" as +5V and "0" as 0V (simple unipolar encoding). If you transmit a long sequence of ones (111111...), the signal stays at a constant +5V. The receiver's clock recovery circuit, which synchronizes to signal transitions, loses lock because there are no transitions to track. Similarly, a long string of zeros produces no signal at all — the receiver cannot distinguish "no data" from "all zeros."
Line coding solves these problems by designing waveforms that guarantee:
- Adequate timing information — Sufficient transitions for clock recovery
- DC balance — Zero average voltage (important for AC-coupled links)
- Error detection — Built-in violation detection capability
- Bandwidth efficiency — Minimum bandwidth for given data rate
- Noise immunity — Good performance in the presence of interference
Categories of Line Codes
Line codes fall into several families based on how they assign voltage levels to bits:
Unipolar: Signal uses only one polarity (e.g., 0V and +V) Polar: Signal uses both positive and negative voltages (e.g., +V and -V) Bipolar: Three levels used (+V, 0, -V) with alternation rules
NRZ (Non-Return-to-Zero) Codes
In NRZ coding, the signal level remains constant throughout the entire bit period — it never returns to zero between bits.
NRZ-L (NRZ-Level):
- "1" → High voltage (+V)
- "0" → Low voltage (-V)
- Simplest scheme, used in RS-232 serial communication
- Problem: No transitions during long runs of same bit → clock drift
NRZ-I (NRZ-Inverted/Mark):
- "1" → Transition at bit boundary (invert previous level)
- "0" → No transition (maintain previous level)
- Better than NRZ-L for "1" runs, but "0" runs still problematic
- Used in USB 2.0
NRZ Bandwidth: Main lobe extends from 0 to Rb Hz. First null at frequency = Rb. Spectral efficiency: 1 bit/Hz (theoretical maximum for binary)
RZ (Return-to-Zero) Code
In RZ coding, the signal returns to zero voltage during the second half of every bit period:
- "1" → +V for first half, 0V for second half
- "0" → -V for first half, 0V for second half
Advantage: Guaranteed transition in every bit (excellent self-clocking) Disadvantage: Bandwidth doubles — requires 2× the bandwidth of NRZ because the pulse is half as wide. First null at 2Rb.
Manchester Encoding (Biphase-L)
Manchester coding is perhaps the most elegant solution to the clock recovery problem. Every bit contains a transition in its center:
- "1" → Low-to-high transition at mid-bit (or high-to-low, depending on convention)
- "0" → High-to-low transition at mid-bit
Properties:
- Always DC-balanced (equal time at +V and -V in every bit period)
- Self-clocking: transition in every bit guarantees clock recovery
- Bandwidth: First null at 2Rb (twice NRZ) — the price of guaranteed transitions
- Error detection: Missing mid-bit transition indicates an error
Applications: 10BASE-T Ethernet (10 Mbps), magnetic storage, RFID
Differential Manchester:
- Transition at mid-bit always present (for clocking)
- "0" → Additional transition at bit boundary
- "1" → No transition at bit boundary
- Used in Token Ring networks — immune to polarity inversion
AMI (Alternate Mark Inversion)
AMI is a bipolar code using three voltage levels:
- "0" → 0V (zero voltage)
- "1" → Alternately +V and -V (marks alternate polarity)
Example: Data: 1 0 1 1 0 1 AMI: +V, 0, -V, +V, 0, -V
Properties:
- DC-balanced (positive and negative pulses cancel over time)
- Built-in error detection: two consecutive same-polarity pulses = violation
- No DC component — suitable for transformer-coupled links
- Problem: Long strings of zeros have no transitions → clock drift
Bandwidth: First null at Rb/2 — half the bandwidth of NRZ! This is because the alternating polarity effectively creates a pattern at half the bit rate.
HDB3 (High Density Bipolar of Order 3)
HDB3 is AMI with a clever modification to handle long zero runs. It never allows more than 3 consecutive zeros without a transition:
Rule: When 4 consecutive zeros occur, replace them with a special pattern containing a "violation" (intentional bipolar violation):
- If number of pulses since last violation is odd: 000V
- If number of pulses since last violation is even: B00V
Where B = balancing pulse (same polarity as last mark) and V = violation (same polarity as last mark).
The receiver detects violations (which cannot occur in normal AMI) and replaces them back with four zeros.
Applications: E1 (2.048 Mbps) and E3 (34.368 Mbps) telecommunications lines.
Comparison Table
| Property | NRZ-L | Manchester | AMI | HDB3 |
|---|---|---|---|---|
| Bandwidth (first null) | Rb | 2Rb | Rb/2 | Rb/2 |
| DC component | Yes | No | No | No |
| Self-clocking | No | Yes | Partial | Yes |
| Error detection | No | Yes | Yes | Yes |
| Complexity | Lowest | Low | Medium | Medium |
| Efficiency (bits/Hz) | 1 | 0.5 | 2 | 2 |
Power Spectral Density
The power spectrum reveals important characteristics:
- NRZ-L: P(f) = sinc²(fTb) — has significant DC component
- Manchester: P(f) = sinc²(fTb/2) × sin²(πfTb/2) — no energy at DC or at Rb
- AMI: P(f) = sinc²(fTb) × sin²(πfTb) — no DC, null at f=0 and f=Rb
The key insight: Manchester has no energy at DC (good for AC-coupled links) but needs twice the bandwidth. AMI has no DC and uses less bandwidth but has clock recovery issues during zero runs.
Choosing a Line Code
The choice depends on application requirements:
- Short links, maximum speed: NRZ (PCB traces, chip-to-chip: PCIe, DDR)
- Medium distance, need DC balance: Manchester (Ethernet 10BASE-T)
- Telecommunications trunks: HDB3 or B8ZS (E1/T1 lines)
- Optical fiber: Scrambled NRZ or 8B/10B (Gigabit Ethernet, Fibre Channel)
- High-speed serial: PAM-4 (four voltage levels, 2 bits per symbol — used in 400GbE)
Modern Block Codes: 8B/10B and 64B/66B
Modern high-speed links use block coding rather than traditional line codes:
8B/10B: Maps 8 data bits to 10 coded bits, guaranteeing DC balance, bounded run length, and embedded comma characters for synchronization. Used in USB 3.0, SATA, Gigabit Ethernet. Overhead: 20%.
64B/66B: Maps 64 data bits to 66 coded bits (only 3% overhead). Used in 10 Gigabit Ethernet and beyond. Achieves adequate transition density through scrambling.
Key Takeaways
- Line coding converts abstract binary data into electrical waveforms optimized for physical transmission.
- Key design goals are clock recovery (transitions), DC balance, error detection, and bandwidth efficiency — no single code optimizes all simultaneously.
- Manchester encoding guarantees transitions in every bit but requires double the bandwidth of NRZ.
- AMI/HDB3 achieve excellent spectral efficiency with DC balance, dominating telecommunications infrastructure.
- Modern high-speed links use block codes (8B/10B, 64B/66B) combined with scrambling rather than traditional line codes.
- The choice of line code involves trade-offs between bandwidth, complexity, clock recovery, and error detection capabilities.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Line Coding Techniques.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Communication Systems topic.
Search Terms
communication-systems, communication systems, communication, systems, digital, line, coding, techniques
Related Communication Systems Topics