Basics
We have covered the basics of AVR timer Programming, during the Timer 1 example we saw that we had to monitor the Flags to check if the Timer has overflown which made the main program dependent on the status of the flags. Timers are independent unit's inside a micro-controller and make full use of them we will configure and use them with Interrupts. This makes the CPU free from polling the flags and timers can operate on their own. When the timing task is finished, it will interrupt and inform the CPU.
TIMSK | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- | - | TICIE1 | OCIE1A | OCIE1B | TOIE1 | - | - |
Code