Real Time Clock - G120 fez cobra II

Hi,

I am using Real Time Clock, and I am referring to following document :

[url]https://www.ghielectronics.com/docs/29/real-time-clock-rtc[/url]

There are few scenarios that I have to make sure.

1 . I set the current time and date using this function - RealTimeClock.SetDateTime(DT); . My application using Watchdog, so if something goes wrong then it will reset the device and run code again, so if it will run again then time will set back to whatever has defined in my code. I have defined like - public DateTime Date = new DateTime(2015, 8, 26, 11, 10, 1);. so , where can I set time so it will only run once, even though device will reset.

  1. In a case of power loss, once systems shutdown does clock still running ? . I tested, but found that it is not working as after powering device on Real time Clock gave me old date( 1/1/1977) . So, when system get power back, is there any way that I can set the time to current time ?
    How could I make it code know that power has lost and now come back, so it can set the time ?

Thanks

@ Akshay - Have you attached a battery for the RTC to your board? If not, then the clock will get reset on a power loss.

@ Mike - Nope, I haven’t connected, so should I just connect to pin called RTC_VBAT ? How much voltage battery will it require ?

@ Akshay - The pin and voltage information should be in the G120 manual.

G120 manual doesn’t says how much voltage, but I found on forum suggesting any 3 V battery will work.

I suggest you look at the old schematics for the Cobra II extender for the RTC circuit.

[url]http://www.ghielectronics.com/downloads/schematic/FEZ_Cobra_II_EXT_SCH.pdf[/url]

Where do I get GHI.processor? I can’t find it anywhere.

@ xrstokes - It is in GHI.Hardware.dll.