how to connect external crystal oscillator for PIC 16F630

Status
Not open for further replies.

srevish

Member level 2
Joined
Apr 23, 2013
Messages
48
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,661
Dear Sir,

I want to connect external oscillator to my PIC16F630 IC, can any one guide me how to interface how to interface it in the hardware and should it required any changes in the software.

I am quite new to this electronic world, your reply will be very valuable for me.


thanks in advance,,
 

you connect one terminal across pin #2 of the pic, and the other across pin #3 of the pic

- - - Updated - - -

Don't forget to branch at each terminal a 22pF capacitor, and group the extremities of the two capacitors to the GND

- - - Updated - - -

As for the software, what language are you using?
 

Attachments

  • pic.jpg
    18.4 KB · Views: 152




I am using C language, should I have enable anything in the program ?
 

I believe KhaledOsmani might have misinterpreted your request (or I did). His answer will work if you are using a crystal with the internal oscillator circuit of the PIC16F630. If I read your question correctly, you want to connect an external oscillator where the clock is generated outside of the PIC. If that is the case, connect the clock output to the CLKIN (pin 2) of the PIC.

You will need to set the configuration bits to define what clock source you are using. How you do it will depend on your compiler. Read your manual to find out how to do it.

For an external oscillator as I described, you need to set:

Code:
// EC: I/O function on RA4/OSC2/CLKOUT pin, CLKIN on RA5/OSC1/CLKIN
#define FOSC_EC              0xFFFB

If your are using a crystal as KhaledOsmani described, use:

Code:
// HS oscillator: High speed crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN
#define FOSC_HS              0xFFFA
// XT oscillator: Crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN
#define FOSC_XT              0xFFF9
// LP oscillator: Low power crystal on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN
#define FOSC_LP              0xFFF8

Which one you use will depend on the type of crystal you use so consult the data sheet.

The names of the configuration bits I listed are from HiTech C. Yours may be different. In either case, you need to configure the clock source or the PIC will not function as expected (if at all).
 



Thanks for your reply,

At present I am using hitech C compiler only.

In this circuit I am using 4Mhz internal clock, due to this I am getting some errors in the timing. So I have decided to go for the external clock.So for this application which method will give better solution to me.

Thanks in advance...
 

To use the external clock, add this to your program code.

Code:
__CONFIG(FOSC_EC);

As far as which method will give you a better solution, that's something you need to figure out on your own.
 

To use the external clock, add this to your program code.

Code:
__CONFIG(FOSC_EC);

As far as which method will give you a better solution, that's something you need to figure out on your own.

Dear sir,

I used KDS4.000MHz crystal and followed our steps, but the hardware did not respond, should I have to do any changes in the program ?

I am using picstart plus programmer to program the IC, during the configuration of the IC, in the oscillator tab I have selected "XT". Is this enough or should I have to include config codes given by you in the program ?

Kindly give your views.
 

Is it a crystal or crystal oscillator? They are 2 different things.

Refer to post#4 above and the data sheet for the PIC16F630 to set the configuration based on what you are using.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…