PIC Micro's For Beginners - How to wire up a PIC

    PIC micro's do not need much to operate, just a steady and stable voltage for Vdd and MCLR, and an external oscillator if you are not using the internal oscillator on the PIC.

    The diagram below explains how to hook up the basic requirements of the PIC micro, and although an 18 Pin PIC has been used in this example, the same analogy applies to any PIC micro, that is,

5 Volts too

MCLR

Vdd (40 pin PIC's have 2 Vdd's)

Earth (GND) to Vss (28 and 40 Pin PIC's have 2 Vss)

A crystal oscillator with loading capacitors if the internal oscillator is not used

    When in doubt, consult the PIC micro datasheet for the PIC you are using! Here's an example of wiring up an 18 Pin PIC;

How to wire up a PIC

Internal Oscillator

    Why use an external crystal oscillator if most PIC's have one built in? Well its because the internal oscillator is not nearly as accurate when compared to crystal oscillators, and for timing crucial (within nS range) applications this is important to know. Of course this is not required for 95% of projects/applications, just something to consider.

    As most of my code examples are written with Swordfish, there is one important factor to consider with the internal oscillator: the internal oscillator will default too 31Khz, and when Library Files are included for use within programs, they could (will) have initialization routines that will execute before your main program. This leads to long "start up delays" as the code to setup the internal oscillator is not actioned until the program has "initialised". Solution: make a User Library that initialises the internal oscillator clock speed, and simply included it first. Have a look at the PIC Transitions page I put together for different devices I use!

 

The capacitors

    The 10uF electrolytic capacitor is required to maintain a steady input voltage to the regulator, and should be used in all designs. If you are driving high current loads, then use a bigger capacitor, but in most cases, 10uF will be suffice. Keep in mind that electrolytic capacitors are polarity sensitive, and the negative lead is marked with a band on the side of the case.

    The 0.1uF ceramic disc capacitor is used to remove transient noises on the output. These are high frequency noises/spikes created from a range of sources and anomalies on your target circuit, and although not required on non timing crucial applications, I still place one to ensure the accurate timing operation of the PIC. Ceramic disc capacitors are not polarity sensitive.

    The 5 volt regulator (7805) can have a much higher input voltage then 12 volts, but heat becomes an issue even with small loads. More information about how to build voltage regulator circuits can be found here.

Basics Section: