Maybe??
Do you have the Watchdog turned off?
Maybe??
Do you have the Watchdog turned off?
Dave
Always wear safety glasses while programming.
Observations:
Watchdog is OFF.I just tried it with 4MHz oscillator, everything works fine. Intervals are 1 sec as expected. I took out the 32kHz crystal while PIC was working, it suddenly increased the speed of counting seconds(I WAS EXPECTING IT TO STOP ENTERING IN ISR) i.e. interrupts started happening a little faster. I inserted the crystal back in, the speed became ideal i.e. 1 sec interrupts.
Two questions now please:
1) Why didn't the Interrupts Stopped when I took the crystal out?
2) Why things get slow when I use 32768 Hz crystal as an oscillator for the PIC as well as the timer? 4MHz for PIC increases the current consumption to 2.5mA which is criminal when running on batteries.
___________________
WHY things get boring when they work just fine?
Are you saying that you have two 32768 crystals?
The CPU will be running at 8192 hz (FOSC/4).
You might as well run the timer off the main clock then, (saves the power used by the timer1 oscillator), and gives the same accuracy.
T1CON = 1
Reload TMR1H with $11100000, and definitely put it First in the handler.
And change the LCD timing because PBP still thinks it's running at 4mhz.
DEFINE LCD_COMMANDUS 17
DEFINE LCD_DATAUS 1
DT
___________________
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?
Bookmarks