No wakeup after a second call to Power.WakeUpInterrupt.RTCAlarm

Hi all,

At the second iteration in the example code below “Power.WakeUpInterrupt.RTCAlarm” does not seem to work. At least the MCU does not seem to wake up the after the second call to Power.WakeUpInterrupt.RTCAlarm. Do i need to reset a flag or ???

Any suggestions are welcome.

public static void Main()
{
// the led is used as feedback during testing of the code.
var led48Cntrl = new OutputPort(EMX.Pin.IO48, false);
var ledStatus = false;

        RealTimeClock.SetTime(new DateTime(2010, 07, 30, 13, 31, 00));
        var alarmTime = RealTimeClock.GetTime().AddSeconds(10);
        while (true)
        {
            // toggle the led
            ledStatus = !ledStatus;
            led48Cntrl.Write(ledStatus);

            RealTimeClock.SetAlarm(alarmTime);

            Power.Hibernate(Power.WakeUpInterrupt.RTCAlarm);

            // Do some work here .... assume it takes only 1 second....

            alarmTime.AddSeconds(10);
        }
    }

Asume you have red this article?

Hi Colin,

Thanks for your reply. I wasn’t aware of the article but the part “Shutdown specific peripherals” was interesting to me…

The first example of code in the article had the same idea as my code… I discovered that my code had a bug. :-[ I had to change the last code line in: alarmtime = alarmTime.AddSeconds(10);

Thanks!

Good job :wink: