Pages: [1]   Go Down
Author Topic: Attach Interrupt to pins other then pin2 and pin3  (Read 896 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12285
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: January 20, 2010, 02:21:32 pm by bcook » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12285
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Excellent!  Thanks for following-up.
« Last Edit: January 20, 2010, 07:02:40 pm by bcook » Logged

Pages: [1]   Go Up
Jump to: