PDA

View Full Version : Check oscillator/Xtal accuracy - how to?



flotulopex
- 4th March 2009, 10:54
Hi,

What is the best way to check the oscillator's or the Xtal's accuracy?

Setting a Pin HIGH then LOW and startover again seems clearly not a good way of doing.

Acetronics2
- 4th March 2009, 12:25
Hello, Roger

Last time I did that ( 15 days ago ...)

I used my R/C Transmitter ( 1500µs neutral )... and placed a "PULSIN" command at the other end ...

Result Was OscTune +6 and +9 @ 4 Mhz, for a couple of 16F88 in Int RC mode.

You also can use a DIL canned Oscillator and a gang of dividers ( 4040 ??? ) to get a "readable" signal period.

Alain

Melanie
- 4th March 2009, 14:29
Frequency Counter! They're cheaper than a round of drinks at the pub nowadays... (even some DVM's go to 10MHz) but don't connect directly (it'll load the oscillator)... a couple of turns of enamelled copper wire around a small jar fed back with some coax to the Frequency Counter is enough to pick up a signal.

If you must connect, always do it on OSC2 which is the drive-out pin.

flotulopex
- 4th March 2009, 15:28
Connecting an oscilloscope directly to the resonator or Xtal will allow me to check the oscillator only.

To make a nice and clean measurement of the PIC itself allowing me to fine tune it (OSCTUNE register), how should I do?

Bruce
- 4th March 2009, 17:54
For the internal osc, just set your config option to output Fosc/4 on OSC2 and check it
with a freq counter or O-scope.

With a 4MHz internal osc, you should see a 1MHz output on OSC2 when it's spot-on 4MHz.

flotulopex
- 4th March 2009, 18:22
Thanks Bruce,

What about measuring the PIC's accuracy with an Xtal?

Bruce
- 4th March 2009, 18:34
Well, since the PICs accuracy is totally dependent on the external crystals accuracy, I
would suggest you look into what Melanie posted above...;o}

A freq counter will do the trick as long as you're not loading the oscillator.

If Melanie says it works, you can normally take that to the bank, and be done with it.

She knows her stuff..;o}

flotulopex
- 4th March 2009, 19:34
So I'm going to take Melanie's advice as the "absolute" truth.

As you say Bruce, what Melanie says, it is!

Thanks All.

Bruce
- 4th March 2009, 19:56
I wouldn't take anything anyone says here as the "absolute" truth, but my
money would be on whatever Melanie said unless I was 100% sure I could prove
it was otherwise..;o}

And good luck with that!

Darrel Taylor
- 4th March 2009, 20:50
If you don't happen to have a frequency counter.
You can put a 32768hz watch crystal or DS32KHZ compensated oscillator on TIMER1 and use it as the time base to measure your system frequency.

I trust it more than frequency counters, which in the Mhz ranges can be off by several Khz, depending on the quality of the counter.

An example of the technique can be found in Microchip's AN244.
Although it's geared towards calibrating the internal oscillator, the concept is the same for externals.

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en012071

flotulopex
- 5th March 2009, 06:11
Thank you Darrel.

I should have started searching there... Lots of infos to find in the application notes ;-)