In circuit serial programmer for PIC16F87X
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 protection.
- 1 (one)
- Put the device in run mode.
- 0 (zero)
- 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 0x00.
Current version of the firmware is 1.04.
You can download the flash-and-burn hex file (4 kB).
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.
If you only need the executable file, e.g. when you are upgrading from a previous version, pick it here (24 kB, zipped).
For more detail: In circuit serial programmer for PIC16F87X
We recommend EasyEDA for electronic circuit design.
From Schematic to PCB Production, Just Need One Tool
Free Circuit Design Software: learn to use Editor quickly and easily
Cheapest PCB: 10pcs 2-layers 10cm×10cm only $8.21, 3-day build time, 100% E-test