Documente Academic
Documente Profesional
Documente Cultură
Contents at a Glance
EC2306 DIGITAL SIGNAL PROCESSING LAB SYLLABUS........3
1. STUDY OF VARIOUS ADDRESSING MODES OF DSP
USING SIMPLE PROGRAMMING EXAMPLES ......................4
2. CONVOLUTION ............................................................9
a. LINEAR CONVOLUTION.................................................9
b. CIRCULAR CONVOLUTION .......................................... 15
3. SAMPLING OF INPUT AND DISPLAY ............................ 23
4. WAVEFORM GENERATION ......................................... 29
a. SINE WAVEFORM GENERATION.................................. 29
5. IMPLEMENTATION OF FIR FILTER ............................... 36
a. FIR LOW PASS FILTER ................................................. 36
b. FIR HIGH PASS FILTER ................................................. 43
USING MATLAB
1. Generation of Signals
2. Linear and circular convolution of two sequences
3. Sampling and effect of aliasing
4. Design of FIR filters
5. Design of IIR filters
6. Calculation of FFT of a signal
7. Decimation by polyphase decomposition.
TOTAL= 45 PERIODS
Result
Thus, the various addressing mode of DSP processor
TMS320C6745 was studied.
Join the Technical Community Today!
http://www.pantechsolutions.net
2. CONVOLUTION
a. LINEAR CONVOLUTION
Aim
To perform the Linear Convolution of two given discrete
sequence in TMS320C6745 KIT.
Requirements
CCS v4
TMS320C6745 KIT
USB Cable
5V Adapter
Theory
Convolution is a formal mathematical operation, just as
multiplication, addition, and integration. Addition takes two
numbers and produces a third number, while convolution takes
two signals and produces a third signal. Convolution is used in the
mathematics of many fields, such as probability and statistics. In
linear systems, convolution is used to describe the relationship
between three signals of interest: the input signal, the impulse
response, and the output signal.
If the input and impulse response of a system are x[n] and h[n]
respectively, the convolution is given by the expression,
x[n] * h[n] = x[k] h[n-k]
Where k ranges between - and
If,
x(n) is a M- point sequence
h(n) is a N point sequence
then, y(n) is a (M+N-1) point sequence.
In this equation, x(k), h(n-k) and y(n) represent the input to
and output from the system at time n. Here we could see that one
of the inputs is shifted in time by a value every time it is multiplied
with the other input signal. Linear Convolution is quite often used
as a method of implementing filters of various types.
Procedure
1. Open Code Composer Studio v4.
2. In Workspace Launcher.
a. BROWSE Select the project location and make one new
folder, MAKE NEW FOLDER Type the Workspace name, OK
OK.
3. FILE NEW CCS PROJECT
a. Project name: Type your project name.
b. Tick use default location. NEXT
Join the Technical Community Today!
http://www.pantechsolutions.net
h(n)
0xC0001030 00000001
0xC0001034 00000001
0xC0001038 00000001
0xC000103C 00000001
Program
#include<stdio.h>
#define xn 4
#define hn 4
Join the Technical Community Today!
http://www.pantechsolutions.net
void main()
{
int *x,*h,*y,i,n,k;
x = (int *)0xc0001000;
h = (int *)0xc0001030;
y = (int *)0xc0001050;
for(i=0;i<(xn+hn-1);i++)
{
y[i]=0;
x[xn+i]=0;
h[hn+i]=0;
}
for(n=0;n<(xn+hn-1);n++)
{
for(k=0;k<=n;k++)
y[n] = (y[n]) + ((x[k])*(h[n-k]));
}
while(1);
}
Join the Technical Community Today!
http://www.pantechsolutions.net
Result
Thus, the Linear Convolution of two given discrete sequence
has performed and the result is stored at memory
location(0xC0001050).
b. CIRCULAR CONVOLUTION
Aim
To perform the Circular Convolution of two given discrete
sequence in TMS320C6745 KIT.
Requirements
CCS v4
TMS320C6745 KIT
USB Cable
5V Adapter
Theory
The circular convolution, also known as cyclic convolution. A
convolution operation that contains a circular shift is called
circular convolution. Circular convolution of two sequences x1[n]
and x2[n] is given by
x1[n]*x2[n] = k x1[k] x2((n-k))N, 0 n N-1
Join the Technical Community Today!
http://www.pantechsolutions.net
Procedure
1. Open Code Composer Studio v4 .
2. In WorkSpace Launcher.
BROWSE Select the project location and make one new folder,
MAKE NEW FOLDER Type the Workspace name, OK OK.
2. FILE NEW CCS PROJECT
a.Project name: Type your project name.
b.Tick use default location. NEXT
c.Project type: C6000.
d.Tick Debug And Release. NEXT NEXT.
e.Output type: Executable.
f.Device Variant : generic C67XX Device.
g.Device Endianness : little
h.Code Generation Tools: TI v6.1.12.
i.Run time support library: automatic.
j.Target content: none.
FINISH
X(n)
0xC0001000 00000001
0xC0001004 00000001
0xC0001008 00000001
0xC000100C 00000001
h(n)
0xC0001030 00000001
0xC0001034 00000001
0xC0001038 00000001
0xC000103C 00000001
Program
#include <stdio.h>
int rot(int *x);
void main()
{
int *in1,*in2,*out,*temp,i,sum=0,j;
in1 = (int *)0xc0001000;
in2 = (int *)0xc0001030;
out = (int *)0xc0001050;
temp = (int *)0xc0002000;
for(i=0;i<4;i++)
{
if(i == 1)
temp[i+2] = in1[i];
else if(i == 3)
temp[i-2] = in1[i];
else
temp[i] = in1[i];
}
for(i=0;i<4;i++)
{
sum = 0;
for(j=0;j<4;j++)
Join the Technical Community Today!
http://www.pantechsolutions.net
{
sum+=(in2[j] * temp[j]);
}
out[i] = sum;
rot(temp);
}
while(1);
}
rot(int *x)
{
int t;
t = x[0];
x[0] = x[3];
x[3] = x[2];
x[2] = x[1];
x[1] = t;
}
Join the Technical Community Today!
http://www.pantechsolutions.net
Result
Thus, the Circular Convolution of two given discrete sequence
has performed and the result is stored at memory
location(0xC0001050).
fs = 2 * finput
Procedure
1. Open Code Composer Studio v4 .
2. In WorkSpace Launcher.
BROWSE Select the project location and make one new
folder, MAKE NEW FOLDER Type the Workspace name, OK
OK.
3. FILE NEW CCS PROJECT
a.Project name: Type your project name.
b.Tick use default location. NEXT
c.Project type: C6000.
Join the Technical Community Today!
http://www.pantechsolutions.net
FINISH
Program
#include "stdio.h"
#include "c6745.h"
#include "spiadc.h"
signed int adc_value[1000];
void main( void )
{
static Uint8 spiadcbuf[3];
unsigned int j;
short *out,i=0;
C6745_init( );
out = (short *)0xc0000000;
spiadc_init();
for(i=0;i<500;i++)
{
spiadcbuf[0] = 0x01; // setup command
spiadcbuf[1] = 0xBF;
spiadcbuf[2] = 0x00;
spiadc_cycle(spiadcbuf, 3); // Execute spiadc read cycle
adc_value[i] = ((spiadcbuf[1]&0x0f) << 8)| spiadcbuf[2];
//for(j=0;j<100000;j++);
}
Join the Technical Community Today!
http://www.pantechsolutions.net
printf("ALL PROCESSED");
while(1);
}
Result
Thus, the Sampling of input sine waveform was sampled and
Displayed the sampled signal in Graph.
4. WAVEFORM GENERATION
a. SINE WAVEFORM GENERATION
Aim
To Generate a sinewave form using TMS320C6745 DSP KIT.
Requirements
CCS v4
TMS320C6745 KIT
USB Cable
5V Adapter
Theory
The simplest method to generate Sine wave is to use
Trignometric Sin function. The Sin function will generate the
samples from our specific parameter like sampling frequency,
number of samples, input frequency. In this project, generating
the correct sample is important. The library function "sin()" does
all of the work.
where:
A, the amplitude, is the peak deviation of the function from its
center position.
, the angular frequency, specifies how many oscillations occur in
a unit time interval, in radians per second
, the phase, specifies where in its cycle the oscillation begins at t
= 0.
Join the Technical Community Today!
http://www.pantechsolutions.net
FINISH
Program
#include<stdio.h>
#include<math.h>
#define PI 3.14
void main()
{
const float sampf = 1024000.0;// Sampling frquency is fixed
const int inpf = 4000; // change the input frquency from 1khz to
8khz(1000 to 8000)
float sampt;
Join the Technical Community Today!
http://www.pantechsolutions.net
double teta;
short value,*sinout;
int i,count,nsamp,value1;
sinout = (short *)0xc0000000;
sampt = 1/sampf;
nsamp = sampf/inpf;
printf("\n Sampling Frequency is : %f",sampf);
printf("\n Sampling Time is :%f",sampt);
printf("\n Input Frequency is : %d",inpf);
printf("\n The number of Sample is : %d",nsamp);
for(i=0;i<400;i++)
*(sinout+i)=0;
for(count=0;count<nsamp;count++)
{
teta = (2 * PI * inpf * sampt * count);
printf("\nteta = %lf",teta);
value = sin(teta)*1024;
printf("\t sin %lf Value is : %d",teta,value);
value1 = value&0x0000FFFF;
Join the Technical Community Today!
http://www.pantechsolutions.net
*sinout++ = value1;
}
}
Result
Thus, the Sine waveform generation was generated and the sine
samples is stored at memory location(0xc0000000).
Theory
In signal processing, a finite impulse response (FIR) filter is a
filter whose impulse response (or response to any finite length
input) is of finite duration, because it settles to zero in finite time.
This is in contrast to infinite impulse response (IIR) filters, which
may have internal feedback and may continue to respond
indefinitely (usually decaying).
The impulse response of an Nth-order discrete-time FIR filter (i.e.,
with a Kronecker delta impulse input) lasts for N + 1 samples, and
then settles to zero.
The output y of a linear time invariant system is determined by
convolving its input signal x with its impulse response b.
For a discrete time FIR filter, the output is a weighted sum of the
current and a finite number of previous values of the input. The
operation is described by the following equation, which defines
the output sequence y[n] in terms of its input sequence x[n]:
where:
is the input signal,
Join the Technical Community Today!
http://www.pantechsolutions.net
FINISH
Program
// ideal low pass filter
#include<stdio.h>
#include<math.h>
#define PI 3.14
Join the Technical Community Today!
http://www.pantechsolutions.net
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);
}
}
Result
Thus, the FIR Low pass filter was Implemented and displayed
the results in console window.
USB Cable
5V Adapter
Theory
In signal processing, a finite impulse response (FIR) filter
is a filter whose impulse response (or response to any finite length
input) is of finite duration, because it settles to zero in finite time.
This is in contrast to infinite impulse response (IIR) filters, which
may have internal feedback and may continue to respond
indefinitely (usually decaying).
The impulse response of an Nth-order discrete-time FIR filter (i.e.,
with a Kronecker delta impulse input) lasts for N + 1 samples, and
then settles to zero.
The output y of a linear time invariant system is determined by
convolving its input signal x with its impulse response b.
For a discrete time FIR filter, the output is a weighted sum of the
current and a finite number of previous values of the input. The
operation is described by the following equation, which defines
the output sequence y[n] in terms of its input sequence x[n]:
where:
is the input signal,
is the output signal,
are the filter coefficients, also known as tap weights, that make
up the impulse response, is the filter order; an th-order filter has
terms on the right-hand side. The
in these terms are
commonly referred to as taps, based on the structure of a tapped
delay line that in many implementations or block diagrams
provides the delayed inputs to the multiplication operations. One
may speak of a 5th order/6-tap filter, for instance.
Procedure
1. Open Code Composer Studio v4 .
2. In WorkSpace Launcher.
BROWSE Select the project location and make one new
folder, MAKE NEW FOLDER Type the Workspace name, OK
OK.
Join the Technical Community Today!
http://www.pantechsolutions.net
FINISH
workspace location, open the gel folder and select the GEL file.
OPEN SAVE.
9. In C/C++ Project window, Right click the project REBUILD
PROJECT.
10. Connections :
a.Connect the usb cable, PC to TMS320C6745 KIT.
b.Connect the 5v adapter.
c.Power on the kit.
11. TARGET DEBUG ACTIVE PROJECT.
12. TARGET RUN.(wait few seconds)
13. TARGET HALT.(AUTO halt)
14. Output is displayed at Console Window.
Program
// ideal high pass filter coefficients
#include<stdio.h>
#include<math.h>
#define PI 3.14
Join the Technical Community Today!
http://www.pantechsolutions.net
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;
}
Join the Technical Community Today!
http://www.pantechsolutions.net
else
a = (n * PI)/2;
b = n * PI;
value = sin(a);
output = value/b;
final = 1 - output;
Result
Thus, the FIR High pass filter was Implemented and displayed
the results in console window.
What do we sell?
Our products range from Various Microcontroller
development boards, DSP Boards, FPGA/CPLD boards,
Communication Kits, Power electronics, Basic electronics,
Robotics, Sensors, Electronic components and much more . Our
goal is to make finding the parts and information you need
easier and affordable so you can create awesome projects and
training from Basic to Cutting edge technology.