---
title: "Line coding in PCM and the right technique"
subject: "Telecommunications"
chapter: 3
key: "semester_8/telecommunications:line-coding-pcm-solution"
source: https://www.bctengineer.com/q/semester_8/telecommunications/line-coding-pcm-solution
site: BCT Engineering
---

# Line coding in PCM and the right technique

Telecommunications · Chapter 3: Signal Multiplexing

- Asked in: 2065 Baisakh (old course), 2+1+8+5 marks
- Video: [LINE CODING IN DIGITAL COMMUNICATION | Hindi | Unipolar, Polar and Bipolar RZ, NRZ waveforms](https://www.youtube.com/watch?v=sFQpBhbNQgQ) — Electronics Subjectified
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_8/telecommunications/line-coding-pcm-solution
- Whole chapter: https://www.bctengineer.com/md/semester_8/telecommunications/chapter-3

## Question

Why line coding is required in PCM (Pulse Code Modulation) system? Is it possible to implement NRZ (Not Return to Zero), RZ (Return to Zero) and AMI (Alternate Mark Inversion) coding techniques? If not, explain why it is not possible and which coding technique solves this problem?

## Short answer

Line coding adapts PCM binary streams to meet transmission requirements: no DC, adequate timing, small bandwidth, error monitoring. NRZ and RZ have DC and lose clock on long sequences; AMI loses clock on long zeros. Zero-substitution bipolar codes like HDB3 and B8ZS replace zero runs with intentional bipolar violations, preserving DC balance and timing.

## Answer

#### Why line coding is required in PCM
The PCM coder gives a plain binary stream. Before it is sent on a cable through regenerative repeaters, it must be converted into a **line code** that matches the line. The code must have:
- **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.**

#### Is it possible to use NRZ, RZ and AMI?
**No.** None of the three meets all the requirements, so none is used on its own for PCM lines.

#### Why they are not possible
```text
 data:     1   0   1   1   0   0   0   0
          +---+   +-------+
 NRZ-L    |   |   |       |
 (unipol) +   +---+       +---------------  0

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

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

**Unipolar NRZ** ('1' = +V for full bit, '0' = 0):
- Average (DC) value $V/2$; DC is blocked by line transformers and coupling capacitors, causing baseline wander and wrong decisions.
- Long runs of 1s or 0s have no transitions, so repeaters cannot recover the clock.
- No spectral line at $f_b$ to extract timing; no error detection.

**Unipolar RZ** ('1' = +V for half bit):
- Still has DC (average $V/4$).
- Long runs of 0s give no pulses, so timing is lost.
- Pulses are half-width, so the bandwidth is double ($2f_b$ first null), causing more attenuation and crosstalk.

**Bipolar AMI** ('1' = alternate +/− pulses, '0' = 0):
- Good: zero DC, narrow spectrum, simple error detection via bipolar violations.
- Problem: a **long run of 0s** sends no pulses, so the repeater clock drifts and synchronisation is lost. PCM traffic (idle channels, data) often contains such runs, so AMI is not transparent.

| Code | DC free | Timing in 0-runs | Bandwidth | Error check |
|---|---|---|---|---|
| NRZ | No | No | $f_b$ | No |
| RZ | No | No | $2f_b$ | No |
| AMI | Yes | No | $f_b$ | Yes |

#### Coding techniques that solve the problem
The solution is **zero-substitution bipolar codes**: AMI with long strings of zeros replaced by special patterns that contain deliberate **bipolar violations (V)**. The receiver recognises a violation, knows it is a substitution and replaces the pattern by zeros. This keeps zero DC and error monitoring while guaranteeing pulses for timing.

**1. HDB3 (High Density Bipolar of order 3)** – used on E1, E2, E3 (ITU-T G.703).
Rule: any string of **four zeros** is replaced by
- **000V** if the number of 1s (pulses) since the last substitution is **odd**;
- **B00V** if it is **even**.

Here V is a pulse of the **same** polarity as the previous pulse (a violation), and B is a normal bipolar pulse (opposite to the previous pulse). This makes successive V pulses alternate, so there is no DC build-up. At most 3 zeros appear in a row.

Example (the first pulse is taken as +):
| Data | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AMI | + | 0 | − | + | 0 | 0 | 0 | 0 | − | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | + |
| HDB3 | + | 0 | − | + | 0 | 0 | 0 | +V | − | 0 | 0 | 0 | −V | +B | 0 | 0 | +V | − |

- After 1 0 1 1 (three 1s, odd) the first 0000 becomes 000V, V = + (same as previous +).
- After that, one 1 (odd) → 000V, with V = − (same as previous −).
- Next 0000 follows with no 1 in between (even, zero) → B00V: B = + (opposite of −), V = + (same as B).
- The V pulses (+, −, +) alternate, so the line stays DC balanced.

**2. B8ZS (Bipolar with 8-Zero Substitution)** – used on T1.
Any string of **eight zeros** is replaced by **000VB0VB**: if the previous pulse is +, the substitute is 000+−0−+; if it is −, it is 000−+0+−. Two violations in fixed positions identify the substitution.
| Data | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AMI | + | − | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | + | 0 | − |
| B8ZS | + | − | 0 | 0 | 0 | −V | +B | 0 | +V | −B | + | 0 | − |

**3. Other codes:** B6ZS and B3ZS (T2, T3), CMI and Manchester (biphase) for some interfaces, 4B3T and 2B1Q for ISDN lines.

#### Result
HDB3/B8ZS give: no DC component, a guaranteed pulse at least every 4 (or 8) bits for clock recovery, bandwidth similar to AMI, in-service error detection (an unexpected violation means an error), and full transparency for 64 kbps clear channels.

## Check yourself

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

1. Why must a PCM line code have no DC component?
   A. Because DC makes the bandwidth double
   B. Because lines are coupled through transformers and capacitors that block DC
   C. Because DC prevents error detection
   D. Because DC causes the sampling rate to change
   Answer: B. Transformers and coupling capacitors block DC, so a DC component causes baseline wander and wrong decisions. (Key point: Why no DC is needed)

2. What is the main weakness of bipolar AMI for PCM lines?
   A. It has a large DC component
   B. It cannot detect errors
   C. A long run of 0s sends no pulses, so repeaters lose timing
   D. It needs twice the bandwidth of NRZ
   Answer: C. AMI is DC-free and detects violations, but 0s are no pulses, so long 0-runs give no clock content. (Key point: Weakness of AMI)

3. In HDB3, a string of four zeros is replaced by 000V or B00V. When is B00V used?
   A. When the number of pulses since the last substitution is even
   B. When the number of pulses since the last substitution is odd
   C. Always when the previous pulse is negative
   D. Only for the first four zeros
   Answer: A. B00V is used when the count of 1s since the last substitution is even, so successive V pulses alternate in polarity. (Key point: Zero-substitution rule of HDB3)

4. Why does the substitution in HDB3/B8ZS use deliberate bipolar violations?
   A. To add DC for repeater power
   B. To double the bit rate
   C. To remove the need for repeaters
   D. So the receiver can recognise the substitution and restore the zeros
   Answer: D. The receiver sees a violation, knows it is a substitution and replaces the pattern by zeros, while pulses guarantee timing. (Key point: Role of bipolar violations)

## Related in Telecommunications

- [Line coding and NRZ, RZ, AMI](https://www.bctengineer.com/question.md?key=semester_8%2Ftelecommunications%3Aline-coding-nrz-rz-ami) — Telecommunications, chapter 3

## Related in other subjects

- [Line coding 1011001010 (polar NRZ, polar RZ, Manchester, AMI)](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aline-codes-1011001010) — Communication Systems, chapter 6, asked 8×
- [Line coding 1001001101 (polar NRZ, polar RZ, Manchester, AMI)](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aline-codes-1001001101) — Communication Systems, chapter 6, asked 8×
- [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 1101010111 (polar NRZ, polar RZ, Manchester, AMI)](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aline-codes-1101010111-polar-ami) — Communication Systems, chapter 6, asked 8×
