goto Home

 

 

PIC Programmer Hardware

If you're going to use PICs' whether it's with code written by someone else, or with your own code you'll need a programmer.  There are numerous free hardware designs available and the software to control them.  Alternatively you can buy programmers as kits or ready built. 

My programmer of choice is now the Microchip PICkit 2 or a clone version of it.  I now have two genuine PICKit2s and four clones.  The photo rights shows an example of each one.
  • Genuine Microchip PK2
  • Sure Electronics clone
  • Szilva clone
  • Junebug PK2 / tutor board

PICkit2

Microchip have now brought out the PICkit2 programmer.  It programs a large range of PICs and it certainly covers all the devices you are likely to want to use in a hobby environment and possibly professionally too.  It integrates with Microchip's MPLAB IDE application software as well as having its own standalone programmer application.  Not only can it program a good range of PICs, it can also program and read EEPROM.  Microchip continue to develop the software for the PICkit2 and as new PICs are introduced support is added for them.

The PICKit 2 also supports a simple 3 channel logic analyser function and serial terminal interface (handy if your PC doesn't have any RS232 serial ports).  Because the PICkit2 uses a USB interface you can connect multiple PICKit programmers to your PC at the same time, use one as a programmer, another as a logic analyser, a third one as a serial port.  It really is a very useful development tool.

Programmer

UART

Logic Tool

The genuine Microchip part

Microchip offer several options with the PICkit2.  You can buy the basic programmer or development kits that include the programmer itself and a development PCB with some tutorial documentation.

You can buy these from Microchip Direct (but shipping is quite expensive) or from major electronic distributors around the world

For full details of the PICKit2 and the application software see Microchips website
 

PICKit2 Clones

Because of the way the PICkit2 works and the simplicity of its design it is easy to build a clone version of the genuine thing.  Most of the clones will only work at 5 volts where the Microchip PICkit2 will support 3.3 volt parts and some of the clones don't support the Programmer-to-go function or EEPROM programming

A nice simple PK2 clone is presented on this website http://www.mcuhobby.com/articles.php?article_id=7.  I've built two of these and they work really well.  One thing to note is the PIC18F2550 used in the circuit needs programming initially with bootloader code so you need access to a programmer to get it working.  If you build this, be careful with R4/R6.  The component overlay is ambiguous as to which is which so check the schematic then look at the PCB track. Photo of this PK2 clone is shown below left.

Sure Electronics

This is quite a good clone and comes with USB and ICSP cables.  They have a website http://www.sure-electronics.com and they sell through an e-Bay shop  Search under MCU Development.  I have one of these programmers myself.

Update: As of January 2010 the price of this in UK is so high I would recommend you buy a genuine Microchip PICKit2 from a local reseller.

AU Electronics

This company sell some good PICkit2 clones with enhanced features, based in the US/Canada they ship worldwide.

http://www.auelectronics.com/

Blueroom Electronics Junebug

A really nice PK2 clone with built in Tutor / Development board is the Junebug from Blueroom Electronics .  You can assemble it without the components for the Tutor and just use it as a PICkit2 clone programmer, or with the Tutor section as well you have a PIC 18F1320 and various switches, LEDs, IR sensors which provides you with a complete programmer and training environment on a single PCB.   The PICkit2 software also allows the programmer to act as a Serial UART and includes a terminal emulator. The Junebug uses a DIP switch to allow the serial RX/TX connections on the Tutor PIC to be connected back to the programmer which means even if your PC doesn't have a serial port, you can develop and test serial interface applications.

What I really like about the Blueroom Electronics Junebug clone is that it can be used as a self contained development system.  For a lot of code development work I just connect up to a USB port and I'm ready to go, no need for breadboards and cables, power-supplies etc. all over the desk.

Blueroom Electronics Junebug PICkit2 clone and PIC tutor

The photo above shows my Junebug PICkit2 clone.  This is assembled as the programmer only.  The photo below shows the board with the Tutor section assembled as well.

For construction photo's of the Junebug click here

Screen dump from Microchips PICkit 2 Programmer software connected to the Junebug pictured left.


Free programmers and software from the Internet

I've updated this section as of April 2009.  I used to suggest you try the free programmers and software you can find on the Internet.  However, the feedback I've had over the last couple of years via the Picprojects website has changed my view. 

All the queries I get relating to programming firmware from the Picprojects site concern non-microchip programmers.  Many of these other programmers either don't support or haven't been updated to fully support newer PICs.  Some of them appear to either ignore or require manual intervention to preserve configuration and calibration data.  The bottom line is that you really need a lot of practical experience to have a good experience using one.  If you're new to PICs and programming your unlikely to have that level of experience so you'll end up struggling, frustrated and demoralised; not a good start.

The popularity of the PIC owes a lot to the availability of free programming hardware and software and I recognise that but times have moved on.  With the low cost of the PICkit2 I really see no reason not to buy one. I use them and I advise you to do the same. 


PICkit2 v. PICkit3

Microchip have recently brought out the PICkit3 programmer which supersedes the PICkit2.   Currently the support and application features for the PICkit3 are not as good as the original PICkit2 and it is more expensive to buy. 

As of January 2010 I would recommend you still buy a PICkit2 programmer and not the PICkit3 unless you specifically need to program/develop a PIC not supported by the PICkit2.


Writing Code

You can get C compliers, Basic compilers and Assemblers for the PIC.  Some are free, some you pay for and yet others you pay even more for, there is even a compiler language called JAL written just for the PIC and it's free.   Of course, you can just program in straight assembler and Microchip provide free IDE software for code development and simulation/debugging.  A few links for starters are here, there's a lot, lot more out there, Google for them.

PIC Simulator

Although the Microchip MPLAB IDE has a software simulator it's not easy or in some case possible to emulate interrupts and some of the hardware devices such as the USART.

I've found a really great PIC simulator that you can get here http://www.oshonsoft.com/.  Download a time-limited version for free and try for yourself.  The cost of the personal edition is only about £12 and I've found it a really useful application.  

Tutorials

Hundreds of PIC tutorial web sites out there, many of them are rubbish, out-of-date or written by people who know less than you do already so be careful which one you PIC (pun intended).

However, it's not all bad and two that I think are worth a spending some time looking at are:

And don't forget the Help files in MPLAB.  These already contain many answers to questions you may have so it's worth having a look through them.

Forums

Forums are good on two counts;  if you just lurk on a forum you can pick up lots of useful tips and helpful information.  If you have a specific question, they're a good place to get the answer. 

When asking a question on a forum word your question so it is concise and clear, read back what you write before posting and don't ask a question that's already been answered previously. 

Buying PIC's

Occasionally you can pick up some good deals on PICs on E-bay, just browse to Business, Office & Industrial > Electronic Components then search for the key word PIC. 

There's  a lot of information and reference to the 16F84 PIC chip. This chip is an old PIC dating from the 90's. You are much better off going for one of the newer PIC's like the 16F627A/628A or 12F675. The 16F627A is pin compatible with the 16F84 but has a lot more functionality, including internal 4Mhz oscillator so you don't need an external crystal or resonator.  The other reason for going with these newer PICs is that the arrangement of their special function registers is standardised so it's easier to port code from one chip to another. In addition the program FLASH memory is now rated for much higher write/erase cycling than the 16F84. 

Two even newer PICs that are worth considering for any new projects are the 12F683, which is backward compatible with the 12F675 but has additional features including 2K program memory and 8Mhz internal oscillator.  Then there's the 16F88 which has 4K program memory, 8Mhz internal oscillator and the ability to self-program along with lots of other features. I also like the 16F690, 20 pin device, all the features of the 16F88 except self-program and cheaper. It's worth looking over the datasheet for these devices if you're planning a new project.

Finally, the newer parts are generally cheaper to buy which is as good a reason as any to use them.

PIC Instruction Set

The Microchip PIC microcontrollers use a Harvard architecture where code and data memory are separate, unlike the von Neumann architecture used on processors such as the Intel Pentium.   The device uses a RISC instruction set with just 35 instructions. All instructions execute in one instruction cycle except for those that modify the program counter such as conditional branches, and goto's which always need two cycles.  Despite this alternative architecture, it is very easy to work with. I've had quite a lot of experience with the 6502 processor from the early 1980's (used in the Apple II and BBC Micro among many).  Although the 6502 had some better test and branch functions, it had only two internal registers so I've found the limited instruction set on the PIC quite easy to adapt to. In addition, the instructions the PIC has, particularly for bit testing and manipulation, are well suited to its intended applications.  PIC Instruction Set

Datasheets

Before you start using a PIC microcontroller you'll need to know all about it.  You should download the datasheet and while you don't need to read it cover to cover, it's the first place your should turn to when you're not sure about something, or things aren't working as you expected.  You can download datasheets from the Microchip website and while your there, take a look through the Application Notes, there's lots of interesting and useful information to be found in them.

For full details of the Microchip Mid-Range MCU family check out this data sheet (it's big, 3Mb PDF) from Microchips website.