06-05-2011, 03:52 PM
Code:
/* prg to implement linear convolution */
#include<stdio.h>
#include<math.h>
int y[20];
main()
{ int m=6; /*Length of i/p samples sequence*/
int n=6; /*Length of impulse response Co-efficients */
int i=0,j;
int x[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Input Signal Samples*/
int h[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Impulse Response Co-efficients*/
for(i=0;i<m+n-1;i++)
{
y[i]=0;
for(j=0;j<=i;j++)
y[i]+=x[j]*h[i-j];
}
for(i=0;i<m+n-1;i++)
printf("%d\n",y[i]);
}
Open Code Composer Studio, make sure the DSP kit is turned on.
Use the Debug Connect menu option to open a debug connection to the DSK board
Start a new project using ‘Project-new ‘ pull down menu, save it in a
separate directory(C:\CCStudio_v3.1\myprojects) with name lconv.pjt.
Add the source files conv.c
to the project using ‘Projectadd files to project’ pull down menu.
Add the linker command file hello.cmd .
(Path: C:\CCStudio_v3.1\tutorial\dsk6713\hello1\hello.cmd)
Add the run time support library file rts6700.lib
(Path: C:\CCStudio_v3.1\c6000\cgtools\lib\rts6700.lib)
Compile the program using the ‘Project-compile’ pull down menu or by
clicking the shortcut icon on the left side of program window.
Build the program using the ‘Project-Build’ pull down menu or by
clicking the shortcut icon on the left side of program window.
Load the program(lconv.out) in program memory of DSP chip using the
‘File-load program’ pull down menu.
To View output graphically
Select view graph time and frequency
Configure the graphical window as shown below