recently I wrote a demo-code for Arduino Uno how to configure timer2 to invoke interrupts with a regular frequency for creating stepper-motor-pulses.
After some search I did find this demo file
#include <TimerTCC0.h>
bool isLEDOn = false;
char time = 0;
void setup()
{
//SerialUSB.begin(115200);
//while(!SerialUSB);
pinMode(13, OUTPUT);
TimerTcc0.initialize(1000000);
TimerTcc0.attachInterrupt(timerIsr);
}
void loop()
{
/*
time ++;
if(time == 10)TimerTcc0.detachInterrupt();
else if(time == 20)
{
TimerTcc0.attachInterrupt(timerIsr);
time = 0;
}
delay(1000);
*/
}
void timerIsr()
{
digitalWrite(13, isLEDOn);
isLEDOn = !isLEDOn;
}
With this demo-code it is the same like with most other demo-codes
very poor documentation.
there is the function-call
TimerTcc0.initialize(1000000);
initialize timer with 1 million. So what does this exactly mean?
Count up to one million before an interrupt is invoked?
Where can I find information how to calculate a “calling-frequency”
best regards Stefan
P.S. This forum looks very similar to the new arduino-forum
but formatting behaves different. What do I have to write to make an entire sketch appearing as a code-section?