0% found this document useful (0 votes)
34 views38 pages

Ec3492 DSP Laboratory

The document outlines a series of MATLAB experiments for engineering students, including generating discrete-time signals, performing linear and circular convolution, and computing cross-correlation. Each section includes an aim, required software, algorithms, procedures, and MATLAB program code. The results confirm successful execution of the programs for various signal processing tasks.
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)
34 views38 pages

Ec3492 DSP Laboratory

The document outlines a series of MATLAB experiments for engineering students, including generating discrete-time signals, performing linear and circular convolution, and computing cross-correlation. Each section includes an aim, required software, algorithms, procedures, and MATLAB program code. The results confirm successful execution of the programs for various signal processing tasks.
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/ 38

Subject code/Name :

Department of _______________ Engineering


Regulation:

University Reg. No : ………………………………………


Name of the student: ……………………………………….
BONAFIDE CERTIFICATE

NAME : ……………………………

ROLL NUMBER : ……………………………

REGISTER NUMBER: …………………………… YEAR/ SEM: …………...

SUBJECT CODE : …………………………… DEGREE / BRANCH: …………...

SUBJET NAME :…………………………………………………………………………..

Certified that this is a bonafide record of work done by the above student during
the year 20 -20

Faculty-In-charge Head of the Department

Submitted for the University Practical Examination held on ………………….

INTERNAL EXAMINER EXTERNAL EXAMINER


TABLE OF CONTENT
S.No Date Name of the Experiment Page No Marks Signature
Ex. No:
GENERATION OF ELEMENTARY DISCRETE- TIME SEQUENCES
Date:

AIM:
To write a MATLAB program for the generation of signals.
SOFTWARE REQUIRED:
MATLAB
ALGORITHM:
1. Get the number of samples.
2. Generate the unit impulse, unit step using ‘ones’, ‘zeros’ matrix command.
3. Generate ramp, sine, cosine and exponential signals using corresponding general formula.
4. Plot the graph.
PROCEDURE:
 Open the MATLAB
 Open New file
 Type the program
 Save in current directory
 Compile and run the program
