Example #1
0
int main(){
    float input_data;
    int32 output_data;
    //Configure hardware
    codec_init();
    fir_init(banda1,banda2,banda3,banda4,banda5);

    while(1){
        //Processing data
        if(DSK6713_DIP_get(3)==0){
            //Initialize processing
            leds_output(LED_STATE_ACTIVE);

            while(DSK6713_DIP_get(3)==0){
                input_data = codec_read();
                output_data = fir_filter(input_data);
                codec_write(output_data);
            }
        }
        //Waiting
        else{
            leds_output(LED_STATE_WATING);
        }
    }
}
Example #2
0
/*
 *  load() - PRD that simulates a 20-25% dummy load on a 225MHz 6713 if
 *           DIP switch #1 is depressed.  The thread is configured in
 *           the DSP/BIOS configuration tool under Scheduling --> PRD
 *           PRD_load.  The period is set there at 10 ticks, which each tick
 *           corresponding to 1ms in real time.
 */
void load(void)
{
    volatile Uint32 i;

    if (!DSK6713_DIP_get(1))
        for (i = 0; i < 30000; i++);
}
Example #3
0
/*
 *  blinkLED() - Periodic thread (PRD) that toggles LED #0 every 500ms if
 *               DIP switch #0 is depressed.  The thread is configured
 *               in the DSP/BIOS configuration tool under Scheduling -->
 *               PRD --> PRD_blinkLed.  The period is set there at 500
 *               ticks, with each tick corresponding to 1ms in real
 *               time.
 */
void blinkLED(void)
{
    /* Toggle LED #0 if DIP switch #0 is off (depressed) */
    if (!DSK6713_DIP_get(0))
        DSK6713_LED_toggle(0);
}
Example #4
0
interrupt void c_int11()    //interrupt service routine
{
  // THIS CODE IS FOR THE FIRST AND SECOND PARTS
  output_left_sample((sine_table[(short)loopindexlow] + sine_table[(short)loopindexhigh])/10);
  //AIC23_data.channel[LEFT] = sine_table[(short)loopindexlow];
  //AIC23_data.channel[RIGHT] = sine_table[(short)loopindexhigh];
  //output_sample(AIC23_data.uint);
  //output_left_sample(sine_table[(short)loopindexlow]);
  //output_right_sample(sine_table[(short)loopindexhigh]);
  /*loopindexlow += STEP_697;
  if (loopindexlow > (float)TABLESIZE)
    loopindexlow -= (float)TABLESIZE;
  loopindexhigh += STEP_1477;
  if (loopindexhigh > (float)TABLESIZE)
    loopindexhigh -= (float)TABLESIZE;*/

  // THIS CODE IS FOR THE THIRD PART
  //printf("Inside the interrupt\n");
  if(inLoop == 1)
  {
	  output_left_sample(sine_table[(short)loopindexlow] + sine_table[(short)loopindexhigh]);
	  if( ( dip0state == 1 ) && ( dip1state == 1 ) && ( dip2state == 1 ) && ( dip3state == 1 ) )
	  {
		  // output a 0
		  loopindexlow += STEP_941;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1336;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 1 ) && ( dip1state == 1 ) && ( dip2state == 1 ) && ( dip3state == 0 ) )
	  {
		  // output a 1
		  loopindexlow += STEP_697;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1209;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 1 ) && ( dip1state == 1 ) && ( dip2state == 0 ) && ( dip3state == 1 ) )
	  {
		  // output a 2
		  loopindexlow += STEP_697;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1336;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 1 ) && ( dip1state == 1 ) && ( dip2state == 0 ) && ( dip3state == 0 ) )
	  {
		  // output a 3
		  loopindexlow += STEP_697;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1477;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 1 ) && ( dip1state == 0 ) && ( dip2state == 1 ) && ( dip3state == 1 ) )
	  {
		  // output a 4
		  loopindexlow += STEP_770;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1209;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 1 ) && ( dip1state == 0 ) && ( dip2state == 1 ) && ( dip3state == 0 ) )
	  {
		  // output a 5
		  loopindexlow += STEP_770;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1336;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 1 ) && ( dip1state == 0 ) && ( dip2state == 0 ) && ( dip3state == 1 ) )
	  {
		  // output a 6
		  loopindexlow += STEP_770;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1477;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
      }
	  else if( ( dip0state == 1 ) && ( dip1state == 0 ) && ( dip2state == 0 ) && ( dip3state == 0 ) )
	  {
		  // output a 7
		  loopindexlow += STEP_852;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1209;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 0 ) && ( dip1state == 1 ) && ( dip2state == 1 ) && ( dip3state == 1 ) )
	  {
		  // output a 8
		  loopindexlow += STEP_852;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1336;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 0 ) && ( dip1state == 1 ) && ( dip2state == 1 ) && ( dip3state == 0 ) )
	  {
		  // output a 9
		  loopindexlow += STEP_852;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1477;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 0 ) && ( dip1state == 1 ) && ( dip2state == 0 ) && ( dip3state == 1 ) )
	  {
		  // output a *
		  loopindexlow += STEP_941;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1209;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else if( ( dip0state == 0 ) && ( dip1state == 1 ) && ( dip2state == 0 ) && ( dip3state == 0 ) )
	  {
		  // output a #
		  loopindexlow += STEP_941;
		  if (loopindexlow > (float)TABLESIZE)
			  loopindexlow -= (float)TABLESIZE;
		  loopindexhigh += STEP_1477;
		  if (loopindexhigh > (float)TABLESIZE)
			  loopindexhigh -= (float)TABLESIZE;
	  }
	  else
	  {
		  // invalid input
	  }
	  toneCounter++;
	  if( toneCounter > 32000 )
	  {
		  toneCounter = 0;
		  inLoop = 0;
	  }
  }
  else
  {
	  if( ( DSK6713_DIP_get(0) == dip0state ) && ( DSK6713_DIP_get(1) == dip1state ) && ( DSK6713_DIP_get(2) == dip2state ) && ( DSK6713_DIP_get(3) == dip3state ) )
	  {
		  startCounter++;
	  }
	  else
	  {
		  startCounter = 0;
		  dip0state = DSK6713_DIP_get(0);
		  dip1state = DSK6713_DIP_get(1);
		  dip2state = DSK6713_DIP_get(2);
		  dip3state = DSK6713_DIP_get(3);
	  }

	  if( startCounter > 32000 )
	  {
		  startCounter = 0;
		  inLoop = 1;
		  loopindexlow = 0.0;
		  loopindexhigh = 0.0;
	  }
  }

  return;					//return from interrupt
}