handling ISR in ATMEGA32

Status
Not open for further replies.

Jayk

Junior Member level 1
Joined
Dec 18, 2011
Messages
16
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Rajkot,India
Activity points
1,426
I want help in writing ISR in atmega32 programming.In my program i have two interrupt one for ADC and another for timer0 overflow flag.I want to call the ISR on timer0 overflow.how can i write the code ?
 

Jayk said:
I want to call the ISR on timer0 overflow.how can i write the code ?
If someone translates that strictly then you cannot call an ISR, it comes when you don't expect it (that's why it is called "interrupt").
If you mean that the ADC interrupt must run in any case, then all you have to do inside timer's interrupt and in the first line of this function, is to enable interrupts globally:

Code:
void TimerIsr (void)  //random ISR name
{
  asm("sei");
  //..........
  //..........
  //..........
}

Don't expect something more fancy like interrupt priorities etc, AVR interrupt system is not that advanced.

Hope this helps.
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…