30.12.04

Serial Ports

Essentially, serial ports provide a standard connector and protocol to let you attach devices, such as modems, to your computer. The name "serial" comes from the fact that a serial port "serializes" data. That is, it takes a byte of data and transmits the 8 bits in the byte one at a time.

Before each byte of data, a serial port sends a start bit, which is a single bit with a value of 0. 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, also called communication (COM) ports, are bi-directional. Bi-directional communication allows each device to receive data as well as transmit it. Serial devices use different pins to receive and transmit data -- using the same pins would limit communication to half-duplex, meaning that information could only travel in one direction at a time. Using different pins allows for full-duplex communication, in which information can travel in both directions at once.

Serial ports rely on a special controller chip, the Universal Asynchronous Receiver/Transmitter (UART), to function properly. The UART chip takes the parallel output of the computer's system bus and transforms it into serial form for transmission through the serial port. In order to function faster, most UART chips have a built-in buffer of anywhere from 16 to 64 kilobytes. This buffer allows the chip to cache data coming in from the system bus while it is processing data going out to the serial port.

9-pin connector:
1 - Carrier Detect - Determines if the modem is connected to a working phone line.
2 - Receive Data - Computer receives information sent from the modem.
3 - Transmit Data - Computer sends information to the modem.
4 - Data Terminal Ready - Computer tells the modem that it is ready to talk.
5 - Signal Ground - Pin is grounded.
6 - Data Set Ready - Modem tells the computer that it is ready to talk.
7 - Request To Send - Computer asks the modem if it can send information.
8 - Clear To Send - Modem tells the computer that it can send information.
9 - Ring Indicator - Once a call has been placed, computer acknowledges signal (sent from modem) that a ring is detected.

Voltage sent over the pins can be in one of two states, On or Off. On (binary value "1") means that the pin is transmitting a signal between -3 and -25 volts, while Off (binary value "0") means that it is transmitting a signal between +3 and +25 volts.

An important aspect of serial communications is the concept of flow control. This 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.

Example of how flow control works:
You have a modem that communicates at 56 Kbps. The serial connection between your computer and your modem transmits at 115 Kbps, which is over twice as fast. 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 Request to Send pin, and checking for a signal on the Clear to Send pin. If there is no Clear to Send response, the computer stops sending data, waiting for the Clear to Send before it resumes. This allows the modem to keep the flow of data running smoothly.

http://computer.howstuffworks.com/serial-port4.htm
http://www.lvr.com/files/spcch1.pdf