Time Keeping?
orrinbare
Posts: 32
I have a project going that will require a fairly accurate time. it will in theory operate 24 hours per day for the lifetime of the device with no human intervention (it will only DO something for about 30 seconds total during each day but will have to keep time and monitor push button status the rest of the time. i am using the BS2, i know how to program a "counter" but would it stay accurate? i don't have a lot of i/o pins to work with MAYBE 2, preferably 1, i could use something like this
http://www.parallax.com/Store/Components/AllIntegratedCircuits/tabid/154/CategoryID/31/List/0/SortField/0/Level/a/ProductID/234/Default.aspx
but just looking over the pdf for it, it will need more than one of my i/o pins, right?
also found
http://www.parallax.com/Store/Components/AllIntegratedCircuits/tabid/154/CategoryID/31/List/0/SortField/0/catpageindex/3/Level/a/ProductID/233/Default.aspx
this being a "time keeping chip" instead of a "timer" this sounds a lot more useful. i confess though, i read the pdf's on these and i don't understand a lot of it. has anyone reading this used either of these before? thoughts or opinions?
http://www.parallax.com/Store/Components/AllIntegratedCircuits/tabid/154/CategoryID/31/List/0/SortField/0/Level/a/ProductID/234/Default.aspx
but just looking over the pdf for it, it will need more than one of my i/o pins, right?
also found
http://www.parallax.com/Store/Components/AllIntegratedCircuits/tabid/154/CategoryID/31/List/0/SortField/0/catpageindex/3/Level/a/ProductID/233/Default.aspx
this being a "time keeping chip" instead of a "timer" this sounds a lot more useful. i confess though, i read the pdf's on these and i don't understand a lot of it. has anyone reading this used either of these before? thoughts or opinions?
Comments
There are other techniques for timekeeping, but there's nothing quite as straightforward as using something like the DS1302.
1) A counter which counts in seconds
2) Another counter which counts nanoseconds (or at least microseconds) into the next second
3) A way of reading out number of seconds, number of nanoseconds
4) Preferably also a way of (re-)setting the counter to a known value (whole seconds would be good enough, nanos may start on 0)
5) or, at least, resetting to zero unless 4) can be done.
With a chip like that you would have essentially everything needed for Unix-style timekeeping. A 32-bit counter could hold number of seconds since 1970 until 2038.
-Tor
@Lean, thats the page with the 3 main links broken. it is still useful though, as it has a wiring diagram and 3 downloadable code examples for BS2
I'm going even further out on my KISS limb to suggest that you consider hacking a cheap wristwatch. I've done it numerous times and they work reliably for YEARS. Every watch in the dollar store has an easily-set (?) daily alarm feature that outputs a 1.5V+ signal to a piezo beeper. A Stamp can easily detect that signal on a single pin and trigger a routine. Once triggered, your code simply needs to ignore the alram beeping for a minute or two until it stops and resets for the next day. I have also used the hourly chime to trigger things.
A lot cheaper & simpler than futzing with an external RTC chip, especially for an app where you simply need to trigger once a day. And you can change the alarm trigger time using the watch buttons, no computer reprogramming needed. And there's a FREE LCD display included on every watch!