0% found this document useful (0 votes)
29 views30 pages

Cs Task Report

Uploaded by

armanmoxx
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)
29 views30 pages

Cs Task Report

Uploaded by

armanmoxx
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/ 30

IT

EC3601-1
Communication Systems-II
Task Report for Communication Systems-II
AM A Task Report Submitted By

SALMAN FARISH NNM22EC141


SANNIDHI S RAO NNM22EC148
SANNIDHI S SHETTY NNM22EC149

Under the Guidance of


DR.SHIVAKUMAR B R,Assistant Professor
MR.CHANDRA SINGH,Assistant Professor

Department of Electronics & Communication


M
Engineering
IT
Contents
1 Pulse Code Modulation (PCM) 3
1.1 Pulse Code Modulation (PCM) . . . . . . . . . . . . . . . . . . . 3
1.1.1 Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2 Demodulation . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Block Diagram: . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Basic Elements of PCM: . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.1 Sampling: . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.2 Quantization: . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.3 Encoding: . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.4 Line Coding: . . . . . . . . . . . . . . . . . . . . . . . . . 5
AM 1.3.5 Transmission: . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3.6 Reception and Decoding: . . . . . . . . . . . . . . . . . . 6
1.3.7 Filtering (Reconstruction Filter): . . . . . . . . . . . . . 6
1.4 Procedure: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4.1 Simulation Setup Procedure . . . . . . . . . . . . . . . . 6
1.5 Simulated Circuit Diagram . . . . . . . . . . . . . . . . . . . . . 7
1.6 Output Waveform . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2 Delta Modulation (DM) 8


2.1 Delta Modulation (DM) . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.1 Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.2 Demodulation . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Block Diagram: . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Procedure: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.1 Simulation Setup Procedure . . . . . . . . . . . . . . . . . 10
2.4 Simulated Circuit Diagram: . . . . . . . . . . . . . . . . . . . . . 11
2.5 Output Waveform: . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 Amplitude Modulation and Demodulation (AM) 12


3.1 Amplitude Modulation (AM) . . . . . . . . . . . . . . . . . . . . 12
3.1.1 Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1.2 Demodulation . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Block Diagram: . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3 Circuit Diagram: . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
M
3.4 Procedure: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.4.1 Simulation Setup Procedure . . . . . . . . . . . . . . . . 14
3.5 Simulated Circuit Diagram . . . . . . . . . . . . . . . . . . . . . 15
3.6 Output Waveform . . . . . . . . . . . . . . . . . . . . . . . . . . 16

4 M-ary QAM 17
4.1 M-ary Quadrature Amplitude Modulation (M-ary QAM): . . . . 17
4.2 Block Diagram: . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.3 symbol constellation diagram for m-ary qam : . . . . . . . . . . . 18
4.4 Procedure: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

1
Task Report for Communication Systems-II

IT
4.4.1 Simulation Setup Procedure . . . . . . . . . . . . . . . . . 18
4.5 Simulated Circuit Diagram: . . . . . . . . . . . . . . . . . . . . . 19
4.6 Constellation Diagram: . . . . . . . . . . . . . . . . . . . . . . . . 20
4.7 Output Waveforms and Constellation Diagram: . . . . . . . . . . 20

5 Phase Locked Loop(PLL) 21


5.1 Theory: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.2 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2.1 MATLAB Code - Part 1 . . . . . . . . . . . . . . . . . . . 23
5.2.2 MATLAB Code - Part 2 . . . . . . . . . . . . . . . . . . . 24
5.3 Output Waveform: . . . . . . . . . . . . . . . . . . . . . . . . . . 25

6 Generation of PN sequence(32bits) 26
6.1 Theory: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
AM6.2 PN Sequence Generation Using LFSR: .
6.3 Mathematical Representation: . . . . . .
6.4 Circuit Diagram: . . . . . . . . . . . . .
6.5 Block Diagram: . . . . . . . . . . . . . .
6.6 Procedure for PN Sequence Generation:
6.7 Simulated Circuit: . . . . . . . . . . . .
6.8 Output: . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
26
26
26
26
28
29
29
M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 2


Task Report for Communication Systems-II

IT
1 Pulse Code Modulation (PCM)
1.1 Pulse Code Modulation (PCM)
Pulse Code Modulation (PCM) is a digital modulation technique in which an
analog signal is sampled, quantized, and then encoded into a binary sequence
for digital transmission. PCM is commonly used in digital telecommunication
systems to convert analog voice signals into digital data.

