how to keep accurate time without RTC?
tad4shi
Posts: 3
in Propeller 1
Hey everyone,
is there a way to keep accurate time(a few seconds a day) without an RTC, with only an external crystal?
Also, is there a way to automatically set the clock to the current date/time on every upload?
Thanks!
is there a way to keep accurate time(a few seconds a day) without an RTC, with only an external crystal?
Also, is there a way to automatically set the clock to the current date/time on every upload?
Thanks!
Comments
By "upload" do you mean when programming the propeller, or is it when uploading data from a Propeller to a comms link? If the latter, you can program the Propeller to accept a time string send over the same link.
Some languages have macros or other means to put the compile time into the code. That may be another trick to do this.
And you can automagically (Makefile?) manipulate your code to set some variable to the date and time e.g. using `sed` or generate a small code snippet with some `printf` or `echo` commands to be included as object, include file, ... or whatever makes your compiler happy.
I'm not rating which solution may be the best.
One Second a day, is ~ 11.6ppm, which is tighter than an average crystal, but it is possible to calibrate each boards crystal, and store that in EEPROM.
eg a GPS 1pps signal can calibrate to fractions of a ppm
That drops you to drift levels, over time and temperature, and for modest ambient changes I would say sub 10ppm is possible.
Sure, many ways to do that.
If you wanted no other code running, you could place a signature in the binary file like 'HH:MM:SS' immediately before your time variable.
A special downloader variant would look for that 64b string signature, and patch in the next 32b with the current time + delay correction.
When the Prop exits reset and finishes loading, it simply starts from that patched time value.
-Phil
"and patch in the next 32b with the current time + delay correction."
It will use the PC's (local time) of compile,
it will not update if no changes was made to the file, so you would always have to click refresh on the file that uses it.
So getting outside access to grab current time is better.
https://datasheets.maximintegrated.com/en/ds/DS1672.pdf
It uses a single 32khz crystal and a backup battery and communicates via I2C. Thats three extra components on your board.