Why is my ATmega32 timer interrupt not executing?
hello I am beginning interfacing on the atmega32 and I am getting started with the peripherals and now I am stuck with the timers, this code isnt executing the interrupt code for some reason
#include<avr/io.h>
#include<util/delay.h>
#include<avr/interrupt.h>
int main(void){
SREG=1<<7;//enable the I-bit
DDRC=0x01;//output
PORTC=0x00;//initializing not depending on default values in the datasheet
TCCR0=0x05;//setting the value of the prescaler
TIMSK=0x03;//enabling the interrupt of overflow and compare
for(;;){
}
}
ISR(TIMER0_OVF_vect){
PORTC^=0x01;
}
33 Replies
help would be appreciated
on overflow ISR you have to set timer value, that to be overflowed next time
that is the only thing missing?
I think I did that but it didnt do nth w8 I will try
Yes, is the register settings are correct
in this you haven't set TCNT0 register
In which mode you want to use timer??
* Overflow ?
* Compare ? etc?
still doesnt work
I only added the TCNT0 initial value to zero
and it still doesnt work
I am trying the overflow mode rn
I set the internal clock to 1 MHz
and reduced the prescaler value
and it still doesnt work
check timer register settings, is the settings correct for overflow enable?