Under construction 3/13/2004
Many newbies have problems getting their first PIC project to work. Many have
a firm foundation in software but don't know the first thing about hooking it up
and making it work. The power supply, oscillator, outputs and all associated
wiring all has to be correct before the first LED lights.
Usually the first device the newcomer tries is the 16F84 device. In recent years the 16F628 has replaced the 16F84 with the addition of new features and compatible software. Check here for an explanation on the new features.
Usually the first software routine is making an LED flash. This tests the software writing and compiling, programming of the device, oscillator configuration and activity, power supply connections, and the LED connection.
Below are a few Q&A in getting your first project working.
Q1) My PIC programs but the LED doesn't flash.
A1a) Is the software written and compiled correctly?
A1b) Is the PIC programmed correctly?
A1c) Is the PIC getting the proper voltage and in the right polarity?
A1d) Is the LED polarity correct? Is there a current limiting resistor of proper value in series with the LED? Is the LED connected to the PIC and power supply correctly? See details.
A1e) Is the internal or external oscillator configured in software correctly? Are you using the correct crystal? Are you using the proper capacitors in the crystal circuit?
Q2) I have a push button switch on an input. When I run my routine, the response is erratic and it looks like I'm getting many activations when I hit the button. Why?
A2) An important thing to remember is that your PIC may be scanning the switch many thousands of time a second. A mechanical switch is two metal contacts that will open or close when depressed. In reality, the contacts will "bounce" many hundreds of times a second as the contacts either open or close. Your PIC will see this as if you are actually opening and closing the contacts this many times. In order to solve this, you can do it in either software or changing the switch to a "hall" effect type of switch. The latter may not be possible so you will have to solve this problem in software.
Q3) I am using a 9 volt battery and a 7805 regulator but the battery life is short. Why?
A3) This method will work for test purposes, but is very inefficient. The regulator device uses power from the battery and dissipates the same plus a little more current than the PIC device and any LED's. There are newer devices called "Low dropout regulators" that use very little current. In some instances you can use three alkaline cells (4.5 volts) to power the PIC directly or four NiCads to provide 4.8 volts. DO NOT use four alkalines. This will provide 6 volts to the device and will damage the PIC......to be continued......
Q4) Why is my regulator so hot it burned my finger?
A4) The regulator is dissipating energy by way of heat or it's oscillating or incorrectly wired. See details.
.....to be continued..