/*1 */ // This project uses support files generated by Rulph Chassaing
/*2 */ // Comm routines included in dsk6713_bsl.lib
/*3 */ #include "dsk6713_aic23.h"
/*4 */ #include <math.h>
/*5 */ #define PI 3.14159265359                          // define the constant PI
/*6 */ typedef struct {float real,imag;} COMPLEX; 
/*7 */                                                   // define complex number exp_value
/*8 */ short sample_period=240;                          // sinusoid period in samples
/*9 */ short ctr;                                        // loop counter
/*10*/ float angle;                                      // angle for cosine function
/*11*/ COMPLEX phasor;
/*12*/ Uint32 fs=DSK6713_AIC23_FREQ_24KHZ                // Define sampling frequency
/*13*/ 
/*14*/ interrupt void c_int11()                          // interrupt service routine
/*15*/ {
/*16*/  angle = 2.0*PI*ctr/sample_period;
/*17*/  phasor.real=20000*cos(angle);                    // real part = cos(w nts)
/*18*/  phasor.imag=20000*sin(angle);                    // imag part = sin(w nts)
/*19*/  output_left_right_sample((short)phasor.real, (short)phasor.imag);      
/*20*/                                                   // output each sine value
/*21*/  if (ctr < sample_period-1) ++ctr;                // increment counter (0 through 239)
/*22*/  else ctr = 0;                                    // reset counter if necessary
/*23*/  return;                                          // return from interrupt
/*24*/ }
/*25*/ 
/*26*/ void main()
/*27*/ {
/*28*/   ctr=0;                                          // initialize counter   
/*29*/   comm_intr();                                    // initialize DSK, codec, McBSP
/*30*/   while(1);                                       // wait for an interrupt to occur
/*31*/ }
 
