                  
                  PP: PIC16X8X PROGRAMMER HARDWARE
                  ================================

                            David Tait
                       david.tait@man.ac.uk
                   http://www.man.ac.uk/~mbhstdj

I released information about a simple PIC programmer in early 1994 because
I couldn't find any homebrew designs around at the time.  That's all changed
now.  There has been an explosion of hobbyist interest in PICs and as
a result there's plenty of DIY information available in magazines and
on web sites.  The problem for most people now is choosing between all the 
stuff that's available.  Although a few of the other offerings you'll find 
are based on variants of my original stuff, and there are even commercial 
versions from Maplin, DonTronics and a others (but don't get the wrong 
idea - nobody has paid me a penny), that shouldn't be taken as any kind of
endorsement of what you've got here.  I can perhaps make your choice a 
little easier by telling you that what I'm offering is some DOS command-line
software which is only capable of programming the PIC16X8X family (16F83/84 
and 16C84) using relatively simple hardware (see pp.pcx) or even trivial 
hardware (see qandd.pcx) connected to the parallel port of a PC.  Now, if you 
really wanted something to program other PICs, look elsewhere; if you wanted 
a GUI, look elsewhere; if you wanted Windows software, look elsewhere; or if 
you would have preferred a serial port connection, look elsewhere.  All of
those alternatives are out there somewhere.  On the other hand, if you've 
built a programmer which you suspect may be compatible with mine, and want 
some no-frills DOS software to program the 16X8X family, look here.

The essential features of what has become known as a "Tait"-style programmer 
can be summarised as follows:

     o  Uses the PC parallel port pins D0, D1, D2, D3, ACK and GND.

     o  The PIC programming pins RB6 and RB7 are connected to D0 and D1
        via open collector buffers (either inverting like the 7406 or
        non-inverting like the 7407).

     o  RB7 is connected to ACK via one of the open collector buffers.

     o  The PIC VDD pin is connected to +5V either via a 4066 CMOS
        analogue switch (possibly the parallel combination of two or 
        three 4066 switches) or via a PNP transistor.

     o  The PIC /MCLR pin is connected to the programming voltage (about
        13-14V) either via a 4066 switch or a PNP transistor.

There are therefore at least four possible variants:

     o  7406 buffers/4066 switches
     o  7407 buffers/4066 switches
     o  7406 buffers/PNP switches
     o  7407 buffers/PNP switches

The original description contained an ASCII sketch of a simple 7406/4066 
version (this is still around as pic84pgm.zip in my PIC archive - reach it
via the URL at the head of this document).  However, possibly the most 
popular variant is based on 7407/PNP hardware and an example of this type 
is shown in the file pp.pcx.  The programmer should work with most PCs 
but the connection between the hardware and the PC should be fairly short.  
A couple of small value capacitors (100pF or so) one connected between RB6 
and GND and the other between RB7 and GND may be needed to suppress the 
"ground bounce" exhibited by some buffers.  PCB designs for various 
versions of the hardware can be found in several places (for example, 
there are a couple in my PIC archive: the 740X/4066 versions can be built 
using the layout in pic84art.zip produced by Michael Laidlaw; and Steve 
Willis has provided a layout for a PNP transistor variant in the file 
pp875.zip).  The hardware can be used to program most midrange PICs 
but I don't supply any software to do that myself.  Note, because of the 
higher current requirements of the non-EEPROM PICs I don't recommend using 
the 4066-based hardware with these devices although it may work.

There is now a lot of software around which is compatible with the 
programmer (for example, www.dontronics.com offers programs written 
by Nigel Goodwin for the DonTronics version; or see www.sistudio.com for 
PIP-02 by Silicon Studio).  My own software is pretty basic and 
as mentioned previously only works with the 16X8X family.  The software is 
designed to be run under MS-DOS and the user interface, if it can be 
dignified by such a description, is documented in the file program.txt.  
The current version of the software is V-0.5.  There have been a few
subtle changes since V-0.4 but the only essential difference between V-0.5 
and the previous version is slightly better support for the 16F84.  Another 
small change in V-0.5 is a more explicit separation between the front-end 
and the hardware dependent parts.  I hope this makes it easier for people
to port the program to other environments.  It should also make it a bit 
easier for me to document my other simple 16x8x programmer designs (like 
the forthcoming update for my TOPIC board - see topic02.zip in the PIC
archive) because the description in program.txt is common to them all.

The remainder of this document describes the hardware dependent features 
of the version of my software intended for use with any "Tait"-style 
programmer.  The executable for this version is in pp.exe and the C 
source is archived in src.zip.

MS-DOS environment variables are used to communicate with the driver 
software (i.e. the hardware dependent parts of the program).  (As MS-DOS 
reserves very little memory for environment variables it may be necessary 
to increase the allocation: more memory can be reserved using the /E:nnnn 
option of command.com and using /E:1024 will quadruple the default
allocation for example.)  The hardware driver changes its behaviour in 
response to the following variables:


     o  PPLPT=nn    Select printer port nn (default 1 thus selecting LPT1 
                    which is often, though not always, at address 378 
                    hex).  The software will only use likely printer 
                    port addresses.

     o  PPDEBUG=nn  Enable debugging if nn=1 (default nn=0).  This 
                    invokes a mode that lets you verify correct
                    operation of the hardware.  In debug mode hitting 
                    enter repeatedly will toggle each of the LPT pins in 
                    turn and also checks the input line for consistency
                    when D0 (equivalent to RB7) is toggled.

     o  PPDUMP=nn   Dump in INHX16 format if nn=16 (default INHX8M).

     o  PPDELAY=nn  Add nn*0.83 microseconds delay between LPT port
                    accesses (possibly useful on fast PCs).  The 
                    meaningful range of nn is 0 to 127 and the default 
                    is 6.

      o PPSETUP=nn  Select hardware setup:

                      nn=0 selects 7406/4066 switches (default).
                      nn=1    "    7407/4066 switches.
                      nn=2    "    7406/PNP transistor switches.
                      nn=3    "    7407/PNP transistor switches.

No environment variables NEED to be set for the original hardware 
described in pic84pgm.zip or the Maplin version.  To use the programmer 
design shown in pp.pcx you should make sure PPSETUP=3.  This can be done 
by several means: by adding

     set ppsetup=3

to your autoexec.bat file; by simply typing the same thing before using 
the software; or by writing a batch file to set the variable and run the 
software which you can then use instead of invoking pp directly.  The batch 
file approach is probably the most convenient.  Here's an example 
designed for 7407/PNP hardware on LPT2:

     @echo off
     set ppsetup=3
     set pplpt=2
     pp %1 %2 %3 %4
     set ppsetup=
     set pplpt=

A dummy batch file is provided in mypp.bat so that you can customise it
for your own version of the hardware.

Now you should read program.txt to learn more about the programmer software.


V-0.2  19 April 1998
