Author | Eur van Andel, Copyright (c) 2003..2008, all rights reserved. |
Adapted-by | |
Compiler | >=2.4h |
This Interrupt Service Routine updates the variable seconds about once per second. The precision is 0.2 ppm, the accuracy depends on the Xtal used.
http://www.romanblack.com/one_sec.htm, http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
This is the Bresenham Line Algorithm, invented at IBM in 1962, which gets an accurate end result by summing the small errors resulting of taking discrete steps and correcting when the error gets too large. This means that individual second lengths may show some jitter, but that long-term timekeeping is accurate. Original assembler by Roman Black.
No dependency found
var volatile byte seconds -- updated by ISR
const mid = 0x4B
var volatile byte bres_lo = lo
const lo = 0x40 -- ideally modified in timeset too, to adjust clock
var volatile byte bres_hi = hi
const hi = 0x4C -- 2 000 000 for 20 MHz xtal and prescaler = 4
var volatile byte bres_mid = mid
var volatile byte seconds -- updated by ISR
No documentation found
const mid = 0x4B
No documentation found
var volatile byte bres_lo = lo
No documentation found
const lo = 0x40 -- ideally modified in timeset too, to adjust clock
No documentation found
var volatile byte bres_hi = hi
No documentation found
const hi = 0x4C -- 2 000 000 for 20 MHz xtal and prescaler = 4
No documentation found
var volatile byte bres_mid = mid
No documentation found
RTC()
No documentation found
sample | 16f877a_rtc_lcd.jal |
sample | 16f876a_rtc_lcd.jal |