There are several tools needed to get started in programming the PICs. I’ll briefly cover some software to develop in and hardware to load the chip.

Software

I use the MPLab package by Microchip. It’s an excellent IDE and is available free for download at their site.

As I go through examples I will introduce specific features of MPLab, I find this the easiest way to do it, rather than listing them out and assuming you’ll get em right away…

Hardware

KIT96 Programmer

On the hardware end is the actual device to send the data to the chip! For this I use kit 96 from www.kitsrus.com. It is a P16PRO compatible programmer, is quite easy to build, and looks pretty nice once it’s put together, a quality product. There is software available for it at www.picallw.com, and costs a mild registration fee to fully program anything beyond a 16F84(a).

There are other programmers but I must say this is by far the nicest programmer you’ll find short of the professional versions. And even some pro versions leave quite a bit to be desired.

The programmer operates on a wall-wart power adapter and a PC parallel port (yet programs the chips serially). I have added a 40-pin wide ZIF socket on mine to facilitate bigger PICs, and make it WAY easier to put chips in and take them out…

PICs are great little chips, useful in all kinds of projects. Here is a run-down of some of the features contained in the chips, as well as potential uses.

How to start… Well, first off, what is a microcontroller? Well, the difference between a microcontroller (heretoin referred to as MCU or μC) and, say, a computer CPU is pretty big… Here’s a little chart of some of the typical differences:

CPU

MCU

Onboard instruction memory

+

Complex math routines

+

Super-high speed

+

General purpose

+

All-in-one

+

Built-in I/O ports

+

Low power consumption

+

Microcontrollers are intended for small, specific purposes, they have their own I/O ports, own memory, nearly everything needed is built in. You’ll find them in your microwave, refrigerator, car, camera, tv, all kinds of things…

The microcontroller I’ll tend to use in the beginning at least, is the PIC 16F628. It has 2048 words of instruction memory, plenty of data RAM, lots of EEPROM storage, a serial module, PWM, Input Capture/Compare, Comparators, etc… Lots of features. These may seem complex but ignore it, we’ll start out with super simple stuff and not use any of it til later (if ever!)

This chip runs at 20MHz, which is PLENTY for the purposes we’ll be putting it to, heck it’s an insane amount faster than needed. You can get them for about $4 at Digi-Key.

Schematic

Each of the pins you see there have a specific purpose, which is explained on the following page. A quick look @ the datasheet reveals this:

Legend:

<–> denotes a bi-directional data line

–> going INTO the chip denotes input-only

<– going OUT of the chip denotes output-only

the pins may have various labels, depending on how you decide to use them in your design

if a label has a BAR above it’s name (i.e. MCLR) it is active LOW, meaning the pin is “enabled” @ 0V instead of @ +5V

The 16F628 has 2 – 8bit data ports. They are the RA0..7 and RB0..7 you see on the diagram. Vss = Ground, and Vdd = +5V typically, and in my examples, always. CMPx are comparators, TX/RX are serial guys, etc, they are all described in the datasheet. For the first few tutorials, I’ll only be using them as straight digital outputs, no funky stuff.