The standard LPT port was designed for a printer connection, in cooperation with printer manufacturers. Nobody expected a different use, so its design was kept very simple. Standard parallel port (SPP) uses a 25-pin female CANNON plug. There are eight data lines, four output lines (control signals), and five input lines (status). Normally, PC waits for the printer to send "I'm ready" signal (BUSY pin), sets the data lines according to a next character to be printed, sends "There's a new character for you" signal (pulse on STROBE), and waits for the printer again. In this worst case, the computer spends most of the time waiting. It is possible for the PC to do something else while the printer is busy, using a hardware interrupt - pin /ACK, IRQ 5 or IRQ 7 (interrupt has to be enabled via the appropriate register).
PC BIOS supports up to four printer ports (LPT's). However, only two I/O addresses are reserved for LPT's, 378h and 278h. The HERCULES company distributed their (very successful at that time) graphics adapters with a built-in printer port, which used the 3BCh address. This one was later designated as a third I/O address for LPT; some manufacturers don't support it, though. During computer boot-up, BIOS looks for LPT ports on the above addresses in the same order. If a LPT is found, a number from 1 to 3 is assigned to it (so we get LPT1, LPT2 or LPT3).
Usually, LPT1 uses IRQ7, and LPT2 uses IRQ5, but don't rely on it. It should be noted that all LPT's can share a single IRQ together with a sound card or a modem. The problem is that some software drivers don't support interrupt sharing, and the above configuration won't work. Therefore, it's safer to assign a dedicated IRQ for each device, or to have LPT and a sound card share IRQ7 (works most of the time). LPT boards that are 2 years old or newer can be configured for different IRQ's and I/O addresses, either via jumpers on board or via software (BIOS SETUP on most machines).
Standards called EPP (Enhanced Parallel Port) and ECP (Extended Capabilities Port) brought many enhancements. The most important one is the possibility of bi-directional communication over the data pins D0-D7, due to modified hardware design of these pins. The SPP data pin is wired according to picture 1 with two transistors, one pulling high and the other pulling low, one of them conducting at any time.
Picture 2 shows the EPP or ECP data pin circuit. The only difference between ECP/EPP and the "normal" SPP is, that the transistor pulling high has been replaced by a resistor (it's supposed to be 4700 Ohms, according to the standards). Therefore, an ECP/EPP pin can be set to "read mode" by setting it to 1, so the transistor pulling low is open (non-conducting) and the actual logical level on the pin can be read. This system is backward-compatible with SPP in most cases; some difficulties do arise (described later). Software-control issues are not covered in this article.
It should be clear now, that this port can be used for direct connection of two PC's without the need for network adapters and expensive networking software. Parallel port connection is generally 3 to 4 times faster than a serial port connection. However, the length of the connection cable is severely limited. Since all signaling uses 5V logical levels instead of current loops, cables longer than 3ft (1 meter) tend to be sensitive to interference. It is still possible to use cables up to 10 meters (30ft) in length, as long as certain rules are observed. Unfortunately, software supporting ECP and EPP ports is not widely available yet.
Most programs, like Laplink or Norton Commander, support only the SPP port (cable sometimes called '4BIT', since only 4 data bits are transferred at a time). Some software available on the Internet (e.g. EASYNET) can emulate an IPX-compatible network over a 4BIT cable. While this is ideal for occassional data transfer between a notebook or a desktop PC, it's not the best option for a stable network connection, as the price of network adapters has dropped significantly.
ECP, EPP or SPP?
While new parallel port standards are backward compatible on the hardware level, it is possible, that they won't work in all cases (e.g., when a long printer cable is used). More, few printers take advantage of the bidirectional communication. Still, the most compatibility problems arise from faulty software for communication between the PC and the printer - sometimes, it accidentaly switches data flow due to improper use of added control bits, etc. My experience with various name-brand manufacturers shows that, if the port is used for printer only, the best option is to switch the port to SPP mode. You can experiment with the extended modes, but the source of troubles is often here. However, EPP/ECP port shows its strengths if a CD-ROM, JAZ or ZIP drive, modem, or another such device is connected to it. The transfer speed goes up rapidly.
How to make good communication cables?
Every data wire should be shielded, or separated from its neighbor by a ground line to reduce echos between neighboring wires. The cable can be longer and achieves faster speeds. For ribbon cables, the pinout of the parallel port connector suggests such wiring. Another good idea is to use a cable, where each pair of wires is twisted together - use one of them for "live" data, and the other for ground.
Pay attention to mains connections of connected equipment
Every PC has its cover, as well as the ground pins, connected to the center wire of the mains plug ("protective earth"). Often, this one is connected to the neutral wire. If you have two PCs connected to different mains plugs that you intend to connect together, it is possible that each of them is connected to a different branch of your home electrical wiring. Although these are connected together at the switchboard, they may have different voltages if a heavy load is connected to one of them (e.g. washer, dryer, etc.) causing a voltage drop.
Single pulse can reach the order of tens of volts. This voltage difference then appears at the inputs of the PC, EASILY DESTROYING the parallel or serial port, hard drive controller, sometimes even the whole mainboard. Therefore, it is a good idea to connect only PC's powered from the same mains plug, or at least connected by a single extension cord. The same applies to monitor, printer, notebook, and other connections. With some notebook computers, the safest thing to do is to run on batteries while connected to a desktop PC; however, new notebooks should have no problems. Please note that communication cables are dangerous to notebooks; when an external disk drive, etc. connects via the parallel port, this port may not be fully compatible, and notebook damage may occur.
More parallel port hints
- Always use either shielded wires, or connect remaining wires in the cable to the ground. This applies especially for long cables used for fast data transfer (over 100kbit/s).
- When making devices connected to LPT, always connect a pull-up resistor "ladder" to +5V to all data wires, preferably at the connector itself. This should reduce potential effect of RC networks in the cable. Usually, resistors between 4 and 10 kOhms work the best.
- For fast communication, always use D-type flip-flops (triggered by edge) instead of latches (triggered by logic level). The latter ones are sensitive to crosstalks, which can cause data errors. (For example, D-type IO's are 74374, 574, 7474, ..., while latches are 74373, 573, etc.)
- When writing software, always keep in mind enhanced ports. For example, bits that are unused or "reserved" in SPP mode may have assigned meaning in ECP or EPP modes.
- Don't try to power devices from the LPT, like a mouse is powered from the serial port. Sometimes, the voltage corresponding to logical 1 is about 3.5V, so, after adding voltage on the diodes, you can't even rely on circuits operating from 2.7V (due to current-carrying capacity) ...
- Parallel port loves to burn and die. Keep this in mind and always experiment with a second LPT on a cheap ISA I/O card. Don't risk your mainboard.
Download & Links:
If you want more information, here is the documentation used for this article. Download here.
Data transfer software utilizing ECP and EPP extensions. A little while ago, I was contacted by two authors of communication programs, which do fulfill most of the requirements on such software. Both programs are presented here with their authors' permission.
- PARCP 3.01
Translation: Joe Hlavac