Hi,
Do you have a nice clean power supply and a fresh backup battery?
Is it always loosing/gaining the same much every day or it is depending on the temperature?
Is the PIC always running or is it asleep?
If the pic is always running and the error is always the same you simply adjust for it in your code i.e add 4 seconds per day running
If the pic is asleep you need to know when you wake up how many days it was since you last corrected this problem. i.e sleep for 25 days... wake up... read DS ... realize it was 25 days ago.... add 25*4 seconds to the current time....store last correction date... do your stuff.... go back to bed
All RTC's has a built in error, some more, some less but they all have it. And the trick to get it accurate is to compensate for it in the code by + or - the right amount of seconds.
Done properly in a stable temperature environment you can adjust n sec per day, x sec per week, y sec per month and z sec per year.
Then you can run it för a million years :-)
or you can buy 1000 x-tals and measure them all and pick the best one ;-)
/me
Bookmarks