Main Site Documentation

RTC Alarm set exception


#1

Does anyone have an idea as to why this code would result in an exception? It was working and on a subsequent debug it stopped working. This is on a Domino, but am also using the same code on a Panda II.

                    // set the RTC alarm
                    RealTimeClock.SetAlarm(RealTimeClock.GetTime().AddSeconds(2));
                    led.Write(false);
                    Power.Hibernate(Power.WakeUpInterrupt.RTCAlarm);
                    led.Write(true);
                    Utility.SetLocalTime(RealTimeClock.GetTime());
                    Debug.Print(DateTime.Now.ToString());

Here’s the exception as shown during debug:

#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message: 
#### GHIElectronics.NETMF.Hardware.RealTimeClock::SetAlarmHelper [IP: 0000] ####
#### GHIElectronics.NETMF.Hardware.RealTimeClock::SetAlarm [IP: 002b] ####
#### Phoenix.Program::Main [IP: 0123] ####

A first chance exception of type ‘System.InvalidOperationException’ occurred in GHIElectronics.NETMF.Hardware.dll


#2

Your RTC have an invalid date or time


#3

Thanks, Gus. That was it. Should have caught that myself.