- Published: Monday, 09 March 2009
- Written by Digital DIY
- Hits: 29770
If you run into issues with this guide or others on the site, please check out the digital-diy.com forums and feel free to post or help others!
PICs are small programmable IC's that have many pins which can be turned into inputs and outputs for any range of tasks. With this incredible feature, coupled with many other 'built-in' peripherals, PIC micro's have infinite uses for projects and applications.
There are many ways to program a PIC, wether it be the type of programmer or the compiler (software used to develop programs), the first couple of stepping stones entailing programming your first PIC are usually where people give up. This basic guide is designed to get you off your feet, and program your first PIC, by not using dodgy programmers or software, just explaining the raw real truth of what are the best tools to use for PIC development.
Before I get much further, I would like to clear one fact up, there are different families of PICs, in particular, the 16Fxxx range and 18Fxxxx range. There are others, but these two are the most popular and supported. Briefly said, Microchip never discontinues a product range. They offer continual support from the date of release, until the present day. With this in mind, there are many types of PICs out and about, some are very old. The 16F range is old, and while they have no errors, they do have flaws in regards to the way memory is handled in particular. This is why I really recommend using 18F PICs, they are newer, operate faster, and have a lot more features ready to go.
To start off with, I bet your wondering how we control the state of pins on a PIC, first of all, lets have a look at the pin-out of a PIC micro, in this case the 18F1320. Here's what one looks like in real life;
And this is the pin-out of the PIC (pin 1 can be identified as the one to the left of the indent on top of the IC)
It looks like jargon if you haven't played with PICs before I know... The next learning curve is the PICs pins are grouped into ports. As you can see, pin 1 is RA0, this means PORTA pin 0. Pin 2 would be PORTA pin 2. As you work your way around the PIC, you will notice that the pins for each port are not necessarily sequential according to their physical location, and you will also see pins labelled MCLR (pin 4), Vss (pin 5) and Vdd (pin 14), amongst others.
These newly discovered pins are the "vitals" for the PIC to operate. Vdd is the positive supply, Vss is earth and MCLR is a hardware reset pin, and must remain high or else the PICs program will reset. The supply voltage for PICs is typically 5 volts, some can go lower then that, but for all tutorials besides those that specify different, Vdd refers to 5 volts. Your power supply should be your first project, and it utilises a 7805 IC which has three pins, input, ground and output. Put simply, it turns any voltage above 6.5 volts and up to 12v into a steady and very stable 5 volts. More can be found on the how to build a voltage regulator tutorial.
- Next >>