Home Kermit 95 C-kermit Scripts Current New FAQ Support

Serial Port and Modem Cables

Frank da Cruz, The Kermit Project, Columbia University, New York City, 28 Nov 2006.
A brief synopsis of portions of Using C-Kermit, Appendix II, "A Condensed Guide to Serial Communications", which may be consulted for greater detail. Portions Copyright © Digital Press.

The RS-232 Standard   •   Description of Modem Signals   •   Modem Connections   •   Direct Serial Connections

The serial port on your computer can be used in one of two ways:

  1. To connect a computer, terminal, or other Data Terminal Equipment (DTE) to a modem or other Data Communications Equipment (DCE).

  2. To connect one DTE directly to another, for example a PC to another computer or to some sort of device.

Each way requires a different kind of cable. Connections between a PC and a modem use a modem cable (in which wires go "straight through", pin to pin), whereas connections between two computers use a null modem cable (in which pairs of wires are cross-connected). To complicate matters, different kinds of connectors might be needed on each end. While the DCE port is almost always a female DB25, and the PC port is always supposed to be of male gender, the PC port can take many shapes: DB25, DB9, Din8, RJ45, USB, etc; thus many combinations are possible.

Connecting a serial port to an external modem is usually straightforward because modem cables are available for each kind of computer. Connecting two computers together can be more challenging.


The RS-232 Standard

The Electronic Industries Association (EIA) RS-232 standard has been a universal, stable, and enduring method for connecting computing and/or terminal devices together for decades; everything else just seems to come and go. The standard describes a number of electrical signals, each carried on its own wire (circuit) between DTE and DCE. Although RS-232 does not specify connector configurations, two have become de facto standards: DB25 (a 25-pin connector, in which usually no more than 10 wires are used), and DB-9 (a 9-pin connector, in which usually all 9 wires are used). The table shows the circuits used in computer/modem connections.

Circuit V.24 Name Direction DB25 DB9 Description
FG (1) Frame Ground   1 Electrical safety
TD 103 Transmitted Data To DCE 2 3 Data from computer
RD 104 Received Data To DTE 3 2 Data to computer
RTS 105 Request To Send (2) To DCE 4 7 Hardware Flow Control
CTS 106 Clear To Send To DTE 5 8 Hardware Flow Control
DSR 107 Data Set Ready To DTE 6 6 DCE on and in data mode
SG 102 Signal Ground   7 5 Voltage measurement reference
CD 109 Carrier Detect (3) To DTE 8 1 Modems are communicating
DTR 108 Data Terminal Ready To DCE 20 4 DTE on and in data mode
RI 125 Ring Indicator To DTE 22 9 Phone is ringing
1. V.24 is the European equivalent of RS-232, compatible but with different terminology.
2. Also known as Ready to Receive (RTR).
3. Also known as Data Carrier Detect (DCD) and Received Line Signal Indicator (RLSI).

Click to enlarge

The TD and RD wires carry the data, the Signal Ground wire allows the signals on the other wires to be measured, and the other circuits monitor the state of the connection.

Figure II-5 from Using C-Kermit shows three common connector types (DB25, DB9, Mini Din8), with the pin numbering for used for each gender. As you can see, the genders are a mirror image of each other so when they they mate, pin 1 connects to pin 1, pin 2 to pin 2, and so on.


Description of Modem Signals

The serial port of a computer or terminal is designed and intended to be connected to a modem. The device driver and/or controller for the port treat the circuits as follows:

Transmitted Data (TD)
Carries data from the computer to the modem. Note that the modem receives data on its Transmit Data pin.

Received Data (RD)
Carries data from the modem to the computer. Note that the modem sends data on its Received Data pin.

Request to Send (RTS)
Today this signal is generally used to indicate that the computer is prepared to receive data from the modem (it can also be used in half-duplex communication to request permission to transmit, hence the name).

Clear to Send (CTS)
Indicates that the modem is ready to receive data from the computer. RTS and CTS acting together provide an instantaneous, effective, and reliable form of flow control, called RTS/CTS or "hardware" flow control. Without this, data is likely to be lost or corrupted due to differing speeds or capacities of the connected devices.

Data Set Ready (DSR)
Indicates that the modem is turned on and in data mode.

Carrier Detect (CD)
Indicates that the modem has a telephone connection to another modem and is communicating with it successfully. When the CD signal goes from Off to On, it means the other modem has just "answered the phone". When it goes from On to Off, it means the phone connection was just hung up.

Data Terminal Ready (DTR)
Indicates that the computer is on, in data mode, and is "paying attention" to the modem. When the DTR signal goes from On to Off, and the modem has an active phone connection, this makes the modem hang up the telephone.

Ring Indicator (RI)
Indicates that the phone to which modem is connected is ringing and a call is waiting to be picked up.


Modem Connections (DTE to DCE)

A modem cable is simple and the various signals do their jobs in a straightforward way. The cable must convey all the signals listed in the previous section, plus Signal Ground (and Frame Ground for electrical safety) for a modem connection to function properly.

Most computers have a male serial-port connector, either DB25 or DB9. If it is a DB25, then all the wires in the cable are "straight through", pin 1 on one end to pin 1 on the other; 2 to 2, and so on as shown in the figure. Wires for pins 9-19 and 23-25 might be missing from the cable since they are generally not used. If the computer has a DB-9 connector, then the wires connect the corresponding pins as shown the table above: 2-to-3, 3-to-2, 4-to-7, and so on.

Computer and terminal serial ports are supposed to be male, so the computer end of a regular modem cable is female. In case the serial port has a female connector, you can buy a "Gender Changer".


Direct Serial Connections (DTE to DTE)

When two computers (or other DTEs) are to be connected directly, each one must be "tricked" into thinking the other is a modem (DCE). The trickery is done entirely with the wires that connect the pins. The result is a null modem cable – a cable that presents itself to each computer computers as if it were coming out of a modem. There are several classes of null modem cables, each with many variations:

Minimum 3- or 4-Wire Cable
In this cable, RD and TD are cross connected and Signal Ground goes straight though (and optionally also Frame Ground). Such a cable provides no hardware flow control and no monitoring of the connection. It might present problems for some software or device drivers that require a serial port connection to be presenting CD, DSR, and/or CTS signals before allowing data transfer.

Fakeout Cable
This cable (Model A in Figure II-6) also has only three functional wires going from end to end, but the remaining signals are "faked out" by jumpering each computer's outgoing signals back into the corresponding incoming ones: DTR to CD, RTS to CTS, and so on. This gets past difficulties with software and device drivers, but in fact provides no status whatsoever about the connection, nor the possibility of hardware flow control.

True Null Modem Cable
A fully functional Null Modem cable (Model B in the figure) allows for hardware flow control and for each computer to detect whether the connection is active. In this cable, complementary circuits are crossed over end-to-end rather than jumpered within each connector: RD and TD, RTS and CTS, DTR and CD, etc, so (for example) the software on one end of the connection can "hang up the phone" by turning off the DTR signal and the software on the other end will see the CD signal go down, even though there are no phones or modems.

The figure shows the connections for DB25 connectors; use the table above to get the corresponding pins for DB9.

By the way, although it was common in days gone by for us to build our own cables, it is (and was even then) much easier to simply buy a "modem eliminator" or "null modem adaptor" from a computer supply store (SEARCH). This is a double ended connector that already has all of the Model B crossovers implemented inside. They come in male-male, male-female, and female-female varieties. Attach a regular modem cable to each computer and then interconnect the two modem cables with the modem eliminator.

The modem eliminator that you want has a connector of the appropriate shape (DB9 or DB25) on each end, and is asynchronous, NOT synchronous. A synchronous null modem is something else entirely, with electronics, clock pulse generators, and so forth.

For greater detail, see the Kermit books.


Serial Port and Modem Cables / The Kermit Project / Columbia University / kermit@columbia.edu / 2006-11-28