#include <avr/io.h>
#include <avr/interrupt.h>
// if ( (TIFR1 & 0x01) == 0x01) // If the overflow flag is set
// ... then following Interrupt routine is called
ISR (TIMER1_OVF_vect)
{
PORTB = PORTB ^ 0b????????; // Toggle the LED
TCNT1 = 0x????; // Restart T/C1 - reload
// Following is not necessary as it is cleared automatically
// TIFR1 = 0x01; // Clear the overflow flag
}
int main( void )
{
/* *********************** Init device ************************************ */
...
// Enable interrupts:
TIMSK1 = 0x01; // Timer 1 overflow interrupt enable
sei(); // Assembler macro for global int. enable
/* *********************** Main Loop ************************************** */
do {
asm("nop"); // Do nothing
} while(1); // And do this forever
return(0);
}