PIC crystal, simple question, pins

Thread Starter

Gag14

Joined Jan 23, 2018
23
Hi
I use a crystal in my project , how should I set the pins , as outputs or inputs ?

thank you .
 

AlbertHall

Joined Jun 4, 2014
12,619
In the configuration settings you select the oscillator type depending on the crystal frequency. That takes over those two pins and you don't need to do anything else.
 

Thread Starter

Gag14

Joined Jan 23, 2018
23
so when I set the ports
I just put this line ?
movlw b'10000000' ;set Portc
movwf TRISC

I need one input and other as outputs .
and the configuration setting for crystal.
is it correct ?

for 16f877a
 

Thread Starter

Gag14

Joined Jan 23, 2018
23
But the crystal pins can not be used , correct ? as outputs or inputs
 
Last edited:

ericgibbs

Joined Jan 29, 2010
21,390
hi,
The 628 and 877 do not have a main internal oscillator block, so when a xtal is used, those pins are committed to the osc function.
E
 

ericgibbs

Joined Jan 29, 2010
21,390
628 does have an internal oscillator.
Hi Gag,
You are correct.
When I make a mistake, I back track to find out why.
I called up my 16F628 d/s and looked at the 'Special Features'.
On the PDF, it did not actually say 'Internal Oscillator'.
Re-checked on a 16F628A d/s and it says 'Internal Osc' for 16F628.
My error., should have taken more time looking.! :oops:

E
 

Attachments

ericgibbs

Joined Jan 29, 2010
21,390
hi Albert,
I believe that is what I said, in my corrective post.
'On the PDF, it did not actually say 'Internal Oscillator'.

Don't misunderstand me, I appreciate your feedback.

E
 

Thread Starter

Gag14

Joined Jan 23, 2018
23
hi
thank you all for help

it has dual speed,
How to set it to 4 Mghz ? I know other speed is 48 khz
 
Top