Here you can find all resources you need to build your own in-circuit serial PIC16F87X programmer.
After experimenting with the PIC16F84, time had come to move on to more powerful
devices, such as the PIC16F871.
These devices offer a low voltage progamming (LVP) mode. This basically means
that it is possible to modify the contents of the program memory without
applying a high voltage (12 V) to the device.
Being used to the remove-plug-burn-remove-plug-test programming method of the 16F84,
I decided to build my own ICSP (in-circuit serial programmer).
Able to program devices from the PIC16F87X family
Uses RS232 (serial port) to communicate to a host (computer, HP48, ...)
Software runs under Win98, NT4.0, Win2000. No support for Linux yet :-(
Programmer is powered from the target circuit, no extra power supply needed
Programs a full 16F871 (2k instructions) in under 35 seconds
Can erase code protected devices
Stays connected to the development board during code tests
The programmer communicates to a host through a serial port. All commands are
character-based. The serial port settings are: 9600 bps, 8 databits, no parity
and 1 stop bit (9600, 8N1).
When a command is finished, the programmer returns 'OK'.
Overview of the instruction set:
Read the contents of the program memory (PM). This command
must be followed by the highest address that has to be read.
E.g. R0078 will dump the contents of the address range
0x0000 to 0x0078 of the PM to the serial port.
Dump the contents of the configuration memory to the
serial port. Configuration memory extends from location 0x2000 up
to 0x2007 with the first 4 locations containing the ID
locations, location 0x2006 containing the device ID and
the last location describing the configuration word.
Bulk erase the device.
Remove code protection from the device. When the code
protection bits are set in the configuration word, all PM locations read as
0x00. All further programming of the device becomes impossible.
It is advisable to first send this command to the device you want to program
before attempting any other programming. WARNING: All memory contents will be erased if the device was under code
Put the device in run mode.
Put the device in reset mode.
Enter program mode. This command must be followed by a
wait of 100 ms. Then you can choose the following options:
Program the PM of the device. This command must be
followed by a sleep of 100 ms. Then you can start sending lines of the hex
file to the programmer. The leading semicolumn must be removed. If the
programmer encounters a CRC error in the received data, it will raise the
error flag (corresponding LED on the programmer will light up). After this
error, a hard reset has to be performed.
If no error is encountered, the programmer will transfer the data to the
device under programming and burn it in flash. After successfully completing
this task it will return a '1' (one) to the host to designate it is
ready to receive the following line of data. This process will stop after an
'end-of-file' line is received ('00000001FF').
Program the configuration locations of the device. The
configuration locations comprise the ID locations and the configuration
word. They are sent in the following format: 0540000000 + ID0 + 00 + ID1
+ 00 + ID2 + OO + ID3 + config word + CRC.
The CRC is the value one has to add to the sum of all 8-bits hex values of
the line to obtain zero. E.g. the line 0500240528 has CRC
AA because 05 + 00 + 24 + 05 + 28 + AA equals
0x100. The leading bits are removed (overflow), so this results in
Current version of the firmware is 1.04.
You can download the flash-and-burn hex file (4 kB).
The MPLAB project with all source files can be found here.
Current stable version is 0.2. It completely supports programming PIC16F87X devices. Read and verify operations are not supported by the software yet. The complete host software setup package for the picprogrammer can be downloaded
here (zipped, 2,6 MB).
If you only need the executable file, e.g. when you are upgrading from a previous version, pick it here (24 kB, zipped).
David Rojas kindly provided the software with some updates. Latest development release is v0.4. Download the complete VB project source code here (zipped, 72 kB). Changelog
The GUI looks like this
Schematics and PCB
I designed a small PCB for the programmer. The files are made using the freeware version of Eagle from CadSoft. You can get it
The IC on the left is a MAX233. It converts the signal levels coming from the
host into logic levels understood by the PIC16F84 (located on the right side).
On the far right side you see the oscillator for the PIC. In the lower left
corner you see the connector to the target system. Next to that, there are some
The target system consist of a PIC16F871 in a PLCC44 socket (square IC in the
middle, kinda' hard to miss this one, isn't it ;-). Together with it's oscillator and some status LEDS it's a basic
platform for testing the programmer.
Q: Is it working?
A: I know of one person who rebuilt this project and uses it to program his 16F877.
Q: I get the error message "Programmer not responding" when I try to burn a hex file into a device...
A: First check if the programmer is well connected and powered by opening the log window ("Prefs"-menu and then select "Log window"). Then reset the programmer. The intro message of the programmer showing its version number should apper in the log window.
If this is OK, then make sure that the HEX file is in Intel HEX8 format. If you use MPLAB for your project you can check this by selecting the "Project" menu. Click on "Edit project..." and select the hex file in the "Project files" box. Choose the "Node properties" button and make sure the "INHX8M" setting is selected.
Q: Can I use this programmer if I run a Linux OS?
A: Yes, theoretically you can. However, host software is not available. If I have time, I will rewrite the programmer code in C so it will be more easy to port it to other platforms. But this is not a priority to me. If there are volunteers, just let me know.
Q: Is the programmer free for use?
A: Yep, no matter for what purpose you like to use it. If you however make a giant 'hole in the market' application with it and you earn so much money that you don't know what to do with it, I will of course not refuse the offer from your part to install that heated open air swimming pool in my garden ;-) Oh, and yes, be kind and don't use this programmer do create that neodymium-yttrium-pumped-crispy-double-ribble-mother-in-law-toaster :-)
If you are not into building a programmer yourself, I would suggest you to have a look at the WARP-13 programmer. It is a multi-PIC programmer that supports high-voltage programming of most used PIC microcontrollers.
I bought such a unit myself and use it for all non-low-voltage programming. As supplier I can recommend Dontronics for both their pricing, the customer support and the speed of delivery. (My programmer arrived within 5 working days!!)