5. Where do you find the ports?

If you are running Unix, there should be a manual indicating which serial ports are present, what they should look like (DB25, DE9, RJ11, whatever) and what the device files for them are. Hopefully, there are conversions from any non-standard connector to the standard DB25 of either sex, or at least some documentation that makes it possible to build such a cable. Then what remains is to figure out if the units at hand is DTE or DCE. If it is on a reasonably recent model PC, the connectors should be all males (9 or 25 pin) and DTE. On non-PC hardware there could very well be female DB25s or RJ11 jacks, as shown in Section 1.

On FreeBSD, the first two serial ports are named /dev/ttyd0 and /dev/ttyd1. On Linux regular serial ports are called /dev/ttyS0, /dev/ttyS1 and so on, while USB ports are /dev/ttyUSB0 and so on. With USB-RS232 converters, the commmand dmesg(1) will be able to tell about the devices, if the kernel is set up correctly.

On other unix systems the ports will have to be defined based on info about major numbers and device selectors in /etc/master and can be named anything at all, though /dev/ttysomethingorother is likely.

On Windows NT and later, there are also entries for all kinds of COM ports in the system information, Device Manager, list. The ports are still named COMn, even USB ones, though the DOS-level programs may have a hard time accessing these.

If you are running a PC under DOS, or in a DOS-box under Windows, look at the 16-bit Equipment word at memory address 0x40:10 and bits 11,10 and 9 tell you how many serial ports there are, from 0 (000) to 4 (100). Then their base addresses may be found as consecutive 16-bit words starting at 0x40:0 for the first port, (COM1) 0x40:2 for the second one (COM2) and so on.

PCs with only one serial port usually has this configured as COM1.

The Interrupts are usually IRQ4 for COM1 and COM3, and IRQ3 for COM2 and COM4. To handle doubled interrupts, the ISR must look at both "its" COM ports addresses to see which one it has to handle.

The actual DE9M or DB25M plugs on the outside of the case if there are more than one, may of course be any of the COMx. Do not confuse the DB25F female parallell port connector or the DA15F game-port connectors for a serial port. At least on PCs, the serial connectors are always some kind of D (DE9, DB25, or DC37) male, and most other connectors are female or non-D males.

The easiest way to find out is to connect some other serial device, another PC with known ports, or a terminal, and run a terminal or other communication program (note that older versions of Laplink does not seem to work very well on Windows NT) and see what works where.

If you have a tracker, (a little box usually with a DB25M one side and a DB25F the other, and with LEDs telling the state of some or all lines), and plug it in possibly via a 9-25pin converter, it will tell you not only if the connector you tried is is a serial port at all but also if it is DTE or DCE. Besides it will reveal whether the transmitting device is transmitting a large enough voltage.


A simple serial-port tracker.

A "Mini tracker" made by the DATAMAN corporation, Colorado. For some reason they decided to hook up pin 11 to LEDs, and skipped pin 22. This is probably because a lot of printers used pin 11 for some kind of signal once. The pin 11 is not assigned at all according to the standard. Despite this, the device remains one of the most useful ones I ever bought.


Related to trackers are breakout boxes, where all the pins may be cross- connected any which way as well. This used to be a big thing when having to interface to arcane and obscure serial equipment, but today most such equipment is standardized or no longer serial. If you got one, use it. As of early 2005, such breakout boxes are still readily available.

Constructing a tracker if you cannot or will not buy one is fairly easy. Get a male and a female 25-pin D connector, wire all 25 pins of the two together, and place 8 pairs of red and green LEDs in antiparallell between pin 7 (common) and each of pins 2, 3, 4, 5, 6, 8, 20 and 22. Each of the 16 LEDs should have a 1000 ohms resistor in series, and the red ones should have their cathodes to pin 7, so that they light up on Space. The greens have their anodes to pin 7 so they will light up on Marks.

Plugging a tracker into a PC parallell port (since the male plug fits), will reveal that none of the lines here have the right voltages and therefore this is not a serial port. No damage done. Plug the tracer into a serial port, and at least one of lines 2 or 3 should show a Mark or a Space. The data lines seem to be normally "resting" in the Mark state, which, if your tracker is wired as above, should give you a green light. The control lines may be sitting at either state

Finally, be aware of HDLC synchronous ports. If your PC has a card with a male 25-pin connector with the right voltages in it, but on the wrong pins, this could be a HDLC port and not a standard RS232 serial port at all.

Another kind of connection I have seen on some terminals are current-loop connections. An alternative to having voltages for Mark and Space is to have a current running in a loop for Mark and no current running for Space or vice versa. Trying the tracker in any of these will reveal that they are not the usual serial kind (strictly speaking they are still serial). I won't bother with these here.

To 0. Introduction

To 4. The 8250 and descendant chips in the PCs.

To 6. Baud-rates.

Table of ASCII codes

To index page