BTW Henrik,
If you have already seen this, what is best (more accurate): internal 32kHz oscillator or external crystal?
BTW Henrik,
If you have already seen this, what is best (more accurate): internal 32kHz oscillator or external crystal?
Roger
An external x-tal will "always" be more accurate than the internal oscillator on a PIC.
On the 16F690 the internal 8MHz oscillator is specified as +/-1% under the best conditions (that doesn't mean it can't be better than that though) and the low frequency, 31kHz oscillator is labeled "uncallibrated" and no furhter specification can be found in the datasheet - as far as I can see.
Your typical €0.20 watch crystal is around 20ppm witch is 500 better than the internal 1% oscillator and if you pony up €0.60 you can get a 5ppm one which would then be 2000 times "better".
So the answer is that running TMR1 off of an exernal 32.768kHz Watch crystal is "better" (for timekeeping purposes) than running it off the internal oscillator. But if you're ALREADY running the PIC on a 4MHz crystal you might not gain much by using a separate crystal for the timer - except that the timer will keep on running when you put the device to sleep.
/Henrik.
Thank you Henrik.
I'm always in trouble when it gets to make time sensitive projects only using the PIC's features and thier own possiblities.
In some of my projects, I just use an RTC to use its 1Hz time base and have it read by an external interrupt in the PIC.
So, what is best?
Roger
Define "best".
Accuracy, long time stability, resolution, power consumption, ease of use, what?
You can either run the PIC off of an external 4MHz (or whatever you need) x-tal and derive the TMR timebase from the main oscillator. You won't get as slow as 1Hz but you can get, lets say, 100Hz and keep counting interrupts. Or you can use the TMR1 oscillator with a separate (32768Hz ) x-tal. Since it's a 16bit timer it will overflow every 2 seconds if you let it freerun.
/Henrik.
When timing is in the game, for me "best" is "accurate".
Does a higher crystal frequency mean more accuracy?
Is it best to choose 4'194'304MHz (32'768kHz*128) crystal and lots of interrupts (if used) or a 32'768kHz one (less interrupts - plenty of time to do "things")?
Roger
Doesn't really matter as far accuracy goes. Look at the frequency tolerance of the crystals you're considering, the one with the lowest value will be the most accurate one. But keep in mind that the TMR1 oscillator is designed specifically for low frequency crystals, typically a 32.768kHz. The datasheet for the 16F690 says DC to 200kHz.
/Henrik.
Thanks a lot, Henrik.
Roger
Bookmarks