# PIC programmers for the parallel port

Using a simple PIC programmer at the parallel port can cause headaches under certain Windows versions. First of all, you must select one of the port access drivers, because the Windows API (application interface) doesn't have suitable functions for the parallel port. Even worse: Sometimes the printer driver (or whatever?) accesses the port though WinPic tries to occupy the port itself. This somehow depends on the signal used to read back the data from the PIC. Especially the PAPER OUT signal seems to attact Window's attention .. and should be avoided for this reason. I did not check if removing all printer drivers can help, if you know more please let me know.

WARNING ! Because Windows sometimes fools around with the parallel port, and we don't know the state of the parallel port before starting the programmer, first connect the programmer with the PC, then turn the PC on, start the programmer, and insert the PIC into the socket (or connect the ICSP cable) shortly before programming ! If you get an error message from WinPic saying "Windows fooled around with the parallel port bits", read this .

However, it may be possible to use a few -in the days of DOS widely used- interfaces. Supported (but not all tested) are the following interfaces, along with their major differences.

PIC programmers for the parallel port
Interface type | Data PC->PIC | Clock PC->PIC | Data PIC->PC | Vpp Control | Vdd Control | Remarks
PIC FLASH programmer V1 (SM6LKM, 2002-10-01) | D2, not inverted | D3, not inverted | ACK, inverted | D4, inverted (L=Vpp on) | D0, not inv. (H= Vdd on) | ICSP adapter with D7 = ICSP disconn(*)
PIP84 (by SM6LKM) | D2, not inverted | D3, not inverted | PAPER,inverted | D4, inverted (L=Vpp on) | D0, inverted (L= Vdd on) | D1=green LED D7=ICSP disconnect
PIP84 (alternative) | D2, not inverted | D3, not inverted | ACK,inverted | D4,inverted | D0,inverted | D1=green LED D7=ICSP disconnect
Tait, 7406, 4066 | D0, inverted | D1, inverted | ACK, inverted | D3, inverted | D2, inverted | 7406=inverter 4066=switches
Tait, 7407, 4066 | D0, not inverted | D1, not inverted | ACK, not inverted | D3, not inverted | D2, not inverted | 7407=non- inverting driver
Tait, 7406, PNP | D0, inverted | D1, inverted | ACK, inverted | D3, not inverted | D2, not inverted | 7406=inverter, + PNP-transistor
Tait, 7407, PNP | D0, not inverted | D1, not inverted | ACK, not inverted | D3, inverted | D2, inverted | David Tait's "classic" design
Microchip "AN 589" | D0 | D1 | ACK | D3 | none (always on) | D2=data tristate, D5=clock tristate, D4=Pull MCLR down

Signals on the PC's 25-pin "LPT" connector (SUB-D)
Pin Nr | Signal | token name in interface definition file | Direction | Description (usual function)
1 | /STROBE | str | PC->printer | 'Byte clock'
2 | D0 | D0 | PC->printer | Centronics Data
3 | D1 | D1 | PC->printer | Centronics Data
4...8 | ... | ... | PC->printer | Centronics Data
9 | D7 | D7 | PC->printer | Centronics Data
10 | /ACK | ack | printer->PC | Acknowledge
11 | BUSY | bsy | printer->PC | Busy or Error
12 | PAPER | pap | printer->PC | high=printer ran out of paper
13 | SELECTED | sld | printer->PC | high=printer is on-line
14 | /ALF | alf | PC->printer | automatic line feed
15 | /ERROR | err | printer->PC | out of paper, error, offline
16 | /INIT | ini | PC->printer | resets the printer
17 | /PRINTER SEL | psl | PC->printer | low = select printer
18..25 | GROUND |  | - | connect ALL LINES to ground

Not listed in the above table: ICSP Connect/Disconnect ... based on an idea by Johan Bodin:
  Centronics D7 (inverted) is used as an additional control line for in-circuit programming. This signal is used to *totally* disconnect the programmer from the target system (using relay(s) and/or CMOS analog switches or whatever). This eliminates the need to plug/unplug the programming connector for code test runs. Some target systems may have very hi-z circuits connected to the programming pins, RB6/RB7 (GP0/GP1).
  D7 = LOW means "Programmer shall be connected to target"
  D7 = HIGH means "Programmer shall be disconnected from target" (you'll find D7 HIGH after booting the PC in many cases, so HIGH=DISCONNECT is the safer state)
  After switching this signal to LOW (=connect programmer to target), the software waits at least 200 milliseconds until the first attempt to switch the PIC into programming mode. This should be enough for electromagnetic relays.

####

Parallel port trouble

Sometimes (especially under Windows XP) you may get a sloppy error message from WinPic telling you that "Windows fooled around with the parallel port". The reason for this may be a scanner driver, printer driver, or the plug-and-play hardware detection which permanently polls the port for new devices. Of course, this will spoil the operation of a PIC programmer connected to the parallel port !

The problem could sometimes be fixed by adding (or modifying) the following key in the windows registry :

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Parport\Parameters]

"DisableWarmPoll"=dword:00000001

Search the web for "Jan's Parallel Port FAQ"; the site contains details about this registry hack.
Caution: Only modify the registry if you know what you're doing ;-)