Tweet to @MicrolinkUK

Microlink Measurement and Control Systems

Technical Notes: RS232 Serial Port


What is RS232? | RS232 Software | The RS232 Standard | COM Port Pins | RS232 Speed | Handshaking or Flow Control | More Information

What is RS232?

RS232 is a popular communications protocol for connecting modems and data acquisition devices to computers. RS232 devices can be plugged straight into the computer's serial port (also known as the COM or Comms port). Examples of data acquisition devices include GPS receivers, electronic balances, data loggers, laboratory instruments and temperature interfaces.

RS232 Software

To obtain data from your RS232 instruments and display it on your PC you need some software. The new version of Windmill RS232 Software is now just £50 - reduced from £145. They also offer serial communication software for RS232, RS422, RS485, Modbus and TCP/IP communications, free to their Monitor newsletter subscribers.

The RS232 Standard

RS stands for recommended standard. In the 60's a standards committee now known as the Electronic Industries Association developed an interface to connect computer terminals to modems. Over the years this has been updated: the most commonly used version of the standard is RS232C (sometimes known as EIA232); the most recent is RS232E. The standard defines the electrical and mechanical characteristics of the connection - including the function of the signals and handshake pins, the voltage levels and maximum bit rate.

The answer RS232 standard was created for just one specific situation and the difficulties sometimes come when it is used for something else. The standard was defined to connect computers to modems as in the setup below:

RS232 Serial Connections

The standard defines how computers (it calls them Data Terminal Equipment or DTEs) connect to modems (it calls them Data Communication Equipment or DCEs). It says that computers should be fitted with a 25 way plug whilst modems should have a 25 way D socket. The interconnecting lead between a computer and a modem should be simply pin1—pin1, pin2—pin2, etc. The main signals and their direction of flow are described below. It is important to note that a signal which is an output from a computer is an input to a modem and vice versa. This means that you can never tell from the signal name alone whether it is an input or an output from a particular piece of equipment. Also, instead of being a DCE device, a data acquisition device might be configured as DTE. In this case you need an adaptor or the RS232 cable wired differently to normal. When the PC is connected to a DTE instrument, some of the cable wires must cross over.

RS232 serial port pinout

RS232 Serial Port Pins

To see the state of your Serial (COM) Port Pins (true or false) download the free ComDebug serial trouble-shooting software.

TXD Transmitted Data, Pin 2 of 25 way D
This is the serial encoded data sent from a computer to a modem to be transmitted over the telephone line.

RXD Received Data, Pin 3 of 25 way D
This is the serial encoded data received by a computer from a modem which has in turn received it over the telephone line.

DSR Data Set Ready, Pin 6 of 25 way D
This should be set true by a modem whenever it is powered on. It can be read by the computer to determine that the modem is on line. In data acquisition applications is is generally false.

DTR Data Terminal Ready, Pin 20 of 25 way D
This should be set true by a computer whenever it is powered on. It can be read by the modem to determine that the computer is on line.

RTS Request to Send, Pin 4 of 25 way D
This is set true by a computer when it wishes to send data.

CTS Clear To Send, Pin 5 of 25 Way D
This is set true by a modem to allow the computer to transmit data. The standard envisaged that when a computer wished to transmit data it would set its RTS. The local modem would then arbitrate with the distant modem for use of the telephone line. If it succeeded it would set CTS true and the computer would transmit data. The distant modem would use its CTS to prevent any transmission by the distant computer. This is called hardware flow control or hardware handshaking.

DCD Data Carrier Detect, Pin 8 of 25 Way D
This is set true by a modem when it detects the data carrier signal on the telephone line. In data acquisition applications, your device's DCD is generally false. If true it may indicate a wiring error.

PC Serial Ports
A nine pin D plug has become the standard fitting for the serial ports of PCs, although it's nothing to do with the RS232 standard. The pin connections used are:

    Pin Direction Signal
    1   Input     DCD  Data Carrier Detect
    2   Input     RXD  Received Data
    3   Output    TXD  Transmitted Data
    4   Output    DTR  Data Terminal Ready
    5   		       Signal Ground
    6   Input     DSR  Data Set Ready
    7   Output    RTS  Request To Send
    8   Input     CTS  Clear To Send
    9   Input     RI   Ring Indicator

How Fast Can Instruments send data over RS232?

The speed of RS232 communications is expressed in Baud. The unit is named after Jean Maurice-Emile Baudot (1845-1903), a French telegraph engineer and the inventor of the first teleprinter. It was proposed at the International Telegraph Conference of 1927. The maximum speed, according to the standard, is 20000 Baud. However, modern equipment can operate much faster than this. No matter how fast (or slow) your connection - the maximum number of readings per second you can take from your instrument depends on the software. For example, with Windmill software, speeds of up to 35 readings per second are achievable whilst with Streamer software this rises to 700 readings per second.

The length of the cable also plays a part in maximum speed. The longer the cable, the greater the cable's capacitance and the slower the speed at which you can obtain accurate results. A large capacitance means voltage changes on one signal wire may be transmitted to an adjacent signal wire. Fifty feet is commonly quoted as the maximum distance, but this is not specified in the standard. We generally recommend a maximum distance of 50 metres, but this depends on the type of hardware you are connecting and characteristics of the cable.

Handshaking or Flow Control

When the RS232 standard was written, it included handshaking by the RTS and CTS pins to try to ensure that data is successfully sent and received. This is known as hardware handshaking or flow control. Not all measurement instruments require hardware handshaking any more, in fact most do not. There may be no handshaking or flow control at all, or they may employ software handshaking.

In software handshaking the RTS and CTS pins, and hence the wires, are not needed. Two bytes have been defined in the ASCII character set to be used with software flow control. These bytes are named XOFF and XON as they stop and start data transfer.

More Information

For more details of RS232 communications, please contact us or send for a free copy of the Microlink Measurement and Control Systems catalogue.

Windmill's web site offers RS232 software to collect data from measurement instruments and send it directly to Windmill's logging and charting software, Excel or other Windows software. They provide a guide to trouble-shooting and testing RS232 serial ports.

Windmill also offer free serial monitor software for solving communication problems.


Microlink Measurement and Control Systems HomeHome
Data acquisition and control IndexIndex
Previous PagePrevious
SearchSearch

Related Topics:


Measurement News Feed (RSS) Tweet
subscribe to free data acquisition newsletter
Copyright Biodata Ltd 2006-
10 Stocks Street, Manchester M8 8QG, UK
Tel: +44 161-834 6688
Fax: +44 161-833 2190
E-mail: info@microlink.co.uk
Last Revised: 24 September 2013