Mondo's

Universal OS PIC Programmer

This programmer requires only a basic terminal program capable of uploading an ascii PIC HEX file. It does not matter what operating system or computer (MAC, Win98, XP, Vista, DOS, Linux, etc.) is used to talk to it.

All of the software necessary for programming is in the unit's own PIC (16F628) which incorporates a set of programming algorithms for several PIC versions along with some I2C eeproms.

Note: Microchip seems to be 'recycling' its programming algorythms at this time, so this unit is likely to program any new PICs as they are released.

Just connect to it with a terminal program and away you go...

 

Here are the commands that are presently available. They will be discussed below. Some commands used in developing it have been left in for experimental purposes.

An Select programming algorithm 'n'
L Begin program load of HEX file.
Unn Unload 'nn' bytes from PIC in standard HEX format.
D Hex data dump until any key hit. Abort on ESC.
P Manual enable program power
R Manual Run program
S

Manual Stop program

/ End of line delay in millisconds
- Delay between characters sent in milliseconds
F Fast mode - no extra delay powering up target.
Q Core dump of PIC internal RAM (used to debug programmer itself)
? Show version and current algorithm (show SignOn message)
.nn Send hex value as PIC (6-bit) command byte (used for debug)
,nnnn Send hex value as 2 PIC (8-bit) data bytes. (used for debug)
;nn Wait nn milliseconds (used for debug)
= Read PIC hex program data (used for debug)
[ Create I2C Start condition
] Create I2C Stop condition

Here is a list of the PIC's that have been verified to work with each algorithm. Other PIC's may also work if they share the same programming specs.

Algorithm PIC Version
1 16C84
2 16F870, 16F876
3 16F83, 16F84
4 16F83A, 16F84A, 16F627A
5 12F683, 12F629, 12F675
6 16F616
7 16F819, 16F88
8 16F628
9 24LCxxx (I2C eeproms)

This unit is designed to do In Circuit Serial Programming (ISP). It can either source power or borrow power from the target device. In either case, it generates its own 12 volt programming voltage from the 5 volt source.

Connection to the computer serial port is made via RJ11 (phone) connector and a DB-9 to RJ11 adapter. Unlike a lot of 'serial' programmers, this design actually uses serial data to communicate to the PC. This makes it usable even at very long distances. Connection to the target device is via a 5-pin connector (lower left corner) and an assortment of adapters.

The adapter that connects the computers standard DB9 serial cable to the RJ11 phone jack is wired as follows...

DB9-5 ---> RJ11-1
DB9-3 ---> RJ11-2
DB9-2 ---> RB11-3


4 LED's indicate: programmer power, target power, target run, and 12 volt VPP.

 

Here are the files needed to construct one of these including the board layout for a single sided board. You could also wirewrap or make your own board design using the same circuit and software.

Schematic - for programming hardware

Board Layout and Parts positioning - for single sided board.

PIC Source and Object files.

Operating Instructions

Set up your terminal program to full duplex,19200 baud, no parity, one stop bit with no hardware or software handshaking.

If you need a good terminal program for Windows, try Term232 (its free).

Once you are connected and power up the unit, you should see something like this:

Vers=3.3 Alg=6/20-5
UPP>

This is the command prompt where you enter instructions. It shows that we are running version 3.3 with programming algorithm 6, end of line delay of 20 milliseconds, and inter-character delay of 5 milliseconds.

Before doing any programming, the algorithm for the specific PIC must be selected with the 'A' command. For example...

UPP>A3
Vers=3.3 Alg=3/20-5
UPP>

If your terminal program needs more time to scroll between lines (loses characters at the start of each line), use the '/'' parameter to increase the delay sent after each line. Values are from 1 (lowest) to 255 highest.

UPP>/25
Vers=3.3 Alg=3/25-5
UPP>

If your computer misses characters, try increasing the intercharacter delay.


UPP>-10
Vers=3.3 Alg=3/25-10
UPP>



(All parameters are stored for future use. )

To begin programmimg, use the 'L' command...

UPP>L
PROG LOAD!

Next tell your terminal program to send the HEX file that you have already assembled. This is the file that virtually every PIC assembler produces. You will see the word LOAD replaced with the current programming address. It then reads back the PIC and shows either OK or ERROR.

This unit processes one line at a time from the Hex file. After receiving a complete line, it programs those locations. This needs some time depending on the specific programming sequence for that PIC. You need to give it time to do the programming, therefore...

In order to have this all work, you need to set up your terminal program to do one of two things:

1. Either wait for the '!' before sending each line.

2. Wait 10 to 100 milliseconds before sending each line.

Many other PIC's should work with this system. Just try the algorithm that looks most like the one for one of the versions above. You need to check the Microchip programming specification sheet for this. Or, just try them one at a time to see which one works.

If you want to read the data from an already programmed PIC, you need the 'U' command. This command needs to know how many bytes to send. It then automatically appends the CONFIG information and the end of file line. Your terminal program needs to have a capture feature to save this information. Then, just load it in any text editor to remove any stray typed characters that wound up in the file.

You can also use the 'D' command for a normal hex/ascii dump. This is also a good way to see if you have the PIC connected properly to the programmer hardware. An erased PIC has all locations as 3FFF; a programmed one will show other data. The Dump function always starts at location zero in the PIC, it runs until you hit any key.

The 'R' command puts the target PIC in the run mode. You use the 'S' command to stop it.

Certain commands used in developing this device have been left in. You may find them useful in working with new version of PICs. With them, you can create the basic commands used to read and write data directly to the chip. Here is an example.

UPP>P.6.6.2,1234.8;A.6=S
3456

This will write the data 1234 to the third program location in a PIC16F84 then read out data at the fourth location.

P turns on program power to the MCLR line
   and powers up the VCC line.
.6 sends an increment command
.6 sends an increment command
.2 sends load data command
,1234 sends hex data 1234
.8 sends the program command
;A waits 10 milliseconds
.6 send an increment command
= read and print program word
S turn prog and power off

 

You will need access to an existing programmer to make one of these units. After that, you can make more for yourself on any operating system that you are set up on.

Good luck.