I want to change timer0 frequency because I need to use 4 PWM pins at a frequency lower than 500Hz and the SPI on an ATmega328. So I changed timer2 to Fast PWM with 64 divisor, enabled the overflow interrupt for timer2 and disabled the overflow interrupt for timer0:
TCCR2A = _BV(WGM21) | _BV(WGM20); TCCR2B = _BV(CS22); TIMSK2 |= (1 << TOIE2); // enable overflow interrupt for timer2 TIMSK0 &= ~(1 << TOIE0); // disable overflow interrupt for timer0
and changed the ISR vector in wiring.c from
delay doesn't work. What can be the problem?