Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Creating a PIC frequency supply

Status
Not open for further replies.

richacm

New Member
Hi,

I am getting a bit confused about creating clock frequencies for a PIC chip (PIC16F72 to be precise).

Looking at the datasheet for the chip I see it has an internal clock, but then some of the schematics seem to have external capacitors etc which I assume is to get the 20Mhz frequency required.

Do I need to create an external 20Mhz freq for the chip? If so how?

If I needed one I thought I would have to use a 555 timer chip - is this not necessary?

Or are these questions dependant on the use of the chip?

Thanks,

Craig
 
The 16F72 is getting pretty long in the tooth and requires an external clock (DC to 20MHz). You need a 20MHz crystal and a couple of 18pf caps. See my Inchworm Assembly manual for a typical schematic (the power and clock pins are the same for the 16F877).
 
I've only worked with the 16f877 and 16f877a, but i think this is how your pic should be connected, too.

I always connect an oscillator ( quartz+2capacitors ) to the OSC0 and OSC1 pins. The frequency of the oscillator is then creating the time base, for the microcontroller. You should most definitely check the datasheet of your pic out. It surely is containing information on this.
 
Last edited:
Thanks.

I am starting out so am not too sure what PIC chip to get - there are so many out there. Is the latest best one the 16F877?

Oh and where can I find your Inchworm assembly manual?

Cheers,

Craig
 
Yeah, the 16f877 is pretty good. Generally even most industrial processes use a 8-bit controller. If u send me your e-mail, I can send you the whole schematic diagram of how to connect this pic.
 
Last edited:
Almost all PIC's share the same approach for external oscillators, and are connected up like this;

**broken link removed**

Have a look in the data sheet, and within the first 5 pages you will find the Pin-out for the device, just hook the crystal oscillator up to OSC1 and OSC2.

Using internal oscillators makes life even easier, and they are very easy to setup in code!

My PIC of choice has been the 18F4550 of late, and setting up the internal oscillator with **broken link removed**is simple;
Code:
Device = 18F4550
Clock = 8
Config FOSC = INTOSCIO_EC

OSCCON = %01111111

// begin the program...

External crystal oscillators are much more accurate then internal oscillators though, this isn't a real issue for 98% of projects :eek:
 
I don't know if you're in my position, but as a beginner I found that Microchip's free sample service was a good way to get several different PICs to try out. Just got four 16F887A in the mail without spending a dime. Morton's introductory book is very good indeed and starts with 16F54, but my biggest problem was the oscillator thing, so my first success was with the 12F508 because it has an internal oscillator.

Would the 16F887 be a little complicated in terms of initialization for the uninitiated? The datasheet looks intimidating. 16F5x and 12F5x seem more straightforward.
 
I don't know if you're in my position, but as a beginner I found that Microchip's free sample service was a good way to get several different PICs to try out. Just got four 16F887A in the mail without spending a dime. Morton's introductory book is very good indeed and starts with 16F54, but my biggest problem was the oscillator thing, so my first success was with the 12F508 because it has an internal oscillator.

Would the 16F887 be a little complicated in terms of initialization for the uninitiated? The datasheet looks intimidating. 16F5x and 12F5x seem more straightforward.

I didn't realise that Microchip had a free sample service...I will have to investigate! I started using the 16F690 which came with PIC2Kit and that has an internal clock although that caused me some other problems in terms of adjusting the frequency. In the end I went down to my local hardware shop and bought a 16F877A and wired up the Oscillator as discussed in this thread. It worked perfectly and I have had no issues with it. The datasheet for the 16F877A is intimidating but it does make sense. Initially it took me about 6 or 7 reads of a section to understand it and then I posted here to make sure I really understood it. I am steaming ahead now though with PIC programming...its all good fun!

One other thing is I really recommend getting a 3rd party compiler when starting out....basic or C. It makes it so much easier to learn and faster to do stuff.
 
In the PIC's datasheet there should be a table of capacitor value's you can use. Look under the Oscillator settings.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top