You are on page 1of 38

Faculty of ENGINEERING

CHULALONGKORN University

Lecture 1:

Line Codes
(based on communication systems by Simon Haykin & Michael Moher)
2182370 Introduction to Digital Communications

August 12, 2021


Line Coding for Digital Communication

How do we transmit bits over a wire, RF, fiber?


Line coding is the process of converting digital data to
digital signals.
The common types of line encoding are unipolar, polar,
bipolar and Manchester encoding.

2
Line Code Examples
1 0 1 1 0 0 0 1

A
Unipolar NRZ 0
A
Unipolar RZ 0
A
Polar NRZ 0
-A
A
Polar RZ 0
-A
Bipolar NRZ A
0
(AMI-NRZ) -A

Bipolar RZ A
0
(AMI-RZ) -A

Manchester A
0
(Split-phase) -A 3
Line Coding Requirements

Small transmission bandwidth


Power efficiency: as small as possible for required data
rate and error probability
Error detection/correction
Suitable power spectral density, e.g., little low frequency
content
Timing information: clock must be extracted from data
Transparency: all possible binary sequences can be
transmitted

4
Source: https://web.stanford.edu/class/ee179/lectures/notes14.pdf
Line Codes

The line codes often used the terminology nonreturn-to-


zero (NRZ) or return-to-zero (RZ)
Return-to-zero implies that the pulse shape used to
represent the bit always returns to the 0 volt or the
neutral level before the end of the bit.
Nonreturn-to-zero indicates that the pulse does not
necessarily return to the neutral level before the end of
the bit.

5
Unipolar
Unipolar Nonreturn-to-Zero (NRZ)
▪ Symbol 1 is represented by transmitting a pulse of
amplitude A for the duration of the symbol, and
symbol 0 is represented by switching off the pulse.

Unipolar Return-to-Zero (RZ)


▪ Symbol 1 is represented by a rectangular pulse of
amplitude A and half-symbol width, and symbol 0
is represented by transmitting no pulse

6
Unipolar & Polar

1 0 1 1 0 0 0 1

A
Unipolar NRZ 0

A
Unipolar RZ 0

A
Polar NRZ 0
-A
A
Polar RZ 0
-A

7
Polar

Polar
▪ Symbols 1 and 0 are represented by transmitting
pulses of amplitude +A and –A respectively.
▪ For RZ, each pulse lasts only half-symbol width.
▪ Relatively easy to generate and more power-efficient
than its unipolar counterpart.

8
Bipolar

Bipolar
▪ Use three amplitude levels 0, - A, A.
▪ -A and A are used alternatively for symbol
1, while no pulse is used for symbol 0.
▪ For RZ, each pulse lasts only half-symbol
width.
▪ Also known as Alternate Mark Inversion
(AMI)

9
Bipolar and Split-Phase (Manchester)

1 0 1 1 0 0 0 1

Bipolar NRZ A
0
(AMI-NRZ) -A

Bipolar RZ A
0
(AMI-RZ) -A

Manchester A
0
(Split-phase) -A

10
Split-Phase (Manchester Code)

Split-Phase (Manchester Code)


▪ Symbol 1 is represented by a positive pulse of
amplitude A followed by a negative pulse of
amplitude –A, with both pulse being a half-
symbol wide. For symbol 0, the polarities of
these two pulses are reversed.
▪ The Manchester code suppresses the DC
component and has relatively insignificant
low-frequency components, regardless of the
signal statistics. This property is essential in
some applications.
11
Power Spectra of Line Codes

All line code signals may be described as different


realizations of a random process

X (t ) =  a g (t − nT )
n =−
n b

where the coefficient an is a discrete random variable,


g(t) is a basic pulse shape, and Tb is the bit duration.

12
Power Spectra of Line Codes

The power spectral density of the signal X(t) is given by


2 1
S x ( f ) = | G( f ) |
Tb
R
m =−
A (m) exp(− j 2 mfTb ) (9.7)

Where RA (m) = E  an an − m  is the ensemble-averaged


autocorrelation function.

13
Power Spectra of Line Codes

Unipolar Bipolar

 A, binary 1  A, − A alternate binary 1


an =  an = 
0, binary 0 0, binary 0

Polar Manchester

 A, binary 1  A, binary 1
an =  an = 
 − A, binary 0  − A, binary 0

14
Power Spectra of Line Codes

The basic pulse shape g(t) of each line code is as follows:

Unipolar Bipolar

 t   t 
g (t ) =    g (t ) =   
 Tb   Tb 

Polar Manchester

 t   t + Tb / 4   t − Tb / 4 
