Hi rad,
I just recently posted an Elapsed Timer Demo in the sample code forum http://www.picbasic.co.uk/forum/show...=&threadid=190
This should make it really easy for you.
Your whole program could look like this.
Can't get much easier than that.Code:Include "Elapsed.pbp" Gosub ResetTime ' Reset Time to 0d-00:00:00.00 Gosub StartTimer ' Start the Elapsed Timer Loop: If DaysChanged = 0 then Loop DaysChanged = 0 ... Do the daily task here ... Goto Loop
Like Desterline says, the accuracy depends on the crystal. But I've found that with an HC49U type crystal, it holds to around 3-4 seconds per day. Even the DS1302/1307 has a tolerance of about 4 seconds per day so this is pretty good.
This doesn't have a battery backup, so if power is lost, the time will get reset. But then, there's a hardware solution for that too.
HTH,
Darrel





Bookmarks