PROGRAM:
% UNIT IMPULSE SIGNAL
clc;
clear all;
close all;
n=-2:1:2;
x=[zeros(1,2) ,ones (1,1), zeros(1,2)];
subplot(3,2,1);
stem(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Unit Impulse ');
% UNIT STEP SIGNAL
n1=input(‘Enter the N value’);
n2=0:1:n1-1;
y=ones (1,n1
subplot(3,2,2);
stem(n2,y);
xlabel('Time');
ylabel('Amplitude');
title('Unit step ');
% RAMP SIGNAL
n3=input(‘Enter the length of ramp sequence’);
n4=0:n3;
subplot(3,2,3);
stem(n4,n4);
xlabel('Time');
ylabel('Amplitude');
title('Ramp sequence ');
% EXPONENTIAL SEQUENCE
n5=input(‘Enter the length of Exponential sequence’);
n6=0:n5;
a = input (‘Enter the a value’)
y=exp (a*n6);
subplot(3,2,4);
stem(n6,y);
xlabel('Time');
ylabel('Amplitude');
title('Exponential sequence ');
%SINE SIGNAL
n7=0:.1:pi;
y=sin(2*pi*n7);
subplot(3,2,5);
stem(n7,y);
xlabel('Time');
ylabel('Amplitude');
title('Sine signal ');
%COSINE SIGNAL
n8=0:.1:pi;
y=cos(2*pi*n8);
subplot(3,2,6);
stem(n8,y);
xlabel('Time');
ylabel('Amplitude');
title('Cosine signal ');

RESULT:
Thus the MATLAB program for generation of signals was written and verified successfully.
Ex. No:
LINEAR AND CIRCULAR CONVOLUTION OF TWO SEQUENCES
Date:

AIM:
To write a MATLAB program for linear and circular convolution of two sequences

SOFTWARE REQUIRED:
MATLAB

ALGORITHM:
1. Get two signals x(m) and h(p) in matrix form
2. The convolved signal is denoted as y(n)
3. y(n) is given by the formula

y(n) = Σ[x(k)h(n-k)]

k = -∞
4. Plot the graph.

PROCEDURE:
 Open the MATLAB.
 Open New file.
 Type the program.
 Save in current directory.
 Compile and run the program.
 For the output see the command window.

PROGRAM :
% LINEAR CONVOLUTION
clc;
clear all;
close all;
x=input('Enter the first sequence');
h=input('Enter the second sequence');
y=conv(x,h);
subplot(3,1,1);
stem(x);
xlabel('(a) n--->');
ylabel('amplitude');
title('x sequence ');
subplot(3,1,2);
stem(h);
xlabel('(b) n---->');
ylabel('amplitude');
title('h sequence ');
subplot(3,1,3);
stem(y);
xlabel('Time');
ylabel('(c) n--->');
title(‘convolution of x and h ');
disp(‘ The resultant signal is’);
y
% CIRCULAR CONVOLUTION
clc;
clear all;
close all;
x=input('Enter the first sequence');
N1=length(x);
h=input('Enter the second sequence');
N2=length(h);
subplot(3,1,1)
stem(x);
xlabel('(a) n--->');
ylabel('Amplitude');
title(' x sequence ');
subplot(3,1,2);
stem(h);
xlabel('(b) n--->');
ylabel('Amplitude');
title('h sequence ');
N=max(N1,N2);
x=[x,zeros(1,N-N1)];
h=[h,zeros(1,N-N2)];
for n=1:N
y(n)=0;
for i=1:N
j=n-i+1;
if(j<=0)
j=N+j;
end
y(n)=y(n)+x(i)*h(j);
end
end
disp(' circular convolution of x & h is');
y
subplot(3,1,3);
stem(y);
xlabel('(c) n--->');
ylabel('Amplitude');
title('circular convolution of x & h');

RESULT:
Thus the MATLAB program for Linear and Circular convolution of two sequences was written and
verified successfully.
Ex. No: AUTO CORRELATION AND CROSS CORRELATION
Date:

AIM:
To write a MATLAB program for computing cross correlation of the sequences.
SOFTWARE REQUIRED:
MATLAB
ALGORITHM:
1. Get two signals x(m) and h(p) in matrix form
2. The correlated signal is denoted as y(n)
3. y(n) is given by the formula

y(n) = Σ[x(k)h(k-n)]

k = -∞
PROCEDURE:
 Open the MATLAB
 Open New file
 Type the program
 Save in current directory
 Compile and run the program
PROGRAM:
clc,
clear all;
close all;
x=input (‘enter the first sequence’);
h= input (‘enter the second sequence’);
y=xcorr(x, h);
subplot(3,1,1);
stem(x);
xlabel('(a) n - - ->');
ylabel('amplitude');
title('x sequence');
subplot(3,1,2);
stem(h);
xlabel('(b) n- - - ->');
ylabel('amplitude');
title('h sequence');
subplot(3,1,3);
stem(y);
xlabel('(c) n-');
ylabel('amplitude');
title('The resultant signal is y’);

RESULT:
Thus the MATLAB program for cross correlation of sequences was written and verified successfully.
Ex. No: DESIGN OF FIR FILTERS AND DEMONSTRATES
THE FILTERING OPERATION
Date:

AIM:
To write a MATLAB program to design FIR filter using hanning window and hamming window.
SOFTWARE REQUIRED:
MATLAB
ALGORITHM:
1.Get the Order of filter.
2. Get the cut off frequency of the filter.
3.Generate the impulse response of the filter using hanning window function.
4. Plot the magnitude response of the filter.
PROCEDURE:
 Open the MATLAB.
 Open New file.
 Type the program.
 Save in current directory.
 Compile and run the program.
 For the output see the command window

PROGRAM:
% % Hanning window
% LPF
clc;
clearall;
close all;
disp(‘LPF’);
N=input(‘enter the order of the filter=’);
wc=input(‘enter the cut off frequency=’);
a=((N-1)/2);
for n=1:N
if(n-1)= =a
hd(n)=wc/pi;
else
hd(n)=sin(wc*(n-1-a)) / (pi*(n-1-a))
end
w(n)=0.5-0.5*cos(2*pi*(n-1)/(N-1));
h(n)=hd(n)*w(n);
end
[H,w]=freqz(h,1,152);
mag=20*log(abs(H));
subplot(2,2,1);
plot(w,mag);
grid on;
disp(‘h=’);
disp(h)
title(‘LPF using hanning window’);
xlabel(‘freq in hz….->’);
ylabel(‘gain in db….->’);
% HPF
disp(‘HPF’);
N=input(‘enter the order of the filter=’);
wc=input(‘enter the cut off frequency=’);
a=((N-1)/2);
for n=1:N
if(n-1)= =a
hd(n)=1-(wc/pi);
else
hd(n)=sin(pi*(n-1-a))-sin(wc*(n-1-a)) / (pi*(n-1-a));
end
w(n)=0.5-0.5*cos(2*pi*(n-1)/(N-1));
h(n)=hd(n)*w(n);
end
[H,w]=freqz(h,1,152);
mag=20*log(abs(H));
subplot(2,2,2);
plot(w,mag);
grid on;
disp(‘h=’);
disp(h)
title(‘HPF using hanning window’);
xlabel(‘freq in hz….->’);
ylabel(‘gain in db….->’);
%BPF
disp(‘BPF’);
N=input(‘enter the order of the filter=’);
wc1=input(‘enter the lower cut off frequency=’);
wc2=input(‘enter the upper cut off frequency=’);
a=((N-1)/2);
for n=1:N
if(n-1)==a
hd(n)=((wc2-wc1)/pi);
else
hd(n)=(sin(wc2*(n-1-a))-sin(wc1*(n-1-a)))/(pi*(n-1-a));
end
w(n)=0.5-0.5*cos((2*pi*(n-1)/(N-1));
h(n)=hd(n)*w(n);
end
[H,w]=freqz(h,1,152);
mag=20*log(abs(H));
subplot(2,2,3);
plot(w,mag);
grid on;
disp(‘h=’);
disp(h)
title(‘BPF using hanning window’);
xlabel(‘freq in hz---->’);
ylabel(‘gain in db----->’);
%BSF
disp(‘BSF’);
N=input(‘enter the order of the filter=’);
wc1=input(‘enter the lower cut off frequency=’);
wc2=input(‘enter the upper cut off frequency=’);
a=((N-1)/2);
for

if(n-1)==a
hd(n)=1-((wc2-wc1)/pi);
else
hd(n)= (sin(wc1*(n-1-a))+sin(pi*(n-1-a))-sin(wc2*(n-1-a)))/(pi*(n-1-a));
end
w(n)=0.5-0.5*cos(2*pi*(n-1)/(N-1));
h(n)=hd(n)*w(n);
end
[H,w]=freqz(h,1,152);
mag=20*log(abs(H));
subplot(2,2,4);
plot(w,mag);
grid on;
disp(‘h=’);
disp(h)
title(‘BSF using hanning window’);
xlabel(‘freq in hz---->’);
ylabel(‘gain in db----->’);
% % Hamming window
% LPF
clc;
clear all;
close all;
disp(‘LPF’);
N=input(‘enter the order of the filter=’);
wc=input(‘enter the cut off frequency=’);
a=(N-1)/2;
for n=1:N
if(n-1)==a
hd(n)=wc/pi;
else
hd(n)=sin(wc*(n-1-a)) / (pi*(n-1-a));
end
w(n)=0.5-0.46*cos(2*pi*(n-1)/(N-1));
h(n)=hd(n)*w(n);
end
[H,w]=freqz(h,1,152);
mag=20*log(abs(H));
subplot(2,2,1);
plot(w,mag);
grid on;
disp(‘h=’);
disp(h)
title(‘LPF using hamming window’);
xlabel(‘freq in hz….->’);
ylabel(‘gain in db….->’);
% HPF
disp(‘HPF’);
N=input(‘enter the order of the filter=’);
wc=input(‘enter the cut off frequency=’);
a=(N-1)/2;
for n=1:N
if(n-1) ==a
hd(n)=1-(wc/pi);
else
hd(n)=sin(pi*(n-1-a))-sin(wc*(n-1-a)) / (pi*(n-1-a));
end
w(n)=0.5-0.46*cos(2*pi*(n-1)/(N-1));
h(n)=hd(n)*w(n);
end
[H,w]=freqz(h,1,152);
mag=20*log(abs(H));
subplot(2,2,2);
plot(w,mag);
grid on;
disp(‘h=’);
disp(h)
title(‘HPF using hamming window’);
xlabel(‘freq in hz….->’);
ylabel(‘gain in db….->’);
%BPF
disp(‘BPF’);
N=input(‘enter the order of the filter=’);
wc1=input(‘enter the lower cut off frequency=’);
wc2=input(‘enter the upper cut off frequency=’);
a=(N-1)/2;
for n=1:N
if(n-1)= =a
hd(n)=((wc2-wc1)/pi);
else
hd(n)=(sin(wc2*(n-1-a))-sin(wc1*(n-1-a)))/(pi*(n-1-a));
end
w(n)=0.5-0.46*cos((2*pi*(n-1))/(N-1));
h(n)=hd(n)*w(n);
end
[H,w]=freqz(h,1,152);
mag=20*log(abs(H));
subplot(2,2,3);
plot(w,mag);
grid on;
disp(‘h=’);
disp(h)
title(‘BPF using hamming window’);
xlabel(‘freq in hz---->’);
ylabel(‘gain in db----->’);
%BSF
disp(‘BSF’);
N=input(‘enter the order of the filter=’);
wc1=input(‘enter the lower cut off frequency=’);
wc2=input(‘enter the upper cut off frequency=’);
a=(N-1)/2;
for n=1:N
if(n-1)==a
hd(n)=1-((wc2-wc1)/pi);
else
hd(n)= (sin(wc1*(n-1-a))+sin(pi*(n-1-a))-sin(wc2*(n-1-a)))/(pi*(n-1-a));
end
w(n)=0.5-0.46*cos((2*pi*(n-1))/(N-1));
h(n)=hd(n)*w(n);
end
[H,w]=freqz(h,1,152);
mag=20*log(abs(H));
subplot(2,2,4);
plot(w,mag);
grid on;
disp(‘h=’);
disp(h);
title(‘BSF using hamming window’);
xlabel(‘freq in hz---->’);
ylabel(‘gain in db----->’);

RESULT:
Thus the MATLAB program to design FIR filter using Hanning window and Hamming window was
written and verified successfully.
DESIGN OF IIR FILTER (BUTTERWORTH 2nd ORDER LPF
Ex. No:
AND HPF) USING BLT METHOD

Date:

AIM:
To design IIR filter (butterworth 2nd order LPF and HPF) using bilinear transformation method to satisfy the
following specifications
a) For LPF 0.6≤ ,

b) For HPF 0.6≤ ,

SOFTWARE REQUIRED:
MATLAB
ALGORITHM:
1. Calculate the pass band and stop band attenuation in db.
2. Get the order and cut off frequency of the filter.
3. Generate the normalized and unnormalised transfer function.
4. Generate the digital transfer function using BLT command.
5. Plot the graph for magnitude response.
PROCEDURE:
 Open the MATLAB.
 Open New file.
 Type the program.
 Save in current directory.
 Compile and run the program.
 For the output see the command window

PROGRAM:
% Butterworth 2nd order LPF Filter
clc;
clear all;
close all;

AP=0.6;
AS=0.1;
PF=0.35*pi;
SF=0.7*pi;
T=1;
alphap=-20*log10(AP);
alphas=-20*log10(AS);
PF1=(2/T)*tan((PF)/2);
SF1=(2/T)*tan((SF)/2);
[N,CF]=buttord(PF1, SF1, alphap, alphas,'s');
[Bn,An]=butter(N,1,'s');
disp('Normalised transfer function is');
Hsn=tf(Bn,An)
[B,A]=butter(N,CF,'s');
disp('Unnormalised transfer function is');
Hs=tf(B,A)
[num,den]=bilinear(B,A,1/T);
disp('Digital transfer function is');
Hz=tf(num,den,T)
w=0:pi/16:pi;
Hw=freqz(num,den,w);
Hw_mag=abs(Hw);
plot(w/pi,Hw_mag);
grid;
title('magnitude response of butterworth 2nd order LPF');
xlabel('Normalised frequency');
ylabel('Magnitude');
% Butterworth 2nd order HPF Filter
clc;
clear all;
close all;
disp('HPF');
AP=0.6;
AS=0.1;
PF=0.35*p

SF=0.7*pi;
T=1;
alphap=-20*log10(AP);
alphas=-20*log10(AS);
PF1=(2/T)*tan((PF)/2);
SF1=(2/T)*tan((SF)/2);
[N,CF]=buttord(PF1, SF1, alphap, alphas,'s');
[Bn,An]=butter(N,1,'s');
disp('Normalised transfer function is');
Hsn=tf(Bn,An)
[B,A]=butter(N,CF,'high','s');
disp('Unnormalised transfer function is');
Hs=tf(B,A)
[num,den]=bilinear(B,A,1/T);
disp('Digital transfer function is');
Hz=tf(num,den,T)
w=0:pi/16:pi;
Hw=freqz(num,den,w);
Hw_mag=abs(Hw);
plot(w/pi,Hw_mag);
grid;
title('magnitude response of butterworth 2nd order HPF');
xlabel('Normalised frequency');
ylabel('Magnitude');

RESULT:
Thus the MATLAB program to design IIR Filter (butterworth 2nd order LPF and HPF)using BLT method
was written and verified successfully.
Ex. No: DESIGN OF IIR FILTER (BUTTERWORTH 2nd ORDER LPF) USING
Date: IMPULSE INVARIANCE METHOD

AIM:
To design IIR filter(Butterworth 2nd order LPF )using Impulse invariance method to satisfy the following
specification.
For LPF 0.707≤

SOFTWARE REQUIRED:
MATLAB
ALGORITHM:
1. Calculate the pass band and stop band attenuation in db.
2. Get the Order and cut off frequency of the filter.
3. Generate the normalized and unnormalised transfer function.
4. And generate the digital transfer function using Impulse invariance command.
5. Plot the graph for magnitude response.
PROCEDURE:
 Open the MATLAB.
 Open New file.
 Type the program.
 Save in current directory.
 Compile and run the program.
 For the output see the command window

PROGRAM:
% Butterworth 2nd order LPF Filter
clc;
clear all;
close all;
disp('LPF');
AP=0.707;
AS=0.2;
PF=0.3*pi;
SF=0.75*pi;
T=1;
alphap=-20*log10(AP);
alphas=-20*log10(AS);
PF1=PF/T;
SF1=SF/T;
[N,CF]=buttord(PF1, SF1, alphap,alphas,'s');
[Bn,An]=butter(N,1,'s');
disp('Normalised transfer function is');
Hsn=tf(Bn,An)
[B,A]=butter(N,CF,'s');
disp('Unnormalised transfer function is');
hs=tf(B,A)
[num,den]=impinvar(B,A,1/T);
disp('Digital transfer function is');
Hz=tf(num,den,T)
w=0:pi/16:pi;
Hw=freqz(num,den,w);
Hw_mag=abs(Hw);
plot(w/pi,Hw_mag);
grid;
title('magnitude response of butterworth 2nd order LPF');
xlabel('Normalised frequency');
ylabel('Magnitude');

RESULT

Thus the MATLAB program to design IIRFilter (butterworth 2nd order LPF ) using Impulse invariance
method was written and verified successfully.
Ex. No: STUDY OF ARCHITECTURE OF DIGITAL
SIGNAL PROCESSOR
Date:

AIM:
To study the architecture of digital signal processor TMS320C5515.
THEORY:
The device is a member of TI's TMS320C5000™ fixed-point Digital Signal Processor (DSP) product
family and is designed for low-power applications. The fixed-point DSP is based on the TMS320C55x™ DSP
generation CPU processor core. The C55x™ DSP architecture achieves high performance and low power
through increased parallelism and total focus
on power savings.
The CPU supports an internal bus structure that is composed of one program bus, one 32-bit data read
bus and two 16-bit data read buses, two 16-bit data write buses, and additional buses dedicated to peripheral
and DMA activity. These buses provide the ability to perform up to four 16-bit data reads and two 16-bit data
writes in a single cycle. The device also includes four DMA controllers, each with 4 channels, providing data
movement for 16-independent channel contexts without CPU intervention. Each DMA controller can perform
one 32-bit data transfer per cycle, in parallel and independent of the CPU activity.
The C55x CPU provides two multiply-accumulate (MAC) units, each capable of 17-bit x 17-bit
multiplication and a 32-bit add in a single cycle. A central 40-bit arithmetic/logic unit (ALU) is supported by
an additional 16-bit ALU. Use of the ALUs is under instruction set control, providing the ability to optimize
parallel activity and power consumption.
These resources are managed in the Address Unit (AU) and Data Unit (DU) of the C55x CPU. The
C55x CPU supports a variable byte width instruction set for improved code density. The Instruction Unit (IU)
performs 32-bit program fetches from internal or external memory and queues instructions for the Program
Unit (PU). The Program Unit decodes the instructions, directs tasks to the Address Unit (AU) and Data Unit
(DU) resources, and manages the fully protected pipeline. Predictive branching capability avoids pipeline
flushes on execution of conditional instructions.
The general-purpose input and output functions along with the 10-bit SAR ADC provide sufficient pins
for status, interrupts, and bit I/O for LCD displays, keyboards, and media interfaces. Serial media is supported
through two Multimedia Card/Secure Digital (MMC/SD) peripherals, four Inter-IC Sound (I2S Bus™)
modules, one Serial-Port Interface (SPI) with up to 4 chip selects, one I2C multi-master and slave interface,
and a Universal Asynchronous Receiver/Transmitter (UART) interface.
The device peripheral set includes an external memory interface (EMIF) that provides glue less access to
asynchronous memories like EPROM, NOR, NAND, and SRAM, as well as to high-speed, high-density
memories such as synchronous DRAM (SDRAM) and mobile SDRAM (mSDRAM). Additional peripherals
include: a high-speed Universal Serial Bus (USB2.0) device mode only, and a real-time clock (RTC). This
device also includes three general-purpose timers with one configurable as a watchdog timer, and an analog
phase-locked loop (APLL) clock generator.
In addition, the device includes a tightly-coupled FFT Hardware Accelerator. The tightly-coupled FFT
Hardware Accelerator supports 8 to 1024-point (in power of 2) real and complex-valued FFTs.
Furthermore, the device includes three integrated LDOs (DSP_LDO, ANA_LDO, and USB_LDO) to
power different sections of the device. The device is supported by the industry’s award-winning express
DSP™, Code Composer Studio™ Integrated Development Environment (IDE), DSP/BIOS™, Texas
Instruments’ algorithm standard, and the industry’s largest third-party network. Code Composer Studio IDE
features code generation tools including a C Compiler and Linker, RTDX™, XDS100™, XDS510™,
XDS560™ emulation device drivers, and evaluation modules. The device is also supported by the C55x DSP
Library which features more than 50 foundational software kernels (FIR filters, IIR filters, FFTs, and various
math functions) as well as chip support libraries.

RESULT:
Thus the architecture of digital signal processor TMS320C5515 was studied.
Ex. No: MAC OPERATION USING VARIOUS
ADDRESSING MODES
Date:

AIM:
To write a program to implement various addressing modes of TMS320C5515 DSP processors.
APPARATUS REQUIRED:
1. System with TMS320C5515 debugger software
2. TMS320C5515 kit
3. USB cable
ALGORITHM:
Immediate addressing modes:
1. Initialize data pointer with 100H data.
2. Load the accumulator with first data.
3. Add the second data with accumulator content.
4. Store the accumulator content in specified address location.
Direct addressing modes:
1. Initialize data pointer with 100H data.
2. Load the accumulator with first data, whose address in specified in the instruction.
3. Add the accumulator content with the second data, whose address is specified in the instruction.
4. Store the accumulator content in specified address location.
Indirect Addressing Modes:
1. Load the auxiliary register with address location of first data
2. The auxiliary register (AR0) is modified indirectly as # symbol.
3. Load the second data into accumulator and perform addition operation.
4. Store the result.
PROGRAM:
Immediate addressing modes:
.MMREGS
.TEXT
START:
LDP # 100H
LACC # 1241H
ADD # 1200H
SACL 2H
HTL : END
Direct addressing modes:
.MMREGS
.TEXT
START:
LDP # 100H
LACC 0H
ADD 1H
SACL 2H
HTL : END
Addition of two numbers with indirect addressing modes:
.MMREGS
.TEXT
START:
LDP AR0, #8000H,
MAR*, AR0
LACC* +, 0 : WIH ZERO SHIFT
ADD * 1
SACL * +
HTL : END

RESULT:
Thus program was written for various addressing modes and it was implemented using TMS320C5515 kit.
Ex. No:
GENERATION OF VARIOUS SGNALS AND RANDOM
Date:
NOISE

AIM:
To write a C program to generate sine wave, square wave, triangular wave and implement it using
TMS320C5515 kit.
APPARATUS REQUIRED:
1. System with code composer studiov4
2. TMS320C5515
3. USB cable
ALGORITHM:
1. The Sin function will generate the sine wave
2. Define the sampling frequency
3. Specify the number of samples
4. Plot the graph

PROCEDURE:
1. Launch CCSv4 from the desktop
2. In workspace launcher, choose the location for the workspace where your project will be saved.
3. Click the CCS icon from the welcome page to go the workbench.
4. From the target menu select new target configuration.
 Specify target name. Extension of the target name is .ccxml
 Click finish.
5.a) Select the connection : Texas instruments XDS100v1 USB Emulator

b) Select the device:USB STICK -5515

c) Finally save it.


6. Go to view option and select the target configutaion
7. Connect the target.
8. Change the perspective debug to C/C++ from the right corner of the CCS
9. Go to file  NewCCS project
10. Specify the name of the project in the space provided.
 Click next
 Select the project type (C5500)
 Click next
 Select the C/C++ indexers
 Click next
 Set linker command file: lnk.cmd in ccs project settings window
 Click finish
11.Go to file  NewSource file. Extension of the source file is .c
12. Type the C program
13. Go to Project Build active project
14. TargetDebug active project
15. Change the perspective C/C++ to debug from the right corner of the CCS
16. Go to target  Run
PROGRAM:
%Sine wave generation:
#include <stdio.h>
#include<math.h>
#define FREQ 500
float m[127];
main()
{
inti=0;
for(i=0;i<127;i++)
{
m[i]=sin(2*3.14*FREQ*i/24000);
printf("%f\n",m[i]);
}
}
% Square wave generation:

#include <stdio.h>

#include <math.h>

unsigned short Square[500];

void main()

int i=0,j=0,k=0;

for(k=0;k<5;k++)

{
for(i=0;i<50;i++)

{ Square[j] = 0x0000FFFF; j++; }

for(i=0;i<50;i++) {

Square[j] = 0x0;

j++; } } }
% Triangular wave
#include<stdio.h>

#include<math.h>

void main()

int*Triangle;

int i=0,j=0;

Triangle = (int *)0xC0000000

while(1)

for(i=0;i<50;i++)

j=j+1;

*Triangle++ = j;

for(i=50;i>0;i--)

j=j-1;

*Triangle++ = j;

}
RESULT:
Thus C program was written to generate sine wave and it was implemented using TMS320C5515 kit.
Ex. No:
DESIGN AND DEMONSTRATION OF FIR FILTER FOR
Date:
LOW, HIGH, BAND PASS AND BAND STOP FILTERING

AIM:
To write a C program to design FIR filter and implement it using TMS320C5515 kit.
APPARATUS REQUIRED:
1. System with code composer studiov4
2. TMS320C5515
3. USB cable
ALGORITHM:
1. Assign the sampling frequency
2. Get the cut off frequency of the filter
3. Generate the impulse response of the filter
4. Plot the magnitude response of the filter
PROCEDURE:
1. Launch CCSv4 from the desktop
2. In workspace launcher, choose the location for the workspace where your project will be saved.
3. Click the CCS icon from the welcome page to go the workbench.
4. From the target menu select new target configuration.
 Specify target name. Extension of the target name is .ccxml
 Click finish.
5.a) Select the connection : Texas instruments XDS100v1 USB Emulator

