Introduction: How to Program PIC MCU With PICkit Programmer Using a Breadboard
You do not need expensive and sophisticated tools to play with PIC (or any other) microcontrollers. All you need is a breadboard where you test your circuit and programming. Of course some kind of a programmer and IDE is necessary. In this instructable I will use MPLAB X IDE and PICkit3 programmer.
I have chosen PIC18F14K22. There is no special reason for this particular PIC, I just have it unused at the moment. It works in the voltage range between 2.3 V and 5.5 V. The programming process will be shown with the simple code that lets the LED periodically blink.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: What We Need
Step 2: Wiring
Let's take a look at the PICkit3 programmer. Notice the 6-pin female header on the bottom side. The pin number one is signed with a white triangle so from the front side pins are numbered from right to left. Pins' description:
- ICSP Data
- ICSP Clock
- Not connected
First place 6-pin header and PIC close enough to each other on the breadboard. In the PIC datasheet we have to find out functions mapping:
- Vdd - pin 1
- Vss (ground) - pin 20
- PGD (ICSP Data) - pin 19
- PGC (ICSP Clock) - pin 18
- MCLR - pin 4
- RC0 - pin 16 (the pin by which the LED will be driven)
The circuit scheme is shown in the Fritzing picture.
As it was mentioned earlier the circuit can be powered either from the 4.5 V battery or the USB outlet (5 V). To make it clear 5 V is ok for this particular PIC but does not have to be for others. Always check the datasheet for the voltage range applicable to the device.
Step 3: Programming
I prepared pretty simple code for testing purposes. When you have the MPLAB project ready for programming attach the PICkit3 to the pin header on the breadboard. Do not forget to have the circuit powered otherwise the connection between the PIC and the programmer fails. Click the "Make and Program Device Main Project" button and wait until the programming is finished. After that the LED should blink - 500 ms on and 500 ms off.