Thank you a lot.
Thank you a lot.
Just one more thing that I had to deal with...
Selection of crystal and capacitors from OSC pins to ground is critical to get accurate clock. I tried one by one from 10 to 47pF, and best results are with 47pF. But that will depend from board layout and used crystal.
My suggestion is that you buy a lot of crystals, and select appropriate capacitor for it. And use that combination from now.
Thank you pedja089,
looks to be a challenge...
I'm glad that I could help.
Good luck![]()
Mike
You may wish to use a 32.768 kHz watch crystal.
Following from the PIC18F/LF1XK50 datasheet:
Norm11.6 Using Timer1 as a Real-Time Clock
Adding an external LP oscillator to Timer1 (such as the
one described in Section 11.3 “Timer1 Oscillator”
above) gives users the option to include RTC functionality
to their applications. This is accomplished with an
inexpensive watch crystal to provide an accurate time
base and several lines of application code to calculate
the time. When operating in Sleep mode and using a
battery or supercapacitor as a power source, it can
completely eliminate the need for a separate RTC
device and battery backup.
Thank you Norm, that looks interesting.
What about NEVER stop Timer1 into the ISR while setting TMRL=<some preload value> and TMRH=<some preload value> in that order?
This approach will be evil or could work?
Thanks.
mikebar
I'm not sure about the interrupt question.
Also see Run-Time Calibration of Watch Crystals and Software Real-Time Clock and Calendar.
Norm
Last edited by Normnet; - 13th July 2014 at 20:12.
Bookmarks