RS232 Software Handshaking: xon/xoff / ext/ack
RS232 serial data can use software based handshaking in the form of XON / XOFF and EXT / ACK to control the data flow.
RS232 Includes:
RS232 basics
RS232 standard
Software handshaking
Signals & voltage levels
Pinouts & connectors
Loopback connections
RS232 cables
Serial Data standards:
Serial data standards
RS422
RS449
RS485
20 mA current loop
The most common method of handshaking that is used with RS2332 is to employ the hard wired option. However it is also possible to use software codes embedded within the data, thereby saving the use of the additional lines required for hardware handshaking.
The RS232 software handshaking option is particularly useful for applications where data needs to be sent over telephone lines. Here it is possible to control the data flow simply using the data only and this makes it possible to send data without he need for the additional lines.
There may also be instances where it is more convenient to use software methods to effect the handshaking.
When implementing RS232 software handshaking two of the commonly used methods are XON/XOFF and EXT/ACK.
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. The "X" in the name means "transmitter," so XON and XOFF are commands for switching a transmitter on or off, respectively.
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.
The actual character or signal for XON is the same bit configuration as the ASCII Ctrl-Q keyboard combination. The XOFF character or signal is the Ctrl-S character.
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
RS232 Control Codes | |
---|---|
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 |
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.
Written by Ian Poole .
Experienced electronics engineer and author.
Wireless & Wired Connectivity Topics:
Mobile Communications basics
2G GSM
3G UMTS
4G LTE
5G
Wi-Fi
Bluetooth
IEEE 802.15.4
DECT cordless phones
Networking fundamentals
What is the Cloud
Ethernet
Serial data
USB
LoRa
VoIP
SDN
NFV
SD-WAN
Return to Wireless & Wired Connectivity