Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top