Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

interrupts

Status
Not open for further replies.

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:
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:
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".

Mike.
 
Pommie said:
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".

Mike.

i get this: "TIMER0_OVF0_vect' undeclared here (not in a function)"
and i'm not so sure about the main function of the code!
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top