Having experimented with different ideas, I arrived at a way of working that is quick and convenient. This page provides a step by step guide to configuring your PC to work with my chosen range of software. Please note - I'm not necessarily saying that this is the best way to do this, but if you're in a hurry to get started, this will ensure your system is the same as mine and all of the following sections will work. Once you've gained confidence and experience, I hope you'll feel free to try different ways of working. If you discover a better way, please let me know...

In short, here's what we need to do:

  1. Check the (modest) system requirements.
  2. Install MPASM, the free assembler from Microchip (a half-meg download)
  3. Install IC-Prog, a free PIC programmer (another half-meg download)
  4. Install ConTEXT, my favourite text editor! (Just over a MB)

1. System requirements

For PIC programming, I use a PC that has a minimal installation of Windows 98. Because I rely on this machine, I deliberately keep it "lean". Despite being an old OS, it's absolutely fine - in fact, it's one of the quickest, most stable Windows machines I've ever used. Note that it doesn't connect to the Internet, so it doesn't need to run a virus checker or a firewall - this makes a big difference to the performance. It's a 333MHz Celeron with 256MB of RAM, and a fast 30GB hard drive. It reboots in less than a minute, so on the rare occasions that you see a GPF, it's no hardship to restart it.

I've run all the applications very successfully on much slower machines (e.g. 200MHz Pentium 1 with 64kB RAM). The software is not demanding, and the machine spec really just affects the way Windows runs more than anything else. You hardly need any disc space either.

Having said that, it does work fine under XP - the only minor complication is making IC-Prog work reliably. I haven't tried Windows 7 or 8, or anything involving Linux!

You do need a serial port, which is another reason to re-purpose an old machine. Please note that USB to serial converters won't work!

2. Install MPASM

You need the latest version of MPASM, the Microchip PIC Assembler. This can be found on the Microchip website - just type "MPASM" into the search box on the front page.

You might not be able to download just the assembler on its own; you might have to download the whole development environment, which is called MPLAB. Personally, I don't use MPLAB, but don't let that stop you - recent versions of MPLAB are really quite good, and it includes a simulator which is occasionally useful.

Installing it is just a case of following the instructions. Decide now which drive and folder you are planning to install it to, as you'll need to know this later. For all sorts of complicated historic reasons (habit!), I installed it on my F: drive, in F:\CAD\PIC\MPLAB

The installation will create a program group, and you should have a shortcut to MPASMWIN (there is a DOS version of MPASM). Run this, and check the options:

Screenshot of MPASM (16k)

From memory, you shouldn't need to change too many of these, but make sure the List File box is ticked. The other "Default" settings are appropriate, because all of these can be specified in the source code that you'll write later.

3. Install IC-Prog

Download IC-Prog from Decide now which drive and folder you are planning to install it to, as you'll need to know this later. For all sorts of complicated historic reasons (habit!), I installed it on my F: drive, in F:\CAD\PIC\PICProg

You'll need to configure it to work with your programmer. The screenshot shows the options I set for my JDM programmer, but feel free to experiment. You'll note that I've selected the PIC16F877 - you have to set this before loading the .HEX file, because when you change device, it empties the buffer. If you are running this from ConTEXT (see below), you'll need to run up IC-Prog before and select the processor.

Screenshot of IC-Prog (25k)

Another option that I changed is to enable Verify during programming, which is in the Options dialogue. Otherwise, it will spend ages programming the device, and won't flag up a problem until it starts to verify. A PIC16F877 has 8KB of programme memory so this takes a while, and is very frustrating!

If using Windows XP, you'll need to download the "NT/2000 driver", which is available on the download page. This consists of a .SYS file, which must be copied to the same directory as ICProg.exe - and then you need to hunt around in the options dialogue to enable it. Without it, you might find that it works sometimes, but it will be unreliable.

Before proceeding, you should ensure that you can write a .HEX file to a PIC, and read one back from the PIC. Use the .HEX file and test circuit discussed previously.

4. Install ConTEXT

