Nigel Goodwin said:
Either way, what you need is "Julian Number Routines", these produce a single number representing a day, actually the number of days that has passed since a certain specific date. They usually use a start day back a few hundred years, simply because the calendar changed then, and it's remained identical ever since.
Modern languages like Delphi (and presumably C or VB) will already include Julian date routines as part of the compiler. Implementing them on a PIC is likely to be fairly hard, because of the maths involved - but certainly possible.
OK ... so I was thinking along the right lines ... but I knew I didn't have to re-invent the wheel someone must have done it before.
This is my wish list:
Store for each channel
* 24 Hour Highest and Lowest Temps
* 7 Day Highest and Lowest Temps
* 30 Day Highest and Lowest Temps
* Highest and Lowest Temp Since 01/01/XX (per year)
Store overall
* Highest Temp Ever Recorded - store channel, date and time
* Lowest Temp Ever Recorded - store channel, date and time
* Running 24 Hr Average for each channel
* Running 7 Day Average for each channel
* Running 30 Day Average for each channel
* Yearly Average for each channel (store the year, the chan #, the yearly average)
The lists are arranged in priorities, from what I'd most like to accomplish to what is least important.
As far as PC connectivity, the thought has crossed my mind from time to time, but for now, I'd like to try to do everything onboard.
The way I envision it:
the data logging portion only needs to store a weeks worth of data for each temperature channel (five in all) so that is 168 hours of temperature samples (each sample would be one byte) per channel times five channels = 840 bytes just for the temperatures (my eeprom is 64 kbytes) ... this will give me data to go back an hour, a day, a week. I'll store that data so it overwrites in a loop... once 168 hours have been recorded, start over at the beginning. I suppose that will give me some tricky math to "go back" several days if the pointer is only a few hours into a loop of the samples cycle
from there, I'm sorta lost ... I haven't come up with how to store or compute the monthly and yearly datas
here is more a more in-depth write up of what I'm working with, for refrence:
https://projects.dimension-x.net/technology-and-projects/exploration-of-max1668/