www.techmind.org logo
by W.A. Steer  PhD
Back to contentsAbout...


RS232 Serial Communications Solutions

This article explains the purpose of the various RS232 pins, and most importantly, how to get two devices communicating over the link.

RS232 Interconnections

The original RS232 specification was designed for communication between "data terminal equipment" (DTE) - end users of data, e.g. terminals and now desktop computers, and "data communication equipment" (DCE) - a forwarder of data, such as a modem. In theory a simple cable which links pin 1 to pin 1, 2 to 2, 3 to 3, etc, should be all that is necessary to connect DTE to DCE.

Frequently these days it is necessary to connect two items of DTE, such as two desktop computers. While it should be as simple as crossing each input/output pair, so that Transmitted Data from one machine goes to Received Data of the other, and vice versa, etc., it's never that easy in practice! Problems usually arise because each piece of equipment uses the various handshaking signals in different ways. There can be a vast array of software settings too. With so many permutations, a systematic approach is essential.

Let's start by looking at the signals:

DTE = "Data terminal equipment" end user of data, e.g. desktop computers
sends data on Transmitted Data (TxD)
receives on Received Data (RxD)
asserts Request to Send (RTS) when ready to receive
waits for Clear To Send (CTS) to be asserted before sending
asserts Data Terminal Ready (DTR) when ready and waiting (to receive)
expects Data Set Ready (DSR) to be asserted before performing (sending)
expects Data Carrier Detect (DCD) to be asserted before receiving

DCE = "Data communication equipment" forwarder of data: a modem
As DCE forwards data, its Transmitted Data connection is actually an input for data to be transmitted down the (telephone) line. Similarly, the input/output status of all the lines is the inverse of those for DTE.

DTE to DTE connection (usual computer to computer)

Link gnd to gnd, cross the TxD/RxD pairs, cross RTS/CTS pairs. Link DSR to DCD locally, and connect to either the local or remote DTR (use local if the other side does not feature such connections). In severe problem cases RTS can be linked to the local CTS, but then software handshaking "XON/XOFF" will be required to prevent possible data loss due to buffer overflow.

prot. GND   1 ------------- 1   GND  prot.    << NOT ALWAYS INTERNALLY CONNECTED! >>

      TxD   2 -->--\ /--<-- 2   TxD     cross
                    X                   these
      RxD   3 --<--/ \-->-- 3   RxD     two

      RTS   4 -->--\ /--<-- 4   RTS     cross
                    X                   these
      CTS   5 --<--/ \-->-- 5   CTS     two

      DSR   6 -<-       ->- 6   DSR        link pins 6 and 8 locally
                 |     |
 sig. GND   7 ------------- 7   GND sig. (always connect the signal ground)
                 |     |
      DCD   8 -<-+-\ /-+->- 8   DCD     cross
                    X                   these
      DTR  20 -->--/ \--<-- 20  DTR     two

Pin numbers:

  25-pin D   1    2    3    4    5    6    7    8   20   22
            GND  TxD  RxD  RTS  CTS  DSR  GND  DCD  DTR  RI
   9-pin D   -    3    2    7    8    6    5    1    4    9

See Horowitz & Hill "The Art of Electronics" (2nd edition) chapter 10.19, pg 725 for more comprehensive coverage.

Other known abnormalities

BBC Master computer RS423 (5 volt system) inputs get overloaded by RS232 (12/15 volt) drive & fail to work. Use 4k7 (top)/ 2k2 (bottom) resistive potential divider on inputs (RxD & CTS) to BBC Master. [Also my BBC Master at home transmits/receives JUNK if it gets too hot!]

Acorn 32-bit micros (Archimedes, Power PC...) use CTS as DSR and vice-versa. On a plug for an Acorn 32-bit micro therefore, read CTS in place of DSR and DSR for CTS.

RTS (o/p) ==   o     o   == data in              BBC Computer, 5-pin DIN
             /         \                         RS423 connections.
      notch  ]    o  ===== GND                   (view of socket, or
             \         /                         plugs' wiring-side)
CTS (i/p) ==   o     o   == data out

Software standards

The most common software configuration is:
no parity, 8 data bits, 1 stop bit
and 9600 baud is often used for relatively short data links, though most PC's will operate at 19200 baud without problem.

From the DOS prompt, you can set the above configuration using the following command:

mode COM1:9600,n,8,1
It is then possible to send a file out of the RS232 port COM1 by using the DOS command copy eg.
copy autoexec.bat com1
to send a copy of your autoexec.bat file to the port.
Unfortunately it does not seem to be possible to read data in from the COM ports to files (or the screen) using the copy command - the machine tends to lock up.

The MS Windows Terminal program can be useful for setting up & experimentation.


"The Art of Electronics" (2nd edn.), P. Horowitz & W. Hill (Cambridge, 1989)


Created: July 1996
Last modified: 12 June 2002

Source: http://www.techmind.org/rs232/

©2002 William Andrew Steer