1.1.1 Modulation
The modulation process in PCM involves three main steps:
1. Sampling: The continuous analog signal is sampled at regular intervals
to produce a discrete-time signal. The sampling rate must satisfy the Nyquist
AM
criterion, which states that the sampling frequency should be at least twice the
highest frequency present in the signal.
2. Quantization: The amplitude of each sample is approximated to the
nearest value from a finite set of levels. This process introduces a small error
known as quantization noise.
3. Encoding: Each quantized sample is represented as a binary code. The
resulting binary sequence is the digital representation of the original analog
signal.
The PCM signal can be represented mathematically as:

s[n] = Q(x(nTs ))

where:
• s[n]: PCM signal at the n-th sample
• Q(·): Quantization function
• x(nTs ): Sampled analog signal at sampling interval Ts

1.1.2 Demodulation
The demodulation process in PCM involves decoding the binary sequence back
into an analog signal. This process can be broken down into: Decoding: The
M
received binary sequence is converted back into discrete quantized values. Each
binary code corresponds to one quantization level.
2.Reconstruction: A low-pass filter is applied to the quantized values to re-
construct the original analog signal. The output signal is a close approximation
of the original input signal, with some loss due to quantization.
The reconstructed signal x̂(t) is given by:
∞  
X t − nTs
x̂(t) = s[n] · sinc
n=−∞
Ts

where:

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 3


Task Report for Communication Systems-II

IT
• x̂(t): Reconstructed analog signal
• s[n]: Quantized sample at the n-th interval
• Ts : Sampling interval
• sinc(·): Sinc function, used to reconstruct the continuous signal from dis-
crete samples
In this way, PCM enables the transmission of analog signals in a digital
format by encoding and decoding the amplitude information through sampling,
quantization, and binary encoding.

1.2
AM Block Diagram:

Figure 1: Block Diagram for PCM Modulation and Demodulation


M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 4


Task Report for Communication Systems-II

IT
1.3 Basic Elements of PCM:
PCM consists of several key elements that convert an analog signal into a digital
signal for transmission and then back to an analog signal at the receiver. The
basic elements of a PCM system are:

1.3.1 Sampling:
• The continuous-time analog signal is sampled at regular intervals.
• The sampling rate must satisfy the Nyquist criterion, which states that the
sampling frequency should be at least twice the highest frequency present
in the analog signal.
AM
1.3.2 Quantization:
• After sampling, each sample is approximated to the nearest value from a
finite set of discrete levels. This process is called quantization.
• The difference between the actual sample and its quantized value is known
as quantization error.

1.3.3 Encoding:
• Each quantized sample is converted into a binary code using an encoder.
The number of bits required depends on the number of quantization levels
(L), where L = 2n , and n is the number of bits.
• The output of the encoder is a binary stream, representing the digital
version of the original analog signal.

1.3.4 Line Coding:


• The binary stream is then converted into a suitable format for transmission
over the communication channel. This process is called line coding.
• Common line coding schemes include NRZ (Non-Return to Zero), Manch-
ester coding, and RZ (Return to Zero).
M
1.3.5 Transmission:
• The encoded digital signal is transmitted through a communication chan-
nel, such as a wired, wireless, or optical medium.

• Noise and interference may affect the transmitted signal, but PCM is
robust to noise, ensuring reliable transmission.

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 5


Task Report for Communication Systems-II

IT
1.3.6 Reception and Decoding:
• At the receiver, the transmitted binary stream is decoded back into quan-
tized values.
• These values are used to reconstruct the signal through a process of digital-
to-analog conversion (DAC).

1.3.7 Filtering (Reconstruction Filter):


• A low-pass filter is applied to smooth the reconstructed signal and remove
high-frequency components introduced during the sampling process.
• The output is an approximation of the original analog signal.
AM
1.4
1.4.1
Procedure:
Simulation Setup Procedure
1. Open circuit simulation software:
• Launch software like Multisim, MATLAB, or LTspice for circuit sim-
ulation.

2. Build the PCM modulator circuit:


• Design the modulator circuit with an encoder for digital signals and
a phase modulator.
3. Run the simulation:

• Simulate the circuit and observe the PCM signal using virtual oscil-
loscopes or signal analyzers.
4. Build the PCM demodulator circuit:
• Add a phase detector and a digital decoder for demodulation.

5. Run and verify the demodulation:


