Digital Signal Processing Reference
In-Depth Information
Browse to the folder c:\ti\c6000\cgtools\lib and select the file
rts6701.lib (which supports the C67x/C62x architecture).
In the left subwindow of the CCS main window, double click on the
folder Libraries to make sure the file was added correctly.
These files, along with your other support files, form the black box that will
be required for every project created in this lab. The only files that change
are the source code files that code a DSP algorithm and possibly a vectors file.
Step 5: Adding Source Code Files to a Project
The last file that you need to add to Sine_gen.pjt is your source code file.
This file will contain the algorithm that will be used to internally generate
a 1KHz sine wave.
Create a file with the following code. Save it as Sine_gen.c .
//Sine_gen.c C program file to generate sine wave
#include <math.h> //needed for sin() function
#define PI 3.14159265359 //define the constant PI
float f0=1000; //sinusoid frequency
short fs=8000; //sampling frequency of codec
float angle=0; //angle in radians
float offset; //offset value for next sample
short sine_value; //value sent to codec
short amplitude = 20000; //gain factor
interrupt void c_int11() //interrupt service routine
{
offset=2*PI*f0/fs;
//set offset value
angle = angle + offset;
//previous angle plus offset
if (angle > 2*PI)
//reset angle if > 2*PI
angle -= 2*PI;
//angle = angle - 2*PI
sine_value=(short)amplitude*sin(angle); //calculate
current output sample
output_sample(sine_value);//output each sine value
return;
//return from interrupt
}
Search WWH ::




Custom Search