Nothing Special   »   [go: up one dir, main page]

Lab 8: Line Coding Techniques: Objective

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Principle of Communication Lab Manual EEE351

Lab 8: Line Coding Techniques


Objective:
The objective of this lab is implementation of line coding techniques using Math script LabVIEW.

Introduction:
A line code is the code used for data transmission of a digital signal over a transmission line.

Types of Line Coding


There are 3 types of Line Coding

1. Unipolar
2. Polar
3. Bi-polar
Unipolar Signaling
Unipolar signaling is also called as On-Off Keying or simply OOK.

The presence of pulse represents a 1 and the absence of pulse represents a 0.

There are two variations in unipolar signaling −

 Non-Return to Zero (NRZ)


 Return to Zero (RZ)
Unipolar Non-Return to Zero (NRZ)
In a unipolar scheme, all the signal levels are on one side of the time axis, either above or below.

Figure 1 Unipolar NRZ

Unipolar Return to Zero (RZ)

Figure 2 Unipolar RZ

1 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)
Principle of Communication Lab Manual EEE351

1. Polar Signaling
There are two methods of Polar Signaling. They are

 Polar NRZ
 Polar RZ
 Biphase (Manchester, and differential Manchester)
Polar NRZ
In polar NRZ encoding, we use two levels of voltage amplitude. We can have two versions of polar NRZ:
NRZ-L and NRZ-I. In the first variation, NRZ-L (NRZ-Level), the level of the voltage determines the
value of the bit. In the second variation, NRZ-I (NRZ-Invert), the change or lack of change in the level of
the voltage determines the value of the bit. If there is no change, the bit is 0; if there is a change, bit is 1.

Figure 3. Polar NRZ

Polar RZ
Return-to-zero (RZ) scheme uses three values: positive, negative, and zero. In RZ, the signal changes not
between bits but during the bit. Here the signal goes to 0 in the middle of each bit. It remains there until
the beginning of the next bit.

Figure 4. Polar RZ

2 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)
Principle of Communication Lab Manual EEE351

 Biphasic (Manchester, and differential Manchester)

The idea of RZ (transition at the middle of the bit) and the idea of NRZ-L are combined into the
Manchester scheme. In Manchester encoding, the duration of the bit is divided into two halves. The
voltage remains at one level during the first half and moves to the other level in the second half.
Differential Manchester, on the other hand, combines the ideas of RZ and NRZ-I. There is always a
transition at the middle of the bit, but the bit values are determined at the beginning of the bit. If the
next bit is 0, there is a transition; if the next bit is 1, there is none.

Figure 5. Biphasic
Programming:
close all;
clear all;
clc;

% Title: Implementation of various Line Coding Schemes


% Unipolar RZ, Polar RZ.
%
% INPUT:
% inbits = input bits row vector
% Tb = Bit time period
% A = Amplitude of the coding

% OUTPUT:
% x = Output line coding row vector
% T = time vector

A = 1;
Tb = 1;
inbits = [1 0 1 0 1 1 0 0 1 0];

3 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)
Principle of Communication Lab Manual EEE351

%---Implementation starts here


Rb = 1/Tb; %---Bit rate
N = length(inbits); %---Bit Length of input bits
tTb = linspace(0,Tb) %---interval of bit time period

% Unipolar NRZ
x=[];
for k = 1:N
x = [x A*inbits(k)*ones(1,length(tTb))];
for bit=1
x = [ 1* 1 * [1 1 1 1 … 1 1]]
x = [1 1 1 1 1 … 1 1]
for bit=0
x = [ 1* 0 * [1 1 1 1 … 1 1]]
x = [0 0 0 0 0 … 0 0]

end

T = linspace(0,N*Tb,length(x)); %---Time vector for n bits


subplot(3,1,1);
plot(T,x);
title('Unipolar NRZ');
axis([0 10 -0.25 1.25]);

% Polar RZ
x2=[];
for k2 = 1:N
c = ones(1,length(tTb)/2);
b = zeros(1,length(tTb)/2);
p = [c b];
x2 = [x2 ((-1)^(inbits(k2)+1))*(A/2)*p];

For bit=1
x2 = [ ((-1)^(1+1)* (0.5) * [1 1 1 … 1 1 0 0 0 … 0 0]]
= [ ((-1)^ 2 * (0.5) * [1 1 1 … 1 1 0 0 0 … 0 0]]
For bit=0
X2 = [ ((-1)^(0+1)* (0.5) * [1 1 1 … 1 1 0 0 0 … 0 0]]
X2 = [ ((-1)^ 1 * (0.5) * [1 1 1 … 1 1 0 0 0 … 0 0]]

end
T2 = linspace(0,N*Tb,length(x2)); %---Time vector for n bits
subplot(3,1,2);
plot(T2,x2);
title('Polar RZ');
axis([0 10 -0.75 0.75]);

4 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)
Principle of Communication Lab Manual EEE351

In-Lab Tasks
Task 1:
Implement Unipolar NRZ, Polar RZ and Polar NRZ-L for bit stream [1 0 1 0 1 1 0 0 1 0]
Procedure:
 Opening of LabVIEW
 Installing of RT math module if using newer version
 Then taking Math script node.
 Putting MATLAB code in math script node.
 Taking output form math script node.
 Connect the output to the waveform graph
 Observing the Unipolar NRZ, Polar RZ and Polar NRZ-L signaling in LabVIEW.

Front Panel:

5 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)
Principle of Communication Lab Manual EEE351

Block Diagram:

6 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)
Principle of Communication Lab Manual EEE351

MATLAB PLOTS:

7 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)
Principle of Communication Lab Manual EEE351

Post-Lab
Task 1:
Implement Polar Biphasic Differential Manchester for bit stream [0 0 1 1 1 1 0 0 1 0]

Procedure:
 Opening of LabVIEW
 Installing of RT math module if using newer version
 Then taking Math script node.
 Putting MATLAB code in math script node.
 Taking output form math script node.
 Connect the output to the waveform graph
 Observing the biphasic Manchester signaling in LabVIEW.

Front Panel:

MATLAB PLOTS:

8 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)
Principle of Communication Lab Manual EEE351

Block Diagram:

Conclusion:
In the end of the lab

 Perform simulations for line coding techniques


 Plotting polar RZ, Unipolar RZ, polar NRZ-L

9 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)
Principle of Communication Lab Manual EEE351

 Plotting Biphasic Manchester coding techniques.

10 CIIT Attock Campus


Muhammad Umair Khan (fa18-bce-010)

You might also like