Radio-Electronics.Com for radio and electronics tutorials, resources, data, articles and news for the radio and electronics design engineer
ContactHomeSearch the Site
 

Navigation:: Home >> Reference and tutorials >> Telecommunications and networking >> this page

RS232 tutorial

- an overview, introduction or tutorial about the basics of RS232 or RS-232 also known as RS232C, RS232D, V24, V28 and V10.

The RS-232 communications standard has been in use for very many years and is one of the most widely used standards for serial data communications as a result of it being a simple and reliable form of serial data communications.

The RS232 standard has been in use for many years. RS232 dates back to 1962 when the first standard was released in response to an industry requirement for a form of serial data communications. Since then, its application has broadened considerable, but the same basic standard is still in use, providing reliable data communications.

The success of the RS232 standard has meant that it is now used for many more types of equipment. As a result many lines defined in the specification are rarely used. This means that care has to be taken when connecting any new equipment or defining which lines are to be used in a new design.


RS-232 Interface Basics

The interface is intended to operate over distances of up to 15 metres. This is because any modem is likely to be near the terminal. Data rates are also limited. The maximum for RS-232C is 19.2 k baud or bits per second although slower rates are often used. In theory it is possible to use any baud rate, but there area number of standard transmission speeds used.


Common Data Transmission Rates

50
75
110
150
300
600
1200
2400
4800
9600
19200
38400
76800

Note: speeds up to 19200 bits per second are normally used. Above this noise that is picked up, especially over long cable runs can introduce data errors.


RS-232 Connections

The RS-232C specification does not include a description of the connector to be used. However, the most common type found is the 25 pin D-type connector.


RS232 signal levels

The voltage levels are one of the main items in the specification. For RS232 data signals a voltage of between -3V and -25V represents a logic 1. The logic 0 is represented by a voltage of between +3V and +25V. Control signals are in the "ON" state if their voltage is between +3V and +25V and "OFF" if they are negative, i.e. between -3V and -25V.

The data is sent serially on RS232, each bit is sent one after the next because there is only one data line in each direction. This mode of data transmission also requires that the receiver knows when the actual data bits are arriving so that it can synchronise itself to the incoming data. To achieve this a logic 0 is sent as a start bit for the synchronisation. This is followed by the data itself and there are normally seven or eight bits. The receiver obviously has to know how many data bits to expect, and there are often small dual in line switches either on the back of the equipment or inside it to set this information.

Data on RS232 is normally sent using ASCII (American Standard Code for Information Interchange). However other codes including the Murray Code or EBCDIC (Extended Binary Coded Decimal Interchange Code) can be used equally well.

After the data itself a parity bit is sent. Again this requires setting because it is optional and it can be even or odd parity. This is used to check the correctness of the received data and it can indicate whether the data has an odd or even number of logic ones. Unlike many systems these days there is no facility for error correction.

Finally a stop bit is sent. This is normally one bit long and is used to signify the end of a particular byte. Sometimes two stop bits are required and again this is an option that can often be set on the equipment.

RS232 data transmission is normally asynchronous. However transmit and receive speeds must obviously be the same. A certain degree of tolerance is allowed. Once the start bit is sent the receiver will sample the centre of each bit to see the level. Within each data word the synchronisation must not differ by more than half a bit length otherwise the incorrect data will be seen. Fortunately this is very easy to achieve with today's accurate bit or baud rate generators.


Lines and their usage

Their are four types of line defined in the RS232 specification. They are Data, Control, Timing and Ground. Not all of them are required all the time. It is possible to set up a very simple communication using very few lines. When looking at the lines and their functions it is necessary to remember that they are defined for a connection between a modem (the data set or communications equipment) and a terminal or computer (data terminal equipment) in mind. All the lines have directions, and when used in this way a one to one cable operates correctly.

The most obvious lines are the data lines. There are two of these, one for data travelling in each direction. Transmit data is carried on pin 2 and the receive data is carried on line three.

The most basic of the control circuits is Data Carrier Detected (DCD). This shows when the modem has detected a carrier on the telephone line and a connection appears to have been made. It produces a high, which is maintained until the connection is lost.

Data Terminal Ready (DTR) and Data Set Ready (DSR) are the main control circuits. They convey the main information between the terminal and modem. When the terminal is ready to start handling data it flags this on the DTR line. If the modem is also ready then it returns its signal on the DSR line. These circuits are mainly used for telephone circuits. After a connection has been made the modem will be connected to the line by using DTR. This connection will remain until the terminal is switched off line when the DTR line is dropped. The modem will detect this and release the telephone line.

Sometimes pin 20 is not assigned to DTR. Instead another signal named, Connect Data Set To Line (CDSTL) is used. This is virtually the same as DTR, but differs in that DTR merely enables the modem to be switched onto the telephone line. CDSTL commands the modem to switch, despite anything else it may be doing.

A further two circuits, Request To Send (RTS) and Clear To Send (CTS) are also used. This pair of circuits are used together. The terminal equipment will flag that it has data to send. The modem will then return the CTS signal to give the all clear after a short delay.

This signalling is used particularly when switched carriers are used. It means that the carrier is only present on the line when there is data to send. It finds its uses when one central modem is servicing several others at remote locations.


Secondary lines

There are two types of lines that are specified in the RS-232 specification. There are the primary channels that are normally used, and operate at the normal or higher data rates. However, there is also provision for a secondary channel for providing control information. If it is used it will usually send data at a much slower rate than the primary channel.

As the secondary lines are rarely used or even implemented on equipment, manufacturers often use these connector pins for other purposes. In view of this it is worth checking that the lines are not being used for other purposes before considering using them. When the secondary system is in use, the handshaking signals operate in the same way as for the primary circuit.


Grounding

The ground connections are also important. There are two. First the protective ground ensures that both equipments are at the same earth potential. This is very useful when there is a possibility that either equipment is not earthed. The signal ground is used as the return for the digital signals travelling along the data link. It is important that large currents that are not part of the signalling do not flow along this line otherwise data errors may occur.


Summary

The RS-232 specification is still widely used. Although faster specifications exist, it is likely to remain in use for many years to come. One of the reasons for this is the fact that it is found on most of today's personal computers. Although the parallel "LPT" ports are used almost universally for printers, it still used for many other purposes, including connecting the computer to a modem.

 

B&B Electronics

 


Ethernet

Charles Spurgeon


Ethernet

amazon

.co.uk

.com


  More books ....
 

 


Digital Signal Processing

James D. Broesch


Digital Signal Processing

amazon

.co.uk

.com


  More books ....
 



  This site is operated and owned by Adrio Communications Ltd and edited by Ian Poole. All information is © Adrio Communications Ltd and may not be copied except for individual personal use. This includes copying material in whatever form into website pages
While every effort is made to ensure the accuracy of the information on this site, no liability is accepted for any consequences of using it. By using this site, these terms are accepted.
Privacy Policy
Radio-Electronics.com