thanks for reading in advance. Please have a look at the code below and note that TCCR0's interrupt is being triggered every now and then, which means what's inside ISR(TIMER0_OVF_vect) is run. However, I have set up TCCR2 the same way, but ISR(TIMER2_OVF_vect) will not be called. Also, what's inside ISRs are just temporary codes for testing purposes.
void init_timer0(void)
{
TCCR0 = 0x07;// 32 prescaler
// 0000 0111b
// clkI/O/1024 (From prescaler)
TCNT0 = 10;
TCCR2 = 0x07;
//TCCR2 = 0x0E;
TCNT2 = 20;
TIMSK |= 0x01;
TIMSK |= 0x40;
}
volatile int i = 0;
ISR(TIMER2_OVF_vect)
{
TCNT2 = 20;
i = 1;
i = 2;
}
ISR(TIMER0_OVF_vect)
{
TCNT0 = 10;
}