BUS INTERFACE:THE PARALLEL PRINTER INTERFACE (LPT)

THE PARALLEL PRINTER INTERFACE (LPT)

The parallel printer interface (LPT) is located on the rear of the personal computer, and as long as it is a part of the PC, it can be used as an interface to the PC. LPT stands for line printer. The printer interface gives the user access to eight lines that can be programmed to receive or send parallel data.

Port Details

The parallel port (LPT1) is normally at I/O port addresses 378H, 379H, and 37AH from DOS or using a driver in Windows. The secondary (LPT2) port, if present, is located at I/O port addresses 278H, 279H, and 27AH. The following information applies to both ports, but LPT1 port addresses are used throughout.

The Centronics interface implemented by the parallel port uses two connectors, a 25-pin D-type on the back of the PC and a 36-pin Centronics on the back of the printer. The pin-outs of these connectors are listed in Table 15–8, and the connectors are shown in Figure 15–13.

The parallel port can work as both a receiver and a transmitter at its data pins (D0–D7). This allows devices other than printers, such as CD-ROMs, to be connected to and used by the PC through the parallel port. Anything that can receive and/or send data through an 8-bit inter- face can and often does connect to the parallel port (LPT1) of a PC.

Figure 15–14 illustrates the contents of the data port (378H), the status register (379H), and an additional status port (37AH). Some of the status bits are true when they are a logic zero.

Bus Interface-0339Bus Interface-0340

Using the Parallel Port Without ECP Support

For most systems since the PS/2 was released by IBM, you can basically follow the information presented in Figure 15–14 to use the parallel port without ECP. To read the port, it must first be initialized by sending 20H to register 37AH as illustrated in Example 15–6. As indicated in Figure 15–14, this sets the bidirectional that selects input operation for the parallel port. If the bit is cleared, output operation is selected.

Bus Interface-0341

Once the parallel port is programmed as an input, it is read as depicted in Example 15–7. Once the parallel port is programmed to function as an input port, reading is accomplished by accessing the data port at address 378H.

Bus Interface-0342

To write data to the parallel port, reprogram the command register at address 37A by writ- ing 00H to program the bidirectional bit with a zero. Once the bidirectional bit is programmed, data are sent to the parallel port through the data port at address 378H. Example 15–8 illustrates how data are sent to the parallel port.

Bus Interface-0343

(80286-based) machines the bidirectional bit is missing from the interface. In order to read information from the parallel port, write 0FFH to the port (378H), so that it can be read. These older systems do not have a register at location 37AH.

Accessing the printer port from Windows is difficult because a driver must be written to do so if Windows 2000 or Windows XP is in use. In Windows 98 or Windows ME, access to the port is accomplished as explained in this section.

There is a way to access the parallel port through Windows 2000 and Windows XP without writing a driver. A driver called UserPort (readily available on the Internet) opens up the protected I/O ports in Windows and allows direct access to the parallel port through assembly blocks in Visual C++ using port 378H. It also allows access to any I/O ports between 0000H and 03FFH. Another useful tool is available for a 30-day trial at www.jungo.com. The Jungo tool is a driver development tool, with many example drivers for most subsystems.

Leave a comment

Your email address will not be published. Required fields are marked *