Tuesday 29 September 2015

Function comm_intr() in Sine wave generation using lookup table program

// Program to generate Sine wave
// Program uses the support files from Chassaing's text book

#include "dsk6713_aic23.h"                                //codec-dsk support file
Uint32 fs=DSK6713_AIC23_FREQ_16KHZ;      //set sampling rate
short sine_table[8] = {0,707,1000,707,0,-707,-1000,-707};
short gain = 10;
int i = 0;

interrupt void c_int11()                         //interrupt service routine
{
output_sample(gain*sine_table[i]);
i= i+1;
if(i >= 8)i=0;
return;
}

void main() // Main Program
{
 comm_intr(); //init DSK, codec, McBSP
 while (1);

}

// ===============================

The function comm_intr() initializes the DSK, AIC23 codec, and the McBSP (Multichannel Buffered Serial Ports)  on the DSK 6713 board. 

The function comm_intr() also sets up interrupts such that the AIC23 codec will sample the analog input signal and interrupt the C6713 processor, at the sampling frequency defined by the line 2 of the program.When the interrupt occurs at Ts =1/fs, the interrupt service routine executes and a value from the sine_table[i] is output to the LINE OUT of the DSK board

No comments:

Post a Comment