ELEC3506

Physical LayerLecture 220 min

Line Coding — Getting Bits onto the Wire

Five ways to turn a bit string into voltage levels, and the two problems — clock recovery and long runs — that separate them.

By the end of this page you should be able to

  • Describe unipolar, polar NRZ, RZ, Manchester and Differential Manchester
  • Explain what self-clocking means and why a receiver needs transitions
  • Say what goes wrong with a long run of identical bits in each scheme
  • State the bandwidth cost of the biphase schemes and why it is accepted

The idea

You want to send 11111111111111111111 down a wire. The obvious scheme: hold the voltage high for a 1, low for a 0. So you hold it high for twenty bit intervals.

Now put yourself at the other end. You see a high voltage. It stays high for a while. How many 1s was that?

You count using your own clock, and your clock is not quite the sender’s. Over twenty intervals a small difference accumulates, and you read nineteen bits, or twenty-one. Nothing was corrupted — the signal arrived perfectly — and you still got the wrong answer.

Every scheme after the first two exists to solve that problem, and each one solves it by guaranteeing the signal changes often enough for the receiver to keep its clock aligned. The transitions are not carrying information for their own sake. They are carrying the clock.

The five schemes

How it works

What each one does

Unipolar NRZ. One level, everything on the same side of the time axis. The lecture lists two problems: cost and clock synchronisation. Nobody uses it for anything serious.

Polar NRZ. The level is either positive or negative. Better than unipolar, but the lecture names the flaw directly — a problem arises when transmitting a continuous stream of 0s or 1s. That is the drift problem above.

A variant worth knowing is NRZ-I, where a 1 inverts the level and a 0 holds it. Now a long run of 1s produces constant transitions. A long run of 0s still produces nothing, so it is half a fix.

Polar RZ. Three levels — positive, negative, and zero. Binary 1 goes from +ve to 0; binary 0 goes from −ve to 0. Because the signal returns to zero partway through every bit, there is a transition in every bit interval, and the receiver can always find the boundary. The cost, in the lecture’s words: two signal elements to represent one bit, which occupies more bandwidth.

Manchester. The transition at the middle of the bit is used for both synchronisation and bit representation — one mechanism, two jobs. Binary 1 is −ve to +ve; binary 0 is +ve to −ve. This is what 10 Mbps Ethernet uses.

Differential Manchester. The presence or absence of a transition at the beginning of the interval identifies the bit: 1 means no transition, 0 means a transition. The mid-bit transition is always there and is used only for synchronisation.

SchemeLevelsTransition every bit?Long-run problem
Unipolar NRZ1 (plus zero)NoBoth 0s and 1s
Polar NRZ-L2NoBoth 0s and 1s
NRZ-I2Only on 1sLong runs of 0s
Polar RZ3YesNone
Manchester2YesNone
Differential Manchester2YesNone
The third column is the one that matters. Any scheme with a guaranteed transition every bit is self-clocking — the receiver recovers the clock from the data and needs no separate clock line.

The two Manchesters

These are the pair most often confused, and the difference is one sentence.

Manchester — the mid-bit transition carries the data and the clock.

Differential Manchester — the mid-bit transition carries only the clock; the data is in whether there is also a transition at the boundary.

Aside

Differential Manchester’s arrangement buys something real: because the bit is carried by change rather than by level, swapping the two wires makes no difference. The signal inverts, every transition is still a transition, and the data comes through unharmed. A polarity-sensitive scheme would decode every bit backwards.

Try it

Line-code plotter

Try it
Schemes to plot

NRZ-L polarity is genuinely unfixed across the field — Stallings, Forouzan and RS-232 all pick different mappings — so this plot’s 0 = high, 1 = low (Forouzan’s choice) is one convention among several, not a settled fact; any exam answer only needs to be internally consistent about which way it goes. Manchester is the opposite case: the lecture’s 1 = low-to-high mapping matches IEEE 802.3, Stallings and Forouzan — it is only the original 1949 Thomas/Tanenbaum convention that runs the other way.

Type 11111111 and compare NRZ-L against Manchester. NRZ-L is a flat line — count the bits from that if you can. Manchester ticks every interval.

Then type 10101010 and notice NRZ-L is fine here. The problem was never the encoding in general; it was specifically the absence of transitions.

Where marks get lost

Polarity conventions are not universal

The scheme definitions are fixed. Which voltage means 1 is often not.

For NRZ-L there is genuinely no standard. Lecture 2 says only that the level is “either positive or negative” and declines to commit. Stallings and Forouzan use opposite mappings from each other, and RS-232 uses yet another (binary 1 is negative). This page follows Forouzan — 0 high, 1 low — and that is a choice, not a fact.

For RZ the lecture gives 1 = +ve→0 and 0 = −ve→0, then writes “or vice versa”. It is telling you the polarity is not the point.

Manchester is the exception. The lecture commits — 1 = −ve→+ve — and that matches IEEE 802.3, Stallings and Forouzan. The outlier is G. E. Thomas’s original 1949 convention, which Tanenbaum follows and which inverts both. The confusion is well enough known to have its own paper: R. Forster, Manchester encoding: opposing definitions resolved (2000).

What this means for your answer. Polarity is a label, not a technical constraint — both mappings carry identical information. Encode the two bit values consistently and oppositely, state your convention, and the answer is correct. If your diagram is internally consistent you should not lose marks for choosing the other polarity.

What the transitions cost

RZ and both Manchesters put two signal elements in every bit interval. From the previous topic: signal rate is what determines bandwidth. Double the signal rate, double the bandwidth.

So 10 Mbps Ethernet using Manchester needs roughly 20 MHz of bandwidth to carry 10 Mbps of data. Half the spectrum is spent on the clock.

That was an acceptable trade at 10 Mbps. It stopped being acceptable at higher rates, which is why faster Ethernet abandoned Manchester for block codes like 4B/5B and 64B/66B — schemes that guarantee enough transitions without spending half the bandwidth to do it.

Check yourself

Without looking: which two schemes have a transition in the middle of every bit, and what is the difference between them?

Both Manchesters. In plain Manchester that transition is the data. In Differential Manchester it is only the clock, and the data is at the boundary.

In the exam

  • Describe each scheme in one or two lines. Levels used, where the transitions are, what it fixes. The comparison table above is the compressed form.
  • The long-run problem. Say why it matters — the receiver loses clock synchronisation and miscounts — not just that it is “bad”.
  • Manchester vs Differential Manchester. The single most likely question here. Mid-bit transition does data-and-clock, versus clock-only with data at the boundary.
  • 10 Mbps Ethernet uses Manchester. One mark, frequently asked.
  • The bandwidth cost of biphase. Two signal elements per bit, so double the signal rate, so double the bandwidth. Link it back to the capacity topic.
  • Draw the waveform. Given a short bit string, draw it in a named scheme. Label your polarity convention and stay consistent.

Check yourself

  1. What is the fundamental problem with a long run of identical bits in polar NRZ?
  2. In Manchester encoding, what does the mid-bit transition do?
  3. In Differential Manchester, how is a binary 1 represented?
  4. Which encoding does 10 Mbps Ethernet use?
  5. Why does polar RZ need three levels rather than two?