Steve,
Do you know if the there is any difference in accuracy between using a xtal osc and the internal RC osc esp. in relation to timer interrupts?
Squib
Steve,
Do you know if the there is any difference in accuracy between using a xtal osc and the internal RC osc esp. in relation to timer interrupts?
Squib
Must be Steve's day off.
Hi Squib,
Well it depends on the internal oscillator type, and how you're using the interrupts.
The typical general purpose crystal will have a tolerance of +/- 50 PPM (Parts per million) Although there are other crystals with tighter tolerances, some down to less than 1 PPM. But they come at a higher cost.
If you're using one of the older 4mhz internal oscillators, depending on temperature and proper calibration numbers, they can vary up to +/-10% (100,000 PPM). A HUGE difference.
The newer 8mhz oscillators will vary a modest +/- 2.5% over the temperature range, but that's still 25,000 PPM.
If the interrupts are being used for "Long Term" timing like a clock, a difference of 1 PPM translates to an error of +/- 31.5 seconds per year. At 50 PPM it's 26.3 minutes/yr
But with the 8mhz INT_OSC, you're looking at a whopping 9.1 Days/Yr.. And with the old 4mhz osc you're off by +/-36.5 days. Yikes!
Of course these are "Worst case" numbers with maximum temperature extremes, actual results may vary.
hth,
DT
For reference, I recently tried to see what kind of baud I could get out of my pic serial port, using the internal 8MHz osc. I used an FTDI232R on the PC side, which accepts +/- 3% on the baud rate. The lower baud rates locked in fine, but at 125Kbaud, I had to slow the PIC baud rate down to 118k to 124k. (I did not try any fractions to get more precise failure speeds.) Apparently at the temperature of that particular pic at that particular time, the oscillator was running about 3% fast. That's 30,000 parts per million... way off, I would say.
Thanks DT for the info, those are some pretty scarey numbers you pulled up!
The reason I asked was I have a three minute timer using DT_14 interrupts and I also used Steves Pic timer calc but I'm consistantly getting the timer out by about -10 secs using the int_osc at 8MHz.
I'll try an ext_xtal and see if I get the same error, but comparing my error to the numbers you pulled up, mines probabaly due to a coding error. :-)
If I find a difference I'll let you know.
Cheers
10 seconds in 3 minutes ....
That's around a 5.5% error, and the OSC would be 7,555,556 Mhz.
http://spreadsheets.google.com/pub?k...uiCKE-EFrRLaZA
I think you're right about it not being the OSC
Are you using the Timer Template, or the Elapsed Timer?
DT
Apropos of nothing in particular . . .
I finally had a project where I needed a simple background "heartbeat" indicator while doing other things with a 16F627A, so I used Darrel's "overkill" blinky.
It works like a charm.
I'll tell everyone this:
It took a few tries, but solutions for each problem and error message I encountered were found on this site. I just had to Do A Search.
. . . well, except one instance--I was getting a message that the file path to the source code was too long (something like in excess of 62 characters). So I moved the file set to a different location with a shorter path. Duh!
I suppose the point I'm making, though, is that beyond RTFM and RTFDS, it doesn't hurt to DAFS.
The search tool Darrel posted works really well, sometimes with as little as a few words from the error message.
Kudos to Darrel Taylor!
Last edited by RussMartin; - 17th June 2008 at 09:46.
Russ
N0EVC, xWB6ONT, xWN6ONT
"Easy to use" is easy to say.
Bookmarks