Content area
Full Text
Teamed up with a little code a parallel printer port can substitute for test equipment like data generators and logic analyzers.
One task that faces many engineers when evaluating a new device is finding a way to control its various functions. It's sometimes quite dif ficult to figure out how to read and write data to and from its registers. This can involve setting up data generators, logic analyzers, and other equipment.
In order to be useful, the device must have the correct timing sequence.
Another solution is to use a dedicated digital I/O board. These are of ten quite expensive and may require special software. A good alternative is to use an I/O port that exists on virtually all PCs and laptops-- namely, the printer port. That port is often left idle in an environment of networked printers and servers. Even if it is being used by a printer or scanner that can't be disconnected, it's possible to buy a second printer-port card for less than $50.
The most basic type of printer port is the AT version. It contains an 8-bit output port (data port), a 5-bit input port (status port), and a 4-bit output port (control port). Later models of PCs improved on this slightly. The PS/2 printer port has a data port that's bidirectional. It can be programmed to read data in as well as write it out. The most recent addition to the printer-port family is the enhanced printer port (EPP), which boasts data transfer rates of up to 1 Msample/s. This article will concentrate on the AT/PS2 versions, as these are the most straightforward and the easiest to program.
The name given to the printer port indicates its location in the PC's memory map. There are three possible.locations in which the printer-port registers can reside:
Port Name Base Address
LPT1 0x378 (most common)
LPT2 0x278
PRN 0x3BC
A number of ways exist for determining where the printer port lies in the memory. The most foolproof is to examine the computer's BIOS information. This area of memory contains information about all of the peripherals which make up the computer, such as serial ports, disk drives, and of course the printer port.
When the PC is powering up, it...