Parallel Port

Home ] Up ]

The parallel port got its start as a straightforward mechanism that allowed the CPU to communicate with a printer.  The CPU could poll a status bit to see if the printer was ready to accept a character, could write a byte to an output port that was wired to the printer, could set a bit to tell the printer the data was valid, and could poll another status bit to see if the printer had acknowledged receipt of the data byte. 

Of course, things changed.  Printers today have more processing power than the early PCs. CPUs went from simple, megahertz, byte-wide machines to screaming, gigahertz, cached, pipelined 32 bit-wide machines.  The parallel port was enhanced and extended.  The reality, however, is that the parallel port hasn't kept up with the advances personal computers in general have enjoyed.

The parallel port is a legacy port. This is truly sad because the parallel port is quite easy to interface to, is quite fast, and up until recently  it wasn't too difficult to write code for.  The parallel port is still a viable I/O path, but be aware that using it may eventually leave you high and dry when some random OS update declines to support it.

Peripherals are increasingly leaving the parallel port behind, depending instead upon USB.  At some point PCs will no longer have parallel ports. 

Software issues are moving the same direction.  It used to be you could use INPORTB() and OUTPORTB() to read and write the port's registers directly.   That doesn't quite happen with the newer versions of Windows, you actually talk to a virtual machine rather than hardware.   The ability to directly touch such registers is limited to kernel mode device drivers as Microsoft attempts to build increasingly robust operating systems.  When support for these ports is withdrawn totally, you quite possibly will have to write your own driver.

Legacy port or not, however, there are simpit builders, along with a few manufacturers, making a go of it quite successfully, and there is no reason you shouldn't be just as successful.  There is a lot of detailed information on the parallel port available, as well as, some nice third party software.  And, if the parallel port IS totally diss-ed, well..., the parallel port into your simpit then becomes an easy target for a USB interface adapter.  (Either buy one or build something like the project described in "USB Parallel Port" by Jan van de Kamer in the February 2003 issue of Circuit Cellar.)

If you do decide to give the parallel port a try, a good way to start is with a visit to Beyond Logic.  This site has a tremendous amount of information on interfacing in general and parallel ports in particular.  Craig Peacock has written a series of excellent articles detailing the standard, enhanced, and extended capabilities parallel ports.  You might also take a look at the book Parallel Port Complete by Jan Axelson.   If you need to get into the nitty gritty of Windows device drivers, check out Writing Windows WDM Device Drivers by Chris Cant, and The Windows 2000 Device Driver Book By Art Baker and Jerry Lozano.

Actually, Windows does apparently still provide at least some support for accessing the parallel port.  In Win 32 System Services, 3rd edition, authors Marshall Brain and Ron Reeves indicate that the communications APIs support the parallel port (LPT) as well as the serial (COM) ports.  Sadly, the book's numerous coding examples all focus on the serial port and there is no detail on the device control blocks or IO control for the parallel port.

You might also take a look at Scientific Software Tools, Inc.'s web site.  SST offers, as a free download, a simple user mode DLL and kernel driver that allows access to I/O ports from both Visual Basic and C++.  The software, "PortIO",  works under Windows 95, 98, Me, 2000, and XT.

Another bit of freeware is IO.DLL. This provides you with a set of calls for making bit, byte, word and double word transfers through the parallel port from C and VB. (My thanks to Scott at Integrated Flight Systems for bring this to my attention, as well as suggesting I review my opinions on parallel port viability.)

TVICHW32 and its subsets offer another possibility. It's no longer freeware, but as a pay-ware product, you can expect broader product support. 

Zeal SoftStudio offers NTPort Library that allows real time direct access to PC I/O ports, including the parallel port.  It functions under Windows NT/2000/XP.  NTPort appears to be receiving frequent support.

A final point; the parallel port is a byte-wide digital interface.  Technically, there are a few status bits that can be pressed into general I/O duty, but the point is that you've fundamentally got an eight bit pipe.  If you intend to do more than handle eight lights or switches, or if you are contemplating analog I/O, you will need to develop some additional logic.

 

It's possible that I'm not as smart as I think I am. (Occasionally, I have moments when I know this to be true. Fortunately the feeling passes quickly.) Although I have tried to make this information as accurate as I can, it is not only possible, but also quite likely, that errors lurk within. I cannot and do not warrant these pages to be error free and correct. Further I accept no liability for the use of this information (or misinformation). If, after reading this, you are still interested, please be aware that the contents of this site are protected by copyright (copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008 by John M. Powell). Nonetheless, you may copy this material subject to these three conditions: (1) the copyright notice is copied and presented along with the material, (2) the copy is used for non-commercial purposes, and (3) the source of the material is properly credited. And of course, you may link to this page.