The Parallel Port
When IBM introduced the PC in 1981, the parallel printer port (often referred to even now as LPT, meaning line print terminal) was included as an alternative to the serial port for connecting a printer. The parallel port could transfer 8 bits of data at a time, whereas the serial port transmitted only one bit at a time. It used a 25-wire connector to transmit the data and the various control signals used by the printer.
The parallel port
Originally, the parallel port allowed for communication in one direction only (computer to printer), and the maximum data transfer rate was around 150 Kbps. There was no standard for the interface, which made it difficult to guarantee correct operation on different platforms, and external cables were limited to two metres in length. The parallel port eventually evolved into the Enhanced Parallel Port (EPP), which allowed bi-directional communication, and a data rate of up to 2 Mbps in both directions, on cables up to nine metres in length. The parallel port on a PC consists of a connector with 17 signal lines and 8 ground lines. The signal lines are divided into three groups:
- Control (4 lines)
- Status (5 lines)
- Data (8 lines)
In the original Standard Parallel Port (SPP), the control lines are used to send control signals from the PC to the printer. The status lines are used to send control signals and status information (for example, to indicate that the printer is busy or out of paper) from the printer to the PC. The data lines carry data from the PC to the printer, in one direction only. Later implementations of the parallel port allowed data to be sent from a peripheral device to the PC. The table below identifies each of these signals, and gives their SPP definitions.
Group | SPP Signal | DB25 Pin | In/Out | Signal Description |
---|---|---|---|---|
Control | STROBE | 01 | Out | Active low. Indicates valid data is on the data lines. |
SELECTIN | 13 | Out | Active low. Used to indicate to the printer that it is selected. | |
AUTOFEED | 14 | Out | Active low. Instructs the printer to automatically insert a line feed for each carriage return. | |
INIT | 16 | Out | Active low. Used to reset the printer. | |
Status | ACK | 10 | In | A low asserted pulse used to indicate that the last character was received. |
BUSY | 11 | In | A high signal asserted by the printer to indicate that it is busy and cannot take data. | |
PAPER END | 12 | In | Paper Empty. | |
ERROR | 15 | In | Asserted low to indicate that some error condition exists. | |
SELECT | 17 | In | Asserted high to indicate that the printer is online. | |
Data | DATA 0 | 02 | Out | Output only in SPP. |
DATA 1 | 03 | Out | ||
DATA 2 | 04 | Out | ||
DATA 3 | 05 | Out | ||
DATA 4 | 06 | Out | ||
DATA 5 | 07 | Out | ||
DATA 6 | 08 | Out | ||
DATA 7 | 09 | Out |
Each signal is assigned to a specific bit within the registers that make up the hardware/software interface to the parallel port. The registers are a block of 3 registers starting from the parallel port's base address. These ports are referred to as the LPT ports and have the I/O base addresses of 3BCh, 378h and 278h. Implementations of the parallel port that support the advanced modes of the IEEE1284 standard use 8 to 16 registers and are located at I/O addresses 378h or 278h or, in the case of a Plug and Play compliant parallel adapter, are re-locatable. Table 2.2.2 identifies the registers for the standard parallel port.
Port Addresses
The parallel port has three frequently used address blocks - 3BCh-3BFh (4 bytes), 378h-37Fh (8 bytes), and 278h-27Fh (8 bytes). The 3BCh base address was originally used for parallel ports on video cards, and fell into disuse when video cards ceased to use parallel ports. It later reappeared as an option for an LPT base address. LPT1 is normally assigned base address 378h, while LPT2 is assigned base address 278h. The parallel port device registers occupy 3 bytes, beginning at the specified base address, and the bits in each register have specific signals associated with them, as shown in the table below.
Register Offset | Name | Read/Write | Bit No. | Description |
---|---|---|---|---|
Base + 0 | Data Port | W | 7 | Data 7 (Pin 9) |
6 | Data 6 (Pin 8) | |||
5 | Data 5 (Pin 7) | |||
4 | Data 4 (Pin 6) | |||
3 | Data 3 (Pin 5) | |||
2 | Data 2 (Pin 4) | |||
1 | Data 1 (Pin 3) | |||
0 | Data 0 (Pin 2) | |||
Base + 1 | Status Port | R | 7 | Busy |
6 | Ack | |||
5 | Paper Out | |||
4 | Select In | |||
3 | Error | |||
2 | IRQ (Not) | |||
1 | Reserved | |||
0 | Reserved | |||
Base + 2 | Control Port | R/W | 7 | Unused |
6 | Unused | |||
5 | Enable bi-directional Port | |||
4 | Enable IRQ Via Ack Line | |||
3 | Select Printer | |||
2 | Initialize Printer (Reset) | |||
1 | Auto Linefeed | |||
0 | Strobe |
The parallel port specification was formalised by the IEEE 1284 standard in 1994. This standard defines several modes of operation, including Compatibility mode, which allows data transfer in one direction only, Enhanced Parallel Port (EPP) mode, and Extended Capabilities Port (ECP) mode. The EPP and ECP modes both provide for bi-directional communication, with the assistance of additional hardware that generates and manages handshaking. IEEE1284 standards for the cable, connector and electrical interface guarantee interoperability between all parallel peripherals, and ensure that data integrity is maintained, even at high data rates, at a distance of up to 30 feet.