How to use interrupts in AVR?

Status
Not open for further replies.

MohammadElwakeel

Junior Member level 1
Joined
Feb 18, 2007
Messages
18
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,441
Hi Everybody

I have a small question about interrupt programming in AVR. I'm using winAVR GCC compiler and trying to use the external interrupts on PORTB and E. If anyone can help with an advice or sample of code or an URL.

Thanks, Please help...
 

you can see the sample code in the GCC compiler in which there is code avilable using interrupts and signal.
Sample code:-
#include <avr/interrupt.h>
#include <avr/signal.h>

int main(void)
{
//------------EXTERNAL INTERRUPT
MCUCSR= 0x00;
MCUCR = 0x0A; //EDGE TRIGERED INTERRUPS
//MCUCR = 0x00;
GICR = 0xE0; //interrupt mak in GICR
SREG = 0x80; // ENABLES ALL INTERRUPTS.
}

SIGNAL(SIG_INTERRUPT0)
{
//your interrupt code is here
}
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…