g (t ) =    g (t ) =    −  
 Tb   b T / 2   b T / 2 

15
Unipolar NRZ

Suppose the 0s and 1s of a random binary sequence occur


with equal probability. For Unipolar NRZ,
1
P(an = 0) = P(an = A) =
2
▪ For m=0,
2
A
RA (0) = E  a n2  = (0) 2 P( an = 0) + ( A) 2 P( an = A) =
2

▪ For m≠0,
1 1 1 1 A2
RA ( m ) = E  an an −m  = (0)(0) + (0)( A) + ( A)(0) + ( A)( A) =
4 4 4 4 4

16
Unipolar NRZ

 t 
A 2
❖ Since g (t ) =   
 2 , m = 0  Tb 
RA ( m) =  2
A , m0 ❖ Then G( f ) = Tbsinc( fTb )
 4

Using Eq. (9.7),



2 1
S x ( f ) = | G( f ) |
Tb
R
m =−
A (m) exp(− j 2 mfTb )
we obtain

A2Tb A 2
Tb
Sx ( f ) = sinc ( fTb ) +
2
sinc ( fTb )  exp(− j 2 mfTb )
2

4 4 m =−
17
Unipolar NRZ

We use Poisson’s formula written in the form



1 
 n

m =−
exp( − j 2 mfTb ) =
Tb
  f − 
n = −  Tb 
to obtain
A2Tb A2Tb 1 
 n
Sx ( f ) =
4
sinc ( fTb ) +
2

4
2
sinc ( fTb )
Tb
  f − 
n =−  Tb 
and recognize that the since function sinc(fTb) has nulls
at f = 1/ Tb , 2 / Tb , , we may simplify the expression
as

A2Tb A2
Sx ( f ) = sinc 2 ( fTb ) + ( f )
4 4
18
Unipolar NRZ
Waste of power due to the transmitted DC level.
Long symbols of 0’s can cause loss of
synchronization.
1 0 1 0 0 0 0 1
A
0

Many codes limit the number of consecutive runs


of 1’s or 0’s, and force bit changes after a given
number of bits.
For example, we may forbid 6 0’s in a row, and
adds an extra one bit after 5 0’s.
19
Source: https://web.stanford.edu/class/ee179/lectures/notes14.pdf
Polar NRZ

1
For Polar NRZ, P(an = − A) = P (an = A) =
2

For m=0,

RA (0) = E  an2  = ( − A) 2 P(an = − A) + ( A) 2 P( an = A) = A2

For m≠0,

1 1 1 1
RA (m) = E  an an −m  = ( − A)( − A) + ( − A)( A) + ( A)( − A) + ( A)( A) = 0
4 4 4 4

20
Polar NRZ

 t 
❖ Since g (t ) =   
 A2 , m = 0  Tb 
RA ( m ) = 
0, m0
❖ Then G( f ) = Tbsinc( fTb )

Using Eq. (9.7),



2 1
S x ( f ) = | G( f ) |
Tb
R
m =−
A (m) exp(− j 2 mfTb )
we obtain

S x ( f ) = A2Tbsinc 2 ( fTb )

21
Polar NRZ
Long symbols of 1’s or 0’s can cause loss of
synchronization, see example below.
1 0 1 0 0 0 0 1

A
0
-A

Many codes limit the number of consecutive runs


of 1’s or 0’s, and force bit changes after a given
number of bits.
For example, we may forbid 6 1’s in a row, and
adds an extra one bit after 5 1’s.
22
Source: https://web.stanford.edu/class/ee179/lectures/notes14.pdf
Bipolar NRZ

For Bipolar NRZ


1 1 1
P ( an = − A) = P ( an = A) = P(an = 0) =
For m=0, 4 4 2
2
A
RA (0) = E  an2  = ( − A) 2 P( an = − A) + ( A) 2 P( an = A) + (0) 2 P (an = 0) =
2
For m=1,
RA ( 1) = E  an an −1  = (0)(0) P (an −1 = 0, an = 0)
+ (0)( − A) P ( an −1 = 0, an = − A) + (0)( A) P ( an −1 = 0, an = A)
+ ( − A)(0) P ( an −1 = − A, an = 0) + ( A)(0) P (an −1 = A, an = 0)
+ ( − A)( − A) P ( an −1 = − A, an = − A) + ( A)( A) P ( an −1 = A, an = A)
+ ( − A)( A) P ( an −1 = − A, an = A) + ( A)( − A) P (an −1 = A, an = − A)
1 1 1 1 1
= (0) 2 + (0)(− A) + (0)( A) + ( − A)(0) + ( A)(0)
4 8 8 8 8
1 1 A2
+ (− A)(− A)(0) + ( A)( A)(0) + ( − A)( A) + ( A)( − A) = − 23
8 8 4
Bipolar NRZ

