#include <math.h>                     // needed for sin() function
#define PI 3.14159265359              // define the constant PI 
short ctr
short sine_table[16];                 // array of values sent to codec
short amp=20;

interrupt void c_int11()              // interrupt service routine
{
 output_sample(amp*sine_table[ctr]);      // output each sine value
 
 if (ctr < 15) ++ctr;
 else ctr = 0;
    
 return;                              // return from interrupt
}

void main()
{
  for(ctr=0; ctr<16; ctr++            // 16 samples of one period of a sinsoid
  {                                   // being outputted at rate 8kHz = 500Hz sine wave
    sine_table[ctr]=(short)1000*sin(2*PI*ctr/16);
  }

  ctr=0;
  comm_intr();                        // init DSK, codec, SP0 for interrupts
  while(1)                            // wait for an interrupt to occur
}
 
