The PICKit3 is microchipβs newest official PIC programmer and while people argue about how good it is, this programmer has never done me wrong. I upgraded away from the old ICD2 clone programmer that I had used for years when I saw that microchip sells their PICKit3 for under $50 and so now Iβll pass on my experience of how to use it, to you guys!
In this article I will explain the process of building up the basic PIC circuit, enough for it to be programmed, and then I will show you how MPLABX and the C18 Compiler is used with the PICKit3 to program the PIC microcontroller, using a simple LED flashing program.
Purpose & Overview of this project
The goal of this project is to install an IDE suite for writing our programs, install a compiler for that IDE suite and to build the minimum hardware circuit necessary for loading programs onto the microcontroller.
We will use microchipβs MPLABX combined with microchipβs C18 Compiler to compile our firmware program and then load it onto a PIC. The PIC weβll use for this project is the generic 18F452.
PIC 18F452
7805 +5v Regulator
20 MHz Crystal
10kΞ© Resistor
1uF Capacitor
5mm LED
Breadboard
Breadboard Wire
SIPs
9v Connector
Battery Holder
Parts List Details
You are probably familiar with most of the parts listed out above, but if thatβs not the case-donβt fear! I will briefly explain the purpose of the most important parts in the sections below.
PICKit3
The focus of this article is using the PICKit3 to program the PIC. The PICKit3 is microchipβs newest programmer for loading programs onto the many different version of the 12xx, 16xx, 18xx, 24xx, 32xx and other series of PICs that microchip manufactures, so getting a PICKit3 is a one-time cost and great investment.
PIC 18F452
The PIC 18F452 is a fairly generic and widely available microcontroller. I have used it in many, many of my articles and projects so after you master programming the PIC using a PICKit3 you can try your hand and building similar projects like mine.
7805 +5v Regulator
This component is used to regulate the +9v or larger that comes from the power supply or battery that Iβm using down to the +5v that the PIC needs to have.
20 MHz Crystal
I chose 20 MHz semi-randomly, any crystal 4 MHz or higher will work for this article. This will act as the clock speed with the PIC instruction speed being 20 / 4 = 5 MHz, because it takes 4 clock cycles to execute 1 PIC instruction.
Breadboard and Breadboard Wire
The breadboard will serve as our platform for connecting everything together and the breadboard wire is what weβll use to actually connect everything together.
9v Connector
Since most people donβt have dedicated power supplies for hobby electronics, I find it is typically easier to use a battery like a +9v or a battery back, so this connector makes it easy to bring power and ground through the red/black wires to the breadboard.
Schematic Overview
The schematic for this project is the basic PIC programming circuit. Many safety components that a professional designer would add to the circuit have been deleted to make the circuit as simple as possible. Since weβre doing simple hobby electronics this doesnβt really make a difference. The main parts in the schematic are the PICKit3, PIC 18F452 and 7805.
Schematic Specifics
Power Regulator
The 7805 converts the input +9v down to a +5v output which powers the PIC. The PIC has two spots where it connects to power and ground, and there is a single 10kΞ© resistor connected to the MCLR Pin1 of the pic that goes to power.
ICSP connection
ICSP is short for in-circuit serial programmer and this is the port used on almost every PIC microcontroller to load your program onto it. The PICKit3 has the same pinout as the connector seen above, the little dot on the PICKit3 tells you which connection is PIN1 or MCLR.
LED Output
A single led can be seen off of PORTA RA1 or PIN2 on the PIC. This led will be used to confirm that out program was successfully loaded onto the PIC by flashing on and off at a predetermined speed.
For more detail: PICKit3 Programming With MPLABX