Saturday, June 14, 2008

Clock with 32.768KHz Crystal

I have learned from making a digital clock that setting TMR1L may apply some errors to the clock. As a solution, using a 32.768KHz crystal as an external oscillator will provide a better accuracy clock.
Why?
Because TMR1 with external osc. at 32.768KHz generates overflow interrupt every 2 seconds. If we set TMR1 to start at 0x8000 (32768), the TMR1 will overflow every 1 second!. Moreover, setting TMR1 to 0x8000 requires only TMR1H = 0x80 which does not affect the clock accuracy (setting TMR1L will affect the accuracy).

In my GPS clock, I am using PPS from GPS which is very accurate as an external oscillator. So, I don't need to use 32.768KHz crystal in my clock.

No comments:

Post a Comment