Go Down

Topic: Timer Interrupt in Arduino Due (Read 358 times) previous topic - next topic


May 24, 2016, 12:09 pm Last Edit: May 24, 2016, 12:23 pm by suraj_150890
Hello folks,

I purchased Arduino Due and  successfully performed an experiment on Simple waveform Generator.
Please refer follwing link:

Now my question is  I am using timer interrupt with constant sampling rate of 44100hz and I want to modify the frequency by changing the index of wave form table. I am bit confused what should I write in Interrupt handler. It is just 2-3 line of code but it is really frustating me.

Thanks in advance.
Code: [Select]

void TC4_Handler() //Interrupt at 44.1KHz rate (every 22.6us)
   TC_GetStatus(TC1, 1); //Clear status to fire again the interrupt.
analogWrite(DAC0, waveformsTable[wave0][i]);  // write the selected waveform on DAC0
i++; // modify the indexing to get different frequency


  if (i == maxSamplesNum)  // Reset the counter to repeat the wave
    i = 0;

Go Up