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!
Can't help with avrs but your c looks fine if a little strangely commented.
Could I suggest that you post what the errors are. What you have stated above is a little like, I went to the doctor and he told me I was ill, what should I do?" Telling what the doctor (compiler) told you would be helpful. Your answer should not be "error on line 37".
Can't help with avrs but your c looks fine if a little strangely commented.
Could I suggest that you post what the errors are. What you have stated above is a little like, I went to the doctor and he told me I was ill, what should I do?" Telling what the doctor (compiler) told you would be helpful. Your answer should not be "error on line 37".