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.

2 comments:

sanyam bajaj said...

hmmm well m a child(16)...i'd love to make dis digital clock....bt i could'nt understand a bit....so can u plz help me..to work on it...or an easy method so that i can work on it...

Unknown said...

OK I put crystal { 32768 } on clock of 15bit counter and it makes the Log1 for 1sec., log0 for 1sec., log1 for 1sec. and it work.

{ I am 13 yrs old}