t.man
New Member
hi guys!
i need help in getting started with interrupts!
can anyone help in setting and using avr timers. i tried to read the application notes and datasheets but can't get going!
for example, i tried to run a code involving this code lines and it gave me errors:
can anyone help me with this code! how to code the main function for this? i'm using Atmega16
any additional information on setting and using interrupts will be appreciated!
i need help in getting started with interrupts!
can anyone help in setting and using avr timers. i tried to read the application notes and datasheets but can't get going!
for example, i tried to run a code involving this code lines and it gave me errors:
Code:
void init_Ex1(void)
{
TCCR0 = (1<<CS02)|(1<<CS00); //Timer clock =
//1024
//system clock /
TIFR = 1<<TOV0; //Clear TOV0 / clear
//pending interrupts
TIMSK = 1<<TOIE0; //Enable Timer0
//Overflow Interrupt
DDRB = 0xFF; //Set Port B as
//output
}
void interrupt [TIMER0_OVF0_vect] ISR_TOV0 (void)
{
PORTB = ~PORTB; // Toggle pins on Port B
}
can anyone help me with this code! how to code the main function for this? i'm using Atmega16
any additional information on setting and using interrupts will be appreciated!
Last edited: