0% found this document useful (0 votes)
56 views

Why The Parallel Port?

The document discusses the parallel port and its use for data acquisition. It provides background on why the parallel port was developed as an alternative to interface cards. The parallel port allows external hardware to connect to a PC through the parallel printer adapter/port. It then describes the basic components and functioning of a simple computer-assisted data acquisition system using the parallel port to connect sensors. It also outlines the signals and standards of the parallel port.

Uploaded by

Mohamd barca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Why The Parallel Port?

The document discusses the parallel port and its use for data acquisition. It provides background on why the parallel port was developed as an alternative to interface cards. The parallel port allows external hardware to connect to a PC through the parallel printer adapter/port. It then describes the basic components and functioning of a simple computer-assisted data acquisition system using the parallel port to connect sensors. It also outlines the signals and standards of the parallel port.

Uploaded by

Mohamd barca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Lecture-2 Parallel Port

Why the Parallel Port?


Conventional methods for connecting external hardware to a PC include the use of plug-in
interface cards. This approach has several disadvantages, such as:

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.

What Is Data Acquisition?


Data acquisition is the process of acquiring information about a phenomenon. If you are
studying a variation in temperature or pressure with time, your data acquisition could consist
of measuring and recording the temperature or pressure either continuously or at some discrete
interval. An automated, human-readable data acquisition system for this situation would
employ a suitable temperature or pressure sensors (e.g., a thermistor, and transducer)
connected to a strip chart recorder. The strip-chart recorder would move the paper in one
direction at some rate, and a stylus driven by the sensor output would plot the temperature or
pressure for creating a continuous record of the temperature–time variation. A computerized
solution for this scenario would essentially do the same thing, except that instead of writing
the data to a strip-chart, the sensor and its associated components would transmit the data
through some hardware interface to the PC. A computer running a suitable software package
(the data acquisition program) can acquire, display, process, and store the data. The advantage
of using a computer for data acquisition is that a computer has the flexibility to adapt to
changing needs and to further process the resulting data to enhance its usefulness.

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.

The Parallel Printer Adapter:


➢ Any port that provides parallel output (as opposed to ports that provide data serially) is a
parallel port, but in PC terminology, the term parallel port refers to port originally known as
the parallel printer adapter.

➢ 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 designers of the parallel printer port knew that:


• Τhe port must provide eight data signals to transfer a byte of data in parallel.
• The computer must be able to signal to the printer that a byte of data is available on the data
lines. This signal was called the strobe signal.
• The computer must get an acknowledgment signal from the printer. This signal is called the
acknowledge (or ack) signal.

➢ 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.

➢ Table below shows a description for the Parallel Port Signals.

Standard Parallel Port (SPP) Signals

Group SPP Signal DB25 Pin In/Out Signal Description

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.

A low asserted pulse used to indicate that the last


ACK 10 In character was received.
Status A high signal asserted by the printer to indicate that
BUSY 11 In it is busy and cannot take data.
PAPER END 12 In Paper Empty.
Standard Parallel Port (SPP) Signals

Group SPP Signal DB25 Pin In/Out Signal Description

Asserted low to indicate that some error condition


ERROR 15 In exists.
SELECT 17 In Asserted high to indicate that the printer is online.

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,

1. Write the byte to the Data Port.


2. Check to see is the printer is busy. If the printer is busy, it will not accept
any data, thus any data which is written will be lost.
3. Take the Strobe (Pin 1) low. This tells the printer that there is the correct
data on the data lines/pins (Pins 2-9).
4. Put the strobe high again after waiting approximately 5 microseconds after
putting the strobe low. (Step 3). Figure below shows a timing diagram of the data transfer from
a PC to a printer using the parallel printer port.
This limits the speed at which the port can run at. The EPP & ECP ports get around
this by letting the hardware check to see if the printer is busy and generate a strobe
and /or appropriate handshaking. This means only one I/O instruction need to be
performed, thus increasing the speed. These ports can output at around 1-2 megabytes per
second. The ECP port also has the advantage of using DMA channels and FIFO buffers,
thus data can be shifted around without using I/O instructions.

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.

Standard Parallel Port (SPP) Registers:


• Data Register:

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.

Figure below shows the parallel port hardware registers.


Bi-directional Ports
Bit 5 of the Control Port enables or disables the bi-directional function of the Parallel
Port.
This is only available on true bi-directional ports. When this bit is set to one, pins 2 to 9 go
into high impedance state. Once in this state you can enter data on these lines and retrieve it
from the Data Port (base address). Any data which is written to the data port will be stored but
will not be available at the data pins. To turn off bi-directional mode, set bit 5 of the Control
Port to '0'.
However not all ports behave in the same way. Other ports may require setting bit 6 of the
Control Port to enable Bi-directional mode and setting of Bit 5 to dis-enable Bi-directional
mode, Different manufacturers implement their bi-directional ports in different ways. If you
wish to use your Bi-directional port to input data, test it with a logic probe or multimeter first
to make sure it is in bi-directional mode.

Using the Parallel Port's IRQ


Interrupts are good when interfacing monitoring devices such as high temp alarms etc, where
you don't know when it is going to be activated. It's more efficient to have an interrupt request
rather than have the software poll the ports regularly to see if something has changed. This is
even more noticeable if you are using your computer for other tasks, such as with a
multitasking operating system.
The Parallel Port's interrupt request is normally IRQ5 or IRQ7 but may be something else
if these are in use.
It may also be possible that the interrupts are totally disabled on the card, if the card was only
used for printing.
The Parallel Port interrupt can be disabled and enabled using bit 4 of the control register,
Enable IRQ Via Ack Line. Once enabled, an interrupt will occur upon a low to high transition
( rising edge  ) of the nACK. However like always, some cards may trigger the interrupt on
the high to low transition.
You must program the programmable interrupt controller (PIC) to respond to the interrupt you
are using and then place an Interrupt Service Routine (ISR) at the appropriate Interrupt Vector.

Programming of the Parallel Port


Ex1: Write required Assembly Language instructions to output 11111111B to the Data
Port of the SPP?
MOV DX,378H ;base address of SPP is 378H
MOV AL,11111111B ;Data Port is placed at [base address + 0]
OUT DX,AL

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.

MOV DX,378H ;base address of SPP is 378H


INC DX ;[378H+1]
IN AL,DX
AND AL,00100000B
CMP AL,00100000B
JE OVER
CALL PAPER_OK ;a procedure to report that paper is ok!
JMP OVER2
OVER: CALL PAPER_OUT ;a procedure to report that paper is run out
OVER2:

EPP - Enhanced Parallel Port


• EPP Ports is included in the IEEE 1284 Standard released in 1994. EPP has two standards, EPP
1.7 and EPP 1.9. There are differences between the two standards which may affect the
operation of devices.
• EPP has a typical transfer rate in the order of 1/2MB/S to 2MB/S. This is achieved by allowing
the hardware contained in the port to generate handshaking, strobing etc, rather that have the
software do it, which was the case with Centronics.
• EPP is more commonly used than ECP. EPP differs from ECP by the fact that the EPP Port
generates and controls all the transfers to and from the peripheral. ECP on the other hand
requires a dedicated controller or ECP Peripheral Chip.

ECP - Extended Capabilities Port


This is both the newest and the fastest of the parallel port configurations. It is a bi-directional
mode.
The Extended Capabilities Mode was designed by hp (Hewlett Packard) and Microsoft to
be implemented as the Extended Capabilities Port Protocol and ISA Interface Standard. This
protocol uses additional hardware to generate handshaking signals etc just like the EPP mode,
thus runs at very much the same speed than the EPP mode. This mode, however may work
better under Windows as it can use DMA channels to move it's data about. It also uses a FIFO
buffer for the sending and/or receiving of data.
Another feature of ECP is a real time data compression. It uses Run Length Encoding (RLE)
to achieve data compression ratio's up to 64:1. This comes is useful with devices such as
Scanners and Printers where the data is long strings which are repetitive.
Both the EPP and ECP support an eight-bit bidirectional port. Usually, EPP is used for newer
models of printers and scanners, whereas ECP is used for non-printer peripherals, such as
network adapters or disk drives. Although EPP and ECP are quite different, there are modern
products that support both EPP and ECP collectively.

parallel port operation during computer boot-up


• The parallel port operation when the computer boots up can vary between
different computers.
• In simplest case the parallel port data pins state might be random in the
beginning, and quickly set to all at logic 0 state. That's how things worked
on old PCs usually.
• Some new PCs running modern Windows versions seem to leave the parallel
port pins all logic 1 (+3..5V).
• On some computers the pin states can change few times during the boot
process, meaning if you have connected LEDs to parallel port pins you can
see them flashing.
• For example many laptop computers send boot time diagnosing codes to the
parallel port data pins.
• During the boot process the code sent to parallel port can change several times.
When controlling some electronics with PC parallel port the best idea is the
following sequence:
1. Make sure the devices you plan to control are not powered up (so it does
not matter if PC data pins change state).
2. Boot-up the PC normally
3. Start your controlling software (this sets parallel port to right state)
4. Power-up the device you plan to control
In this way the device will not get any control signal you did not design it to
get, no matter what happens during power-up.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy