justDIY
Active Member
I've started an ambitious project to build a data logging multi-channel temperature probe, with a VFD readout and a menu driven user interface.
I currently have a DS1307 BCD encoded serial real time clock, but I'm wondering what the best way to transform the data the clock gives me into something tangable I can use for data logging, averaging, elapsed time, etc.
since the finest time resolution I'm interested in is hours, I was thinking I could calculate the number of hours elpased since 10-1-2005 but then I began to think well, how will the program know how many days its been since that date, once the month goes by... I'd have to use a lookup table with the number of days in each month, and what happens when Feburary has the extra day every four years...
I suppose I could have a subroutine increment a counter stored on the eeprom, at the beginning of each hour it increments the value by one (checking for xx:00:00) but this count could get messed up by the user setting the clock incorrectly and then correcting it... and then what about day-light savings time where clocks here in the US move forward and back an hour with the seasons changing.
I'm not really looking for code samples, but insight from those who've already experienced this sort of thing. I'm also not really looking to produce a bullet proof commerical grade product here, just something nice and easy to use for family members as holiday gifts.
Gordon
I currently have a DS1307 BCD encoded serial real time clock, but I'm wondering what the best way to transform the data the clock gives me into something tangable I can use for data logging, averaging, elapsed time, etc.
since the finest time resolution I'm interested in is hours, I was thinking I could calculate the number of hours elpased since 10-1-2005 but then I began to think well, how will the program know how many days its been since that date, once the month goes by... I'd have to use a lookup table with the number of days in each month, and what happens when Feburary has the extra day every four years...
I suppose I could have a subroutine increment a counter stored on the eeprom, at the beginning of each hour it increments the value by one (checking for xx:00:00) but this count could get messed up by the user setting the clock incorrectly and then correcting it... and then what about day-light savings time where clocks here in the US move forward and back an hour with the seasons changing.
I'm not really looking for code samples, but insight from those who've already experienced this sort of thing. I'm also not really looking to produce a bullet proof commerical grade product here, just something nice and easy to use for family members as holiday gifts.
Gordon