Lab Report # 13: "Overview and Working On DSP Stater Kit DSK C6713"
Lab Report # 13: "Overview and Working On DSP Stater Kit DSK C6713"
Lab Report # 13
“Overview and working on DSP Stater kit DSK C6713”
Task:
Sketch a code for Sine Wave Generation Using Eight Points with DIP Switch Control (sine8_LED)
using Code Composer Studio (CCS) for DSK C6713 kit. Elaborate the working of each
line/segment of this code and explain that how DSP C6713 kit will be operated using this code?
Solution:
Following is the code and its explanation of code as well as working of dsp kit.
Code:
#include "dsk6713_aic23.h" //codec support
Uint32 fs = DSK6713_AIC23_FREQ_8KHZ; //set sampling rate #define
DSK6713_AIC23_INPUT_MIC 0x0015
#define DSK6713_AIC23_INPUT_LINE 0x0011
Uint16 inputsource=DSK6713_AIC23_INPUT_MIC; //select input #define LOOPLENGTH 8
short loopindex = 0; //table index short gain = 10; //gain factor
short sine_table[LOOPLENGTH]= {0,707,1000,707,0,-707,-1000,-707}; //sine values void main()
{
comm_poll(); //init DSK,codec,McBSP DSK6713_LED_init(); //init LED from BSL
DSK6713_DIP_init(); //init DIP from BSL while(1) //infinite loop
{
if(DSK6713_DIP_get(0)==0) //if DIP #0 pressed
{
DSK6713_LED_on(); //turn LED #0 ON
} //end of while(1)
} //end of main
Explanation of code:
An array, sine table , of eight 16 -bit signed integers is declared and initialized to contain
eight samples of exactly one cycle of a sinusoid. The value of sine table[i] is equal to Within
function main() , calls to functions comm_poll() , DSK6713_LED_init() ,and DSK6713_DIP_init()
initialize the DSK, the AIC23 codec onboard the DSK,and the two multichannel buffered
serial ports (McBSPs) on the C6713 processor. Function comm_poll() is defined in the file
c6713dskinit.c , and functionsDSK6713_LED_init() and DSK6713_DIP_init() are supplied in
the board support library (BSL) fi le dsk6713bsl.lib.The program statement while(1) within
the function main() creates an infinite loop. Within that loop, the state of DIP switch #0 is
tested and if it is pressed down, LED #0 is switched on and a sample from the lookup table is
output. If DIP switch#0 is not pressed down then LED #0 is switched off. As long as DIP switch
#0 ispressed down, sample values read from the array sine table will be output and a sinusoidal
analog output waveform will be generated via the left -hand channel of the AIC23 codec and
the LINE OUT and HEADPHONE sockets. Each time a sample value is read from the array
sine_table , multiplied by the value ofthe variable gain , and written to the codec, the index,
loop index , into the arrayis incremented and when its value exceeds the allowable range for
the array( LOOPLENGTH -1 ), it is reset to zero.
Each time the function output_left_sample() , defined in source fileC6713dskinit.c , is
called to output a sample value, it waits until the codec, initializedby the function comm_poll()
to output samples at a rate of 8 kHz, is ready forthe next sample. In this way, once DIP switch
#0 has been pressed down it will betested at a rate of 8 kHz. The sampling rate at which the
codec operates is set bythe program statementUint32 fs = DSK6713_AIC23_FREQ_8KHZ;One
cycle of the sinusoidal analog output waveform corresponds to eight outputsamples and
hence the frequency of the sinusoidal analog output waveform is equal to the codec sampling
rate (8 kHz) divided by eight, that is, 1 kHz