Pages: [1]   Go Down
Author Topic: Interrupts do not fire with Arduino 1.0  (Read 792 times)
0 Members and 1 Guest are viewing this topic.
UT
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Folks;

I just upgraded from the IDE version 0022 to the 1.0, and now my interrupts no longer fire in SLEEP_MODE_PWR_DOWN mode.  Is anyone aware of this change?

The SLEEP_MODE_IDLE mode just bounces out of the sleep mode too quickly, so it's rather pointless.  I'm trying to put the thing to sleep, and the SLEEP_MODE_PWR_DOWN does, but after the upgrade, the interrupts no longer fire.  The code :


    attachInterrupt(5,handleEvent,CHANGE);
//    set_sleep_mode(SLEEP_MODE_IDLE);
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    sleep_enable();
    sleep_mode();
    sleep_disable();

Anyone know if someone changed the code?  I didn't see anything in the revision history (didn't check out the source for changes, though).

Joe
Logged

UT
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Unfortunately, it stopped letting me upload code.  Not sure if this is 1.0 yet, but will back-rev the IDE just to see if it's a problem with 1.0.
Logged

UT
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

After getting the arduino un-bricked, I have validated that moving back to 0023 the interrupts were working, and moving to 1.0 and uploading the code caused them to fail.  Back to 0023 a fourth time, and it is clear something has changed from 0023 to 1.0, as it works again.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 437
Posts: 23660
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

do you have

# include <avr/interrupt.h>

at the top of your sketch?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

UT
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I do.  The full code is available at http://www.silverhawk.net/files/interrupt_alarm.ino.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't know if this is related.. but I was trying to get the code from http://www.engblaze.com/hush-little-microprocessor-avr-and-arduino-sleep-mode-basics/ running on a 8mhz breadboard arduino and the LED on 13 stays high on 1.0.
Have you found a solution?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Figured it out.. setting the attachInterrupt() once in the setup routine did the trick.
I also had to disable timer0 with power_timer0_disable() before sleep_mode() and enable it back at wakeup.
http://paste.pocoo.org/show/586914/
Logged

Pages: [1]   Go Up
Jump to: