Communication, Ports and Interfaces

Here we will look at some of the types of interfaces you will find in a PC that are used for communicating with external devices such as scanners, serial mice, printers, PDAs, games controllers (e.g. joysticks), and external dial-up modems.

RS232 Serial Port

Serial transfer means one-after-another. Communication ports (COM ports) that use the RS232 protocol are called serial ports because they transfer data in exactly this way: bits are sent down a single data wire sequentially, one bit after another.

RS-232 is a standard that was first introduced in 1962! While it has evolved over the years, much remains the same. RS-232 allows the transmission of characters, where characters are made up of an arbitrary number of bits - typically 7 or 8. RS-232 encodes bits on the wire by changes in voltage. A negative voltage indicates a bit value of 1, while a positive voltage indicates 0. Each character is prefixed by a start bit (a zero) and is terminated with a stop bit (a one). Thus, 7 bit characters actually require the sender to transmit 9 bits along the wire. Most modern RS232 implementations use parity to check for data integrity. For more information on this, check out this DeRailed Technology Forum post.

The physical connection to the port that you will find on a PC is typically a male 9-pin D type connector (DB9). These pins provide for data, ground and control lines. Most PCs have one or two such ports, which are identified by the system as COM1 and COM2. Often, on machines with two connections, one is found to be a male 25-pin D type (DB25) connector; however, many of the pins are not actually used in this arrangement.

COM ports communicate with the CPU over the ISA bus and therefore each require an interrupt line (IRQ line) and an I/O address. To learn more about these requirements, check out the I/O bus section. The typical IRQ and I/O address assignments for the COM ports are shown in the table below.

COM port IRQ I/O address range
1403F8H - 03FFH
2302F8H - 02FFH
3403E8H - 03EFH
4302E8H - 02EFH

Actually, it is the UART (Universal Asynchronous Receiver/Transmitter) that reserves these I/O addresses. While the COM port itself sends data in a serial manner, data in the ISA bus travels in parallel. It is the job of the UART to convert this parallel data into a stream of bits for out-bound data, and vice versa for incoming data.

The 16550 UART additionally has 16 bytes of buffer. This results in significant improvements in both speed and reliability, since data is not lost of the CPU fails to respond quickly to an interrupt request from the UART. For example, imagine the CPU is busy and can not respond to a stream of incoming data. Rather than losing this data, as would have happened in the days before the 16550, this data gets stored in the UART's local buffer. The 16550A UART is found in most modern PCs today, integrated into the chipset. This is basically the same as the 16550 but has improved error-correction. The maximum transfer rate achievable through a serial port using a 16550A UART controller is 1.5 megabits per second, although this is dependent on the cable length.

PS/2 DIN6 Until recently, it was fairly common to find a serial mouse plugged into COM1. These days, most mice are PS/2 compatible and plug into a dedicated PS/2 DIN6 connection, illustrated left (or even a USB interface).

Similarly, internal ISA modems were often set up to run on COM3. You may well have noticed from the table above that COM1 and COM3 share the same IRQ. This is why many people found that their mouse stopped working while they were using their modem! Serial connection was also once very popular for linking two PCs together, although with cheap and easy network cards available, this is not very common anymore. However, many PDA devices (personal digital assitants) such as a Psion palmtop still communicate with PCs via a serial port.


Parallel Ports

While many printers these days plug in to the PC using a USB connection, many printers still connect to the parallel port. This port resembles a DB25 serial port, except that the connector on the PC is female.

Parallel communication also uses the ISA bus and therefore needs to be assigned an IRQ and I/O address. Typically, IRQ 7 is used. Note that on modern computers, it is possible to have an IRQ port without an IRQ line assigned.

25-pin parallel

The difference between parallel and serial communication is that in the former, 8 lines are used for simultaneous (parallel) data transmission. Hence 8 bits are transferred simultaneously, rather than one after the other. This offers a great data transfer rate advantage over serial. The maximum data transfer rate that can be achieved over IEEE-1284 is 4 megabits per second.

The physical connection that a printer is connected to is typically identified by the system as LPT1. Initially only unidirectional data flow was possible through the parallel port, i.e. from the computer to the printer. However, it soon became apparent that bidirectional communication would be useful (e.g. to allow the printer to signal ink and paper levels or to inform the computer of malfunctions). Thus the IEEE-1284 parallel standard evolved to support this requirement. Turning on bi-directional support for this port is usually possible via a BIOS setting.

IEEE-1284 provides other functionality also. Firstly, it allows for interfacing with devices other than printers, such as scanners. It also supports EPP and ECP printing modes. These both utilise data transfer circuitry integrated into the port itself, thus allowing faster data transfer rates. ECP additionally handles data compression and run length encoding. RLE permits repeated data to be sent with much lower overhead. In simple terms, RLE issues requests along the lines of, "send this particular bit of data n times in a row." However, ECP does require its own DMA channel. If such resources are not available, then you should opt to use EPP.

IEEE-1284 parallel ports also support mixed devices, such as a scanner and printer attached to the same port. Normally in such a combination, the scanner would be attached directly to the port and the printer would be attached to the scanner in a daisy-chain fashion. However, due to lack of standardisation in the peripheral devices themselves, this kind of connectivity was never too reliable. While it had its uses for a short time, the arrival of USB has made this feature redundant.


Universal Serial Bus (USB)

USB has proved to be a welcome revolution for peripheral connectivity. Firstly, the data transfer rate available through USB is 12 Mbit/sec (1.5 MB/sec) over the PCI bus, a significant improvement over serial and parallel communication. This data rate will support traditional serial and parallel devices, such as scanners, mice, modems and printers. It will also support gaming devices that used to require a 15-pin gaming port (which was typically supplied on dedicated game cards or on sound cards). 12 Mbit/sec also supports 'medium bandwidth' devices such as slow CD-ROM/CDRW drives.

Another major advantage is the ability to 'hot-swap' peripherals. That is, install and remove hardware while the PC is running, by simply plugging in the device.

For some, especially users who have a lot of peripherals, the main reason for going with USB is the fact that it makes resource conflicts a thing of the past. Individual devices connected by USB do not need IRQ lines or I/O addresses! With the 7-bit addressing provided by each USB root hub, up to 128 devices can be connected to your PC! Actually, this isn't really true, since many devices reserve a certain amount of USB bandwidth. Even so, low double figures is definitely possible, and I'll think you'll be hard-pressed to find that many devices to use anyway! Of course, you probably don't have 127 USB ports available on your computer. Most motherboards supply two, while some (especially those supporting USB 2.0 - more on this later) supply more; my motherboard has six USB 2.0 ports. The good news is that if you run out of ports, all you need to do is buy a USB hub. This simple device has a number of USB ports (usually 4 or more) and occupies one of the USB ports on your PC motherboard (or, if you're feeling really adventurous, a USB port on another hub that is already plugged into your PC).

USB

The ability to use USB does require that your chipset provides USB support in the form of a USB controller. This controller will require an IRQ line and I/O address. But the individual devices themselves do not require such resources.


IEEE-1394 - Firewire

IEEE-1394 is a relatively new high-speed communication standard. It is more commonly known as Firewire, although technically Firewire is a trademark owned by Apple.

Firewire / IEEE-1394IEEE-1394 has 6-bit addressing, allowing 64 devices to be attached. Devices also daisy-chain, eliminating the need for a hub. The much higher data transfer rate available to IEEE-1394 of up to 400 Mbit/sec (50 MB/sec) allows the use of high-throughput devices like digital video cameras and external DVD drives to be attached in this way.

For a while, it was difficult to tell if IEEE-1394 would squeeze USB out of the market, or vice versa. IEEE-1394 appeared to cater for a different target audience, aiming at high-throughput devices while USB was targetted to low and medium-throughput devices. One would have assumed that the sheer speed advantage of IEEE-1394 would have put an end to USB. However, USB was very quickly established in the market place and rapidly became standard on PC motherboards. IEEE-1394 is seen as somewhat more exotic (and perceived as more expensive). It is not commonly found on motherboards, although some may be surprised to know that, for example, Creative Labs' high-end soundcards come with IEEE-1394 interfaces! It would seem that there is a place for both... or is there?


USB 2.0

USB 2.0 - aka 'Hi-Speed USB' is a new specification for USB. It supports data transfer rates of up to 480 Mbit/sec (60 MB/sec). This is some 40 times faster than the original USB 1.1 specification and is marginally faster than IEEE-1394. The good news for the end user is that it looks exactly the same. Existing USB 1.1 devices will run happily on a USB 2.0 hub, and furthermore the cabling and connectors remain unchanged. USB 2.0 is also backwards compatible to existing 1.1 software interfaces.

Given the prolific nature of USB 1.1 and the fact that motherboards are already being shipped with USB 2.0 ports (my motherboard has six of them!), I begin to wonder if this may seal the fate for IEEE-1394. But perhaps IEEE-1394 is sufficiently rooted. We will have to wait and see.


PCMCIA - the Laptop Card

I include this interface here just for the sake of completeness. (Since laptops don't use the same industry standard components as a typical PC, it's not a topic I consider particularly relevent to this site.)

PCMCIA actually stands for PC Memory Card International Association, a name derived from the fact that the first cards designed for laptops were solely for memory expansion. Personally, I prefer to remember these six stupid letters as People Can't Memorise Computer Industry Acronyms. PCMCIA defines a set of standards that laptop cards must adhere to, and currently permits three different card sizes. As well as memory expansion, PCMCIA cards are available with much more impressive functionality, such as dial-up modems, wireless networking and even removable hard drives!

Most PCMCIA cards these days use a 32-bit bus loosely based around PCI. This type of bus is known as the CardBus.