Parallel / Printer / LPT / Centronics Port



Port info

The Parallel Port isn't like most of the other ports on your pc, nearly every other port is serial. Basically the serial port puts out a stream of off and on pulses, the parallel port sets a group of output pins to on (3v to 5v) or off (0v) and reads some input pins that are grounded or not. That makes the parallel port a good option for the hobbyist that wants to turn things off and on with their computer.

The Parallel port is actually 3 port addresses, an 8 bit data output, a 4 bit control output and 5 bit status input.

Port Addresses
Port DATA STATUS CONTROL
on most computers 378h 379h 37Ah
second port 278h 279h 27Ah
on older PC's 3BCh 3BDh 3BEh
The parallel port is a 25-pin female port.

Pinout
Pin # Bits I / O
1 Control Bit 0 Output
2 Data Bit 0 Output
3 Data Bit 1 Output
4 Data Bit 2 Output
5 Data Bit 3 Output
6 Data Bit 4 Output
7 Data Bit 5 Output
8 Data Bit 6 Output
9 Data Bit 7 Output
10 Status Bit 6 Input
11 Status Bit 7 Input
12 Status Bit 5 Input
13 Status Bit 4 Input
14 Control Bit 1 Output
15 Status Bit 3 Input
16 Control Bit 2 Output
17 Control Bit 3 Output
18-25 Ground Ground

On most computers each port is actualy an 8 bit port, but those pins are all the bits that you can access through the connector. Also on some computers you can switch the pins between input and output. But that makes life complex and doesn't work on all computers. To turn a pin on you just output to that port. To turn on Data Bit 1 you would output 00000001b to the chosen port. In asm:

mov dx,378h ; load port address
mov al,00000001b : pins to turn on
out dx,al ; set pin

to turn it off:

mov dx,378h ; load port address
mov al,00000000b : pins to turn on
out dx,al ; set pin

The main problem with the printer port for controlling things is that it doesn't have enough power to actualy run a motor or even power a light. A ttl input level solid state switch, with a high voltage output, connected to the port, works well for turning on AC power motors and lights. There are a number of servo and stepper motor controllers that will connect directly to the printer port and power those sorts of motors. There are also a number of companies who sell break out boards to safeguard your computer from any mistakes and provide more power to drive devices.