For other values of m,


P( an −m = − A, an = A) = 1/16
P( an −m = A, an = − A) = 1/16
P( an −m = A, an = A) = 1/16
P( an −m = − A, an = − A) = 1/16

Hence in this case RA (m) = 0

 A2 / 2, m=0

RA ( m ) =  − A2 / 4, m = 1
0, otherwise

Bipolar NRZ

 t 
 A2 / 2, m=0 ❖ Since g (t ) =   

RA ( m ) =  − A2 / 4, m = 1
 Tb 
0,
 otherwise ❖ Then G( f ) = Tbsinc( fTb )

Using Eq. (9.7), 


2 1
S x ( f ) = | G( f ) |
Tb
R
m =−
A (m) exp(− j 2 mfTb )
we obtain
 A2
A2

S x ( f ) = Tbsinc 2 ( fTb )  − [exp( j 2 fTb ) + exp( − j 2 fTb )] 
 2 4 
= A2Tbsinc2 ( fTb )sin 2 ( fTb )
A2Tb
= sinc 2 ( fTb )[1 − cos(2 fTb )] 25
2
Bipolar NRZ

Bipolar NRZ or AMI was used in early PCM systems.


The PSD has a null at DC, which aids in transformer
coupling.
Eliminates DC build up on cable.
Provides error detecting; every bit error results in
bipolar violation.
Guarantees transitions for timing recovery with long
runs of ones.
Long symbols of 0’s can cause loss of synchronization.
1 0 1 0 0 0 0 1

Bipolar NRZ A
0
(AMI-NRZ) -A

Source: https://web.stanford.edu/class/ee179/lectures/notes14.pdf
Manchester
 t + Tb / 4   t − Tb / 4 
For Manchester g ( t ) =    −   
 b T / 2   b T / 2 
and T T
G ( f ) = b sinc( fTb / 2)exp( j fTb / 2) − b sinc( fTb / 2)exp( − j fTb / 2)
2 2
= jTbsinc( fTb / 2)sin( fTb / 2)

 A2 , m = 0
RA ( m ) = 
0, m0
Using Eq. (9.7),

2 1
S x ( f ) = | G( f ) |
Tb
R
m =−
A (m) exp(− j 2 mfTb )
we obtain

S x ( f ) = A2Tbsinc 2 ( fTb / 2)sin 2 ( fTb / 2)


27
Manchester

Very easy to get the timing signal from the coding


waveform.
First introduced with the development of magnetic disk
drives in the late 1940’s and early 1950’s.
Read heads were only sensitive to transitions in
magnetization, so this approach guaranteed at least one
transition per bit.
Widely used in wired ethernet.
Also common in RF, particularly in low power near field
RF (NFRF) devices.

Source: https://web.stanford.edu/class/ee179/lectures/notes14.pdf
Power Spectra of different line codes

Tb Tb

Unipolar NRZ Polar NRZ


0.5Tb 0.5Tb

f f
0 1 2 0 1 2
Tb Tb Tb Tb

Tb Tb

Bipolar NRZ Manchester


0.5Tb 0.5Tb

f f
0 1 2 0 1 2
Tb Tb Tb Tb

29
RZ Line Codes

 t 
For RZ line codes, g (t ) =   
 Tb / 2 

A2Tb  1 
 n 
Unipolar RZ Sx ( f ) = sinc ( fTb / 2) 1 +
2
   f − 
16  Tb n =−  Tb  

Polar RZ A2Tb
Sx ( f ) = sinc 2 ( fTb / 2)
4

Bipolar RZ A2Tb
Sx ( f ) = sinc 2 ( fTb / 2)sin 2 ( fTb ) 30
4
Power Spectra of RZ Line Codes
Tb Tb

0.25 Unipolar RZ Bipolar RZ


0.5Tb 0.5Tb

0.1
f f
0 1 2 0 1 2
Tb Tb Tb Tb
Tb

Polar RZ
0.5Tb

f
0 1 2
Tb Tb

Disadvantage of RZ Line Codes


Occupies twice the bandwidth of their NRZ
counterparts.
31
Advantages of RZ Line Codes
Unipolar Return-to-Zero (RZ)
An attractive feature of this code T b

is the presence of delta function at 0.25 Unipolar RZ


f = 0, 1/Tb in the power 0.5T b

spectrum of the transmitted 0.1

signal, which can be used for bit- 0 1 2


f

timing recovery at the receiver


Tb Tb

Polar Return-to-Zero (RZ)


