Line Coding in Digital Communication

November 2, 2011
By Colin Yao

>> What is Line Coding?

In telecommunication, a line code (also called digital baseband modulation, also called digital baseband transmission method) is a code chosen for use within a communications system for baseband transmission purposes. Line coding is often used for digital data transport.

Binary 1’s and 0’s, such as in PCM signaling, may be represented in various serial–bit signaling formats called line codes.


>> Why Line Coding?

There are many reasons for using line coding. Each of the line codes you will be examining offers one or more of the following advantages:

  • Spectrum Shaping and Relocation without modulation or filtering. This is important in telephone line applications, for example, where the transfer characteristic has heavy attenuation below 300 Hz.
  • Bit clock recovery can be simplified.
  • DC component can be eliminated; this allows AC (capacitor or transformer) coupling between stages (as in telephone lines). Can control baseline wander (baseline wander shifts the position of the signal waveform relative to the detector threshold and leads to severe erosion of noise margin).
  • Error detection capabilities.
  • Bandwidth usage; the possibility of transmitting at a higher rate than other schemes over the same bandwidth.

At the very least the LINE-CODE ENCODER serves as an interface between the TTL level signals of the transmitter and those of the analog channel. Likewise, the LINE-CODE DECODER serves as an interface between the analog signals of the channel and the TTL level signals required by the digital receiver.


>> Most Popular Line Codes

Some of the most popular line codes are shown below.



The line codes shown above are also known by other names:

Polar NRZ: Also called NRZ–L where L denotes the normal logic level assignment

Bipolar RZ: Also called RZ–AMI, where AMI denotes alternate mark (binary 1) inversion

Bipolar NRZ: Also called NRZ–M, where M denotes inversion on mark (binary 1)


>> Two Major Categories of Line Coding

There are 2 major categories: return–to–zero (RZ) and nonreturn–to–zero (NRZ). With RZ coding, the waveform returns to a zero–volt level for a portion (usually one–half) of the bit interval.


>> Further Classification

The waveforms for the line code may be further classified according to the rule that is used to assign voltage levels to represent the binary data.

1) Unipolar Signalling:

In positive–logic unipolar signaling, the binary 1 is represented by a high level (+A volts) and a binary 0 by a zero level. This type of signaling is also called on–off keying (OOK).

2) Polar Signaling:

Binary 1’s and 0’s are represented by equal positive and negative levels

3) Bipolar (Pseudoternary) Signaling:

Binary 1’s are represented by alternating positive or negative values. The binary 0 is represented by a zero level. The term pseudoternary refers to the use of 3 encoded signal levels to represent two–level (binary) data. This is also called alternate mark inversion (AMI) signaling.

4) Manchester Signaling:

Each binary 1 is represented by a positive half–bit period pulse followed by a negative half–bit period pulse. Similarly, a binary 0 is represented by a negative half–bit period pulse followed by a positive half–bit period pulse. This type of signaling is also called split–phase encoding.


>> Properties of Line Codes

Each line code has advantages and disadvantages.

For example, the unipolar NRZ line code has the advantage of using circuits that require only one power supply, but it has the disadvantage of requiring channels that are DC coupled (i.e. with frequency response down to f = 0), because the waveform has a non–zero DC value.

The polar NRZ line code does not require a DC coupled channel, provided that the data toggles between binary 1’s and 0’s often and that equal numbers of 1’s and 0’s are sent. However, the circuitry that produces the polar NRZ signal requires a negative voltage power supply as well as the positive voltage power supply.

The Manchester NRZ line code has the advantage of always having a 0 DC value, regardless of the data sequence, but it has twice the bandwidth of the unipolar NRZ or polar NRZ code because the pulses are half the width.


>> Desirable Properties of a Line Code

  • Self–Synchronisation: There is enough timing in formation built into the code so that bit synchronisers can extract the timing or clock signal. A long series of binary 1’s or 0’s should not cause a problem in time recovery.
  • Low Probability of Bit Error: Receivers can be designed that will recover the binary data with a low probability of bit error when the input data is corrupted by noise or ISI.
  • A Spectrum that is Suitable for the Channel: For example, if the channel is AC coupled, the PSD of the line code signal should be negligible at frequencies near 0. In addition, the signal bandwidth needs to be sufficiently small compared to the channel bandwidth, so that ISI will not be a problem.
  • Transmission Bandwidth: This should be as small as possible.
  • Error Detection Capability: It should be possible to implement this feature easily by the addition of channel encoders and decoders, or the feature should be incorporated into the line code.


>> Differential Coding

