PICMicro Project using PIC16F84 Microcontroller
In the past two weeks, I discussed the prerequisits for starting your first application and the issues surrounding PICMicro programmers and what to look for. With this background, I am now ready to present what I think is a good first application for somebody learning about the PICMicro. This circuit is not as simple as what I started with in “Programming and Customizing the PIC Microcontroller”, but can be used in the same way to experiment with different ideas and trying out new concepts.
The application itself consists of the 16F84 PICMicro (with power, reset and clocking “core”) with two LEDs and a button. One of the LEDs is lit by the PICMicro while the other is lit when the button is pressed.
Bill of Materials
4.7K 0.25 Watt Resistor
220 Ohm 0.25 Watt Resistor
10 uF 25 Volt Electrolytic Capacitor
0.1 uF 16 Volt Tantalum Capacitor
78L05 Voltage Regulator
5 mm Red LEDs
“Momentary On” SPST Pushbutton
Power Supply (> 6 Volts if Voltage Regulator used)
4MHz Ceramic Resonator (With Internal Capacitors)
When I built the circuit, I put it on a spring loaded “Breadboard” as is shown at the top of the article. I was able to put on the Voltage regulator at one end of the breadboard with the “red” commoning bar as positive voltage and the blue bar as ground. I used a +12 Volt “Wall Wart” for powering my prototype, but this circuit could be powered by a 9 Volt Alkaline radio battery. As I pointed out in the earlier articles, three “AA” 1.5 Volt Alkaline batteries could be wired in series to provide power as well.
For my prototype, I used a 4 MHz “Ceramic Resonator” for clocking. For this circuit, the operating frequency is not important. If you haven’t used a Ceramic Resonator before, I highly recommend that you look into them because they are a) easier to wire than a crystal and a couple of capacitors and b) are much more robust than a crystal, which means that you will be able to abuse them more and not loose your investment.
The LEDs are lit when the Microcontroller pins that they are connected to are pulled to ground. This is traditional in Microcontroller applications because in most devices, the “0” can “sink” more current than the “1” can “source”. The PICmicro is capable of sourcing enough current to drive an LED, but I prefer using the sink feature because this is the only way that the 8051 can light LEDs directly and this eliminates the need for me to convert mentally how applications work for different devices.
The button connection probably seems unreasonably simple because I have not provided a “pull up” for the switch to pull down. In the interests of keeping the circuit simple, I rely on the internal pull ups in “PORTB” of the PICMicro to provide this function for me. A 4.7K Resistor connected between Vdd and the PICMicro’s I/O pin could also be used if the internal pull ups are not used.
There is one point to make about the layout that you should always keep in mind when developing a circuit with a microcontroller or other programmable device; you should always design the circuit in such a way that the chip can be pulled easily. This means that there should be space at either end for prying the chip up out of its socket or, as I like to do, slide a small screwdriver underneath the PICMicro and “pop” it up simply by twisting it. I know a lot of people that end up cursing themselves because they’ve forgotten to remember this basic operation. In keeping with this theme, when using a “breadboard”, I like to put in a connection between the row of holes above the Microcontroller. This allows me to pull the part without having to figure out where it goes back each time.
For more detail: PICMicro Project using PIC16F84 Microcontroller
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
Current Project / Post can also be found using:
- pic16f84 projects