The Parallel Port Interface on the PC compatible computer is one of the most flexible interfaces for connecting the PC to a wide range of devices. The interface was originally intended purely for connection to printers but due to the simple nature of the digital control lines it has found many other uses. It's simplicity relies on the fact that the data to and from the port forms an 8 bit binary on/off pattern. This pattern is accessible
and measurable directly on the corresponding connection pins on the 25 way D-Type connector on the PC.
Unlike serial ports which rely on a chip to do the data transmission, parallel data is handled entirely with software. This means that, for the hobbyist, he has complete control of the actual on/off condition of the output lines directly from his program. This control is achieved by writing data to specific areas of PC I/O memory. This , in simple terms , is just a set of numbers in the range 0 - 1024 corresponding to memory registers dedicated by the PC hardware for input / output
functions. Parallel ports have three registers:
one for data out ,one for output control lines .and one for input control lines. The PC standard starts the I/O ports for the first parallel interface at 0x378, and for the second at 0x278. The first port is a bidirectional data register; it connects directly to pins 2 through 9 on the physical connector. The second port is a read-only status register; when the parallel port is being used for a printer, this register reports several aspects of printer status, such as being online, out of
paper, or busy. The third port is an output-only control register, which, among other things, controls whether interrupts are enabled.
WARNING: The parallel connector is not isolated from the computer's internal circuitry, which is useful if you want to connect logic gates directly to the port, but you have to be careful to do the wiring correctly; the parallel port circuitry is easily damaged when you play with your own custom circuitry unless you add opto-isolators to your circuit.
Standard Printer Operations
During standard printer operation the way in which data is transmitted over parallel ports varies, but a general description follows: To send a byte of data, the software outputs the byte to the data lines, then pulses the STROBE output. The device on the other end (normally a printer) then asserts its BUSY line. The PC waits for BUSY to go away before sending the next byte. In other implementations, the ACKNOWLEDGE line is used for the printer to signal to the PC that it has received the data.
The other control lines are used for various purposes. On the printer side, PAPER-END is a signal to the PC that the printer is out of paper. The printer also sends a SELECTED signal to the PC indicating that it is "on line" and ready to receive data. The ERROR signal from the printer can be used for any type of error that would cause the printer to be unable to receive data. In general, if any of these signals are asserted, BUSY is also asserted.
The PC has three additional output control lines. Usage of these lines varies with the particular software and printer in use. In the original PC implementation, they are used as follows:
AUTOFEED - tells the printer to automatically insert a line feed after each carriage return.
INIT - initializes the printer upon power up.
SELECT - deselects the printer and takes it "off line".
SELECT was most often used as a method to signal the operator that some attention was required. For example, when the software needed to change to a different font, it would deselect the printer. This would cause the printer to turn off its SELECTED line and its front panel light. The user would then change the print wheel in the printer and press the SELECT button on the printer. The printer would then turn on its SELECTED line signalling the software to proceed. Many printers will stay
in the "off line" condition for as long as SELECT or INIT are asserted even if the SELECT button is pressed.
As stated earlier, not all of these controls lines are used in the same manner. Some of the latest laser printers on the market ignore all the control lines to it except for the STROBE line.
Types of Printer Port
There are three different types of parallel ports found in PCs.
Unidirectional - The unidirectional port is the original port found on PCs and all three ports can run in unidirectional mode.
Bidirectional - The bi-directional port offers data transfer in both directions on the same lines.
FastParallel - The fast parallel port not only offers Bidirectional data transfer but also runs at a much faster data rate.
The bidirectional port offers data transfer in both directions on the same lines, and both the fast parallel and the bidirectional port can run in any of the three data transfer rates. Your software should attempt to run in the most advantageous mode, depending on the port type it is connected to. If errors are encountered in data transfers you may need to change the port usage to a different setting. You will generally need to select a lower speed if errors occur during data transfers.