Programming your PIC

Programming a PIC

Embedded programming is all about the mircocontroller. At the end of the project, it’s all about stepping back and allowing the device along with it’s supporing hardware and operate without human intervention.

Some applications enable the development to be simulated, however at some point the eventuality of downloading the compiled code onto your device is inevitable.The process of programming a PIC involves using an additional piece of hardware known as a programmer to export and and download the HEX file or compiled code onto the device.

Where to get a programmer?

There are a number of avenues that can be pursued to obtain a programmer:

  • DIY
  • Hobbyisy Programmers
  • Comercial Products

Do It Yourself

The DIY avenue has it’s place, not withstanding that is where most of us began. Personally, my first programmer was a parallel interface built off the WEB and used a Microchip application note for technical support.

DIY projects are widely available and easily found on the WEB. So a quick search will locate a suitable example.

Hobbyist Type Programmers

I am making a distinction bewteen DIY and hbbyist programmers on the basis that a hobbyist programmer is a non -comercial product which has aftersales service and backup. This type of programmer can be a worthwhile investment over time as new PICs are being released all the time. Since there is an organisation behind the product, continued support is more likely especiall when it comes to updating the device to support new PICs as they are released.

After my many attempts at DIY and other programmers. Microchip released the PICKIT2 and then later the PICKIT3. These programmers are ideally priced, they don’t need an external power supply and the use the USB interface to communicate between the PC and the target device.

The PICKIT 3 is the current iteration of the PICKIT 2 design and as a unit it’s compact and easy to use. I often take it with onsite so it’s entirely versatile.

As shown below, the PICKIT 3 intefaces directly with a PCB using the 6 way SIL ICSP header.

Figure 1: Pickit 3 and accompanying hardware.*

The PICKIT 3 can be used with MPLAB X or the standalone version of their software.

Commercial Programmers

Commercial Programmers are generaly reserved for the professional developer or Embedded Design House and are designed to program devices en masse. These types are usually very expensive and unless as the developer you are deploying hundres of units at a time is overkill for the hobbyist.

Why a programmer is needed

A PIC is programmed using the ICSP or in circuit serial programming method which although is not overly complicated does require an “intelligent” collaboration between hardware and software to get the HEX file onto the PIC. This involves reading the device, erasing the memory, downloading the new code into the correct memory blocks and then jump starting the device once it is complete.

:100000002DEF00F00000000000EF00F00000000005
:0A0010000000000000000000F3D71C
:10001C0081803D0E0B6EE10E0C6E3F0E0D6E0D2EA3
:10002C00FED70C2EFCD70B2EFAD7000000008190C7
:10003C003D0E0B6EE10E0C6E3F0E0D6E0D2EFED7AF
:0E004C000C2EFCD70B2EFAD70000000012007D
:10005A000F0EC112070EB412936A816ADADFFED755
:02006A00FFD7BE
:020000040030CA
:0E0000002402190EFF8480FF0FC00FE00F4096
:00000001FF

figure 2: Example hex file

When purchasing a development PCB, unless the Development PCB has an integrated programmer this additional piece of hardware will need to be purchased.

[E]

* Any images and products displayed here are displayed for information purposes only. The product branding and ownership of the product is retained by the product owners.