---
title: "Line coding and NRZ, RZ, AMI"
subject: "Telecommunications"
chapter: 3
key: "semester_8/telecommunications:line-coding-nrz-rz-ami"
source: https://www.bctengineer.com/q/semester_8/telecommunications/line-coding-nrz-rz-ami
site: BCT Engineering
---

# Line coding and NRZ, RZ, AMI

Telecommunications · Chapter 3: Signal Multiplexing

- Asked in: 2065 Magh (old course), 4+12 marks
- Video: [Line Coding Techniques | RZ, NRZ, Unipolar, Polar, Bipolar & Manchester | Digital Communication](https://www.youtube.com/watch?v=daf9F9NC7zQ) — Engineering Funda
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_8/telecommunications/line-coding-nrz-rz-ami
- Whole chapter: https://www.bctengineer.com/md/semester_8/telecommunications/chapter-3

## Question

Why line coding is required before the PCM signals to be connected to the digital line? Justify that Unipolar Non Return to Zero (NRZ), Return to Zero (RZ) and bipolar Alternate Mark Inversion (AMI) codes can not be used in line coding.

## Short answer

Line coding ensures no DC component, adequate timing content, and error detection. Unipolar NRZ has large DC and loses timing on long runs of 1s or 0s. Unipolar RZ retains DC and doubles bandwidth. AMI eliminates DC but fails to provide timing during long zero sequences, so none alone meets all requirements.

## Answer

#### Why line coding is required
The binary output of a PCM coder (simple on–off pulses) is not suitable for sending directly on a cable. **Line coding** converts it into a waveform that suits the line and the regenerative repeaters. The line code must give:
- **No DC component:** lines are coupled through transformers and capacitors (and carry DC power for repeaters), so the signal must have no DC and little low-frequency energy.
- **Timing (clock) content:** regenerative repeaters extract the clock from the transitions of the received signal; there must be enough transitions whatever the data.
- **Small bandwidth:** the spectrum should be narrow to reduce attenuation and crosstalk on the cable.
- **Error monitoring:** the code should have redundancy so that errors can be detected in service (e.g. bipolar violations).
- **Transparency:** any data pattern, including long runs of 0s or 1s, must pass without loss of timing.
- **Simple, low-cost coding and decoding.**

#### Waveforms of the three codes
```text
 data:     1   0   1   1   0   0   0   0
          +---+   +-------+
 NRZ-L    |   |   |       |
 (unipol) +   +---+       +---------------  0

          +-+     +-+ +-+
 RZ       | |     | | | |
 (unipol) + +-----+ +-+ +-----------------  0

          +---+       +---+
 AMI      |   |       |   |
       ---+   +---+   +   +---+------------ 0
                  |   |   (no pulses
                  +---+    for 0s)
```

#### 1. Unipolar NRZ cannot be used
In unipolar NRZ, '1' = +V for the whole bit, '0' = 0 V.
- **Large DC component:** the average value is $V/2$ for random data (and $V$ for a run of 1s). Lines use transformers and series capacitors (and carry DC to power repeaters), which block DC. The DC part is lost, the baseline wanders, and the decision threshold shifts, causing errors.
- **No timing for long runs:** a long run of 1s or 0s has no transitions at all, so the repeater's clock-recovery circuit loses lock, causing bit slips.
- **No discrete clock line in the spectrum:** its power spectrum has no component at the bit rate $f_b$, so simple tuned-circuit clock extraction is not possible.
- **No error monitoring:** any pattern is legal, so in-service errors cannot be detected.
- Most energy is at low frequency, where crosstalk on pairs is high.
Hence unipolar NRZ is unsuitable.

#### 2. Unipolar RZ cannot be used
In RZ, '1' = +V for half a bit and returns to 0; '0' = 0 V.
- **Still has DC:** the average is $V/4$ for random data, so the same baseline wander problem.
- **Long runs of 0s give no transitions,** so timing is lost (runs of 1s are fine).
- **Bandwidth doubles:** pulses are half as wide, so the first spectral null is at $2f_b$; more attenuation and crosstalk, and repeaters must be closer.
- Half the pulse energy is lost for the same peak voltage, lowering noise margin.
- No error detection.
Though RZ does contain a clock component at $f_b$, its DC content and bandwidth rule it out.

#### 3. Bipolar AMI cannot be used (on its own)
In AMI, '0' = 0 V, and each '1' is a pulse of alternating polarity (+, −, +, …).
It solves several problems:
- **No DC:** positive and negative pulses balance, so the average is zero and the spectrum is zero at DC.
- **Narrow spectrum:** most energy near $f_b/2$.
- **Error detection:** two successive 1s of the same polarity (bipolar violation) show an error.

But it fails one requirement:
- **Long runs of zeros give no pulses at all.** PCM data from an idle channel or from data terminals can contain many consecutive zeros. During such a run the repeaters receive nothing, so the timing-recovery circuit drifts and loses bit synchronisation. Every following bit may then be mis-read.
- Therefore plain AMI is not **transparent**; early T1 systems had to force a 1 into all-zero words ("zero code suppression"), which corrupts data and limits users to 7 bits (56 kbps) per channel.

Example – data 1 0 1 1 0 0 0 0 0 0 0 0 1: AMI gives + 0 − + 0 0 0 0 0 0 0 0 −; the eight zeros produce 8 bit periods with no pulse, and the repeater clock has nothing to lock to.

#### Summary
| Requirement | Unipolar NRZ | Unipolar RZ | Bipolar AMI |
|---|---|---|---|
| Zero DC | No | No | Yes |
| Timing in long 0 runs | No | No | No |
| Timing in long 1 runs | No | Yes | Yes |
| Bandwidth | $f_b$ (null) | $2f_b$ (null) | $f_b$ (peak at $f_b/2$) |
| Error monitoring | No | No | Yes (violations) |
| Suitable alone? | No | No | No |

#### What is used instead
Modified bipolar codes that keep AMI's benefits but replace long zero strings with patterns containing deliberate **bipolar violations**:
- **HDB3** (High Density Bipolar 3) in E1/E2/E3: no more than 3 consecutive zeros on the line.
- **B8ZS** (Bipolar 8 Zero Substitution) in T1: eight zeros replaced by 000VB0VB.
The receiver recognises the violation pattern and restores the zeros, so DC balance, timing and error monitoring are all achieved.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Why must no DC component be present in a line code?
   A. DC makes the clock too fast
   B. Transformers and capacitors in the line block DC, causing baseline wander and errors
   C. DC increases bandwidth
   D. DC cannot be amplified
   Answer: B. The line is coupled through transformers/capacitors, so DC is lost, causing baseline wander and decision errors. (Key point: Need for line coding)

2. What is a main reason unipolar NRZ cannot be used?
   A. It has zero average value
   B. Large DC component and no transitions in long runs of 1s or 0s
   C. It doubles the bandwidth
   D. It has a clock line at the bit rate
   Answer: B. Unipolar NRZ averages V/2 (DC) and has no transitions in long runs, so repeaters lose timing. (Key point: Why unipolar NRZ fails)

3. What is the problem with unipolar RZ?
   A. DC is zero but no clock
   B. Still has DC (V/4), no timing in runs of 0s, and bandwidth doubles
   C. It cannot carry 1s
   D. It has error monitoring that wastes bandwidth
   Answer: B. RZ pulses are half-width so bandwidth doubles; DC remains and long 0 runs give no transitions. (Key point: Why RZ fails)

4. What single requirement does plain AMI fail?
   A. Zero DC
   B. Error detection
   C. Timing during long runs of zeros, since no pulses are sent
   D. Narrow spectrum
   Answer: C. AMI balances DC and detects bipolar violations, but long zero strings give no pulses so repeaters lose clock; HDB3/B8ZS fix this. (Key point: Why AMI alone fails)

## Related in Telecommunications

- [Line coding in PCM and the right technique](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Aline-coding-pcm-solution) — Telecommunications, chapter 3
- [Short note: Line coding principles in PCM](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Ashort-note-line-coding-pcm) — Telecommunications, chapter 3

## Related in other subjects

- [Line coding 1001101101 (unipolar NRZ, polar RZ, AMI, Manchester)](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aline-codes-1001101101) — Communication Systems, chapter 6, asked 8×
- [Line coding 10110101 (polar NRZ, unipolar RZ, AMI, Manchester)](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aline-codes-10110101) — Communication Systems, chapter 6, asked 8×
- [Line coding 100111010 (Polar RZ, bipolar NRZ, AMI, Manchester)](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aline-codes-100111010) — Communication Systems, chapter 6
- [Line coding: polar RZ and bipolar AMI](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Aline-coding-polar-rz-ami) — Data Communication, chapter 5
