QUICK-AND-DIRTY 16F84 PROGRAMMER ================================ David Tait david.tait@man.ac.uk http://www.man.ac.uk/~mbhstdj If you have a source of +12V-14V and +5V available you can program 16F84s with virtually no hardware. The schematic in qandd.pcx shows one possible setup. This is more or less the simplest circuit possible. In one design I've seen (Mark Cox's BLOWPIC) things are made even more simple by connecting the PIC directly to the parallel port but the 1k resistors add a little protection (the values are not critical but don't use less than 1k). Adding a few more components will make things a lot more convenient (see topic02.zip in my PIC archive for a more elaborate version; or, if I ever find time to document it, my hardware for programming 16F84s in-circuit via the PC serial port). The quick-and-dirty circuit has several limitations and one very big plus point: it should only take a few minutes to lash the thing together. The hardware is usable with the pp V-0.5 software described in pp.txt and program.txt but, because there is no way of reading the PIC, pp must be run with the -n switch and the PIC can't be dumped or verified. One other drawback with this setup is that program memory and data memory can't be programmed together. Using a hex file with both program and data memory specified will only give correct results for program memory. If this is a problem the hex utilities in pichex01.zip (from my PIC archive) can be used to split the hex file so that each area can be programmed separately. As most PIC applications don't really need the data memory to be programmed it's not likely to be a major limitation in practice. Although they were simply meant as examples of how to customise pp the files mypp.bat and mypp.pif are in fact ready to use with the hardware described in qandd.pcx. To use the quick-and-dirty programmer: insert a PIC (any of the 16x8x family); then, making sure the switch is closed, turn on the power supplies; run mypp with a command line of the form: mypp [ -xyz ] prog.hex where -xyz is an optional set of valid pp switches excluding -! or -s and prog.hex is the name of the hex file to be downloaded (using mypp rather than pp itself ensures that the software uses the correct setup, i.e. ppsetup=3, and that the -n switch is specified); when pp asks you to "Insert PIC ..." open the switch and hit any key (or control-C to abort); when pp exits close the switch, turn off the supplies and remove the PIC. You can run mypp from a Windows DOS box or drag mypp.pif onto a Windows folder for lazy "double-click" execution (you'll need to use the Windows PIF editor to set the appropriate command line though). If you add another single-pole double-throw switch wired so that it selects whether the /MCLR resistor is connected to +12V-14V (as shown) or to +5V you get a crude form of in-circuit programmer. This is roughly speaking how Derren Crome's Everyday Practical Electronics setup works. When the new switch is in the +5V position the existing switch either resets the PIC (closed position) or lets it run (open position). Of course, for the PIC to do anything useful you'll need to add oscillator components and make connections to some of the remaining port pins (as RB6 and RB7 are used for programming they are unavailable). You could try this out using the relevant bits of the setup shown in test.pcx. To program/reprogram the PIC you should first close the reset switch and select the +12V-14V supply with the other switch; then run mypp with whatever else you need on the command line (mypp walk.hex for example); when pp asks you to "Insert PIC ..." open the reset switch and hit a key; when pp exits close the reset switch and reselect the +5V supply; finally, open the reset switch at which point the PIC should start running. Sounds complicated but you'll soon get the hang of it: reset closed - select +12V-14V - reset open - reset closed - select +5V - reset open. (Adding a couple of transistors as described in topic02.zip automates these steps.) Build everything on a solderless breadboard and you don't really need the switches at all as you can get the same effect by moving a couple of wires about. If you don't have power supplies available you'll need a few more components to get you going. There are several options: one that I hesitate to mention is to steal the supplies from your PC via a spare floppy disk power connector - do this at your own risk (and the risk is considerable!); use a regulated 12V supply (12V battery or 8 AA batteries or whatever) and a 7805 regulator plus a couple of decoupling capacitors to get +5V; use the power supply parts of the programmer shown in pp.pcx together with an inexpensive "battery eliminator" on its 12V setting (which will typically produce about 16V-17V so don't be tempted to omit the 78L12 regulator); use a regulated +5V supply plus a couple of small 9V (PP3) batteries in series instead of the +12V-14V supply and connect a 12V zener diode from /MCLR to ground; use a regulated +5V supply and a DC-DC converter (one of the 8-pin Maxim chips for example) to get +12V; you get the idea ... Have fun. V-0.3 20 April 1998