b) Select the device:USB STICK -5515

c) Finally save it.


6. Go to view option and select the target configutaion
7. Connect the target.
8. Change the perspective debug to C/C++ from the right corner of the CCS
9. Go to file  NewCCS project
10. Specify the name of the project in the space provided.
 Click next
 Select the project type (C5500)
 Click next
 Select the C/C++ indexers
 Click next
 Set linker command file: lnk.cmd in ccs project settings window
 Click finish
11.Go to file  NewSource file. Extension of the source file is .c
12. Type the C program
13. Go to Project Build active project
14. TargetDebug active project
15. Change the perspective C/C++ to debug from the right corner of the CCS
16. Go to target  Run
PROGRAM:
// ideal low pass filter //
#include<stdio.h>
#include<math.h>
#define PI 3.14
void main()
{
const int sampf=10000;
const int cutf=1000;
float value,a,b,output;
int nyqf,n,c0;
int *coeff;
coeff = (int *)0xc0001000;
nyqf=sampf/2;
c0=cutf/nyqf;
for(n=-5;n<6;n++)
{

if(n==0)
{
output = 0.5;
}
else
a = (n * PI)/2;
b = n * PI;
value = sin(a);output = value/b;
printf("\n The Fir Low pass filter coefficient : %f",output)
}
// ideal high pass filter coefficients//
#include<stdio.h>
#include<math.h>
#define PI 3.14
void main()
{
const int sampf=10000;
const int cutf=1000;
double value,a,b,output,final;
int nyqf,n,c0;
int *coeff;
coeff = (int *)0xc0001000;
nyqf=sampf/2;
c0=cutf/nyqf;
for(n=-5;n<6;n++)
{ if(n==0)
{
output = 0.5;
}
else
a = (n * PI)/2; b = n * PI;
value = sin(a); output = value/b; final = 1 - output;
printf("\n The Fir High pass filter coefficient : %f",final);
}
}

RESULT:
Thus C program was written to design FIR filter and it was implemented using TMS320C5515 kit.
DESIGN AND DEMONSTRATION OF FIR FILTER FOR
Ex. No:
LOW, HIGH, BAND PASS AND BAND STOP FILTERING
Date:

AIM:
To design a Chebyshev Filter using Impulse Invariant Transformation method to
satisfy the following specification.
a) For LPF

