EmbLogic's Blog

PARALLEL PORT INTERFACE

PARALLEL PORT

A parallel port is a type of interface found on computers (personal and otherwise) for connecting peripherals. In computing, a parallel port is a parallel communication physical interface. It is also known as a printer port or Centronics port. It was a de facto industry standard for many years, and was finally standardized as IEEE 1284 in the late 1990s, which defined a bi-directional version of the port. Today, the parallel port interface is seeing decreasing use because of the rise of Universal Serial Bus (USB) and FireWire (IEEE 1394) devices, along with network printing using Ethernet.

The parallel port interface was originally known as the Parallel Printer Adapter on IBM PC-compatible computers. It was primarily designed to operate a line printer that used IBM’s 8-bit extended ASCII character set to print text, but could also be used to adapt other peripherals. Graphical printers, along with a host of other devices, have been designed to communicate with the system.

IBM released the IBM Personal Computer in 1981 and included a variant of the Centronics interface— only IBM logo printers (rebranded from Epson) could be used with the IBM PC.IBM standardized the parallel cable with a DB25F connector on the PC side and the Centronics connector on the printer side. Vendors soon released printers compatible with both standard Centronics and the IBM implementation.

The original IBM parallel printer adapter for the IBM PC was designed to support 8-bit data bidirectionally in 1981. This feature was removed in later revisions of the hardware, so that the data lines could only be used to output data. Years later in 1987, IBM reintroduced the bidirectional interface with its IBM PS/2 series, where it could be enabled or disabled for compatibility with applications hardwired not to expect a printer port to be bidirectional. HP introduced their version of bidirectional, known as Bitronics, on the LaserJet 4 in 1992. The Bitronics and Centronics interfaces were superseded by the IEEE 1284 standard in 1994.

A wide variety of devices were eventually designed to operate on a parallel port. Most devices were uni-directional (one-way) devices, only meant to respond to information sent from the PC. However, some devices such as Zip drives were able to operate in bi-directional mode. Printers also eventually took up the bi-directional system, allowing various status report information to be sent.

Interfaces

Most PC-compatible systems in the 1980s and 1990s had one to three ports, with communication interfaces defined like this:

  • Logical parallel port 1: I/O port 0x3BC, IRQ 7 (usually in monochrome graphics adapters)

  • Logical parallel port 2: I/O port 0×378, IRQ 7 (dedicated IO cards or using a controller built into the mainboard)

  • Logical parallel port 3: I/O port 0×278, IRQ 5 (dedicated IO cards or using a controller built into the mainboard)

If no printer port is present at 0x3BC, the second port in the row (0×378) becomes logical parallel port 1 and 0×278 becomes logical parallel port 2 for the BIOS. Sometimes, printer ports are jumpered to share an interrupt despite having their own IO addresses (i.e. only one can be used interrupt-driven at a time). In some cases, the BIOS supports a fourth printer port as well, but the base address for it differs significantly between vendors. Since the reserved entry for a fourth logical printer port in the BIOS Data Area (BDA) is shared with other uses on PS/2 machines and with S3 compatible graphics cards, it typically requires special drivers in most environments. Under DR-DOS 7.02 the BIOS port assignments can be changed and overridden using the LPT1, LPT2, LPT3 (and optionally LPT4) CONFIG.SYS directives.

Access

DOS-based system will make the logical parallel ports detected by the BIOS available under device names such as LPT1, LPT2 or LPT3 (corresponding with logical parallel port 1, 2, and 3, respectively). These names derive from terms like Line Print Terminal, Local Print Terminal, or Line PrinTer. A similar naming convention was used on ITS, DEC systems, as well as in CP/M and 86-DOS (LST).

In DOS, the parallel printers could be accessed directly on the command line. For example, the command “TYPE C:\AUTOEXEC.BAT > LPT1” would redirect the contents of the AUTOEXEC.BAT file to the printer port. A PRN device was also available as an alias for LPT1. Some operating systems (like Multiuser DOS) allow to change this fixed assignment by different means. Some DOS versions use resident driver extensions provided by MODE, or the mapping can be changed internally via a CONFIG.SYS PRN=n directive (as under DR-DOS 7.02 and higher). DR-DOS 7.02 also provides optional built-in support for LPT4 if the underlying BIOS supports it.

PRN, along with CON, AUX and a few others are invalid file and directory names in DOS and Windows, even Windows XP. There is even an MS-DOS device in path name vulnerability in Windows 95 and 98, which causes the computer to crash if the user types “C:\CON\CON”, “C:\PRN\PRN” or “C:\AUX\AUX” in the Windows Explorer address bar. A patch to fix this bug has been released by Microsoft, but newly installed Windows 95 and 98 operating systems will still have the bug.

A special “PRINT” command also existed to achieve the same effect. Microsoft Windows still refers to the ports in this manner in many cases, though this is often fairly hidden.In the Linux operating system the first LPT port is available via the filesystem as /dev/lp0.

Program interface

In versions of Windows that did not use the Windows NT kernel (as well as DOS and some other operating systems), programs could access the parallel port with simple outportb() and inportb() subroutine commands. In operating systems such as Windows NT and Unix (NetBSD, FreeBSD, Solaris, 386BSD, etc.), the microprocessor is operated in a different security ring, and access to the parallel port is inhibited, unless using the required driver. This improves security and arbitration of device contention. On Linux, inb() and outb() can be used when a process is run as root and an ioperm() command is used to allow access to its base address; alternatively, ppdev allows shared access and can be used from userspace if the appropriate permissions are set.

The cross-platform library for parallel port access, libieee1284, also is available on many Linux distributions and provides an abstract interface to the parallel ports of the system. Access is handled in an open-claim-release-close sequence, which allows for concurrent access in userspace.

Current use

For consumers, the USB interface — and sometimes Ethernet — has replaced the parallel printer port, for connections both to printers and to other devices.

Many manufacturers of personal computers and laptops consider parallel to be a legacy port and no longer include the parallel interface. Smaller machines have less room for large parallel port connectors. The guidelines for Microsoft’s Windows Logo Program “strongly discourages” systems builders from including parallel ports.USB-to-parallel adapters are available that can make parallel-only printers work with USB-only systems. There are PCI (and PCI-express) cards that provide parallel ports. There are also some print servers that provide interface to parallel port through network. USB-to-EPP chips can also allow other non-printer device to continue to work on modern computers without a parallel port.

For electronics hobbyists the parallel port is still often the easiest way to connect to an external circuit board. It is faster than the other common legacy port (serial port) and requires no serial-to-parallel converter, and requires far less interface logic and software than a USB target interface. However, Microsoft operating systems later than Windows 95/98 prevent user programs from directly writing to or reading from the PrinterPort. Current CNC Milling Machines also often make use of the parallel port to directly control the machine’s motors and attachments.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>