P.E.S.
UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
PRINCIPLES OF DIGITAL SIGNAL PROCESSING LABORATORY
Subject Code: UE22EC252B
PROCEDURE TO USE Code Composer Studio
It is assumed that the user has LAUNCHED THE CODE COMPOSER STUDIO according to the
procedure mentioned above. Once the project explorer window appears, the user has to set the
configurations for the target device (LCDK C6748).
Setting Target Configuration:
1
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
2
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
Click on Finish.
The Connection should be “Texas Instruments XDS100V3 Debug Probe”. The Board
or Device should be LCDKC6748.
Click on Save and then Test Connection. If your connection is OK, then a message as
“JTAGDR
integrity test succeeded” will appear.
Click on the “Advanced” tab and then Click on C674x_0, verify the GEL file path.
3
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
Without the proper GEL file, hardware will not be connected to CCSv5.
Close “Target Configuration” window and Right Click on My_target and select SET AS
DEFAULT and then LAUNCH SELECTED CONFIGURATION.
Debug window will be launched.
4
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
CREATE A NEW CCS PROJECT
Let’s see how we can link these libraries to be used for our examples.
We are going to link the dsplib and implement an FIR filter, this is a non real time example.
Create a new CCS project. Name it as fir_lib
Make the changes as follows. Please note that the connection field can be “Texas
Instruments XDS100v3 Debug Probe” if you are using one.
5
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
Click on FINISH.
1. Go to view-> target configurations
2. New target configuration: File name- test1.ccxml -> finish
6
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
3. Connection type- TIXDS100V3 Debug Probe
4. Board/Device – LCDK 6748
5. Save
6. Test connection-> wait for message “JTAG INTEGRITY SCAN TEST SUCCEEDED”
7. Right click on configuration file and set the configuration file as “default” and “launch selected
configuration”.
8. To open new project: (In Edit mode) Go to Project-> New CCS project
a. Target-LCDK 6748
b. Connection type- TIXDS100V3
c. Name the project- eg: test123
d. Output type: EXCE
e. Output format- Legacycoff
f. Linker command- c6748.cmd
g. Runtime- rts6740.lib
h. Finish
9. Type code in main.c
10. Build, Debug (Debug mode) and Run the code
7
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
Experiment No. 1:-Impulse response
#include<stdio.h>
float x[5]={1,0,0,0,0};
float y[5]={0,0,0,0,0};
void main()
{
int i,j;
printf("\nTo calculate impulse response\n");
for(i=0;i<5;i++)
{
if(i==0)
y[i]=x[i]*0.1311;
if(i==1)
y[i]=x[i]*0.1311+0.2622*x[i-1]+0.7488*y[i-1];
if(i>=2)
y[i]=x[i]*0.1311+0.2622*x[i-1]+0.7488*y[i-1]-0.2722*y[i-
2];
}
for(j=0;j<5;j++)
printf("\n %f",y[j]);
}
8
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
Experiment No. 2:- N point DFT and IDFT
N point DFT USING DSP KIT
#include <stdio.h>
#include <math.h>
float x[4]={0,1,2,3}; //input only real sequence
float Yreal[4],Yimag[4];
//for 4 point DFT to store real & imaginary
float theta;
int n,k,N=4,xlen=4;
void main()
{
for(k=0;k<N;k++)
{
Yreal[k]=0;
Yimag[k]=0; //initialize real & imag parts
for(n=0;n<xlen;n++)
{
theta = -2*3.141592*k*n/N;
//careful about minus sign
Yreal[k]=Yreal[k]+x[n]*cos(theta);
Yimag[k]=Yimag[k]+x[n]*sin(theta);
}
printf("%0.2f+j%0.2f \n", Yreal[k], Yimag[k]);
}
}//end of main
IDFT USING DSP KIT
#include<stdio.h>
#include<math.h>
float x[4],XReal[4],XImag[4],theta;
int k,n,N;
void main()
{
printf("\t\tInverse Discrete Fourier Transform(IDFT)\n");
printf("\nEnter the length of the DFT N = ");
scanf("%d",&N);
// length of the DFT
printf("\nEnter the real amd imaginary parts of X(k) as
follows\n"
"X(k) = Re{X(k)} Im{X(k)}\n");
for(k = 0; k < N; k++)
{
printf("X(%1.0f) = ",k);
// enter values of DFT
9
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
scanf("%f %f",&XReal[k],&XImag[k]);
}
// next part of the program computes inverse DFT
for(n = 0; n < N; n++)
{
x[n] = 0;
for(k = 0; k < N; k++)
// this loop computes one value of x(n)
{
theta=(2*3.141592*k*n)/N;
x[n] = x[n] + XReal[k]*cos(theta)
- XImag[k]*sin(theta);
}
x[n] = x[n]/N;
}
// Next part of program displays x(n) on the screen
printf("\nThe sequence x(n) is as follows...");
for(n = 0; n < N; n++)
// displaying x(n) on the screen
printf("\nx(%1.0f) = %0.2f",n,x[n]);
}
10
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
Experiment No. 3:- Linear convolution and Circular convolution
Linear convolution
#include<stdio.h>
int x[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int h[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int y[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int l1,l2,N;
int i,n,k;
void main()
{
printf("Enter length of x: ");
scanf("%d",&l1);
printf("Enter x[20]:\n ");
for(i=0;i<l1;i++)
scanf("%d",&x[i]);
printf("Enter length of h: ");
scanf("%d",&l2);
printf("Enter h[20]:\n ");
for(i=0;i<l2;i++)
scanf("%d",&h[i]);
N=l1+l2-1;
for(n=0;n<N;n++)
{
y[n]=0;
for(k=0;k<l1;k++)
{
if(n-k>=0 && n-k<l2)
y[n]=y[n]+x[k]*h[n-k];
}
}
printf("Convolution result y[n]= \n");
for(n=0;n<N;n++)
printf("%d\n",y[n]);
11
P.E.S. UNIVERSITY
Department of Electronics and Communication Engineering
Session: Jan - May 2025
Circular convolution
#include<stdio.h>
int x[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int h[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int y[20]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int m,N,sum;
int i,n,k;
void main()
{
printf("Enter N: ");
scanf("%d",&N);
printf("Enter x[20]:\n ");
for(i=0;i<N;i++)
scanf("%d",&x[i]);
printf("Enter h[20]:\n ");
for(i=0;i<N;i++)
scanf("%d",&h[i]);
// Next nested for loop calculates circular convolution
printf("\nThe circular of convolution is...");
for(m = 0; m < N; m++)
{
sum = 0.0;
for(k = 0; k < N; k++) //computation of one value in circular
{//convolution
if((m-k)>= 0)
n = m-k;
//modulo index
else
n = m-k+N;
sum += x[k] * h[n];
}
y[m] = sum;
printf("\ny[%d] = %d",m,y[m]);
}
// displaying the value on screen
}
12