View Full Version : Crystal osc running but PIC not using it
p15218
- 17th February 2007, 18:10
I'm trying to use the PBP Count function with a bit more stability than the 16F690's internal RC oscillator provides.
My problem is that I have the crystal oscillator running with the following edit to 16f690.inc file:
; __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF ------- original code
__config _HS_OSC & _WDT_ON & _MCLRE_ON & _CP_OFF --------my edit
BUT it matters not if I remove or short the crystal, the code still runs!
I've checked the 4 MHz crystal's pins with a scope & counter and it is active at about 3999990 Hz, close enough to 4 MHz for me.
MCLR is pulled high with a 4.7k Ohm resistor.
What else do I have to do to enable the crystal oscillator internal to the PIC ?
thanks
Bob
Charles Linquis
- 17th February 2007, 19:24
Your problem lies with the line
__config _INTRC_OSC_NOCLKOUT
The "_INTC_OSC" part means to use the internal oscillator.
You should change this to "_XT_OSC" instead
p15218
- 17th February 2007, 20:09
Your problem lies with the line
__config _INTRC_OSC_NOCLKOUT
The "_INTC_OSC" part means to use the internal oscillator.
You should change this to "_XT_OSC" instead
Well thanks but I did...notice the ";" commenting the "_INTC_OSC" line out.
Changing to "_XT_OSC" has activity at the crystal as well as _HS_OSC did with the same result that pulling the crystal makes no difference, the code runs no matter.
Darrel Taylor
- 18th February 2007, 04:16
Make sure your programmer is updating the CONFIG settings of the chip.
Usually there's an option for that.
It may still be using the CONFIG settings from a previous program.
<br>
Archangel
- 18th February 2007, 06:24
Hi Bob,
This particular PIC has special Oscillator, options and Has FSCM, which stands for Fail Safe Clock Monitor - datasheet page 49 of 294 and as I understand it, it automaticly deploys an internal clock when oscillator failure occurs, pretty darn nifty feature unless you are doing what You want to . Easiest way is use a cheaper PIC.
mister_e
- 18th February 2007, 11:25
Easiest way is use a cheaper PIC.
And never learn... not for me.
Archangel
- 18th February 2007, 11:59
And never learn... not for me.
Me no understand . . . was I wrong?
mister_e
- 18th February 2007, 12:13
may bee hi deed not reed care foolee dee hole tred ;)
'The Easiest solution and use another PIC' reply always drive me nuts when the user don't need to and have a nice 'learning opportunitie' on hand... i know i may have badly interpret it anyways... Need to sleep... sorry :(
Good news, you are right! Assuming the Fail-Safe clock monitor AND the int-ext-switchover mode are both enable, at POR, the internal OSC run @ 4MHz.... hence why it always work without noticeable bugs.
p15218
- 18th February 2007, 13:56
Ah, thanks to Joe S. for the info. I have verified this by using a 4.91 Mhz crystal, far enough out to show errors in frequency counting.
Pulling the crystal had the PIC instantly switch to it's internal RC source. THANKS!
Bob
Archangel
- 18th February 2007, 22:33
may bee hi deed not reed care foolee dee hole tred ;)
'The Easiest solution and use another PIC' reply always drive me nuts when the user don't need to and have a nice 'learning opportunitie' on hand... .
ICE e e e e gotit EWE SCAERT MEE . . thought I missed something in de datasheet, possible as it was about 4 am here when I wrote that.:) HE HE You don't miss very many MASTER_E, I humble grasshopper, wish, only to learn . . .
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.