Hey guys, I am in dire need of a simple hardware interrupt example, i've done my research all to no avail. I know it isn't that difficult, but all i need is kick start... so please, if anyone of you can take the time and help me with my interrupt quandary, i'll appreciate it (BIG TIME). I am using the Atmega 8, using interrupt pin INT1 (aka PD3). Here's what i am trying to do, i have a switch connected to the PD3 pin, and i want to program the atmega8 in a way where when i press the switch (transition from 0 to 1), it turns the LED on (which is connected to an output pin). so far the LED is working perfectly with polling, however i want to learn how hardware interrupts work. i am not sure of the declaration of the interrupt per se, nor am i sure of the global declarations that need to be done. here's a sample of my program:
ISR(INT1_vect)
{
while ((PIND & _BV(PD3))) == 1)
LED_on();
}
Any help will be greatly appreciated.