PC Interfacing Fourth Level Lecture TWO: Parallel (Centronic) Port Interface

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

PC Interfacing

Fourth Level
Lecture TWO

Parallel (Centronic) Port


Interface

Goals:
Up-on completing this lecture, the student should be able to:

1- Identify the main concept of PC-interfacing.


2- Identify the Parallel port and its principle of operation
3- Design interfacing circuits using the 3 groups of pins in the parallel port.
1. Introduction:-
The Centronic, RS232 and game ports are the most common I/O ports that a
modern computer has. Some notebook computers may not have a game port, but the
Centronic and the RS232 ports are the universal features of all types of computers.
Originally, these ports were designed for specific applications. Centronic ports
are used for connecting computers to printers; RS232 ports for connecting printers,
modems and mice; and game ports for connecting joysticks. They can also be used for
other interfacing applications. Peripheral devices designed for these ports not only
provide the easiest way of connection to computers but also offer a universal hardware
solution for all computers. Therefore, it would be very useful to understand how these
ports work and how to make the best use of them.
2. The Centronic Port :-
The Centronic port, also known as the printer port or the parallel port, is an
industrial standard interface designed for connecting printers to a computer. A
computer at least has one such a port installed. The port may come with the computer's
mother-boards or with plug-in I/O cards. Adding more Centronic ports is easy and
inexpensive. In total, four Centronic ports may be installed on a computer and they
have logic names LPT1 to LPT4.
• Mother boards have 1, adding more is easy and inexpensive using
plug in I/O cards (Max.4)
• They have Logic name (LPT1 to LPT4)
• Work with distance < or= 5 meters

3. Port connectors (Pin configuration) :-


The port connectors on a computer and on a printer are different. The one on
the computer is a 25 pin D-type female connector (Figure 1.1(a)), and the latter is a 36-
pin female Centronic-type connector (Figure 1.1(b)). The pin functions of the two
connectors are shown in Figure 1.1. To connect a printer to a computer, a printer cable
is used (Figure 1.2). The length of the cable must not exceed 5 meters. The Centronic
interface is not for long distance operations.
Fig. 1.1: Pin-out of the Centronic port connectors on computers and printers
Fig. 1.2: The printer lead

4. Internal hardware organization :-

The circuit of a generic Centronic port inside a PC is shown in Figure 1.3.


Eight-bit data is latched into IC1 by writing to a port having an address: base
address+0. This operation is under the control of WRITE_DATA. The output forms
the Data group. Data can be read into the computer from the same address via IC2
under the control of-READ_DATA. When reading data, the output from IC1 must be
in high impedance state. This is achieved by making pin 1 (OUTPUT ENABLE) of
IC1 high.

A 6-bit control is latched to IC3 by writing to base address+2. This operation is


under the control of WRITE_CONTROL. Bit 0 to bit 3 are output to the port
connector to form the Control group. Some of the lines are inverted by open-collector
inverters (IC6 and IC7). All the output lines are pulled to +5V by 4k7 resistors. These
bits can be read back into the computer at the same address via IC4a under the control
of-READ_CONTROL. Bit 4 of the control byte enables the interrupt and bit 5 enables
or disables the output of IC1. Five lines in the port connector (the Status group) can
be read into the computer via IC4b under the control of-READ_STATUS. The address
associated with this is base address +1. These inputs are pulled to +5V by 4k7 resistors
and one of the lines is inverted.
In original, the output enable of IC1 is tied to ground to permanently enable the
outputs. This is the unidirectional version of the Centronic port. From IBM PSI2, the
output enable of IC1 is connected to bit 5 of the control register IC3 as shown in
Figure 1.3 and the port becomes a bidirectional port. Each output line in the Data
group is capable of sourcing 2.6 mA current with the voltage varying between 2.6 to
5V. Each can sink 24 mA. The lines in the Control group have a much smaller
capacity to source and to sink current. They can only source 100 µA and sink 8 mA
current. The rate of data transfer through the Centronic port is greater than 1
Mbyte/second.

Fig. 1.3: Circuit diagram of the generic Centronic port


5. Groups (Data, Control and Status):-

The I/O lines in the port are organized into three groups, namely, the Data
group, the Control and the Status group. Figure 1.4 gives the logic structure of the
Centronic port.

Fig. 1.3: the logic structure of the Centronic port on computers


Data group

This sends data from PCs to external devices. It has eight latched output lines and the
group is associated with an 8-bit CPU port. The address is: base address.

Control group

This controls the operation of external devices. It contains four latched output lines (-
STROBE, -LF/CR, -SLIN and -INITIALIZE) which are from the computer to the
devices. The group is controlled by a CPU port having an address: base address+2. -
STROBE, -LF/CR and -SLIN lines are inverted.-INITIALIZE is not.

Status group

The group is used by the computer to obtain the current status of external devices. It
contains five lines (-ERROR, SLCT, PE,-ACK and BUSY), which are directed from
external devices to the computer. It is fed into a CPU port, the address of which is:
base address+l. BUSY line is inverted and the other four lines are not.

The bit functions of each I/O port are summarized in Table 1.1.
The LPT base address

There are two ways to obtain the base address. One is to check the hardware
configuration of your computer. The other is to find the addresses directly from the
user's program by using the facilities provided by the computer's basic input output
system (BIOS). When a computer is powered on or reset, the BIOS checks all the
possible Centronic ports. If it finds one, it writes the addresses (a 2- byte word) of that
port to two specific memory locations. The memory locations for LPT1 to LPT4 are
listed as follows:
LPTI: 0000:0408h - 0000:0409h
LPT2: 0000:040Ah - 0000:040Bh
LPT3: 0000:040Ch - 0000:040Dh
LPT4: 0000:040Eh - 0000:040Fh
There is another useful memory location, 0000:4011h. It stores the total number of
Centronic ports installed. The information is contained in bit 6 and bit 7.
bit 7=0, bit 6=0: no Centronic port installed
bit 7=0, bit 6=1: one Centronic port installed
bit 7=1, bit 6=0: two Centronic ports installed
bit 7=1, bit 6=1: three Centronic ports installed

The LPT base address


1-from the HW
2-directly from (BIOS), with memory locations are:
LPTI: 0000:0408h - 0000:0409h
LPT2: 0000:040Ah - 0000:040Bh
LPT3: 0000:040Ch - 0000:040Dh
LPT4: 0000:040Eh - 0000:040Fh

Software control
a-How to obtain the base address of LPT
-QBASIC
-TP6
-WINDOWS
b-How to Output & Input data via the LPT
1-Printer commands &BIOS interrupt routines
. QBASIC with instruction PRINT
. TP6 with instruction WRITELIN(LST)
.BIOS interrupt INT 17h
2-Direct I/O access
Summary:
1- There are three groups of pins in the parallel port: Data, Status, Control
2- Some are pulled-up and some are inverted.
3- Data is sent in parallel hence strobing and ACK should be used.

Questions:
1- Design an interfacing cct to connect two eight bit analog to digital
converters to the parallel port of a computer. Write the pseudo-code as
well.

2- how to read a 12 bit data-bus on the parallel port? Design and show
the pseudo-code.

You might also like