PICKit3 Programming With MPLABX
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.
7805 +5v Regulator
20 MHz Crystal
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.
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.
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.
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.
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.
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 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.
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