PDA

View Full Version : RTC run too fast



pedja089
- 14th December 2012, 12:46
Hi,
I have PIC18LF46k80, with 32768Hz crystal on SOSC pin. i need 32 interrupts per second for other things.
Shematic:
6772
PCB:
6773

ISR:
DEFINE INTHAND myint
#CONFIG
CONFIG SOSCSEL = LOW ;Low power mode SOSC
etc...
#ENDCONFIG
TMR1H = 252
T1CON = %10001101
T1GCON = 0
ASM
myint
Clrf BSR
Btfss PIR1,0
GOTO End_RTC
Clrf PIR1
Movlw .252 ; TMR1H=252
Movwf TMR1H

Bsf _PULL

Movlw .141
Movwf T3CON
Movlw .255
Movwf TMR3H
Movlw .223
Movwf TMR3L
Bsf _TimeChanged,0
Incf _Ticks,F


Movlw .31 ;if ticks=32 then
Cpfsgt _Ticks
GOTO End_RTC
Incf _Seconds,F
Bsf _TimeChanged,1
Clrf _Ticks
Movlw .1
etc...

Crystal MH32768C datasheet:
http://www.farnell.com/datasheets/1322434.pdf
I think that problem is in capacitors for crystal. I upload schematic and pcb layout, it's probably ok, but...
I tried to put capacitors from 10,12,22pF and result always is same. About 10s to much per day...
PC clock(Internet time disabled) and mobile phone are my references.
Any idea how to solve this??
Thanks

fratello
- 14th December 2012, 16:05
6774Maybe this help ?!

pedja089
- 14th December 2012, 19:17
That is problem.. Because I can't sped few days adjusting cap...
I remove C6, now clock are much slower... C5 is 22pF...
I put 12pF on C5, and I will see result tomorrow.
Is both capacitor needed or just one?