Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
http://www.iki.fi/hyvatti/pic/picprog.html
2. Requirements Jaakko Hyvätti Picprog 1.7 documentation
See the hardware section. This device is connected to a usual serial port of your PC, and is thesame device as used with many DOS PIC burning programs.
This program is written in C++, so you need a C++ compiler to compile it. This you should
already have installed on your Linux system or Windows/Cygwin system.
Linux kernel version 2.0.32 or 2.1.45 or later.
PIC16 and PIC18 microcontroller programmer for Linux and Windows/Cygwin.
This programmer needs some functionality in Linux serial driver that as of kernel versions 2.0.32and 2.1.45 is available in standard kernels. The programmer uses TIOCSBRK and TIOCCBRK
ioctl to control the state of TxD serial port output accurately. These ioctl’s are standard on BSDflavor unixes, like SunOS 4, but they still are unimplemented on many serial drivers in Linux
kernel. Only the standard serial port is known to work by me.
(For Windows installations only) Earlier Cygwin versions do not contain the necessary
TIOCSBRK and TIOCCBRK ioctl functionality.
Your assembler, or C compiler, or whatever, should produce either Intel IHX32, IHX16, or
IHX8M format hex files. For assembler on Linux I recommend GNU PIC Utilities gpasm.
6. Burning PICs7. Reading PICs8. Exit values
3. Hardware
Use a serial port programmer device with the following pinouts:
11. Other available programmers12. Available languages
PICmicro microcontrollers, or MCUs, are fine chips that are especially easy to program with a simple
A very good programmer like this is for example PIC-Programmer 2 designed by Jens Madsen. I have
device attached to a parallel or serial port. Because of the EEPROM or Flash memory, they are also
heard that other programmers work also, for example TE20 and Olimex PG2C have been tested with
easy and fast to erase and reprogram without need for UV equipment. This makes them very popular
The description below is based on old version of JDM hardware. There is a new version of the PCB
At the moment this is the second implementation of a PIC programmer for Linux that works with the
available on Jens Madsen site. It supports more chips without jumper wires: PIC-Programmer 2. Please
very simple and cheap serial port programmers. The first one I know was made by Ralph Metzler in
use that one instead. Note however that his PCB does not support for example PIC16F628A that need
1996. My programmer was originally designed for PIC16C84 and PIC16F84 chips back in 1997, and
to have pin 10, RB4/PGM grounded. Please modify the PCB to ground this pin if your chip has PGM
since then I have implemented other chips without access to most of them. I have tested PIC16F628,
PIC16F676, PIC12F675, PIC16F88, PIC16F876A, PIC16F76, PIC18F1320 and PIC18F458. Othershave used many other models.
I made a minor modification to the jdm84v23 schema and pcb mask, because I thought D4 was stressedon positive clock pulses - it short circuits the rs-232 RTS pin to GND. I added a 10k resistor between
1. Background reading
D4 and D3. But it also is not absolutely required, as the clock pulses are short and rs-232 is protectedfor short circuits anyway. Now I have noticed that this resistor makes the programmer less reliable,especially with later PIC chips, like PIC16F76 and PIC18 family. If you have built the hardware I
You really should take a look at the Microchip www-pages and read the device datasheets and
previously suggested, and it does not work, please short circuit that resistor or build the new PCB from
Maybe the best source for PIC information is the home page of PICLIST discussion group. Also
To support for example PIC16F628 and PIC16F88, which have a low voltage programming mode, the
historically a good collection of links and software for PIC was in David Tait’s PIC links page and in
circuit was again modified to ground the RB3 pin 9 and the RB4 pin 10. This prevents the chip from
GNUPIC pages. I have also documented here the software I took a look at back in 1997. I have focused
entering the low voltage programming mode. To support for example PIC12F675, PIC16F630, and
into Linux support, so I have never used any DOS software mentioned.
PIC16F676, pin 1 was connected to Vdd. Other jumpers need to be installed as described below.
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
above pcb. You need to connect pin 16 on the socket to clock (same as pin 12), pin 17 to data (same aspins 11 and 13), and pin 18 on the socket to Vss (same as pins 5-10). Note that pin 1 is alreadyconnected to Vdd in the above PCB mask. If this connection is missing on your older PCB, connect pin1 to pin 14 with a wire.
Always check the correct pinouts for your chip from the datasheets also!
4. Installation
There are binary packages available that have been prepared by helpful users and operating systemvendors. I know of the following, but cannot offer any support for them. They might be for olderversions, but even if they are, check for the 10. Changes section below if you really need a laterversion. Some new versions of Picprog only fix small specific bug, which may not affect you at all.
FreeBSD includes Picprog port. Gentoo has Picprog as a package. Jan Wagemakers made a Debian package.
Linux i386 rpm compiled on Red Hat 9 by Maarten Blomme
To install from source, download the picprog-1.7.tar.gz package, if you do not already have it.
Check your system against the requirements mentioned above.
Untar the archive and change to the source file directory. You should only have to type:
and the program should compile without errors or warnings. If it does not, please check that yourcompiler, c and c++ libraries and utilities like make are of a reasonably recent, bugfree and compatibleversion.
After compilation you can, as a root user, just type:
to install the program and manual page to /usr/local. Or just copy the files picprog and picprog.1 manually. Windows/Cygwin
The Linux emulator for Windows, Cygwin, allows Picprog to be compiled on Windows plattforms.
To install Cygwin, go to www.cygwin.com and follow the instructions there. In short, download
To support for example PIC16F876A and 16F76, which have different pinouts for programming
setup.exe and run it. You need to install at least the Developer packages Gcc C compiler, Gcc C++
signals, you need an adapter that connects to the external connector of the above programmer.
compiler, Make, and Binutils in addition to the default install.
Alternatively you could redesign the pcb layout, but maybe it is easier to just solder the adaptor. Solderthe pins like this:
To install Picprog on Cygwin, follow the above instructions for Linux compilation from source.
Windows 2000 installations that I have tried work fine. Windows 98 installations worked sometimes,
connector 3 -- data -- 28 (RB7) socket 5 -- Vss -- 8,19,24
and I suppose the timing routines of Picprog do not work well on Windows 98, they even lock the
computer sometimes. I suggest using Windows 2000 or later.
To support for example PIC12F675, PIC16F630 and PIC16F676, which have different pinouts for
programming signals but do not conflict with PIC16C84 pins, you can solder jumper wires on the
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
To get information about the usage of the program, just type the program name. These options give
Force reprogramming the OSCCAL word and BG bits in control word. Default is to read thecalibration values off the chip before erasing and preserving their values. Use this option if you
have accidentally erased the values on chip, and you reprogram them from your saved copy
Display warranty or copyright information or the help text with list of supported chip types.
which was read off the chip before the values were lost there. In general it is a really good idea to
first read the empty chip and save the file somewhere if the calibration data gets lost later, either
Do not display the copyright notice.
by accident or because of some bug in Picprog.
--pic-serial-port device , -p device
The actual operation of the program is controlled by the options --input-hexfile and --output-hexfile. If the
The device name of the serial port the programmer is connected to. Default is /dev/ttyS0.
former is present, the program acts as a burner. If the latter is specified, the program will read the
--device chipname, -d chipname
contents of the PIC device eeprom memories. Both may be specified on the same command line, in
The chip type. Currently supported by code are:
which case the chip is first programmed and then read.
auto, pic16c84, pic16cr83, pic16cr84, pic16f83, pic16f84, pic16f84a*, pic16f87*, pic16f88*,pic16c61, pic16c62, pic16c62a, pic16c62b, pic16c63, pic16c63a, pic16c64, pic16c64a, pic16c65,
6. Burning PICs
pic16c65a, pic16c65b, pic16c66, pic16c66a, pic16c67, pic16cr62, pic16cr63, pic16cr64,pic16cr65, pic16c620, pic16c620a, pic16cr620a, pic16c621, pic16c621a, pic16c622, pic16c622a,pic16f627*, pic16f627a*, pic16f628*, pic16f628a*, pic16f648a*, pic16ce623, pic16ce624,
pic16ce625, pic16c641, pic16c642, pic16c661, pic16c662, pic16c71, pic16c710, pic16c711,pic16c712, pic16c715, pic16c716, pic16c717, pic16c72, pic16c72a, pic16cr72, pic16c73,
1. Compile your program into a hex file.
pic16c73a, pic16c73b, pic16c74, pic16c74a, pic16c74b, pic16c76, pic16c77, pic16f72*,
2. Insert the pic16c84 or other pic chip into the socket in the programmer, or connect the in-circuit
pic16f73*, pic16f74*, pic16f76*, pic16f77*, pic16c432, pic16c433, pic16c781, pic16c782,
pic16c745, pic16c765, pic16c770, pic16c771, pic16c773, pic16c774, pic16f870*, pic16f871*,
3. Connect the programmer device to a serial port.
pic16f872*, pic16f873*, pic16f873a*, pic16f874*, pic16f874a*, pic16f876*, pic16f876a*,
4. If the device contains calibration information, like OSCCAL word in program memory or BG
pic16f877*, pic16f877a*, pic16f818*, pic16f819*, pic16c923, pic16c924, pic16f630*,
bits in configuration word in PIC12F675, it is a good idea to save these for later if this is the first
pic16f676*, pic12c671*, pic12c672, pic12ce673, pic12ce674, pic12f629*, pic12f675*,
time you program the chip. See next chapter for more on reading chip, but this should be enough
pic18f242*, pic18f248*, pic18f252*, pic18f258*, pic18f442*, pic18f448*, pic18f452*,
pic18f458*, pic18f1220*, pic18f2220*, pic18f4220*, pic18f1320*, pic18f2320*, pic18f4320*,pic18f6520*, pic18f6620*, pic18f6720*, pic18f8520*, pic18f8620*, pic18f8720*, pic18f6585*,
picprog --output saved-cal-chip1.hex --skip-ones --pic /dev/ttyS1
pic18f8585*, pic18f6680*, pic18f8680*, pic18f2515*, pic18f2525*, pic18f2585*, pic18f4515*,
pic18f4525*, pic18f4585*, pic18f2610*, pic18f2620*, pic18f2680*, pic18f4610*, pic18f4620*,pic18f4680*, pic18f6525*, pic18f6621*, pic18f8525*, pic18f8621*, pic18f2439*, pic18f2539*,
picprog --burn --input file.hex --pic /dev/ttyS1
pic18f4439*, pic18f4539*, pic18f2331*, pic18f2431*, pic18f4331*, pic18f4431*, pic18c242,pic18c252, pic18c442, pic18c452, pic18c658, and pic18c858.
6. If the above command produces error output that suggests that the chip was in the code
The devices marked with a star (*) can be autodetected, so they need not to be specified. If code
protection state, or that the chip must be completely erased before programming, retry with the
protection is active on the chip, autodetection may not work.
picprog --erase --burn --input file.hex --pic /dev/ttyS1
I do not know if all the chips work or if any other than pic16c84, pic12f675, pic16f676, pic16f76,pic16f88, pic16f876a, pic16f628, pic18f1320, and pic18f458 work, these I have tested myself.
7. Wait for the program to complete. Burning 8192 program locations on 14 bit devices may take 3
Default is to autodetect the device by reading configuration memory location 0x2006. If no
minutes. I know better programming algorithms would speed this up significantly, but I have not
device id is present, the default is pic16c84. If reading location 0x2006 with 14 bit programming
had time to fix that. PIC18 family programming algorithm is significantly faster.
algorithm fails, the PIC18 programming algorithm is used to read configuration memorylocations 0x3ffffe and 0x3fffff. To add a new supported chip type, just edit the table in file
The hex file addresses (in IHX16 format) used are the ones specified by Microchip. This example is for
To be able to reprogram a PIC device that has previously been programmed into Code Protection
state (for example in pic16c84 Control Word fuse bit 0x10 cleared), it is necessary to bulk erasethe chip. Also some PIC devices do not automatically erase each location as they are
programmed, and these devices must always be bulk erased first. It is done by adding this option
Program memory, 2048 words * 14 bits.
to the command line. The default is not to bulk erase the chip.
Actually program the device. Without this option only the syntax of input files and command line
Device id (not present on older chips), not present in hex file
--input-hexfile path, -i path
Specifies the input hex file. The file can be either in IHX32, IHX16, or IHX8M formats, the
Only necessary for debugging. Outputs the same data as was read from the input hex file.
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
The addresses in IHX32 and IHX8M files are not word addresses but byte addresses. Divide those
addresses by 2 and you get the same addresses as in the example above.
This example is for pic18f1320. These addresses are byte addresses. IHX32 is the only option for
saving PIC18 family programs in hex files.
file or serial port io error, or after-programming verification failed
Program memory, 8192 bytes of 8 bits, or 4096 words of 16 bits.
input file syntax error, not in IHX8M, IHX16, or IHX32 format
unable to find input file or file open failed
9. Internals
Before interfacing with the PIC chip, Picprog calibrates its delay loops by checking the clock speed ofthe CPU and whether the CPU supports the TSC feature. On Linux, /proc/cpuinfo is read. On
Windows/Cygwin, /proc/cpuinfo is read and CPU clock frequency is estimated. Therefore the clock
class picport: manipulates the serial port hardware. With this class you can execute programming
frequency displayed on Windows is not necessarily exactly the true clock frequency.
commands like read a word, program a word, increment address etc. Look at picport.h for details.
If Picprog is run as root user, or otherwise gets capabilities to define itself as a real time task, a
class hexfile: contains a PIC memory image. You can load and save the contents of this class to a
different timing method is used. The system call nanosleep() is used for delays.
file, and you can program and read it from the PIC chip. Programming uses class picport. 7. Reading PICs
class program: just some generic option handling.
Just the main () to parse command line and call class hexfile to do its job. 10. Changes
1. Insert the PIC chip into the socket in the programmer, or connect the in-circuit programming
2. Connect the programmer device to a serial port.
This document has not changed much since it was first released with the 1.0 programmer. The changes
include some information about new software and more accurate links to PIC information. New optionsto select type of device other than pic18c84 are also present.
picprog --output ofile.hex --pic /dev/ttyS1
With help from Taneli Kalvas changed the schemantics diagram and pcb mask to ground the RB4 pin,selecting high voltage programming on for example pic16f628.
--output-hexfile path, -o path
Implemented preservation of OSCCAL and other calibration data.
Specifies the output hex file. The file will be written in IHX16 format, unless otherwise specified
Added automatic detection of devices based on location 0x2006.
by the --ihx8m or --ihx32 options. For PIC18 family devices, file will be written in IHX32 format.
Merged Bart Goossens’s changes to implement PIC16F73. I hope it works.
When reading the PIC device, do not consider the all-ones memory locations to be programmed,
and skip them in the hex file output. For 14 bit devices, this skips the program memory locations
Autodetect more chips. Fix programming of chips with OSCCAL. Fix erasing some chips - erasing and
that have hex value 0x3FFF, and for PIC18 family devices, this skips byte values 0xFF. In data
resetting code protection is now performed the hard way: all methods are tried regardless of chip type.
memory locations that have hex value 0xFF are skipped.
--erase now works also without --input-hexfile flag.
Select the output hex file format to be either ihx16 or ihx8m, respectively. The default is ihx32
for PIC18 family devices and ihx16 for others.
Add option --force-calibration to program OSCCAL and BG bits. Implement programming algorithms for
--pic-serial-port device , -p device
16f87/16f88 and 16f87Xa. Revise some timings on programmer reset to avoid operating voltage to dip.
The device name of the serial port the programmer is connected to. Default is /dev/ttyS0.
More verbose output on how many locations actually were burned. 8. Exit values
2004-03-02 version 1.5 Fix PIC16F87xA configuration word burning. Remove the 10k resistor added by me from the PCB andschema. Add support for PIC18 family. Make the DTR be held low as long as possible. This may
Exit values are as defined in <sysexits.h>:
improve the reliability and limit stress on RS-232 port.
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
Now compiles on Windows with Cygwin DLL version 1.5.8 and later. More accurate timings result in
shorter programming times compared to previous versions. These timings use the CPU RDTSC
Parallel port programmer, DOS software, needs external 13V power source. Author Stephen M.
instruction on x86 and AMD64 plattforms. PIC16F87/88 second configuration word programming
12. Available languages
2004-04-28 version 1.7 Fixed 16c OTP and UV erased parts EPROM programming to use 100µsprogramming/overprogramming pulses. Use real time priorities and nanosleep() for delays if run under
Free compilers
root priviledges. Relax timings so that they work out of the box with longer cables. Fixed PIC12F629 /PIC12F675 / PIC16F627a / PIC16F628a / PIC16F648a / PIC16F630 / PIC16F676 programming with
gputils have assembler, linker, disassembler and library utilities much like MPASM. Theysupport all PICs. 11. Other available programmers
A graphical development environment for PIC16F84 by Mark Colclough at the University ofBirmingham. Yappa combines into a single application the editor, assembler and programmer
interface that are needed to program a PIC. Picprog is used as the programmer backend.
PiKdev is a simple graphic IDE for the development of PIC-based applications. PiKdev is
developed in C++ under Linux and is based on the KDE environment. It includes a programming
Assembler in ANSI-C by Timo Rossi. Outputs both IHX16 and IHX8M. You can also find
engine which allows programming various flavors of PIC microcontrollers via classic (ie: D. Tait
disassemblers for 12 bit and 14 bit PIC’s on Timo’s site.
or JDM compatible) programming hardware connected to the parallel port or to the serial port.
Assembler in ANSI-C by James Cleverdon, [email protected]. No INCLUDE, no IF, outputs
Linux and Windows programming software that knows about 83 pic’s and 6 programmers.
Programmer software written in Python by Wouter van Ooijen.
I have heard of free SIL language (something like Pascal/M2) compiler for PIC.
A serial port programmer software for Linux, written in c++, author Ralph Metzler. It directly
Just Another Language, a Pascal like high level language. ". I wanted a HLL which is better
handles the serial hardware, standard 16450/16550 compatible uarts, and needs root priviledges
mached to the PIC architecture, to my programming habits, and which I could explain to the kidsof the local electronics club without giving a full course on computer architecture."
A serial port programmer, schema (gif) and DOS software. The hardware manages with rs-232interfaces with low voltage output, even as low as ±7V is fine. This is the programmer I use with
Commercial demos
I modified the circuit to include connections to pins that are needed for programming some PIC
A demo is available of their compiler.
CoreChart (formerly named bitset) is an icon-based development tool. 30-day trial available.
There is a new version of the PCB available on Jens Madsen site. It supports more chips withoutjumper wires: PIC-Programmer 2. 13. Other software
A serial port programmer, schema (gif) and DOS software. Needs +12V rs-232 positive voltage
A parallel and serial port programmer, and software for Linux and dos, written by Wim Lewis
14. History
and Frank Damgaard. There is some experimental code for an USB parallel port device.
dvtait84, pic84faq (dvtait84.zip, pic84faq.zip)
A parallel port programmer, schema (ascii) and DOS software with basic and turbo-C sources
Picprog was first written and released in May 1997. Around that time I briefly experimented with
included. Author David Tait. He has a lot more stuff, and some new designs to program other
microcontrollers. I found no Linux software for the cheap serial programmer hardware by Jens Madsen,
and I wanted to use that one as it was so simple to build. Only later did I learn about serp-0.5. Anyway,
that one directly programmed PC style serial port hardware while I wanted to use standard UNIX
A parallel port programmer, no schema, written in assembler for DOS with 486/33 timings. Very
methods of accessing serial ports. Linux was missing an IOCTL to force BREAK condition (steady
limited. Author: Mark J Cox, [email protected].
+12V) on the serial data transmit line. This kind of functionality existed for example in Solaris. No
problem, I created a patch for Linux kernel versions 2.0.30 and 2.1.42, submitted it, and it was included
A parallel port programmer and disassembler, no schema, seems to use pins DATA1 = data and
in mainline kernel versions 2.0.32 and 2.1.45.
DATA2 = clock and needs external programming voltage. From Everyday Practical Electronics,February 1996, author Derren Crome. Disassembler by Nigel Goodwin
Since the time I first wrote the software I did not work with microcontrollers at all for years, though I
Jaakko Hyvätti Picprog 1.7 documentation
http://hyvatti.iki.fi/~jaakko/pic/picprog.html
maintained Picprog by fixing obvious compilation problems and updating documentation. Version1.0.1 was put together in May 2001 and included mainly documentation fixes. In June 1997 I hadworked on adding support for different memory sizes of different PIC chips, and these changes andagain documentation updates were released as version 1.1 in February 2002. I also found theprogrammer hardware I thought I lost a few years back, and was able test that it still works.
Picprog-1.0 was ported to FreeBSD and included in the distribution around September 1999. MITMASLab 6.186, a student-run robotics course, seems to have used it since January 2001. Recently thisdocumentation page has attracted steadily over 1000 visits per month, so I guess someone is finding ituseful.
Nowadays I mostly test Picprog with new chips, and sometimes I start a new project like KanSatsatellite or 8-PIN PONG, and never finish them. 15. Copyright notice
This program is free software; you can redistribute it and/or modify it under the terms of the GNUGeneral Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULARPURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not,write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
Email: [email protected]: http://www.iki.fi/hyvatti/
Please send any suggestions, bug reports, success stories etc. to the Email address above. To avoid myspam filters, please put the word ’picprog’ somewhere on the subject line.
If you want to support the developement of picprog, please make a donation to Jaakko via PayPal(click on the button). Jaakko Hyvätti /[email protected] /+358 40 5011222
Prehospital Therapy With the Platelet Glycoprotein IIb/IIIa Inhibitor Eptifibatide in Patients With Suspected Acute Coronary Syndromes* The Bochum Feasibility Study Christoph Hanefeld, MD; Clemens Sirtl, MD; Martin Spiecker, MD;Waldemar Bojara, MD; Peter H. Grewe, MD; Thomas Lawo, MD; andAndreas Mu¨gge, MD Study objectives: To assess the practical application and safety of prehospita
Drivers’ Contents Chapter 1 Personal Preparation Chapter 2 Equipment a. Clothing b. Helmets d. Ear Protection Chapter 3 The Working Environment b. Padding c. Ventilation d. Supplementary Comfort Chapter 4 Safety Harnesses Chapter 5 On an Event a. All Events b. Race Events c. Rally Events d. Rally Safety