When serial data is passed through many circuits along a communication channel, the waveform is often unintentionally inverted (i.e. data complemented). This result can occur in a twisted pair transmission line channel just by switching the 2 leads at a connection point when a polar line code is used. (Note: such switching would not affect the data of a bipolar signal)

To eliminate this problem differential encoding is often employed.

Each digit in an differential encoded sequence is obtained by comparing the present input bit with the past encoded bit. A binary 1 is encoded if the present input bit and past encoded bit are of opposite state. A binary 0 is encoded if the states are the same.

Differential coding is often used with Manchester coding. The diagram below shows Manchester coding and differential Manchester coding for a sequence of bits.



>> Line Codes for LAN (Local Area Network)

Manchester, differential Manchester, nB/mB and kBnT codes are commonly used for local area networks. We have already dealt with Manchester and differential Manchester, we now look at nB/mB and kBnT.

nB/mB: Although a code like Manchester introduces systematic transitions in any bit sequence, it is not effective because it requires a signaling rate twice as high as the bit rate (2 pulses per bit). What is often used instead is nB/mB coding. With nB/mB coding schemes, n data bits will be represented by a sequence of m pulses, the efficiency increases from 50 % in Manchester to n/m %.

4B/5B NRZI: This coding scheme is used for Ethernet 100 Mbps and FDDI (fiber distributed data interface) over optical fiber. With 4B/5B, 4 data bits will be represented by a sequence of 5 pulses (efficiency increases from 50 % in Manchester to 80 %), which will be themselves encoded using NRZI (nonreturn–to–zero inverted) coding.

Note: In order to ensure enough transitions in the data most communication systems, using fibre optics, use nonreturn–to–zero inverted (NRZI) coding. In NRZI coding, a 0 is represented as a change of state on the line and a 1 as the absence of a change of state, or vice–versa. This ensures that strings of 0’s or 1’s do not cause problems. The diagram below illustrates NRZI where a zero represents a change of state and a 1 the absence of a change of state.



In 4B/5B coding, as only 16 of the 32 pulse patterns are used to encode 4 bits, 5–pulse codes can be selected in such a way that at least 2 transitions are present in each pulse pattern. The diagram below illustrates 4B/5B NRZI coding. Note that that in the NRZI code used here a 1 represents a change of state and a 0 represents the absence of a change of state.



8B/10B: This coding scheme is used in Gigabit Ethernet. It uses principles similar to 4B/5B. 8 bits are encoded into 10 pulses to provide a good transition density. It is more powerful than 4B/5B in terms of error detection capability and transmission characteristics.

kBnT Codes: This is a class of codes using 3 levels (as in AMI) where a set of k bits is encoded as a succession of n ternary symbols. AMI can be considered as a 1B1T code. This scheme provides greater efficiency than binary coding.

8B6T: This coding scheme is used in 100 Mbps Ethernet. 8B6T sends 8 data bits as 6 ternary (one of 3 voltage levels) signals, hence the carrier needs to be running at 3/4 of the speed of the data rate. The incoming data stream is split into 8 bit patterns. Each 8 bit data pattern is converted into a 6 bit pattern using 3 voltage levels, -V, 0 and V volts, so that each 8 bit pattern has a unique 6T code. The rules for the symbols are that there must be at least 2 voltage transitions (to maintain clock synchronization) and the average DC voltage must be 0 (this is called DC balance).


>> Line Codes for WAN (Wide Area Network)

Bipolar codes have been designed similar to AMI codes, from which they differ only when a long sequence of 0’s occurs. A filling sequence is then inserted instead of the sequence of 0’s. These codes are used in long distance transmissions (e.g. T1 links – 1.544 Mbps (USA) or E1 links – 2.048 Mbps (Europe).

B8ZS (North America – Bipolar with 8 Zero Substitution): This code is the same as bipolar AMI, except that any string of 8 zeros is replaced by a string with 2 code violations (violation of the rule of alternating positive and negative levels).

  • If the octet of zeros occurs and the last preceding voltage pulse was positive, code as 000+-0-+
  • If the octet of zeros occurs and the last preceding pulse was negative, code as 000-+0+-

This causes 2 violations of AMI code, which is unlikely to occur as a result of noise. The receiver detects and interprets this as 8 0’s.

HDB3 (Europe, Japan – High Density Bipolar – 3 Zeros): Any string of 4 zeros is replaced by a string with one code violation (violation of the rule of alternating positive and negative levels). The last element of the filling sequence is a code violation, with the 2 middle elements 0’s. The first element of the filling sequence is either a 0 or a 1 so that the polarity of the code violation is different from the polarity of the last violation.

B8ZS and HDB3 coding are illustrated in the diagram below.