0% found this document useful (0 votes)
10 views9 pages

LineCoding

line coding exp

Uploaded by

Aryan Pund
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views9 pages

LineCoding

line coding exp

Uploaded by

Aryan Pund
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Group number: - 7

Date: - 6/11/2024

EXPERIMENT NO: - 10

Line Coding Techniques

• AIM: To study and generate different line codes (Unipolar, Polar, Bipolar RZ and
NRZ, AMI)

• COMPONENTS:
1. Digital Storage Oscilloscope (DSO).
2. Scientech 2801 Kit.
3. Connecting cords and probes.
4. Power Supply.

• THEORY:
Line coding refers to a process of converting digital data into digital signals. Whenever
we transmit data, it is in the form of digital signals, so with the help of line coding, we
can convert a sequence to bits (or encoding) into a digital signal which then again
converted into bits by the receiver (or can be said as decoded by the receiver).
• Properties of Line coding:

1. As the coding is done to make more bits transmit on a single signal, the bandwidth
used is much reduced.
2. For a given bandwidth, the power is efficiently used.
3. The probability of error is much reduced.
4. Error detection is done and the bipolar too has a correction capability.
5. Power density is very favourable.
6. The timing content is adequate.
7. Long strings of 1s and 0s are avoided to maintain transparency.

• Types of line coding:


1. Unipolar
2. Polar
3. Bipolar

• Applications:
1. Telecommunications:
NRZ (Non-Return to Zero): Commonly used in Ethernet and USB communications
due to its simplicity and efficiency.
RZ (Return to Zero): Used in older telecommunication systems and optical fiber
communications for its synchronization capabilities.
2. Local Area Networks (LANs):
4B/5B Encoding: Employed in Fast Ethernet (100BASE-TX) to ensure sufficient
transitions for clock recovery.
8B/10B Encoding: Used in Gigabit Ethernet and high-speed serial communication
links like USB 3.0 and PCI Express for error detection and correction.
3. Wireless Communication:
Differential Manchester Encoding: Applied in wireless communication systems,
particularly in RFID and Bluetooth, for its robustness to signal inversion and noise
resilience.
4. Optical Fiber Communication:
NRZ: Widely used in optical fiber communication systems for its simplicity.
RZ and NRZI (Non-Return to Zero Inverted): Utilized in high-speed optical
networks to reduce error rates and enhance signal integrity.

• Disadvantages:

1. Bandwidth Usage: Increased Bandwidth: Some line coding schemes, such as


Manchester encoding, require higher bandwidth compared to the original data
signal because they effectively double the frequency of the signal.
2. Power Consumption: Higher Power Requirements: Certain line coding schemes,
due to their increased transitions, can lead to higher power consumption, which is
a critical consideration in battery-operated devices.
3. Error Propagation: In some coding schemes, an error in one symbol can propagate
and cause multiple errors, making error detection and correction more challenging.
• Observations:
Input = 16 bit data [ 0 1 0 0 1 1 0 1 1 0 1 1 0 0 1 0 ].
Carrier frequency = 500 Hz.
Line Coding Circuit Connection DSO Output
Techniques
Channel 1: Data
Signal
Channel 2:
Unipolar NRZ

Channel 1: Data
Signal
Channel 2: Polar
NRZ

Channel 1: Data
Signal
Channel 2:
Bipolar RZ

Channel 1: Data
Signal
Channel 2:
Unipolar RZ

Channel 1: Data
Signal
Channel 2:
Manchester
• CODE:

data = [1 0 1 1 0 0 1];
bit_rate = 1;
T = length(data) / bit_rate;
t = 0:0.01:T;
% Initialize the square wave signal
signal = zeros(1, length(t));
% Generate the square wave based on the binary data
for i = 1:length(data)
if data(i) == 1
signal((i-1)/bit_rate*100+1 : i/bit_rate*100) = 1; % High level for '1'
else
signal((i-1)/bit_rate*100+1 : i/bit_rate*100) = 0; % Low level for '0'
end
end
% Plot square wave data signal
figure;
plot(t, signal, 'LineWidth', 2);
ylim([-0.5 1.5]); % Set y-axis limits to clearly show 0 and 1 levels
xlabel('Time (s)');
ylabel('Amplitude');
title('Binary Data as Square Wave');
grid on;
% Initialize signal
signal = zeros(1, length(t));
for i = 1:length(data)
if data(i) == 1
signal((i-1)/bit_rate*100+1 : i/bit_rate*100) = 1;
end
end
% Plot Unipolar NRZ
figure;
plot(t, signal, 'LineWidth', 2);
ylim([-0.5 1.5]);
xlabel('Time');
ylabel('Amplitude');
title('Unipolar NRZ Line Coding');
grid on;
% Initialize signal
signal = zeros(1, length(t));
for i = 1:length(data)
if data(i) == 1
signal((i-1)/bit_rate*100+1 : i/bit_rate*100) = 1;
else
signal((i-1)/bit_rate*100+1 : i/bit_rate*100) = -1;
end
end
% Plot Polar NRZ
figure;
plot(t, signal, 'LineWidth', 2);
ylim([-1.5 1.5]);
xlabel('Time');
ylabel('Amplitude');
title('Polar NRZ Line Coding');
grid on;
% Initialize signal
signal = zeros(1, length(t));
last_voltage = -1; % Track last '1' voltage for alternating

for i = 1:length(data)
if data(i) == 1
% Alternate the voltage for each '1'
last_voltage = -last_voltage;
% First half of the bit period
signal((i-1)/bit_rate*100+1 : (i-0.5)/bit_rate*100) = last_voltage;
% Second half remains zero
end
end
% Plot RZ Bipolar
figure;
plot(t, signal, 'LineWidth', 2);
ylim([-1.5 1.5]);
xlabel('Time');
ylabel('Amplitude');
title('RZ Bipolar Line Coding');
grid on;

% Initialize signal
signal = zeros(1, length(t));
for i = 1:length(data)
if data(i) == 1
% First half of the bit period is high for '1'
signal((i-1)/bit_rate*100+1 : (i-0.5)/bit_rate*100) = 1;
% Second half remains zero (no need to explicitly set it as zero)
end
end
% Plot RZ Unipolar
figure;
plot(t, signal, 'LineWidth', 2);
ylim([-0.5 1.5]);
xlabel('Time');
ylabel('Amplitude');
title('RZ Unipolar Line Coding');
grid on;

% Initialize signal
signal = zeros(1, length(t));
for i = 1:length(data)
if data(i) == 1
signal((i-1)/bit_rate*100+1 : (i-0.5)/bit_rate*100) = 1;
signal((i-0.5)/bit_rate*100+1 : i/bit_rate*100) = -1;
else
signal((i-1)/bit_rate*100+1 : (i-0.5)/bit_rate*100) = -1;
signal((i-0.5)/bit_rate*100+1 : i/bit_rate*100) = 1;
end
end
% Plot Manchester
figure;
plot(t, signal, 'LineWidth', 2);
ylim([-1.5 1.5]);
xlabel('Time');
ylabel('Amplitude');
title('Manchester Line Coding');
grid on;

• OUTPUT:
• Conclusion:

You might also like