Parallel Port Breakout

prototype breakout device

One day a fair while ago I built this prototype parallel port breakout widget after spending a few frustrating hours working with the arcane pin-out of the PC parallel port.

It probably isn't a new idea, and it probably isn't really that earth shattering, but I find it much easier to work with the signals lines brought out in the same order as their respective bits in the registers that represent them. At least when I am probing around with a logic probe while debugging.

The prototype was built using some fine gauge enamel wire and about an hour of patient soldering. You can build your own pretty easily, but it is time consuming. After extensive use of the little tool I showed it to a few people and they loved it, vowing to build their own.

The idea, for those unfamiliar with the practice of using machined-pin IC sockets as transient connectors, is to use a piece of solid-core (single strand) hook-up wire to plug into the socket and then into your prototype on a solderless breadboard. I find the wire from cat-5 cable, or old PC data leads ideal for this kind of service. A pair of side cutters and a T-Rex stripping tool is an excellent rapid bread boarding combination. (Sourcing 0.71mm solid core PVC jacketed wire is increasingly difficult and expensive compared to flex hook-up wire, at least in my neck of the woods.)

I decided to get a small PCB made up to make building them trivial. I figured, worst case, I can probably flog them on eBay if my idea turned out to be totally insane.

Unfortunately the first batch I got made up were missing the silkscreen because the board house's machine broke down and they sent them anyway, believing I was in a rush for them. This is a little annoying, but doesn't make the entire batch worthless. I am selling them on eBay at cost. I've since received a replacement batch from the board house with the silkscreen which will also be sold to friends and on eBay.

Here is a picture of one without a silkscreen:

one of the first batch (missing silkscreen) of breakout devices

The pin-out is easy to learn and remember:


The leading / denotes signals of inverted logic (i.e. active low, a 0 in software is 5 Volts in hardware). The PC parallel port is represented in software as three 8 bit IO locations. For the first port, the IO base address is 0x378. Various signals, both input and output and inverted in the hardware of the PC port, this breakout is completely passive, doing nothing to 'correct' this, it simply notes it in the silkscreen and lets you deal with it in your application hardware (or software).

The first register (i.e. 0x378) is the Data or D register. By default it is an 8 bit wide output. This breakout maps D0-D7 to pins 1-8. By setting a bit in the Control register you may turn these pins into 8 inputs with weak pull-ups. There is no facility to do bit-wise I/O selection, it is all 8 bits at once or none. At least for the SPP mode. Input (bi-direction) may not be supported on some older ports, but all modern devices claiming to be SPP compliant will offer bidirectional mode. The pins can source several mA, and can light a LED via a 560 Ohm resistor to the DC return/ground, which this breakout offers as pin 10.

'''In fact I've made up several strips of LEDs with dropper resistors on a piece of IC socket or SIL header. It is very handy for viewing byte-wide bus states, or general bit states from a prototype. If you are fortunate enough to come across an IC test clip you can make a buffered parallel logic probe.'''

The second register (i.e. 0x379) is the Sense or S register. It offers 5 inputs, mapped to the 5 MSB of the register. The MSB (S7) is inverted. The inputs typically offer weak pull-ups in hardware, but I've seen many ports that are a bit weird in this respect, in particular many Toshiba laptops have truly bizarre parallel ports. The bottom 3 unused sense bits seem to always read 1 in SPP mode, but I wouldn't depend on it.

The third and final register (i.e. 0x37A) is the Control or C register. It offers 4 outputs mapped to the 4 LSB of the register. All are inverted except C2. The output will source a few mA and are much like D0-D7, some are defined to be open collector, but all modern ports seem to ignore this. The C5 bit is special, setting it enables the tri-state on D0-7 and as long as it remains set input can be read from D0-7. C4 is also special, setting it enables interrupt generation, the IRQ associated with the parallel port (i.e. IRQ 7) will fire on the rising edge of S6. C6 and C7 seem to always read 1 in SSP mode, but again don't depend on it.

Strange things to watch out for are ports that tri-state after each read, or only assert D0-7 while the Strobe signal is asserted. This is totally broken, but not uncommon on cheap 486 I/O cards and laptops.

This site has a huge collection of parallel port information. It also carries lots of Win32 specific software and links, which is something I can't help you with :-).

I've also written some software for Linux to help with prototyping with these things. It is very simple, it offers a few commands to print the state of the parallel port registers, toggle or set individual bits, and set entire registers to decimal, hex, or octal values. It is interactive, the ? command gives the command list:

Commands: q quit ? this usage message r Read status of port d <byte val> assign Data register D <bit num> toggle bit of Data register c <byte val> assign Control register C <bit num> toggle bit of Control register

Byte values can be supplied as decimal (e.g. 34), octal (e.g. 042), or hex (e.g. 0x22).

In Linux you need to be root to call the ioperm() system call (giving a user space process access to IO space). You should setuid the tool and only allow your development people's group to execute it. You may of course just run it as root, but setuid is nice. It isn't written to be super secure, it is a development tool, not something you'd have on a Internet facing server. #include <std-disclamer.h>

Some ideas to get you started? How about bread boarding my I2C Interface/Serial EEPROM programmer, or how about testing some stepper motors with something like this code and this circuit (I've used this many times, works great for small steppers from fax machines, scanners, and disk drives. Use more voltage for more torque, you will warm up, but not destroy 5 V steppers running them from up to about 18 Volts, just don't leave them sitting there burning, share the current around the windings, or add resistors.). Two steppers can be controlled via one port in this manner, for example, to move an X/Y platform. Perhaps some other 2 dimensional control system. Limit switches can be read via the Sense bits. Perhaps the Control bits can turn on machines, maybe a vacuum clamp, maybe a Z-axis stepper. CNC here we come :-)

Leave a comment on this article.