SOFTWARE REQUIRED:
MATLAB
ALGORITHM:
1. Calculate the pass band and stop band attenuation in db.
2. Get the Order and cut off frequency of the filter.
3. Generate the normalized and unnormalised transfer function.
4. And generate the digital transfer function using BLT command.
5. Plot the graph for magnitude response.
PROCEDURE:
 Open the MATLAB.
 Open new file.
 Type the program.
 Save in current directory.
 Compile and run the program.
 For the output see the command window

PROGRAM:
% Chebyshev 3rd order LPF
clc;
clear all;
close all;
disp('LPF');
AP=0.9;
AS=0.24;
PEF_D=0.25*pi;
SEF=0.5*pi;
T=1;
alphap=-20*log10(AP);
alphas=-20*log10(AS);
PEA= PEF_D/T;
SEF_A=SEF_D/T;
[N,CF]=cheb1ord (PEF_A, SEF_A,alpha_p ,alpha_s,'s');
[Bn,An]=cheby1(N, alpha_p,1,'s');
disp('Normalised transfer function is');
Hsn=tf(Bn,An)
[B,A]=cheby1(N,alphap,CF,'s');
disp('Unnormalised transfer function is');
Hs=tf(B,A)
[num,den]=impinvar(B,A,1/T);
disp('Digital transfer function is');
Hz=tf(num,den,T)
w=0:pi/16:pi;
Hw=freqz(num,den,w);
Hw_mag=abs(Hw);
plot(w/pi,Hw_mag);
grid;
title('magnitude response of chebyshev 3rd order LPF');
xlabel('Normalised frequency');
ylabel('Magnitude');

RESULT:
Thus the MATLAB program to design IIR Filter (Chebyshew 3rd order LPF)
using bilinear transformation method was written and verified successfully.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy