Chapter 7 Printer and Serial Port

MS-DOS supports printers, plotters, modems, and other hard-copy output or communication devices with device drivers for parallel ports and serial ports. Parallel ports are so named because they transfer a byte覧8 bits覧 in parallel to the destination device over eight separate physical paths (plus additional status and handshaking signals). The serial port, on the other hand, communicates with the CPU with bytes but sends data to or receives data from its destination device serially覧a bit at a time覧over a single physical connection.

Parallel ports are typically used for high-speed output devices, such as line printers, over relatively short distances (less than 50 feet). They are rarely used for devices that require two-way communication with the computer. Serial ports are used for lower-speed devices, such as modems and terminals, that require two-way communication (although some printers also have serial interfaces). A serial port can drive its device reliably over much greater distances (up to 1000 feet) over as few as three wires覧 transmit, receive, and ground.

The most commonly used type of serial interface follows a standard called RS-232. This standard specifies a 25-wire interface with certain electrical characteristics, the use of various handshaking signals, and a standard DB-25 connector. Other serial-interface standards exist覧for example, the RS-422, which is capable of considerably higher speeds than the RS-232覧 but these are rarely used in personal computers (except for the Apple Macintosh) at this time.

MS-DOS has built-in device drivers for three parallel adapters, and for two serial adapters on the PC or PC/AT and three serial adapters on the PS/2. The logical names for these devices are LPT1, LPT2, LPT3, COM1, COM2, and COM3. The standard printer (PRN) and standard auxiliary (AUX) devices are normally aliased to LPT1 and COM1, but you can redirect PRN to one of the serial ports with the MS-DOS MODE command.

As with keyboard and video display I/O, you can manage printer and serial-port I/O at several levels that offer different degrees of flexibility and hardware independence:

MS-DOS handle-oriented functions

MS-DOS traditional character functions

IBM ROM BIOS driver functions

In the case of the serial port, direct control of the hardware by application programs is also common. I will discuss each of these I/O methods briefly, with examples, in the following pages.