Using external xtal osc with a PIC

pebe

Sep 3, 2013
83
Joined
Sep 3, 2013
Messages
83
I want to use a 20MHz crystal module as an oscillator fed into GPIO 5 of a PIC 12F629.
Does that still tie up GPIO 4 pin as the OSC out pin, or can I use it as an input?
 

Minder

Apr 24, 2015
3,561
Joined
Apr 24, 2015
Messages
3,561
The manual shows that setting Osc CONFIG to EC retains I/O on GP4, GP5 is OSC CLK.
M.
 

pebe

Sep 3, 2013
83
Joined
Sep 3, 2013
Messages
83
Thanks, M.
I haven't got a manual, as such. But looking at Microchip 33023A.PDF section 27.1, I cannot see a reference to EC. How would I describe it in the config file?
Sorry for my ignorance but in the past I have only used the internal RC oscillator.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The best place to look for these in in the include file for the processor found at:

"Program Files (x86)\Microchip\MPASM suite"\p12f629.inc"

You will see this line:

_FOSC_EC EQU H'3FFB' ; EC: I/O function on GP4/OSC2/CLKOUT pin, CLKIN on GP5/OSC1/CLKIN
 

Minder

Apr 24, 2015
3,561
Joined
Apr 24, 2015
Messages
3,561
See or Down load manual DS41190G see p54 CONFIG register.
You should have a header in your file setting the Config bits.
M.
 

pebe

Sep 3, 2013
83
Joined
Sep 3, 2013
Messages
83
Thanks to you both. It's so much easier when you know just where to look:)
Just to confirm, do I use _FOSC_EC ?
 
Top