Back in 2001, I downloaded just about every free text editor, and decided that ConTEXT was the clear winner for this application. As of 2013, I haven't seen a better option yet. Sadly, ConTEXT isn't actively developed these days, but it's perfectly fine as it stands. As well as PIC programming, I use it for other coding; this website has been produced using it. Yes, it has some quirks, but I like it a lot. Of course, some people have strong views about text editors and will probably want to use their own, but I'd encourage you to try ConTEXT for this - principally because of the ability to define function keys that invoke the assembler and programming software, which makes the "programming cycle" very quick.

Download the latest version from - note that this text refers to 0.x versions (0.98.6 at time of writing). For some time now, we've been anticipating the release of Version 1 which promises to be radically different, which I hope is a good thing. Should version 1 ever become available - which doesn't seem awfully likely at the moment, then the following instructions might not work.

The download is 1.6MB, and installation is simply a case of running the .EXE, and choosing which directory to install to. For all sorts of complicated historic reasons (also habit!), I installed it on my D: drive, in D:\Program Files\WinUtils\ConTEXT

(After installing Windows, I create Program Files on my D: drive and install all applications there, thus keeping the C: drive as clean as possible. This makes reformatting and rebuilding much easier)

I like to have shortcuts to ConTEXT and IC-Prog on the quick-launch area of the taskbar...

Quick-launch area (4K)

Now, the fun begins. First, we need to install the correct Microchip PIC highlighter. My version is here, but feel free to make your own, as mine is a "work in progress". Every few months I discover a new keyword that should be in the list! Alternatively you can download one from the ConTEXT site - I haven't tried this, so I can't comment on it. Either way, copy the appropriate .CHL file to the Highlighters directory within the ConTEXT programme directory and restart ConTEXT. You should find that it defaults to Microchip Assembler (look at the drop-down at the top-right of the screen), but if it uses x86 Assembler instead, you can set it up: Tools, Set Highligher, Customise Types...

You might be wondering why I feel that syntax highlighting is so important. Apart from making the source code look nice, it performs an essential role for beginners - there are so many new instructions and keywords to learn that any help you get from the computer has got to be welcome. As you're typing in your source code, seeing that the instruction changes colour and is shown in bold is good positive feedback - you know you've just typed something that the assembler can understand!

Next, make sure you have a .ASM file to play with. It can be anything - we just need to have the file open in the editor, because we're going to customise the function keys. You're about to see why ConTEXT is so good!

Drop down the Options menu and select Environment Options... In the dialogue box, click the Execute Keys tab - you should see a tree in a white box showing "asm" as a branch, with F9 to F12 hanging from it. If not, click the Add button.

F9 - Assemble this program

First, click on F9, then click the button on the right of the Execute box (Button). Browse to the folder you installed MPASM in, and select MPASMWIN.EXE - note that if you installed MPLAB, you'll find MPASM in a sub-folder called "MCHIP_Tools" or similar.

This means that if you press F9 while editing a .ASM file, the Microchip Assembler will run. Pretty neat! But, to make this do something useful, we need to configure the remaining options:

Setting up F9 (15K)

As you can see, we are saving the file, and passing on the filename using %p%f - looking now, I'm not sure why I'm not using %n; perhaps it wasn't an option when I first set this up (there have been many versions of ConTEXT released since I first installed it)

F10 - Programme PIC

Next, click on F10 and browse to the folder that contains ICProg.EXE

Setting up F10 (15K)

You'll note that I've used F12 here, but that was because originally I'd tried doing other things with F10 and F11. In the end I changed it to use F10.

To load a file into IC-Prog from the command line, you must preface the filename with "-l" (lower-case "L"). So, to load PREAMP.HEX, for example, you would type "icprog -lpreamp.hex" at the DOS prompt. Knowing this, we can get ConTEXT to work by typing "-l%p%F.hex" into the Parameters box - %F means the current file minus the extension - a rather neat option.

General ConTEXT options

Have a hunt around the options dialogue - ConTEXT is very configurable. Of course, most options are a matter of personal choice, but I've found the following settings useful:

Context options (13k)
Context options (16k)

The print options are equally configurable - you can define some nice headers and footers, and you can choose whether to use syntax highlighting and colours - very useful.


So that's all you need - a handful of small applications running on a modest machine. You should have configured ConTEXT so that pressing F9 assembles the program, and F10 programmes the PIC. This makes the programming cycle (explained later) very quick and simple. I find this approach much easier than using MPLAB, but feel free to try it both ways.