The pin-out of the parallel port is the following:
13 12 11 10 9 8 7 6 5 4 3 2 1
\ o o o o o o o o o o o o o /
\ o o o o o o o o o o o o /
25 24 23 22 21 20 19 18 17 16 15 14
(o) pin 1 -Strobe
(x) pin 2 +Data bit 0
(x) pin 3 +Data bit 1
(x) pin 4 +Data bit 2
(x) pin 5 +Data bit 3
(x) pin 6 +Data bit 4
(x) pin 7 +Data bit 5
(x) pin 8 +Data bit 6
(x) pin 9 +Data bit 7
(i) pin 10 +Acknowledge
(i) pin 11 -Busy
(i) pin 12 +Paper out
(i) pin 13 +Select
(o) pin 14 -Auto feed
(i) pin 15 +Error
(o) pin 16 +Initialize
(o) pin 17 -Select input
(-) pin 18 Ground
... ... .. ...
(-) pin 25 Ground
(o) = pin is for output
(i) = pin is for input
(x) = pin is for output and maybe also for input
(-) = pin is common reference
+ = bit follow direct logic: 1 = +5V, 0 = 0V
- = bit follow inverse logic: 1 = 0V, 0 = +5V
Using the port
Data can be easily sent through the parallel port using redirection in
DOS. However you will only gain full control of the port writing your own
applications. I will briefly describe the basics of the parallel port
control for the purposes of simple interfacing.
The parallel port is controlled writing to and reading from 3 port
addresses. The base addresses are 0378h and 037Ch for LPT1, 0278h and 027Ch
for LPT2, and 03BCh for LPT3. The meaning of each port address and its bits
is the following, where bit 0 is the least significant bit and bit 7 is the
most significant bit.
- Base address: Data port, for writing and maybe also for reading.
- Bit 0: Data bit 0.
- Bit 1: Data bit 1.
- Bit 2: Data bit 2.
- Bit 3: Data bit 3.
- Bit 4: Data bit 4.
- Bit 5: Data bit 5.
- Bit 6: Data bit 6.
- Bit 7: Data bit 7.
- Base address + 1: Status port, for reading.
- Bit 0: reserved.
- Bit 1: reserved.
- Bit 2: IRQ detection.
- Bit 3: Error.
- Bit 4: Select.
- Bit 5: Paper out.
- Bit 6: Acknowledge.
- Bit 7: Busy
- Base address + 2: Control port, for reading and writing.
- Bit 0: Strobe
- Bit 1: Auto feed
- Bit 2: Initialize
- Bit 3: Select input
- Bit 4: IRQ enable
- Bit 5: reserved*
- Bit 6: reserved*
- Bit 7: reserved*
* One of these bits will be probably used in bidirectional ports to
switch the data port from output to input and vice-versa.
Using the commands and routines which every programming language has to
read from and write to the ports, you can set and check the status of the
lines of the parallel port. This will let you interface with your own
devices, for example you can open/close a relay which feeds a motor, a
light, etc.; or you can check if a cable has been cut (alarm) or a switch
has been activated, etc. For instance, if you want to monitor the status
of the Busy line of LPT1 and activate Initialize when Busy is activated,
you can do it with a BASIC program like the following, note that Busy uses
inverse logic and Initialize direct logic.
10 WHILE 1 : REM *** Endless loop ***
20 BU = INP (&h0379) AND &h80 : REM *** Read port and mask bit for Busy
30 IF (BU <> 0) THEN GOTO 50 : REM *** Check if Busy is low ***
50 OUT &h037A, &h04 : REM *** Set Initialize high ***
For information about extended capabilities (bidirectional, EPP, ECP) see:
E-mail: padilla at
domain "gae ucm es" (my PGP/GPG public key)
First version: 24-Jun-1997, last update: 21-Jan-2003
This link: http://www.gae.ucm.es/~padilla/extrawork/parallel.html
Go to the parent page: Specifications of useful PC