Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
0 0 2
S. No.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
S.No.
Equipment
TMS320C6713 DSK
development board
External 5VDC power supply
IEEE 1284 compliant maleto-female cable
233MHz or Higher PentiumCompatible CPU
Monitor
Frequency Generator
CRO
Speaker Jack
2
3
4
5
6
7
8
Qty(N
os.)
10
Functional Status
Working Non-Working
10
NIL
10
10
10
10
NIL
NIL
15
15
NIL
15
2
2
5
15
2
2
5
NIL
NIL
NIL
NIL
S.No.
Items
Quantity (Nos.)
Roll No.
Name
Group C1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Group C2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
short h[33]={-31,43,69,-58,-178,42,379,81,-670,-426,1006,
1172,-1326,-2857,1554,10206,14739,10206,1554,-2857,
-1326,1172,1006,-426,-670,81,379,42,-178,-58,69,43,-31};
short inp_buffer[N],out_buffer[N],ant_out[N],out_sample;
short left_output,right_output,l_input,r_input,i,flag0=0,flg=0;
DSK6713_AIC23_Config config = { \
0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \
0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
0x00d8, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \
0x00d8, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \
0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */ \
0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */ \
0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */
\
0x0043, /* 7 DSK6713_AIC23_DIGIF
Digital audio interface format */ \
0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */
\
0x0001 /* 9 DSK6713_AIC23_DIGACT Digital interface activation */ \
};
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output, r_output;
/* Initialize the board support library, must be called first */
DSK6713_init();
/* Start the codec */
hCodec = DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hCodec, 3);
while(1)
{ /* Read a sample to the left channel */
while (!DSK6713_AIC23_read(hCodec, &l_input));
/* Read a sample to the right channel */
while (!DSK6713_AIC23_read(hCodec, &r_input));
/*******processing********/
inp_buffer[0]=r_input;
out_sample=0;
if(flg==0)
flg=1;
else
{
if(antialiasing==1)
out_sample=antialiasing_filter(inp_buffer,h);
else
out_sample=r_input;
flg=0;
}
for(i=N-1;i>0;i--)
inp_buffer[i]=inp_buffer[i-1];
out_buffer[0]=out_sample;
if(recon==1)
out_sample=reconstruction_filter(out_buffer,h);
for(i=N-1;i>0;i--)
out_buffer[i]=out_buffer[i-1];
l_output=out_sample;
r_output=out_sample;
/* Send a sample to the left channel */
while (!DSK6713_AIC23_write(hCodec, l_output));
/* Send a sample to the right channel */
while (!DSK6713_AIC23_write(hCodec, r_output));
}
/* Close the codec */
DSK6713_AIC23_closeCodec(hCodec);
}
short antialiasing_filter(short *x,short *h)
{
short j,val;
long int sum=0;
for(j=0;j<N;j++)
sum += (long int)x[j]*(long int)h[j];
sum=sum>>15;
val=(short)sum;
return(val);
}
Path C:\CCStudio\C6000\dsk6713\lib\dsk6713bsl.lib
Copy files dsk6713.h and dsk6713_aic23.h from
C:\CCStudio\C6000\dsk6713\include and paste it in current project.
Build, Load and Run the program.
You can notice the input signal of 500 Hz. appearing on the CRO verifying the
codec configuration.
You can also pass an audio input and hear the output signal through the
speakers.
You can also vary the sampling frequency using the DSK6713_AIC23_setFreq
Function in the codec.c file and repeat the above steps.
Result:The output waveform can be seen on the monitor and sampling can be viewed on CRO
after performing the experiment.
Precautions:
1) Connect the wire properly
2) Power cable should be connected after the connection of data cable in the DSK board.
Importance/Competencies: Students have now understood the basic concept of sampling and
how any waveform is generated and sampled.
de-correlated with the signal, but in reality it is perceptually tied to the signal itself, in such an
extent that quantization can be perceived as an effect.
Code:
#include "quancfg.h"
#include "E:\ccstudio_v3.1\c6000\dsk6713\include\dsk6713.h"
#include "E:\ccstudio_v3.1\c6000\dsk6713\include\dsk6713_aic23.h"
//extern signed int FILTER(signed int );
DSK6713_AIC23_Config config = { \
0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \
0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
0x00d8, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \
0x00d8, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \
0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */ \
0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */ \
0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */
\
0x0043, /* 7 DSK6713_AIC23_DIGIF
Digital audio interface format */ \
0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */
\
0x0001 /* 9 DSK6713_AIC23_DIGACT Digital interface activation */ \
};
/*
* main() - Main code routine, initializes BSL and generates tone
*/
Uint32 l_input, r_input,l_output, r_output;
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Method of Experiment:
Connect CRO to the Socket Provided for LINE OUT.
Connect a Signal Generator to the LINE IN Socket.
Switch on the Signal Generator with a sine wave of frequency 500 Hz. and Vpp=1.5v.
Now Switch on the DSK and Bring Up Code Composer Studio on the PC.
Create a new project with name quant.pjt.
From the File Menu new DSP/BIOS Configuration select
dsk6713.cdb and save it as quant.cdb
Add quant.cdb to the current project.
Add the given codec.c file to the current project which has the main function
and calls all the other necessary routines.
Add the library file dsk6713bsl.lib to the current project
Path C:\CCStudio\C6000\dsk6713\lib\dsk6713bsl.lib
Copy files dsk6713.h and dsk6713_aic23.h from
C:\CCStudio\C6000\dsk6713\include and paste it in current project.
Build, Load and Run the program.
You can notice the input signal of 500 Hz. appearing on the CRO verifying the
codec configuration.
You can also pass an audio input and hear the output signal through the
speakers.
You can also vary the sampling frequency using the DSK6713_AIC23_setFreq
Function in the codec.c file and repeat the above steps.
Result: Quantized waveform obtained on CRO.
Precautions: 1) Connect the wire properly
2) Power cable should be connected after the connection of data cable in the DSK
board.
Importance/Competencies: Students have now understood the basic concept of quantization
and its real application in digital signal processing.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double quantize(double value,double delta)
{
int q = value/delta;
if ((value-delta*q)<=(delta * (q + 1)-value))
return delta * q;
else
return delta * (q + 1);
}
void quantize_vector(double s[],double x[],double dither[],double delta,int n)
{
int i;
for (i=0;i<n;i++)
s[i] = quantize(x[i]+dither[i],delta)-dither[i];
}
void print_vector(double x[],int n)
{
int i;
for (i=0;i<n;i++)
printf("%.2f",x[i]);
printf("\n");
}
void print_bits(char x[],int n)
{
int i;
for (i = 0; i < n; i++)
printf("%c", x[i] ? '1' : '0');
printf("\n");
}
double sqr(double x)
{
return x * x;
}
double distance(double y[],double dither[],double delta,int n)
{
int i;
double sum=0.0;
for (i=0;i<n;i++)
sum +=sqr(y[i]-(quantize(y[i]+dither[i],delta)-dither[i]));
return sum;
}
int decode_vector(double y[],double **dither,double delta,int l)
{
Add the source files to the project using Projectadd files to project pull
down menu.
Add the linker command file hello.cmd .
(Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd)
Add the run time support library file rts6700.lib
(Path: c:\ti\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(pcm.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.
Result: The encoded data can be seen on the monitor and inferences will be drawn from that.
Precautions: 1) Connect the wire properly
2) Power cable should be connected after the connection of data cable in the DSK
board.
Importance/Competencies: Students have now came to known the different types of encoding
used for quantized signal and tgeir transmission.
The modulator is made by a quantizer which converts the difference between the input signal and
the average of the previous steps. In its simplest form, the quantizer can be realized with a
comparator referenced to 0 (two levels quantizer), whose output is 1 or 0 if the input signal is
positive or negative. The demodulator is simply an integrator (like the one in the feedback loop)
whose output rises or falls with each 1 or 0 received. The integrator itself constitutes a low-pass
filter.
Code:
/*Fc=30hz
Fm=10hz
Carrier Gain=10
Modulation Index =3;*/
#include<stdio.h>
#include<math.h>
float X1[50],X2[50],X3[50];
main()
{
int i,j,k,fc,Gain,fm;
float Beta;
printf( " Enter the value of Carrier frequency \n");
scanf("%d",&fc);
printf(" enter the value of Gain\n");
scanf("%d",&Gain);
printf("Enter the value of modulation Frequency\n");
scanf("%d",&fm);
printf("Enter the value of Modulation index\n");
scanf("%f",&Beta);
printf("carrier signal \n");
for(i=0;i<=50;i++)
{
X1[i]= Gain*cos(2*3.14*fc*i/100);
printf("%f \t", X1[i]);
}
printf("\n \n sinusoidal Signal\n\n");
for(j=0;j<=50;j++)
{
X2[j]= Beta*sin(2*3.14*fm*j/100);
printf("%f\t ",X2[j]);
}
In QAM, an inphase signal (the I signal, for example a cosine waveform) and a quadrature phase
signal (the Q signal, for example a sine wave) are amplitude modulated with a finite number of
amplitudes, and summed. It can be seen as a two-channel system, each channel using ASK. The
resulting signal is equivalent to a combination of PSK and ASK.
In all of the above methods, each of these phases, frequencies or amplitudes are assigned a
unique pattern of binary bits. Usually, each phase, frequency or amplitude encodes an equal
number of bits. This number of bits comprises the symbol that is represented by the particular
phase.
If the alphabet consists of M = 2N alternative symbols, each symbol represents a message
consisting of N bits. If the symbol rate (also known as the baud rate) is fS symbols/second (or
baud), the data rate is NfS bit/second.
For example, with an alphabet consisting of 16 alternative symbols, each symbol represents 4
bits. Thus, the data rate is four times the baud rate.
In the case of PSK, ASK or QAM, where the carrier frequency of the modulated signal is
constant, the modulation alphabet is often conveniently represented on a constellation diagram,
showing the amplitude of the I signal at the x-axis, and the amplitude of the Q signal at the yaxis, for each symbol.
Code:
Code for ASK
#include<stdio.h>
#include<string.h>
#include<math.h>
void freq_10( void );
void freq_0( void );
float c[1000];
int k=0;
main()
{
int i, length;
char b[10];
puts("\n Enter the value for ASK in 1's and 0's\n");
gets(b);
length = strlen(b);
for(i=0;i<length;i++)
{
if (b[i]=='1')
freq_10();
else
freq_0();
}
}
void freq_10 ()
{
int j;
for(j=k;j<(k+100);j++)
{
c[j]= sin(2*3.14*10*j/200);
printf("\n%dj\t%dj\t\t%.3fc\n",j,k,c[j]);
}
k=j;
}
void freq_0 ()
{
int j;
for(j=k;j<(k+100);j++)
{
c[j]= 0;
printf("\n%d\t %d\t\t%.3f\n",j,k,c[j]);
}
k=j;
}
Code for FSK
#include<stdio.h>
#include<string.h>
#include<math.h>
void freq_10( void );
void freq_5( void );
float c[1000];
int k=0;
main()
{
int i, length;
char b[10];
puts("\n Enter the value for FSK in 1's and 0's\n");
gets(b);
length = strlen(b);
for(i=0;i<length;i++)
{
if (b[i]=='1')
freq_10();
else
freq_5();
}
}
void freq_10 ()
{
int j;
for(j=k;j<(k+100);j++)
{
c[j]= sin(2*3.14*10*j/500);
printf("\n%d\t%d\t\t%.3f\n",j,k,c[j]);
}
k=j;
}
void freq_5 ()
{
int j;
for(j=k;j<(k+100);j++)
{
c[j]= sin(2*3.14*5*j/500);
printf("\n%d\t %d\t\t%.3f\n",j,k,c[j]);
}
k=j;
}
Method of Experiment:
Open Code Composer Studio, make sure the DSP kit is turned on.
Start a new project using .Project-new . pull down menu, save it in a separate
directory(c:\ti\myprojects) with name mod_tech.pjt.
Create the source file i.e. program for any modulation technique (ASK, FSK) in
C language.
Add the source files to the project using Projectadd files to project pull
down menu.
Add the linker command file hello.cmd .
(Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd)
Add the run time support library file rts6700.lib
(Path: c:\ti\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(xyz.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.
Result: Waveforms for ASK and FSK are shown on CRO.
Precautions: 1) Connect the wire properly
2) Power cable should be connected after the connection of data cable in the DSK
board.
Importance/Competencies: Student will came to know the advantages of different digital
modulation schemes and their signal-to-noise performance
Note that 2x becomes zero in the above equation because addition of coefficients is
performed modulo 2
Multiplication is similar:
We can also divide polynomials mod 2 and find the quotient and remainder. For
example, suppose we're dividing x3 + x2 + x by x + 1. We would find that
Code:
/* DESCRIPTION
*
* Program for the error detection
*
* using the TMS320C6713 DSK.
*
*
*
*
*
*
* Enter the data in the form of string
*
*
*
* input --> Input data string
*
*
data --> Output data string
*/
/**********************************************************************/
#include<stdio.h>
#include<string.h>
int i,frame_length,polynomial_degree,dividend[100],remainder[100];
int temp_var1=0,data[100];
void main()
{
char input[100];
int polynomial[10],frame_pointer=0,temp_var=0,remainder_length=0;
/****************Input data string***************************************/
printf(" Enter the Data [Bits string]::");
gets(input);
frame_length=strlen(input)-1;
for(i=0;i<strlen(input);i++)
{
if(input[i]=='1') data[i]=1;
else data[i]=0;
}
{
for(i=0;i<=polynomial_degree;i++)
{
if(dividend[i]==polynomial[i]) remainder[i]=0;
else remainder[i]=1;
}
for(temp_var=-1,i=0;i<=polynomial_degree;i++)
{
if(remainder[i]==1 || temp_var>-1)
dividend[++temp_var]=remainder[i];
}
if(temp_var<polynomial_degree)
{
if(frame_pointer<=(polynomial_degree+frame_length))
{
temp_var1=temp_var;
for(i=0;i<(polynomial_degree-temp_var1);i++)
{
if(frame_pointer<=(polynomial_degree+frame_length))
dividend[++temp_var]=data[frame_pointer++];
else
{
remainder_length=temp_var;
break;
}
}
}
else remainder_length=temp_var;
}
}
if(remainder_length==-1)
for(i=1;i<=polynomial_degree;i++) data[frame_length+i]=0;
else
{
for(i=(polynomial_degree-remainder_length);i>1;i--)
data[++frame_length]=0;
for(i=0;i<=remainder_length;i++)
data[++frame_length]=dividend[i];
}
printf("<!! The CRC status !! >");
for(i=0;i<=frame_length;i++)
printf("%d",data[i]);
}
Method of Experiment:
Open Code Composer Studio, make sure the DSP kit is turned on.
Start a new project using .Project-new . pull down menu, save it in a separate
directory(c:\ti\myprojects) with name crc.pjt.
Create the source file i.e. program for error correction in C language.
Add the source files to the project using Projectadd files to project pull
down menu.
Add the linker command file hello.cmd .
(Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd)
Add the run time support library file rts6700.lib
(Path: c:\ti\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(crc.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.
Result: To verify the CRC status, Observe the output string, view the output window in the CCS
IDE.
Precautions: 1) Connect the wire properly
2) Power cable should be connected after the connection of data cable in the DSK
board.
Importance/Competencies: The student came to know that how the error correcting codes are
helpful in transmission of any digital data
Code:
#include <stdio.h>
#include <math.h>
void dft(short *x, short k, int *out); //function prototype
#define N 8
//number of data values
float pi = 3.1416;
short x[N] = {1000,707,0,-707,-1000,-707,0,707}; //1-cycle cosine
//short x[N]={0,602,974,974,602,0,-602,-974,-974,-602,
//
0,602,974,974,602,0,-602,-974,-974,-602};//2-cycles sine
int out[2] = {0,0};
//init Re and Im results
void dft(short *x, short k, int *out) //DFT function
{
int sumRe = 0, sumIm = 0;
//init real/imag components
float cs = 0, sn = 0;
//init cosine/sine components
int i = 0;
for (i = 0; i < N; i++)
//for N-point DFT
{
cs = cos(2*pi*(k)*i/N);
//real component
sn = sin(2*pi*(k)*i/N);
//imaginary component
sumRe = sumRe + x[i]*cs;
//sum of real components
sumIm = sumIm - x[i]*sn;
//sum of imaginary components
}
out[0] = sumRe;
//sum of real components
out[1] = sumIm;
//sum of imaginary components
}
void main()
{
int j;
for (j = 0; j < N; j++)
{
dft(x,j,out);
//call DFT function
}
}
Method of Experiment:
Open Code Composer Studio, make sure the DSP kit is turned on.
Start a new project using .Project-new . pull down menu, save it in a separate
directory(c:\ti\myprojects) with name dft.pjt.
Create the source file i.e. program for dft in C language.
Add the source files to the project using Projectadd files to project pull
down menu.
Add the linker command file hello.cmd .
(Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd)
Add the run time support library file rts6700.lib
(Path: c:\ti\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(dft.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.
Result:The DFT of the any arbitrary sequence has been obtained in the form of waveform.
Precautions: 1) Connect the wire properly
2) Power cable should be connected after the connection of data cable in the DSK
board.
Importance/Competencies: DFT computation concept will be more elaborated through this
practical.
#define PI 3.14159265358979
typedef struct {float real,imag;} COMPLEX;
void FFT(COMPLEX *Y, int n);
//FFT prototype
float iobuffer[PTS];
//as input and output buffer
float x1[PTS];
//intermediate buffer
short i;
//general purpose index variable
short buffercount = 0;
//number of new samples in iobuffer
short flag = 0;
//set to 1 by ISR when iobuffer full
COMPLEX w[PTS];
//twiddle constants stored in w
COMPLEX samples[PTS];
//primary working buffer
main()
{
for (i = 0 ; i<PTS ; i++)
// set up twiddle constants in w
{
w[i].real = cos(2*PI*i/(PTS*2.0)); //Re component of twiddle constants
w[i].imag =-sin(2*PI*i/(PTS*2.0)); //Im component of twiddle constants
}
for (i = 0 ; i < PTS ; i++) //swap buffers
{
iobuffer[i] = sin(2*PI*30*i/PTS);/*10- > freq,100 -> sampling freq*/
samples[i].real=0.0;
samples[i].imag=0.0;
}
for (i = 0 ; i < PTS ; i++) //swap buffers
{
samples[i].real=iobuffer[i]; //buffer with new data
/* iobuffer[i] = x1[i];
//processed frame to iobuffer*/
}
for (i = 0 ; i < PTS ; i++)
samples[i].imag = 0.0;
//imag components = 0
FFT(samples,PTS);
{
COMPLEX temp1,temp2;
//temporary storage variables
int i,j,k;
//loop counter variables
int upper_leg, lower_leg;
//index of upper/lower butterfly leg
int leg_diff;
//difference between upper/lower leg
int num_stages = 0;
//number of FFT stages (iterations)
int index, step;
//index/step through twiddle constant
i = 1;
//log(base2) of N points= # of stages
do
{
num_stages +=1;
i = i*2;
}while (i!=N);
leg_diff = N/2;
//difference between upper&lower legs
step = (PTS*2)/N;
//step between values in twiddle.h // 512
for (i = 0;i < num_stages; i++) //for N-point FFT
{
index = 0;
for (j = 0; j < leg_diff; j++)
{
for (upper_leg = j; upper_leg < N; upper_leg += (2*leg_diff))
{
lower_leg = upper_leg+leg_diff;
temp1.real = (Y[upper_leg]).real + (Y[lower_leg]).real;
temp1.imag = (Y[upper_leg]).imag + (Y[lower_leg]).imag;
temp2.real = (Y[upper_leg]).real - (Y[lower_leg]).real;
temp2.imag = (Y[upper_leg]).imag - (Y[lower_leg]).imag;
(Y[lower_leg]).real = temp2.real*(w[index]).real
-temp2.imag*(w[index]).imag;
(Y[lower_leg]).imag = temp2.real*(w[index]).imag
+temp2.imag*(w[index]).real;
(Y[upper_leg]).real = temp1.real;
(Y[upper_leg]).imag = temp1.imag;
}
index += step;
}
leg_diff = leg_diff/2;
step *= 2;
}
j = 0;
for (i = 1; i < (N-1); i++) //bit reversal for resequencing data
{
k = N/2;
while (k <= j)
{
j = j - k;
k = k/2;
}
j = j + k;
if (i<j)
{
temp1.real = (Y[j]).real;
temp1.imag = (Y[j]).imag;
(Y[j]).real = (Y[i]).real;
(Y[j]).imag = (Y[i]).imag;
(Y[i]).real = temp1.real;
(Y[i]).imag = temp1.imag;
}
}
return;
}
Method of Experiment:
Open Code Composer Studio, make sure the DSP kit is turned on.
Start a new project using .Project-new . pull down menu, save it in a separate
directory(c:\ti\myprojects) with name fft.pjt.
Create the source file i.e. program for fft in C language.
Add the source files to the project using Projectadd files to project pull
down menu.
Add the linker command file hello.cmd .
(Path: c:\ti\tutorial\dsk6713\hello1\hello.cmd)
Add the run time support library file rts6700.lib
(Path: c:\ti\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(fft.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.
Result:The graph has been viewed on the monitor.
Precautions: 1) Connect the wire properly
2) Power cable should be connected after the connection of data cable in the DSK
board.
Importance/Competencies: Students have understood the importance of FFT and procedure to
compute it.
Tap The number of FIR taps, typically N, tells us a couple things about the filter. Most
importantly it tells us the amount of memory needed, the number of calculations required,
and the amount of "filtering" that it can do. Basically, the more taps in a filter results in
better stopband attenuation (less of the part we want filtered out), less rippling (less
variations in the passband), and steeper rolloff (a shorter transition between the passband
and the stopband).
Multiply-Accumulate (MAC) In the context of FIR Filters, a "MAC" is the operation of
multiplying a coefficient by the corresponding delayed data sample and accumulating the
result. There is usually one MAC per tap.
There are a couple different basic filter responses. Each will have a unique frequency response
based on its cut-off frequency, the number of taps used, its roll off, and amount of ripple. The
various attributes describing a filter may be seen in the following diagram:
Figure 2: This figure demonstrates an FIR low pass filter with 40 taps.
Reducing the number of taps used in the filter will reduce the number of calculations to process
in the signal, however, the quality of the filtering will suffer. Rippling will become more sever,
the rolloff will be less steep, and the passband will be less accurate. This may be seen in the
following diagram where fewer number of taps were used.
Figure 3: Using only 11 taps has degraded the filter from figure 1.
All filters may be categorized by the section of the frequency spectrum that they alter. The
following figures depict some of the basic types of digital filters:
Figure 5: Bandpass filters allow a section in the middle of the spectrum to remain.
Code:
#include "FIRcfg.h"
#include "dsk6713.h"
#include "dsk6713_aic23.h"
float filter_Coeff[] ={0.000000,-0.001591,0.002423,0.000000,0.005728,0.011139,0.010502,
-0.000000,-0.018003,-0.033416,0.031505,0.000000,0.063010,0.144802,0.220534,0.262448,
0.220534,0.144802,0.063010,0.000000,-0.031505,-0.033416,-0.018003,0.000000,0.010502,
0.011139,0.005728,0.000000,-0.002423,-0.001591,0.000000};
static short in_buffer[100];
DSK6713_AIC23_Config config = { \
0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \
0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\
0x00d8, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \
0x00d8, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \
0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */ \
0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */ \
0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */
\
0x0043, /* 7 DSK6713_AIC23_DIGIF
Digital audio interface format */ \
0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */
\
0x0001 /* 9 DSK6713_AIC23_DIGACT Digital interface activation */ \
};
/* main() - Main code routine, initializes BSL and generates tone */
void main()
{
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output, r_output;
/* Initialize the board support library, must be called first */
DSK6713_init();
/* Start the codec */
hCodec = DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hCodec, 1);
while(1)
{ /* Read a sample to the left channel */
while (!DSK6713_AIC23_read(hCodec, &l_input));
while (!DSK6713_AIC23_read(hCodec, &r_input));
l_output=(Int16)FIR_FILTER(&filter_Coeff ,l_input);
r_output=l_output;
Method of Experiment:
Connect CRO to the Socket Provided for LINE OUT.
Connect a Signal Generator to the LINE IN Socket.
Switch on the Signal Generator with a sine wave of frequency 500 Hz. and Vpp=1.5v.
Now Switch on the DSK and Bring Up Code Composer Studio on the PC.
Create a new project with name fir.pjt.
From the File Menu new DSP/BIOS Configuration select
dsk6713.cdb and save it as fir.cdb.
Add fir.cdb to the current project.
Add the given codec.c file to the current project which has the main function
and calls all the other necessary routines.
Add the library file dsk6713bsl.lib to the current project
Path C:\CCStudio\C6000\dsk6713\lib\dsk6713bsl.lib
Copy files dsk6713.h and dsk6713_aic23.h from
C:\CCStudio\C6000\dsk6713\include and paste it in current project.
Build, Load and Run the program.
You can notice the input signal of 500 Hz. appearing on the CRO verifying the
codec configuration.
You can also pass an audio input and hear the output signal through the speakers.
You can also vary the sampling frequency using the DSK6713_AIC23_setFreq
Function in the codec.c file and repeat the above steps.
Result: Filteration has been observed through the head-phone.
Precautions: 1) Connect the wire properly
2) Power cable should be connected after the connection of data cable in the DSK
board.
Importance/Competencies: This practical helps in designing of FIR filter of desired
specifications to the student.
Method of Experiment:
Connect CRO to the Socket Provided for LINE OUT.
Connect a Signal Generator to the LINE IN Socket.
Switch on the Signal Generator with a sine wave of frequency 500 Hz. and Vpp=1.5v.
Now Switch on the DSK and Bring Up Code Composer Studio on the PC.
Create a new project with name iir.pjt.
From the File Menu new DSP/BIOS Configuration select
dsk6713.cdb and save it as iir.cdb.
Add iir.cdb to the current project.
Add the given codec.c file to the current project which has the main function
and calls all the other necessary routines.
Add the library file dsk6713bsl.lib to the current project
Path C:\CCStudio\C6000\dsk6713\lib\dsk6713bsl.lib
Copy files dsk6713.h and dsk6713_aic23.h from
C:\CCStudio\C6000\dsk6713\include and paste it in current project.
Build, Load and Run the program.
You can notice the input signal of 500 Hz. appearing on the CRO verifying the
codec configuration.
You can also pass an audio input and hear the output signal through the speakers.
You can also vary the sampling frequency using the DSK6713_AIC23_setFreq
Function in the codec.c file and repeat the above steps.
Observations: Filtration has been observed through head-phone.
Precautions: