Go Down

Topic: Attach Interrupt to pins other then pin2 and pin3 (Read 1 time) previous topic - next topic

Quagga

Hello

I would like to know if there si a way to attach an external interrupt to other pins then pin 2 and pin 3, if yes, how?

I'm using the code from:
http://www.arduino.cc/playground/Learning/ArduinoSleepCode

but i need the Atmega to wake up, when pin 13 goes high.
I tryed to set "wakePin = 13;" but that did not help.

I (might) have found the "problem" in the "void sleepNow()" funktion

attachInterrupt(0,wakeUpNow, LOW) and detachInterrupt(0);  

as far as I can read the "0" refers to pin 2, I could change it to "1" (pin 3), but on the PCB i made I'm using both of those pins as data pins for a display.

If I knew that I would run in to this problem I would have changed the PCB-layout, but now i'm thinking it is easyer to change it in the software.

Can it be done?

Thanks

\Quagga

Coding Badly

#1
Jan 20, 2010, 08:21 pm Last Edit: Jan 20, 2010, 08:21 pm by bcook Reason: 1
You may be able to use a "pin change" interrupt.  Unfortunately, the Arduino libraries do not provide any wrappers for them.  Search the forum for "pin change interrupt".  If you cannot find what you need, report back and hopefully someone can get you on track.

Quagga

Thanks for the keyword to search for found this:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1259918394

i put:
PCICR |= (1 << PCIE0);
PCMSK0 |= (1 << PCINT5);

in the void setup();

and now when pin 13 goes high the thing wakes up!!

thanks

Coding Badly

#3
Jan 21, 2010, 01:02 am Last Edit: Jan 21, 2010, 01:02 am by bcook Reason: 1
Excellent!  Thanks for following-up.

Go Up