Hello all,
I just started looking into programming the timers to handle interrupts for a project I'm thinking of undertaking. I looked at a few of the tutorials, but they all seemed to assume that I understood the syntax they were using, such as:
TCCR0A
TCCR0B
TCNT1
et cetera
These terms just came out of the blue! I downloaded the Atmel data sheet for the ATmega328 device and was able to decode these terms. I also figured out the logic statements being used in setup(), such as:
TCCR0B |= (1 << CS11) | (1 << CS10);
I had never seen these before, but the Arduino reference pages helped me decipher them.
I now have two questions I haven't been able to nail down:
1. What libraries do I need for programming the timers. I saw two lines of code that used avr libraries:
#include <avr/io.h>
#include <avr/interrupt.h>
Again, I don't know where these come from or if they are the right ones (my short test sketch didn't crash on them.)
2. Interrupt Service Routine
What is the syntax for this. I've seen ISR(TIMER1_COMPA_vect) {}. Can someone explain the sytax. One example had three ISRs with different contents inside the (....).
Thanks for any help or guidance.
Kevin H.