Microchip PIC Building BlocksEvery project usin a Microchip PIC processor requires several standard building blocks. Power SupplyI prefer to do initial testing under battery power, first, if something goes wrong, the damage is limited due to the low current available - although, you can potentially damage any of the components you are using, damage to any PC or other equipment is much less likely. For projects that draw more current, or are to be left turned on for long periods of time, a wall plug power supply is the way to go. Power from wall plug or battery supply can be regulated to the PIC's nominal requirement of 5 Volts using a small 78L05 three pin regulator chip. These with the aid of a couple of smoothing and decoupling capacitors can supply up to 100mA of current to your project. Many people also prefer to include a blocking diode in the line to prevent damage should the battery or wall plug be connected the wrong way round.
Here is the circuit I use:- ![]() The capacitors are 10uF electrolytic. Flashing LightsAlthough many projects do not need a visible indicator, connecting a led and 330 ohm to 1k series resistor between 5v and a port pin will allow you to see what is going on (if you turn on/off the port pin at various stages of your program). This simple circuit forms the effective PIC 'hello world' circuit - if you can blink a led, you have managed to control the processor. There is a very useful reference to this at Blink a Led, using the free JAL language, circuits and pre-compiled programs are shown for many of the standard PIC processors. Basic GatesIn many circuits, one or more basic gates are also required to condition inputs to the PIC processor. If the requirement is simply an inverter and possibly level converter for the onboard RS232 interface, the circuit here will suffice:- ![]() The above circuit was adapted from the examples given here R1 limits the voltage into the transistor. The 10k shown will allow RS232 input from a laptop or similar device, lower values ,may be required for use with the output of another PIC or other 5volt device. R2 pulls up the input, and allows proper operation when the input is connected to an open collector output. The transistor may be any small switching npn type. The Diode is only required if the input will fall below 0v (as in an RS232 connection). I have used a pair of the above inverters to connect a PIC to the RS232 port of several computers via their built in RS232 and external USB converters. It is also possible to use diodes and other components to impliment OR and AND gates, however, if more than a couple of these are required, it makes sense to use an IC from the 74LS series or similar as it is easier to add an extra IC than several gates built from discrete components. |
![]()
Introduction |