M
• Simulate the demodulation and check the recovered digital signal,
comparing it with the original message signal.

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 6


Task Report for Communication Systems-II

IT
1.5 Simulated Circuit Diagram

AM
Figure 2: Simulated Circuit Diagram for PCM Modulation and Demodulation

1.6 Output Waveform


M

Figure 3: PCM Modulation and Demodulation Output Waveform

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 7


Task Report for Communication Systems-II

IT
2 Delta Modulation (DM)

2.1 Delta Modulation (DM)


Delta Modulation (DM) is a simple form of modulation where the difference
between successive samples of an analog signal is encoded. Unlike Pulse Code
Modulation (PCM), DM does not transmit the absolute amplitude but instead
the changes (increases or decreases) in signal level.
In DM, a fixed step size is used to approximate the input signal. If the
input signal increases compared to the previous sample, a ”1” is transmitted; if
it decreases, a ”0” is transmitted. The advantages of DM include its simplicity
and reduced bit-rate requirement compared to PCM, but it is susceptible to
granular noise and slope overload.
AM
2.1.1 Modulation
The modulation process in Delta Modulation can be described as follows:
1.Difference Calculation: The difference between the current sample value,
x[n], and the predicted signal value, s[n − 1], is calculated.
2. Step Decision: Based on the difference, a binary decision is made:

s[n] =
(
s[n − 1] + ∆ if x[n] > s[n − 1]
s[n − 1] − ∆ if x[n] < s[n − 1]

where:
• s[n]: The predicted signal value at the n-th sample
• x[n]: The actual sample value at the n-th sample
• ∆: Fixed step size

3. Binary Encoding: If the signal increases (i.e., x[n] > s[n − 1]), a ”1” is
transmitted; if it decreases (i.e., x[n] < s[n − 1]), a ”0” is transmitted. This
binary sequence represents the changes in the signal over time.
M
2.1.2 Demodulation
The demodulation process in Delta Modulation involves reconstructing the sig-
nal by integrating the binary data stream, adding or subtracting the fixed step
size ∆ based on the received bits.
1. Step Integration*: For each received bit:
• If the bit is ”1,” the reconstructed signal value increases by ∆.
• If the bit is ”0,” the reconstructed signal value decreases by ∆.

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 8


Task Report for Communication Systems-II

IT
2.Reconstruction: The demodulated signal ŝ[n] is reconstructed using the
following expression:
ŝ[n] = ŝ[n − 1] + b[n] · ∆
where:
• ŝ[n]: Reconstructed signal at the n-th sample
• b[n]: Binary value of the received bit at the n-th sample (1 for increase,
-1 for decrease)

• ∆: Fixed step size


Through this process, Delta Modulation allows for simple encoding and de-
coding of the signal’s amplitude changes rather than its absolute values. How-
AM
ever, it is limited by issues such as slope overload and granular noise, which
arise due to the fixed step size.

2.2 Block Diagram:


M
Figure 4: Block Diagram of a Delta Modulation and Demodulation System

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 9


Task Report for Communication Systems-II

IT
2.3 Procedure:
2.3.1 Simulation Setup Procedure
1. Open simulation software:

• Launch circuit simulation software like Multisim, MATLAB, or LT-


spice.
2. Build the Delta Modulator circuit:
• Design the modulator with a comparator to compute the difference
between successive samples, an integrator to accumulate changes, and
a quantizer to convert the difference to a 1-bit binary output.
AM3. Run the simulation:
• Simulate the circuit and observe the delta-modulated signal on the
virtual oscilloscope or signal analyzer.

4. Build the Delta Demodulator circuit:


• Design the demodulator with an accumulator and low-pass filter to
reconstruct the original signal from the binary stream.
5. Run the demodulation simulation:

• Simulate the demodulator and observe the recovered signal. Compare


it with the original analog input signal to evaluate performance.
M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 10


Task Report for Communication Systems-II

IT
2.4 Simulated Circuit Diagram:

AM Figure 5: Simulated Circuit Diagram for Delta Modulation

2.5 Output Waveform:


M
Figure 6: Delta Modulation and Demodulation Output Waveforms

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 11


Task Report for Communication Systems-II

IT
3 Amplitude Modulation and Demodulation (AM)

3.1 Amplitude Modulation (AM)


Amplitude Modulation (AM) is a modulation technique in which the amplitude
of the carrier wave is varied in accordance with the information signal, while
the frequency and phase remain constant.

3.1.1 Modulation
In AM, the amplitude of the carrier signal is modified based on the message (or
information) signal. The mathematical representation of AM is:
AM
where:
s(t) = [1 + m(t)] · Ac cos(ωc t)

• s(t): Modulated signal

• m(t): Message signal (information signal)


• Ac : Amplitude of the carrier signal
• ωc : Angular frequency of the carrier signal
In AM, the message signal m(t) modulates the amplitude of the carrier.
When m(t) varies, it causes the amplitude of the carrier signal to change ac-
cordingly, while the frequency and phase remain constant.
The **modulation index** (µ) represents the extent of modulation and is
calculated as:
Am
µ=
Ac
where Am and Ac are the amplitudes of the message and carrier signals, respec-
tively. The modulation index µ indicates how much the carrier amplitude varies
with the message signal, and it should ideally be between 0 and 1 for effective
AM.
M
3.1.2 Demodulation
Demodulation of an AM signal involves recovering the original message signal
m(t) from the modulated signal s(t). A simple method for AM demodulation
is **envelope detection**.
1. Rectification: The AM signal s(t) is first passed through a rectifier to
remove the negative half-cycles, leaving only the positive envelope.
2. Filtering: The rectified signal is then passed through a low-pass filter to
remove high-frequency components, leaving only the envelope, which is propor-
tional to 1 + m(t).

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 12


Task Report for Communication Systems-II

IT
3. DC Offset Removal: If necessary, the constant term (1) is removed to
retrieve the original message signal m(t).
The demodulated output can be represented as:

m̂(t) = senv (t) − 1

where senv (t) is the envelope of the rectified AM signal, and m̂(t) is the recovered
message signal after removing the DC offset.

3.2 Block Diagram:

AM Figure 7: Block Diagram for AM Modulation and Demodulation


M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 13


Task Report for Communication Systems-II

IT
3.3 Circuit Diagram:

AM Figure 8: Circuit Diagram for AM Modulation


M
Figure 9: Circuit Diagram for AM Demodulation

3.4 Procedure:
3.4.1 Simulation Setup Procedure
1. Open circuit simulation software:

• Launch software like Multisim, MATLAB, or LTspice for circuit sim-


ulation.

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 14


Task Report for Communication Systems-II

IT
2. Build the modulator circuit:
• Design the modulator circuit with a carrier generator, message signal
generator, and modulator (e.g., mixer or multiplier).
3. Run the simulation:

• Simulate the circuit and observe the AM signal using virtual oscillo-
scopes or signal analyzers.
4. Build the demodulator circuit:
• Add a diode detector and low-pass filter in the simulation for the
demodulation process.
AM5. Run and verify the demodulation:

3.5
• Simulate the demodulation and check the recovered signal, comparing
it with the original message signal.

Simulated Circuit Diagram


M
Figure 10: Simulated Circuit Diagram for AM Modulation and Demodulation

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 15


Task Report for Communication Systems-II

IT
3.6 Output Waveform

AM Figure 11: AM Modulation and Demodulation Output Waveform


M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 16


Task Report for Communication Systems-II

IT
4 M-ary QAM

4.1 M-ary Quadrature Amplitude Modulation (M-ary QAM):


M-ary Quadrature Amplitude Modulation (M-ary QAM) is a modulation scheme
that combines both amplitude and phase modulation to transmit data. It is
widely used in modern communication systems due to its bandwidth efficiency.
In M-ary QAM, the carrier signal is modulated by both in-phase (I) and quadra-
ture (Q) components, which are combined to form a constellation of M discrete
points.
The general form of the QAM signal is:
AM s(t) = AI cos(ωc t) + AQ sin(ωc t)

where:
• AI and AQ : Amplitudes of the in-phase and quadrature components,
respectively.

• ωc : Angular frequency of the carrier signal.


For M-ary QAM, the number of possible symbols is M = 2n , where n is
the number of bits per symbol. Each symbol represents a unique point in the
constellation diagram with a specific amplitude and phase.

4.2 Block Diagram:


M
Figure 12: Block Diagram of an M-ary QAM System(M=16)

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 17


Task Report for Communication Systems-II

IT
4.3 symbol constellation diagram for m-ary qam :

AM
Figure 13: symbol constellation Diagram for M-ary QAM Modulation

4.4 Procedure:
4.4.1 Simulation Setup Procedure
1. Open simulation software:
• Launch circuit simulation software such as MATLAB, Simulink, or
Multisim.
M
2. Build the M-ary QAM Modulator:
• Design the modulator with two signal paths: one for the in-phase
component (I) and one for the quadrature component (Q).
• Use two mixers (multipliers) to modulate the carrier signal with both
components, followed by summing them to form the QAM signal.
3. Run the modulation simulation:
• Simulate the M-ary QAM modulator and observe the constellation
diagram and transmitted signal on a virtual oscilloscope.

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 18


Task Report for Communication Systems-II

IT
4. Build the M-ary QAM Demodulator:
• Design the demodulator with two mixers, followed by low-pass filters
to extract the in-phase and quadrature components.
• Use a symbol detector to recover the transmitted symbols from the
received signal.

5. Run the demodulation simulation:


• Simulate the demodulator and compare the recovered symbols with
the original transmitted data.

AM
4.5 Simulated Circuit Diagram:

Figure 14: Simulated Circuit Diagram for M-ary QAM Modulation and Demod-
ulation
M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 19


Task Report for Communication Systems-II

IT
4.6 Constellation Diagram:

AM Figure 15: Constellation Diagram for M-ary QAM Modulation(M=16)

4.7 Output Waveforms and Constellation Diagram:


M
Figure 16: Output Waveforms for M-ary QAM(M=16)

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 20


Task Report for Communication Systems-II

IT
5 Phase Locked Loop(PLL)

5.1 Theory:
A Phase Locked Loop (PLL) is a versatile electronic servo system that com-
pares the phase and frequency of a given signal with an internally generated
reference signal. It is used in various applications like frequency multiplication,
FM detector, AM modulator and demodulator, Frequency Shift Keying (FSK),
etc.

Free Running Frequency (f0 )


When there is no input signal applied to pin no. 2 of the PLL, it is in free running
AM
mode, and the free running frequency is determined by the circuit elements Rt
and Ct and is given by:
0.3
f0 =
Rt Ct
where Rt is the timing resistor and Ct is the timing capacitor.

Lock Range of PLL (fL )


The lock range of the PLL is the range of frequencies within which the PLL will
remain locked. It is given by:
8f0
fL = ±
VCC
where f0 is the free running frequency and VCC is the supply voltage. Here,

VCC = VCC − (−VCC ) = 2VCC

Capture Range (fC )


The capture range of the PLL is the range of frequencies over which the PLL
acquires lock. It is given by:
M
1
r
fL
fC =
2π C × L

where fL is the lock range, C is the filter capacitor, and R = 3.6 × 103 . ation.

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 21


Task Report for Communication Systems-II

IT
5.2 Block Diagram

AM Figure 17: Block Diagram of a PLL

The block diagram includes:


• Phase Detector (PD): Compares the phases of the reference signal and
VCO output.
• Low Pass Filter (LPF): Filters the error signal to remove high-frequency
components.
• Voltage-Controlled Oscillator (VCO): Adjusts the frequency based
on the control voltage to match the reference signal phase.
M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 22


Task Report for Communication Systems-II

IT
5.2.1 MATLAB Code - Part 1

MATLAB Code - Part 1


close all;
clear all;
reg1 =0;
reg2 =0;
reg3 = 0;
eta =sqrt(2)/2;
theta =2*pi*1/100;
Kp = [(4*eta*theta)/(1+2*eta*theta+thetaˆ2)];
Ki = [(4*thetaˆ2)/(1+2*eta*theta+thetaˆ2)];
AM d_phi_1 = 1/20;
n_data = 100;
for nn =1:n_data
phi1= reg1 +d_phi_1;
phi1_reg(nn) = phi1;
s1 =exp(j*2*pi*reg1);
s2 =exp(j*2*pi*reg2);
s1_reg(nn) =s1;
s2_reg(nn) =s2;
t =s1*conj(s2);
phi_error =atan(imag(t)/real(t))/(2*pi);
phi_error_reg(nn) = phi_error;
sum1 =Kp*phi_error + phi_error*Ki+reg3;
reg1_reg(nn) =reg1;
reg2_reg(nn) = reg2;
reg1 =phi1;
reg2=reg2+sum1;
reg3 =reg3+phi_error*Ki;
phi2_reg(nn) =reg2;
end
M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 23


Task Report for Communication Systems-II

IT
5.2.2 MATLAB Code - Part 2

MATLAB Code - Part 2


figure(1)
plot(phi1_reg);
hold on
plot(phi2_reg,'r');
hold off;
grid on;
title('phase plot');
xlabel('Samples');
ylabel('Phase');
AM figure(2)
plot(phi_error_reg);
title('phase Error of phase detector');
grid on;
xlabel('samples(n)');
ylabel('Phase error(degrees)');
figure(3)
plot(real(s1_reg));
hold on;
plot(real(s2_reg),'r');
hold off;
grid on;
title('Input signal & Output signal of VCO');
xlabel('Samples');
ylabel('Amplitude');
axis([0 n_data -1.1 1.1]);
M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 24


Task Report for Communication Systems-II

IT
5.3 Output Waveform:

AM
M

Figure 18: Output Waveform of the PLL

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 25


Task Report for Communication Systems-II

IT
6 Generation of PN sequence(32bits)

6.1 Theory:
A Pseudorandom Noise (PN) sequence is a sequence of binary values (0s and
1s) that appears random but is generated deterministically. PN sequences are
widely used in communication systems, cryptography, and spread spectrum
techniques, such as CDMA (Code Division Multiple Access).
A common method for generating PN sequences is through the use of a Lin-
ear Feedback Shift Register (LFSR). The LFSR is a shift register with feedback,
where the input bit is a linear function of the previous state of the register.
AM
6.2 PN Sequence Generation Using LFSR:
An LFSR generates a PN sequence by shifting bits through the register and
using feedback from specific positions of the register. The feedback function
is defined by the taps of the LFSR. For example, an n-bit LFSR with taps at
positions 1 and 3 will generate a sequence based on the XOR of the bits at those
positions.
The characteristic polynomial for an LFSR is a polynomial whose degree
represents the length of the register, and the taps correspond to the exponents
of the terms in the polynomial.
The sequence produced by the LFSR repeats after a certain period, which
depends on the number of bits in the register and the tap positions.

6.3 Mathematical Representation:


For an n-bit LFSR, the next bit in the sequence x(t + 1) is given by:

x(t + 1) = x(t1 ) ⊕ x(t2 ) ⊕ · · · ⊕ x(tn )


Where: - ⊕ denotes the XOR operation. - t1 , t2 , . . . , tn represent the tap
positions in the register.

6.4 Circuit Diagram:


M
The circuit diagram for generating a PN sequence using an LFSR is shown in
Figure 19. The LFSR consists of flip-flops, XOR gates, and feedback connec-
tions.R1,R2,R3and R4 represents LFSR.

6.5 Block Diagram:


The block diagram of a PN sequence generator is shown in Figure 20. The
sequence generator consists of a shift register (LFSR), feedback mechanism,
and output that generates the PN sequence.

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 26


Task Report for Communication Systems-II

IT
AM
Figure 19: Circuit diagram for PN sequence generation using LFSR
M

Figure 20: Block diagram of PN sequence generation

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 27


Task Report for Communication Systems-II

IT
6.6 Procedure for PN Sequence Generation:
The PN sequence generator uses a linear feedback shift register (LFSR) config-
uration with feedback based on a polynomial p(z) = z 4 + z + 1. The steps for
generating the PN sequence are as follows:

1. Initialize the shift register with a non-zero seed value across registers
z0 , z1 , z2 , z3 , and z4 .

2. At each time step, compute the feedback bit by XORing the outputs of
z4 and z1 as specified by the feedback polynomial:

Feedback = z4 ⊕ z1
AM3. Shift the contents of each register to the next register:

• z3 is shifted to z4 ,
• z2 is shifted to z3 ,
• z1 is shifted to z2 ,
• z0 is shifted to z1 ,

and load the computed feedback bit into z0 .


4. Output the value of z4 at each time step as part of the PN sequence.
5. Repeat steps 2 to 4 until the sequence completes one full period.

The PN sequence generated can be observed on the scope connected to the


output of z4 .
M

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 28


Task Report for Communication Systems-II

IT
6.7 Simulated Circuit:
The simulated circuit for the PN sequence generator is shown in Figure 21. The
simulation can be performed using tool simulink, where you can simulate the
LFSR and observe the output sequence.

AM Figure 21: Simulated circuit of PN sequence generator

6.8 Output:
The output of the PN sequence generator is shown in Figure 22. This output is
the result of running the simulated circuit ,displaying the generated PN sequence
over time.
M

Figure 22: Output of the PN sequence generator

Dept. of Electronics and Communication Engineering, NMAMIT, Nitte 29

You might also like