Easy and Accurate Clocks without RTC IC


Results 1 to 19 of 19

Threaded View

  1. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    micro,

    This short/simple algorithm uses TMRO with a prescaler of 256. This equates to 65,536 uS per TMR0 overflow (w/ a 4.000 MHz Xtal). Once TMRO is started, it is not stopped or reloaded with values – it is just monitored. 16 minutes 40 seconds = 1,000 S = 1,000,000,000 uS.

    1,000,000,000 uS / (65,536 uS / TMRO overflow) = 15,258.78906 overflows for 1,000 S.

    Since overflows come in integer values, the time error is

    0.78906 overflow * 65,536 uS / overflow = 51,711.99345 uS error.

    51,711.99345 uS / 1,000,000,000uS * 100 = .00517%.

    As you can see, the longer the clock runs the more accurate the clock becomes because you divide by a larger number (e.g., at exactly 1 year, error is .000000181%. The error approaches zero! Again, not too bad!

    The only real error is associated with the crystal. I use +/-20ppm crystals, which results in a maximum of 1.728 S per day (or 0.002% time error max in the long run). Let me know if I can answer any more questions.

    The provided code attachments in the original post are heavily commented and easy to use - Anybody had any luck with these programs?

    Note: This website comes in handy for testing
    http://nist.time.gov/

    Paul Borgmeier
    Salt Lake City, Utah
    USA
    Last edited by paul borgmeier; - 26th March 2006 at 07:39.

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts