Digital Signal Processing Reference
In-Depth Information
// bios_sine_intr.c Sine generation using .cdb in BIOS for INT11
#include <std.h>
#include <log.h>
#include "bios_sine_intrcfg.h"
//generated by .cdb
#include "dsk6713.h"
#include "DSK6713_AIC23.h"
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ;
//set sampling rate
int loop = 0, flag = 0;
short sine_table[8]={0,707,1000,707,0,-707,-1000,-707};//sine data
interrupt void c_int11() //ISR defined in .cdb
{
short out_data = 0;
if (flag == 1) //if SW#3 is pressed
{
out_data = sine_table[loop]*10;
if (++loop > 7) loop = 0; //if @end of table
}
output_sample(out_data); //real-time output
}
void main()
{
comm_intr(); //init codec,DSK,MCBSP
DSK6713_LED_init(); //BSL support for LED
DSK6713_DIP_init(); //BSL support for SW
LOG_printf(&trace,"Start"); //from message log
while(1) //infinite loop
{
if (DSK6713_DIP_get(3) == 0) //if sw#3 is pressed
{
flag = 1; //set flag=1 if pressed
DSK6713_LED_on(3); //then turn on LED#3
}
else
{
DSK6713_LED_off(3); //if not pressed LED off
flag = 0; //flag=0 if not pressed
}
} //end of while(1)
} //end of main
FIGURE 9.5. C program for sine generation with INT11 set in the ( .cdb ) configuration file
( bios_sine_intr.c ).
Example 9.3: Sine Generation Using BIOS to Set Up
Interrupt INT11 ( bios_sine_intr )
This example illustrates the generation of a sine wave when a dip switch is pressed.
Figure 9.5 shows the interrupt-driven program bios _ sine _ intr.c that implements the
sine generation. It uses a configuration file to set up transmit interrupt INT11 and
specify the ISR. See also Examples 9.1 and 9.2.
Search WWH ::




Custom Search