0% found this document useful (0 votes)
23 views3 pages

221902001-Lab Report 7

Uploaded by

Hasnat Zamil
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)
23 views3 pages

221902001-Lab Report 7

Uploaded by

Hasnat Zamil
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/ 3

Green University of Bangladesh

Department of Computer Science and Engineering (CSE)


Faculty of Sciences and Engineering
Semester: (Spring, Year:2024), B.Sc. in CSE (Day)

Lab Report NO # 07
Course Title: Data Communication Lab
Course Code: CSE 308. Section: 221- D7.

Lab Experiment Name: Encoding and Decoding technique of Differential

Manchester.

Student Details
Student Name ID
Hasnat Zamil 221902001

Submission Date : 10 /05/2024


Course Teacher’s Name : Muhaimen Khan

Lab Report Status


Marks: ………………………………… Signature:.....................
Comments:.............................................. Date:..............................
Lab report name

Encoding and Decoding technique of Differential Manchester


Objectives

1.To be familiar with Differential Manchester Line coding technique.

Procedure

Differential Manchester Encoding:


1. bits, bitrate, n: These variables are initialized. bits represents the binary data to be
transmitted, bitrate is the rate at which bits are transmitted, and n represents the
number of samples per bit.
2. If the bit is 0, it sets the signal level to the opposite of the previous bit for the first
half of the bit duration, and then switches back for the second half.
3. If the bit is 1, it sets the signal level to the same as the previous bit for the first half
of the bit duration, and then switches for the second half.

Differential Manchester Decoding:


1.At each sample time, it checks if it's time to sample a new bit based on the counter.
If it's time to sample a new bit:
2. It compares the signal level at the current time with the previous bit's level (lastbit).
3. If they are the same, it decodes a 1 and flips the lastbit.
4. If they are different, it decodes a 0.
5. The decoded bits are stored in the result array.
6. Displaying Decoded Bits:
7. Finally, it displays the decoded bits using disp().

Implementation

bits = [1 0 0 1 0 1 1 0];
bitrate = 1;
n = 1000;
T = length(bits)/bitrate;
N = n*length(bits);
dt = T/N;
t = 0:dt:T;
x = zeros(1,length(t));
lastbit = 1;
for i=1:length(bits)
if bits(i)==0
x((i-1)*n+1:(i-1)*n+n/2) = -lastbit;
x((i-1)*n+n/2:i*n) = lastbit;
else
x((i-1)*n+1:(i-1)*n+n/2) = lastbit;
x((i-1)*n+n/2:i*n) = -lastbit;
lastbit = -lastbit;
end
end
plot(t, x, 'Linewidth', 3);
counter = 0;
lastbit = 1;
for i = 1:length(t)
if t(i)>counter
counter = counter + 1;
if x(i)==lastbit
result(counter) = 1;
lastbit = -lastbit;
else result(counter) = 0;
end
end
end
disp('Differential Manchester Decoding:');
disp(result);

Output

Conclusion

In summary, this code first encodes binary data using Differential Manchester
Encoding, then plots the encoded signal, and finally decodes the signal back into
binary data using Differential Manchester Decoding.

You might also like