How Serial Ports Work

The serial port has been an integral part of most computers for more than 20 years. Serial ports provide a standard connector and protocol to let you attach devices, such as modems, to your computer.All computer operating systems in use today support serial ports. Parallel ports are a more recent invention and are much faster than serial ports.

By Marshall Brain February 15, 2002

The serial port has been an integral part of most computers for more than 20 years. Serial ports provide a standard connector and protocol to let you attach devices, such as modems, to your computer.

All computer operating systems in use today support serial ports. Parallel ports are a more recent invention and are much faster than serial ports. USB ports are only a few years old, and will likely replace both serial and parallel ports over the next several years.

The serial port transmits the eight bits in a data byte one bit at a time. The advantage is that a serial port requires only one wire to transmit the eight bits, while a parallel port requires eight. The disadvantage is that it takes eight times longer to transmit the data than it would if there were eight wires. Before each byte of data, a serial port sends a start bit. After each byte of data, it sends a stop bit to signal that the byte is complete. It may also send a parity bit.

Serial ports are bidirectional. Bidirectional communication allows each device to receive data as well as transmit it. Serial devices use different pins to receive and transmit data allowing full-duplex communication. Using the same pins would limit communication to half-duplex, meaning that information could only travel in one direction at a time.

Serial ports rely on the universal asynchronous receiver/transmitter (UART) to function properly. The UART chip transforms the parallel output of the computer’s system bus into serial form for transmission through the serial port.

The serial connection

The external connector for a serial port can be either 9 pins or 25 pins. Originally, the primary use of a serial port was to connect a modem to the computer. The following list describes the function of each pin of a 9-pin serial port when a modem is connected.

  • Pin 1. Carrier Detect — Determines if the modem is connected to a working phone line.

  • Pin 2. Receive Data — Computer receives information sent from the modem.

  • Pin 3. Transmit Data — Computer sends information to the modem.

  • Pin 4. Data Terminal Ready (DTR) — Computer tells the modem that it is ready to talk.

  • Pin 5. Signal Ground — Pin is grounded.

  • Pin 6. Data Set Ready (DSR) — Modem tells the computer that it is ready to talk.

  • Pin 7. Request To Send (RTS) — Computer asks the modem if it can send information.

  • Pin 8. Clear to Send (CTS) — Modem tells the computer that it can send information.

  • Pin 9. Ring Indicator — Once a call has been placed, computer acknowledges signal (sent from modem) that a ring is detected.

    • Voltage applied to the pins can be either on or off. “On” (binary value 1) means that the pin is transmitting a signal between -3 and -25 V, while “off” (binary value 0) means that it is transmitting a signal between +3 and +25 V.

      Going with the flow

      Flow control is the ability of one device to tell another device to stop sending data for a while. The commands request to send (RTS), clear to send (CTS), data terminal ready (DTR), and data set ready (DSR) are used to enable flow control.

      A modem that communicates at 56 kbps is an example of how flow control works. The serial connection between the computer and modem transmits at 115 kbps. This means that the modem is getting more data coming from the computer than it can transmit over the phone line. Even if the modem has a 128K buffer to store data in, it will still quickly run out of buffer space and be unable to function properly with all that data streaming in.

      With flow control, the modem can stop the flow of data from the computer before it overruns the modem’s buffer. The computer is constantly sending a signal on the RTS pin, and checking for a signal on the CTS pin. If there is no CTS response, the computer stops sending data, waiting for the CTS before it resumes. This allows the modem to keep the flow of data running smoothly.