NETMF Get/Set Real Time Clock (RTC)

Just a short reminder post on how to get and set RTC.  The RTC is powered by VBatt pin and keeps the RTC ticking with the time after you set it once.  After you set it, then just read the time on boot and set the system clock.

private static DateTime SetDateTimeFromRTC()
{
    // RealTimeClock.SetTime(new DateTime(2011, 4, 22, 1, 1, 1, 0)); // Set once to set the RTC.
    DateTime dt = RealTimeClock.GetTime(); // Get RTC time.
    Utility.SetLocalTime(dt); // Set system clock.
    return dt;
}
About these ads
This entry was posted in .Net Micro Framework, C# and tagged , , , . Bookmark the permalink.

One Response to NETMF Get/Set Real Time Clock (RTC)

  1. palsor1 says:

    William,

    If possible, could you contact me? I have some questions about some of your older code. Thanks!

    palsor at yahoo dot com

    - Andy

Comments are closed.