___________________
WHY things get boring when they work just fine?
That would gain about 2.5 seconds per hour, which is not good.
Have you set LP oscillator mode in your configs?
Since it worked for you at 4mhz, it's probably set to XT and over driving the crystal.
How are you measuring that frequency?
Is it a high quality frequency counter?
Accurate measurements of low frequencies can be difficult, with large errors.
DT
Yes, I change it to LP when driving it with 32 kHz and your advised process to run timer 1 from internal clock (loading TMR1H=%11100000) & XT when 4MHz (with 32kHz attached 4 TMR1).
For frequency, unfortunately I am not equipped with those luxuries, I am just using an Timer Calculator I found in the Forum only. Screenshot attached.
___________________
WHY things get boring when they work just fine?
Even with loading 32768 into TMR1, the calculator shows the interrupts 1.00027 Hz.
This is just to seek clarification, it is unlikely that I will be able to use 4MHz for OSC & 32kHz for TMR1.
___________________
WHY things get boring when they work just fine?
That calculator is wrong.
Here's the way it works ...
The main OSC is running at 32768 hz.
The CPU is running a 8192 hz (32768 / 4).
Timer1 is loaded with the highbyte of 57344 and will overflow at 65536.
65536 - 57344 = 8192
So the timer overflows exactly 1.0000 seconds every time (depending on the crystal tolerance).
DT
___________________
WHY things get boring when they work just fine?
Financecatalyst, I would first check that the crystal is indeed operating at the proper frequency... (Frequency counter)
Dave Purola,
N8NTA
Bookmarks