Phipps Electronics

Order within the next 

FREE SHIPPING OVER $199

50,000+ ORDERS

WORLDWIDE SHIPPING

SSL SECURED

How to Program a PIC Microcontroller

Contents

Got some PIC microcontrollers but don’t know how to program them? Read through this article to learn how to program PIC microcontrollers.

PIC MCU
PIC K150 Programmer

Introduction

Nowadays, it’s easy to program modern development boards. You simply hook them up via a USB cable to your PC, run your programming environment, choose your board and chip type, write your code, and then upload it with a click of a mouse button. Thanks to the advent of the Arduino ecosystem, the process of programming a chip or board has become much easier.

However, as you’ll see later, not every chip works with Arduino. Several chip manufacturers choose to have their own proprietary programming peripherals and software. One of them is Microchip, which keeps its popular PIC MCUs programmed by its proprietary programmers and software.

Here, you’ll learn how to program PIC microcontrollers with different programmers and development environments. 

How are PIC Microcontrollers Programmed

Like other microcontrollers, PIC microcontrollers can be programmed in-system through ICSP (In Circuit System Programming). ICSP means the chip can be programmed inside a circuit, no need to take out the chip in order to program it, as long as you have access to the ICSP lines.

How to program PIC microcontroller in circuit ICSP

However, PIC microcontrollers have a unique set of classic ICSP lines: Reset, VDD, VSS, ICSPCLK, and ICSPDATA. These lines are very different from what Arduino has. The table below compares standard 6-pin Arduino and PIC MCU ICSP lines.

ICSP LineArduinoPIC
Pin no.FunctionPin no.Function
Reset5RESET1RESET
Power2VDD2VDD
Ground6VSS3VSS
Clock3SCK4ICSPCLK
Dat14MOSI5ICSPDAT
Dat21MISO6Reserved

To add to the complexity, Arduino development boards usually employ a bootloader. Through this bootloader, an external programmer is not needed. With this, popular Arduino development boards, such as the UNO or MEGA, do not need external programmers. These dev boards have a built-in USB-to-UART chip which serves as a communication interface between your PC’s USB port and the MCU. A bootloader code is written inside the chip, which effectively self-programs the chip through commands on the PC. Note, however, that you have to reprogram the bootloader code with an external programmer in case the code gets corrupted.

UNO R3 Board ATmega328P CH340G Arduino Compatible with USB Cable

HOw to Setup the PIC MCU ICSP Lines

The ICSP lines should have a direct connection between the PIC and the programmer through the circuit lines. The reset pin usually needs a pull-up resistor for signal integrity purposes. It is not recommended to obscure these lines with passives like resistors, capacitors or diodes, although for some instances, programming still works even with the added components.

PIC MCU ICSP Lines
PicKit3 ICSP Guide

HOw to Program a PIC MCU

USing Offcially Supported External Programmers

Microchip has proprietary programmers like the PicKit, ICD, SNAP, and PM3 programmers. It officially supports these programmers and employs timely firmware updates. Additionally, Microchip is known for having good customer support for its tools and devkits.

You use these programmers in combination with an IDE or programming software. Before, the popular software to use was MPLAB IDE. MPLAB was simple and easy to use during those times.

MPLAB IDE v8.962 example software

The next iteration to the series is MPLAB-X. MPLAB-X IDE programmed not only PIC MCUs but other MCUs and devices as well like AVR MCUs (Atmel), SAM ARM Cortex MCUs, EEPROMS and memory, and others. MPLAB-X also supports several plug-ins and can even do performance analysis and data visualizations, among others.

USing Third-PArty External Programmers

Interestingly, several third-party PIC MCU programmers have been developed by other people.  One such popular programmer among hobbyists is the PIC K150 programmer. It is cheaper than the official tools and can program many classic PIC MCU chips. It is also easy to use although it uses legacy software.

PIC K150 was originally produced by Tony Nixon for Kits r us, a DIY electronics shop. It is firmware upgradeable and uses the PIC16F628A as it’s main chip.

PIC K150 Programmer

In order to program using the PIC K150 programmer, you’ll have to use their software. Below is a video rundown on how to use it.

Create your Own Programmer

If you don’t want to buy an external programmer, you can create your own COM port or USB based programmer. These programmer’s parts are made up of common off the shelf components and can program classic PIC MCU chips.

Fruttenboel JDM redraw scematic
Image from Fruttenboel PIC Projects
Image couretsy of usbpicprog

You may also create your very own ‘Pickit clone’ (PIckit 2-based) using a PIC18F2550 and some off-the shelf components as seen below.

SUBSCRIBE FOR NEW POST ALERTS

Subscribe to be the first to know when we publish a new article!
List Subscriptions(Required)

POPULAR POSTS

Scroll to Top