Timer1 Compare & Overflow setup

The following actions could be taken as a part of initialization tasks:

bitSet(TIMSK1, 0);    //TC1 overflow interrupt is enabled

bitSet(TIMSK1, 1);   //TC1 Compare Match A interrupt is enabled

bitSet(TIMSK1, 2);  //TC1 Compare Match B interrupt is enabled

bitSet(SREG, 7);     //Global interrupt in enabled (it has already been done in init() of Arduino)

ISR(TIMER1_COMPA_vect)    //ISR for TC1 Compare Match A interrupt
{
   //codes
}

ISR(TIMER1_COMPB_vect)    //ISR for TC1 Compare Match B interrupt
{
   //codes
}


ISR(TIMER1_OVF_vect)    //ISR for TC1 overflow interrupt
{
   //codes
}

These files (file1, file2) may be consulted as reference document.