Well, it was longer than I tough, but I finally could program my PICs (16F690 and 12F675) from the Atari.
I made two programs:
- picprog.asm / picprog.com : This is the programming software, reads a "script" with programming instructions from memory, blanks the PIC, programs and verifies all. This does not works alone, as the script must be created before.
- readhex.c / readhex.com : A C program (compile with CC65, "cl65 -tatari readhex.c -o readhex.com") that reads a .HEX file, asks for the PIC model, reads from disk the PICPROG.COM base and writes a new .COM capable of programming the given PIC.
Attached are a ZIP with the sources and binaries, and an ATR image with BWDOS, binaries and a sample program for a PIC16F690.Usage:
From the bwdos prompt, type:
READHEX SAMPLE.HEX SAMPLE.COM
Now, you see a prompt with the available PIC models. Select the one you wand by entering the number and RETURN.
This takes a while, reading "SAMPLE.HEX", the including "PICPROG.COM" and producing "SAMPLE.COM". If you omit the output name in the command line, the default is the same as input with ".COM" instead of any existing extension. If you omit both parameters, the program asks for the input HEX file name.
After the end, press RETURN to return to DOS.
Now, you have in the disk a new binary, run it to program the PIC:
Now, pressing START begins the programming. The background color flashes to indicate progress.
The programming is a little slow, because I have limited the speed to one WSYNC per clock transition, this is about 7.7kbaud, and the programming protocol takes 28bits for each word plus 3ms of "programming time", so 2kword of PIC memory should take about 15 seconds.Hardware:
This is the current hardware:
I added a transistor at the output of the VPP signal, as the PIC16F690 consumes more current from the VPP input, also added a 2k2 resistor from the DATA line to the PIC, this makes the programming much more reliable, and an optional zener diode to limit the VPP voltage. This is specially important if you want to program newer PIC that don't tolerate more than 10V at VPP input.