Red Bar
Navigation:: Home >> Telecoms and networks >> this page

RS232 software handshaking

- an overview of the way in which codes such as X-ON and X-OFF sent over an RS232 communication link can be used for handshaking.


This RS232 tutorial is split into several pages each of which addresses different aspects of RS 232 operation and technology:

[1] RS232 serial interface tutorial
[2] EIA and RS232 standards
[3] RS232 Handshaking
[4] RS232 signals and voltage levels
[5] RS232 pinouts
[6] RS232 loopback
[6] RS232 serial data cables

When using RS232, the most usual method for handshaking between two equipments is to use hardwired lines between the two equipments to control the data flow. Unfortunately when using RS232, it is not always possible to use these additional lines. For example when data is being sent along a telephone line, where only the signal lines are available, it is not possible to utilise additional lines for RS232 handshaking. Additionally, there are instances where it is more convenient to use software methods to effect the handshaking. With the rise of processor control, this is often a more attractive technique than introducing extra hardwired lines.

To implement RS232 software handshaking, it is necessary to send codes along the lines to establish communications and control the data flow. There are a number of control codes used for RS232 (and other) links under these circumstances. However they are normally used with older legacy equipment.

Two of the most commonly used code systems used with RS232 are X-ON / X-OFF and ETX / ACK. However there are other codes that can also be used to provide other facilities as well.


X-ON / X-OFF

The X-ON X-OFF operates by sending the control characters along the data line from the equipment receiving the data. When X-ON is received at the transmitting end data transmission is started. Once the input buffer on the terminal or printer starts to become full the X-OFF character is sent to stop the data. When sufficient space appears in the buffer X-ON can be sent to the transmitter to resume the data flow.


EXT / ACK

A second method is called EXT/ACK. Using this method the data is separated into blocks and after each block has been sent the control code ETX is transmitted to show the end of this block of text. Once the data has been accepted and there is sufficient space in the input buffer the ACK or acknowledgement control code is sent. Once this has been received, the next block of data is sent.


Other codes

Other codes are also used within what is effectively software control of an RS232 communications link. These codes are used for a variety of purposes from indicating tabs, form feeds as well as providing audible 'bell' warnings. These codes are naturally focussed on some of the older teletypes that used two wire RS232 links.


Control Codes Names


Code Name Function
NUL Null (blank)
SOH Start of header
STX Start of text
ETX End of text
EOT End of transmission
ENQ Enquiry
ACK Acknowledgement
BEL Bell (Audible)
BS Backspace
HT Horizontal tab
LF Line feed
VT Vertical tab
FF Form feed
CR Carriage return
SO Shift out
SI Shift in
DLE Data link escape
DC1 Device control 1
DC2 Device control 2
DC3 Device control 3
DC4 Device control 4
NAK Negative acknowledgement
SYN Synchronous idle
ETB End of transmission block
CAN Cancel
EM End of medium
SUB Substitute
ESC Escape
FS File separator
GS Group separator
RS Record separator
US Unit separator
DEL Delete


Summary

Although not all of the codes are used these days because many are intended for use by the older teletype equipments, the same processes are valid for modern equipment. This set of codes are known as control codes, which even gives rise to the 'CTRL' key on today's keyboards. Additionally the idea of software handshaking, although it was not so widely used in the early days, is now well established and usually the preferred method of implementing control of communications systems in view of the flexibility offered by processors.

Further pages from this tutorial
Page [ 1 ] >> [ 2 ] >> [ 3 ] >> [ 4 ] >> [ 5 ] >> [ 6 ] >> [ 7 ] >>
<< Previous     Next >>