Joseph Ellsworth / Mbed 2 deprecated xj-Init-clock-to-compile-time-if-not-already-initialized-ds1302

Dependencies:   DS1302 compile_time_to_system_time mbed

Fork of DS1302_HelloWorld by Erik -

You are viewing an older revision! See the latest version

Homepage

Initialize Clock To Compile Time

Initialize clock chip to compile time the first time the program runs after that it will read the time from the clock chip.

I find this an easy way to initialize my clock chip and then it stays set for as long as the battery lasts. I use a quick recompile then copy this utility to the mbed board where it sets the time and date. After than reload the mbed board with normal firmware and the clock remains set.

I use it for low volume testing.

Underlying library for parsing DATE and TIME is as follows:

call with the command printf("compile time=%s date=%s\r\n",TIME,DATE); time_t build_time = cvt_date(DATE,TIME); printf("compile time reformate=%s r\n", ctime(&build_time));

Referenced


All wikipages