Why The Parallel Port?
Why The Parallel Port?
1) If the device is intended for lab or classroom use, placing hardware inside the computer
may be too risky for the machine or the users (who may be beginners).
2) A piece of hardware is easily accessible for probing and measuring when it is outside the
boundaries of a PC.
3) Inserting an interface card increases the complexity of the operation. In some cases,
adding an interface card could cause a problems (for instance, when you're interfacing to
a multimeter or logic analyzer or an oscilloscope probe that may create unwelcome
electrical shorts).
4) Not all computers have an available expansion slot. With shrinking computer sizes, some
modern computers have fewer slots. Laptop computers do not have any conventional
expansion slots (other than PCMCIA (Personal Computer Memory Card International Association )
slots). Other computers may have slots, but those slots may be devoted to other purposes,
such as network cards, sound cards, and fax/modems.
5) Many applications that require data acquisition and control do not really require the
sophistication of a motherboard expansion slot. A simpler solution would be cleaner,
easier, and cheaper.
An alternative to using an interface card is to design your hardware so that it can connect to
the PC through the parallel printer adapter (i.e., the parallel port). This approach has several
advantages, such as:
1) Parallel ports are universally available on all PCs and compatibles.
2) Another benefit of the parallel port is that the IEEE has continued to improve the parallel
port specification while at the same time retaining backward compatibility with the
original parallel port.
3) Over the past few years, programmers have increasingly favored the parallel port as a
means of connecting tape backup systems, CD-ROM Players, and LAN adapters, as well
as various types of high-performance printers.
4) The parallel port is thus an graceful solution for interfacing a data acquisition device with
a PC.
Figure 1.1 shows the block diagram of a simple computer-assisted data acquisition system. A
computer is connected to the interface hardware. The interface hardware, in turn, is connected
to suitable sensors that will respond to changes in the physical variables for the experiment.
Control is the process of acquiring data about a phenomenon as a function of some variable
and then regulating the phenomenon by restricting the variable to a preset value as shown in
Figure-2.
➢ In the early days of personal computers, most printers only could be connected using a serial
interfaces. When printers started to have their own memory buffers, users found the serial
link too slow. Manufacturers started offering printers with a parallel interface that could, in
principle, receive data at least eight to ten times faster than was possible with the serial port.
The adapter on the computer that allowed the user to connect to the parallel printer (i.e., the
printer with a parallel input) was the parallel printer adapter.
➢ At the time the parallel printer adapter came into existence, PC processors were all 8-bit
processors. So, it seemed logical to define a data path to a printer with the capacity to transfer
eight simultaneous bits of data.
➢ The data, strobe, and ack signals are sufficient to transfer data between the computer and the
printer.
➢ However, during occasions when the printer's internal memory buffer is full (because the
printer cannot print as fast as it can receive data), the printer must be able to inform the
computer that it can't receive more data or that it is busy. This signal from the printer to the
computer is called the busy signal. The printer also needs to signal the computer if there is any
error condition (e.g., if the paper has jammed in the printer mechanism or if the paper is empty).
A signal between the printer and computer called the error signal is used for this purpose.
➢ The computer can also use more signals to control the printer, such as a signal line to reset the
printer at the start of a fresh print run so that any residual data in the printer buffer is flushed
out.
➢ The actual parallel printer adapter is designed with 17 signals. These signals are distributed
across the three internal ports as follows:
➢ an output port with eight data signals called the DATA port;
➢ an input port with five status signals called the STATUS port;
➢ another output port with four signals called the CONTROL port.
➢ The output signals from the adapter are connected to a 25-pin D-type connector.
➢ On many of the new PCs, the parallel printer adapter has been integrated on the motherboard,
though plug-in card adapters are also available.
STROBE 01 Out Active low. Indicates valid data is on the data lines.
Active low. Used to indicate to the printer that it is
SELECTIN 13 Out selected.
Control
Active low. Instructs the printer to automatically
AUTOFEED 14 Out insert a line feed for each carriage return.
INIT 16 Out Active low. Used to reset the printer.
DATA 0 02 Out
DATA 1 03 Out
DATA 2 04 Out
DATA 3 05 Out
Data Output only in SPP.
DATA 4 06 Out
DATA 5 07 Out
DATA 6 08 Out
DATA 7 09 Out
Parallel Port’s are standardized under the IEEE 1284 standard first released in 1994.
This standard defines 5 modes of operation which are as follows,
1. Compatibility Mode. (Centronics Mode)
2. Nibble Mode.( bi-directional)
3. Byte Mode. .( bi-directional)
4. EPP Mode (Enhanced Parallel Port).
5. ECP Mode (Extended Capabilities Mode).
• Compatibility mode is also known as "Centronics Mode". In this mode you can only
output data.
• To receive/input data, you must change the mode to either Nibble or Byte mode.
• Nibble mode can input a nibble (4 bits) from device to computer.
• Byte mode uses the Parallel's bi-directional feature (found only on some cards) to
input a byte (8 bits) of data.
• Extended and Enhanced Parallel Ports use additional hardware to generate and
manage handshaking.
For example, to output a byte to a printer (or anything in that matter) using compatibility
mode, the software must,
Port Addresses
The Parallel Port has three commonly used base addresses.
LPT1 is normally assigned base address 378h, while
LPT2 is assigned 278h. 378h & 278h have always been
commonly used for Parallel Ports.
Below is a table of the "Pin Outs" of the D-Type 25 Pin connector and the Centronics
34 Pin connector. The D-Type 25 pin connector is the most common connector found
on the Parallel Port of the computer, while the Centronics Connector is commonly
found on printers.
The above table uses "n" in front of the signal name to denote that the signal is active
low. e.g. nError. If the printer has occurred error then this line is low. The "Hardware Inverted"
means the signal is inverted by the Parallel card's hardware.
• Centronics?
Centronics is an early standard for transferring data from a host to the printer.
The Centronics 36-pin connector is arranged in two rows of pins, each with 18 contacts. The
36-pin connector is often used for parallel applications, especially for printers. It is also referred
to as an IEEE-1284 Type B connector.
Note 1 : If the Port is Bi-Directional then Read and Write Operations can be performed
on the Data Register.
The base address, usually called the Data Port or Data Register is simply used for
outputting data on the Parallel Port's data lines (Pins 2-9). This register is normally a
write only port. If you read from the port, you should get the last byte sent. However if
your port is bi-directional, you can receive data on this address.
Status Register:
The Status Port (base address + 1) is a read only port. Any data written to this port will
be ignored. The Status Port is made up of 5 input lines (Pins 10,11,12,13 & 15), an IRQ
status register and two reserved bits.
• Control Register:
The Control Port (base address + 2) was intended as a write only port. When a printer is
attached to the Parallel Port, four "controls" are used. These are Strobe, Auto Linefeed,
Initialize and Select Printer, all of which are inverted except Initialize.
Ex2: Write required Assembly Language instructions to check if the Paper has run out
at the printer (paper out).
Bit 5 of the Status port indicates the status of paper at the Printer. So after inputting 8-
bit data from this port at [base address+1] we can check if paper is finished or not.