Skip to content
Tutorials Center
My learning

Topics

Lesson 19 of 46 ยท Sampling and Digital Transmission

Line codes and pulse shaping

Compare NRZ, RZ, Manchester and AMI line codes by DC content, bandwidth and timing, then learn Nyquist's ISI criterion and the raised-cosine pulse.

PCM produces a stream of bits. A wire, however, carries voltages, so we must decide which voltage stands for a 1 and which for a 0. That rule is the line code, and its choice affects bandwidth, whether the receiver can recover a clock, whether a transformer will pass the signal and whether single errors can be detected. A second choice, the pulse shape, decides whether neighbouring pulses blur into one another (intersymbol interference). This lesson covers both.

Five stacked waveforms for the bits 1 0 1 1 0 0 1 0 in unipolar NRZ, polar NRZ, RZ, Manchester and AMI
The same bits, five different waveforms.

What you will learn

  • The common line codes and the trade-offs between them.
  • How to judge a code by DC content, bandwidth, timing information and error detection.
  • What intersymbol interference (ISI) is and how Nyquist's criterion avoids it.
  • The raised-cosine pulse and the bandwidth (1 + ฮฑ) Rs / 2.

Key terms

  • Symbol rate Rs: symbols per second (equal to the bit rate for binary signaling).
  • NRZ (non-return-to-zero): the level stays for the whole bit.
  • RZ (return-to-zero): the pulse returns to zero within the bit.
  • ISI: intersymbol interference, the tail of one pulse corrupting its neighbours.
  • Eye diagram: many bit-length segments of the received waveform overlaid on one plot.

Common line codes

Code Rule Strengths Weaknesses
Unipolar NRZ 1 = +A, 0 = 0 Simplest DC component, no timing in long runs
Polar NRZ 1 = +A, 0 = โˆ’A Zero mean for random data, best noise margin per power Long runs of equal bits lose timing
Unipolar RZ 1 = pulse for half the bit, 0 = zero Timing information in each 1 Twice the bandwidth of NRZ
Manchester Each bit has a mid-bit transition: direction encodes the bit No DC, a transition in every bit gives a clock Twice the bandwidth of NRZ
AMI (bipolar) 0 = 0, 1s alternate +A and โˆ’A No DC, single errors detectable (violation of alternation) Long runs of zeros lose timing

Conventions for Manchester differ: the IEEE 802.3 and G. E. Thomas conventions are opposites. Telephone trunks fix AMI's long-zero problem with substitution schemes such as B8ZS (North America) and HDB3 (Europe). Ethernet 10BASE-T used Manchester; later versions use block codes with better efficiency.

What to look for in a code:

  1. No DC (the lines pass through transformers and AC-coupled amplifiers).
  2. Timing: frequent transitions let the receiver recover the bit clock.
  3. Bandwidth: fewer transitions per bit, narrower spectrum.
  4. Error detection: some codes forbid certain patterns.
  5. Noise immunity per transmitted power (polar beats unipolar by 3 dB).

Bandwidth of the pulses

For rectangular pulses, the power spectrum has a sincยฒ shape. For polar NRZ the first null is at f = Rb; for Manchester the mid-bit transitions double it to 2 Rb. Rectangular pulses have infinite spectra with slowly decaying side lobes, which interfere with neighbouring channels. Practical systems therefore shape the pulses to confine the spectrum.

Intersymbol interference and Nyquist's criterion

A band-limited channel spreads every pulse in time. At the instant the receiver samples one pulse, the tails of its neighbours may add to it. This is ISI. Nyquist (1928) found the conditions under which a pulse p(t) causes no ISI at the sampling instants t = k T (with T = 1/Rs):

p(0) = 1 and p(k T) = 0 for every other integer k.

The simplest such pulse is the sinc, p(t) = sinc(t / T), with an ideal rectangular spectrum of width Rs/2: the minimum possible bandwidth B = Rs / 2, so the maximum symbol rate is Rs = 2B (Nyquist rate). The sinc is not practical: it extends forever and decays as 1/t, so any timing error causes large ISI.

The raised-cosine family trades a little extra bandwidth for tails that decay quickly. The roll-off factor ฮฑ (0 to 1) sets the excess bandwidth:

B = (1 + ฮฑ) ยท Rs / 2.

With ฮฑ = 0 it is the ideal sinc; with ฮฑ = 1 the bandwidth is Rs. The pulse is

p(t) = sinc(t/T) ยท cos(ฯ€ ฮฑ t / T) / (1 โˆ’ (2 ฮฑ t / T)ยฒ),

and it still satisfies p(kT) = 0 for all k โ‰  0. In practice the shaping is split between a transmit and a receive filter, each a root-raised-cosine, so the cascade is raised-cosine.

Worked example: 1 Mb/s binary with ฮฑ = 0.5 needs B = 1.5 ร— 1 MHz / 2 = 750 kHz. Using four levels (2 bits per symbol) halves the symbol rate to 500 ksym/s, so B = 375 kHz. More levels save bandwidth but need more SNR (chapter 6).

The eye diagram

Overlay many two-symbol-long segments of the received waveform. In a good system the traces pass through a wide-open "eye" at the sampling instant. ISI closes the eye vertically; noise blurs the traces; timing jitter closes it horizontally. Engineers read margin directly from the eye opening.

Common misconceptions

"Manchester is better than NRZ." It has a clock and no DC, but needs twice the bandwidth. Better for short copper links, worse for scarce spectrum.

"Zero ISI means no error." Noise can still cause errors; Nyquist pulses only remove the interference between symbols at the sampling instants.

"Roll-off ฮฑ = 0 is the best choice." It gives minimum bandwidth but extreme sensitivity to timing errors; most systems use ฮฑ between 0.2 and 0.5.

Try it

The first example estimates the power spectra of three line codes from random bits, with eight samples per bit. Compare the first null of NRZ with the wider Manchester spectrum, and notice the DC component of unipolar NRZ.

Python Spectra of line codes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The second example builds the raised-cosine pulse, checks that it is zero at every other sampling instant, and draws an eye diagram for two roll-off factors.

Python Raised cosine and the eye

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Which line code has a transition in the middle of every bit?

    Manchester encodes each bit as a mid-bit transition, which also supplies timing.
  2. 2. A minimum-bandwidth (sinc) system for a symbol rate of 8 Msym/s needs a bandwidth of

    B = Rs / 2 = 4 MHz.
  3. 3. A raised-cosine pulse with roll-off 0.25 and symbol rate 4 Msym/s needs bandwidth

    B = (1 + 0.25) ร— 4 MHz / 2 = 2.5 MHz.
  4. 4. What does Nyquist's first criterion require of a pulse?

    p(0) = 1 and p(kT) = 0 for k โ‰  0, so neighbours add nothing at the sampling instants.
  5. 5. Which code lets a receiver detect some single-bit errors by noticing a broken alternation?

    In AMI successive 1s alternate in polarity; two same-polarity 1s signal a violation.

Summary

  • Line codes map bits to voltages; judge them by DC content, timing, bandwidth, error detection and noise margin.
  • Manchester and RZ cost twice the bandwidth of NRZ; AMI removes DC and detects errors.
  • Nyquist: no ISI if p(0) = 1 and p(kT) = 0; minimum bandwidth Rs/2.
  • Raised cosine: B = (1 + ฮฑ) Rs / 2; the eye diagram shows ISI at a glance.

Next: Chapter 4 review