We can easily Polar RZ
A
0
extract the timing X (t ) -A
information from
the signal by taking X (t ) A
0
the absolute value. -A

32
Source: https://web.stanford.edu/class/ee179/lectures/notes14.pdf
Quiz #1

A channel of bandwidth 4 kHz is available. Determine


the data rate that can be accommodated for the following
line codes (assume a bandwidth to the first spectral null)
A) Unipolar NRZ
B) Manchester
C) Unipolar RZ and Polar RZ
D) Bipolar RZ

33
Quiz #2

Consider line code below that uses 4 levels of amplitudes,


to represent 00, 01, 10 and 11, find the ensemble-
averaged autocorrelation function R ( m ) = E a a
A  n n −m 
00 01 10 11 01 11 00 10
0, 00
 A,
 01
Line Code
3A
2A
an = 
1 A  2 A, 10
0 3 A, 11

1
P(an = 0) = P(an = A) = P(an = 2 A) = P(an = 3 A) =
4 34
Quiz #2

Sol. RA (0) = E  a n2  = (0) 2 P (an = 0) + ( A) 2 P(an = A)


+ (2 A)2 P (an = 2 A) + (3 A) 2 P (an = 3 A)
1 2 1 2 1 2 1
=(0) + ( A ) + (4 A ) + (9 A ) = 3.5 A2
4 4 4 4
1 1 1 1
RA (m) = E  an an − m  = (0)(0) + (0)( A) + (0)(2 A) + (0)(3 A)
16 16 16 16
1 1 1 1
+ ( A)(0) + ( A)( A) + ( A)(2 A) + ( A)(3 A)
16 16 16 16
1 1 1 1
+ (2 A)(0) + (2 A)( A) + (2 A)(2 A) + (2 A)(3 A)
16 16 16 16
1 1 1 1
+ (3 A)(0) + (3 A)( A) + (3 A)(2 A) + (3 A)(3 A)
16 16 16 16
= 2.25 A2 35
Quiz #2

Sol. 
1
Sx ( f ) = | G( f ) | 2

Tb
R
m =−
A ( m) exp( − j 2 mfTb )


1
=| Tb sinc( fTb ) | 2

Tb
R
m =−
A ( m) exp( − j 2 mfTb )

 

= Tb sinc ( fTb )  RA (0) exp( − j 2 mfTb ) +  RA (m) exp( − j 2 mfTb ) 
2

 m =− , m  0 
 

= Tb sinc ( fTb ) 3.5 A +  2.25 A exp( − j 2 mfTb ) 
2 2 2

 m =− , m  0 
 

= Tb sinc ( fTb ) 1.25 A +  2.25 A2 exp( − j 2 mfTb ) 
2 2

 m =− 
1 
 n
= 1.25 A Tb sinc ( fTb ) + 2.25 A Tb sinc ( fTb )
2 2 2 2
 f − 
Tb n =−  Tb 
= 1.25 A2Tb sinc 2 ( fTb ) + 2.25 A2 ( f )
36
Quiz #2

5 A2Tb 9 A 2
Sx ( f ) = sinc 2 ( fTb ) + ( f )
4 4

Compared to Unipolar
A2Tb A2
Sx ( f ) = sinc 2 ( fTb ) + ( f )
4 4

37
References
❖ สุวิทย์ นาคพีระยุทธ และคณะ หลักการไฟฟ้าสื่อสาร พิมพ์ครั้งที่ 3 สำนักพิมพ์แห่ง
จุฬำลงกรณ์มหำวิทยำลัย 2558
❖ Simon Haykin. Communication Systems. 3rd Edition. John Wiley & Sons, Inc. 1994.
❖ Simon Haykin. Communication Systems. 4th Edition. John Wiley & Sons, Inc. 2001.
❖ Simon Haykin. An Introduction to Analog and Digital Communications. John Wiley & Sons,
Inc. 1989.
❖ Wayne Tomasi. Electronic Communications Systems. Prentice-Hall International, Inc., 1998.
❖ William Turin. Digital Transmission Systems : Performance Analysis and Modeling. 2nd
Edition. McGraw-Hill Companies, Inc. 1999.
❖ R. E. Ziemer and W. H. Tranter. Principles of Communications : Systems, Modulation, and
Noise. 4th Edition. John Wiley & Sons, Inc. 1995.
❖ Rodger E. Ziemer and Roger L. Peterson. Introduction to Digital Communications. 2nd
Edition. Prentice Hall, Inc. 2001.
❖ Rodger E. Ziemer and William H. Tranter. Principles of Communications : Systems
Modulation and Noise. John Wiley & Sons, Inc. 2002.

You might also like