|
Technical Background Pages |
|
|
|
|
What is it RS-232? |
RS-232 is interface for carry information
between two devices distance of up to 20 meters. The information
is carry along patch wires higher voltage than is standard 5V
for greater interference immunity. Data transfer is asynchronous
with closely set transmission speed and synchronization by trailing
edge start pulse. |

|
Main purpose of RS-232 |
The RS-232-C interface was developed for a single purpose, unambiguously stated by its title:
"Interface Between Data Terminal Equipment and Data Communications Equipment Employing Serial Binary Data Interchange."
Every word in the title is significant: it describes the interface between a terminal (DTE) to a modem (DCE) for the transfer of serial data.
|

|
Connectors |
The devices for serial link have been connect by cable with 9-pins or 25-pins connector type D.
You can find many terminology, for example DB-9, DB-9, CANNON 9, CANNON 25, etc.
The connectors are made in male and female type.
Each pin is named and labeled.
Their pinouts you can see here.
|
|
Voltage levels |
RS-232 using two voltage levels.
Logical 1 and 0. Logical 1 is sometimes calling as marking
estate or quiescent state too, logical 0 is calling
as space estate. Logical 1 is indicate negative level,
while logical 0 is indicate positive level. Allow voltage levels
are state in table.  |

|
The Noise Margin Issue |
Signals traveling along the
cable are attenuated and distorted as they pass. Attenuation
increases as the length of the cable increases. This effect
is largely due to the electrical capacitance of the cable.
The maximum load capacitance is specified as 2500pf (picofarad)
by the standard. The capacitance of one meter of cable is
typically around 130pf, thus the maximum cable length is limited
to around 17 meters.
For more detail see on the parts Cables
and Wiring length.
|

|
Problem with power supply |
If you connected two computers
via RS-232 and each of then is power supplayed from another
power point. We recommended mere voltage between their signal
ground before connection. |
|
Data signals |
Level |
Transmitter |
Receiver |
Logical 0 |
+5 V to +15 V |
+3 V to +25 V |
Logical 1 |
-5 V to -15 V |
-3 V to -25 V |
Undefine |
-3 V to +3 V |
Control signals |
Signals |
Driver |
Terminator |
"Off" |
-5 V to -15 V |
-3 V to -25 V |
"On" |
5 V to 15 V |
3 V to 25 V |

|

|
Pinout
DB25 Female |
 |
|
DB9 Female |
 |
|
RJ-45 |
 |
|
|
Signals Functional Description |
To understand the function of each signal
lets look at the events taking place to eventually exchange
data. The RS-232 Signals Functional Description page. |
|
The wiring of the RJ-45 connector is not standardize.
This wiring is one of posible. |
|
Cables
RS-232 Null-Modem Cable
3-wire with loopback handshaking |
|
Compatibility issues |
Consider first the DSR signal (pin 6).
This input indicates that the other side is ready to start
communicating. In the layout, the line is linked back to the
DTR output (pin 4). This means, that the software doesn't
see the ready signal of the other device, but its own. The
same holds for the CD input (pin 1). The assumption is, that
if software has been written to check the DSR line to test
communication availability, it will probably also set the
DTR output to indicate its own state.
This is true for at least 99% of all serial communication
software. This implies that at least 99% of all serial communication
software is capable of faking its own DSR check with this
null modem cable.
The same trick is used with the CTS input. In the original use, RTS is set, and then CTS is checked before starting the communication. By setting the RTS output (pin 7) the CTS input on the same connector (pin 8) is receiving clearance immediately. There is no possibility of a software hangup because of dangling RTS requests.
|

|
7-wire with full handshaking |
|
Compatibility issues |
The most expensive null modem cable is
the null modem cable suitable for full handshaking. In this
null modem cable, seven wires are present. Only the ring indicator
and carrier detect signal are not linked.
The null modem cable with full handshaking does not permit
the older way of flow control to take place. The main incompatibility
is the cross connection of the RTS and CTS pins. Originally,
these pins are used for a question/answer type of flow control.
When the full handshaking null modem cable is used, there
is no request anymore. The lines are purely used for telling
the other side if communication is possible. |
Tip! |
Pins number 2 and 3 on the D-Type 9 pin connector
is accurately conversely than on the D-Type 25 pin connector.
So you wiring pins 2 - 2 and 3 - 3 betweeen D-Type 25 pin and
D-Type 9 pin, you made communication cable. Signal Ground (SG)
must also be connected so both grounds are common to each computer.
See on the table below.
|
|
5-wire cable with handshaking |
|
Descriptin |
You can find or you can make
many sort of cables for communication via the RS-232 interfece.
This null modem cable use the fire wires only. In this wiring
are use the data signals as TXD, RXD and GND. The control
signals RTS and CTS are used moreover for handshaking.
|
Appellation of cables |
All DTE-DCE cables
are straight through, the pins are connected one to
one. DTE-DTE and DCE-DCE cables are cross cables.
- DTE - DCE is called a 'Straight Cable'
- DTE - DTE is called a 'Null-Modem Cable'
- DCE - DCE is called a 'Tail Circuit Cable'
|
What is Handshaking? |
Look on the part HANDSHAKING to clarify what mean the Handshaking.
|
|
Description of Null-Modem Cable with Full Handshaking
9pin D-Sub to 9pin D-Sub |
DB9-1 |
DB9-2 |
Receive Data |
2 |
3 |
Transmit Data |
Transmit Data |
3 |
2 |
Receive Data |
Data Terminal Ready |
4 |
6+1 |
Data Set Ready + Carrier Detect |
System Ground |
5 |
5 |
System Ground |
Data Set Ready + Carrier Detect |
6+1 |
4 |
Data Terminal Ready |
Request to Send |
7 |
8 |
Clear to Send |
Clear to Send |
8 |
7 |
Request to Send |
|

|
25pin D-Sub to 25pin D-Sub |
DB25-1 |
DB25-2 |
Receive Data |
3 |
2 |
Transmit Data |
Transmit Data |
2 |
3 |
Receive Data |
Data Terminal Ready |
20 |
6+8 |
Data Set Ready + Carrier Detect |
System Ground |
7 |
7 |
System Ground |
Data Set Ready + Carrier Detect |
6+8 |
20 |
Data Terminal Ready |
Request to Send |
4 |
5 |
Clear to Send |
Clear to Send |
5 |
4 |
Request to Send |
|

|
9pin D-Sub to 25pin D-Sub |
DB9 |
DB25 |
Receive Data |
2 |
2 |
Transmit Data |
Transmit Data |
3 |
3 |
Receive Data |
Data Terminal Ready |
4 |
6+8 |
Data Set Ready + Carrier Detect |
System Ground |
5 |
7 |
System Ground |
Data Set Ready + Carrier Detect |
6+1 |
20 |
Data Terminal Ready |
Request to Send |
7 |
5 |
Clear to Send |
Clear to Send |
8 |
4 |
Request to Send |
|
|
RS-232 loopback test plug
Loopback test plug for terminal emulation
software |
DB 9 female |
DB 25 female |
The following RS-232 connectors can be used to test
a serial port on your computer. The data and handshake lines have
been linked. In this way all data will be sent back immediately. The
PC controls its own handshaking. It can be used to check the function
of the RS-232 serial port with standard terminal software. |
 |
 |
RS-232 spy cable (monitor cable)
|
Half Duplex |
To monitor the RS-232 serial communication
between two devices with a PC. To do this you need the RS-232
monitor cable which is displayed in the next picture. Two sockets
are connected straight through. The spy computer is connected
to the third one. This monitor cable taps communication from
two sources on only one RS-232 receiver port. This means that
if the two devices happen to talk simultaneously, the monitored
information will be garbage. In most circumstances communication
protocols work half duplex, in which case this RS-232 cable
will work without problems.
|
Spy Software |
For spy (monitor) cable you need software. See on the Software page
|
|
Wiring length
Wiring length |
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.
|

|
Maximum length of cables |
Baud rate [Bd] |
Max length [ft] |
Max length [m] |
19 200 |
50 |
15 |
9 600 |
500 |
150 |
4 800 |
1 000 |
300 |
2 400 |
3 000 |
900 |
|
|
What is Baud? |
The speed of RS-232 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. |

|
Parity
Parity in RS-232 communication |
Parity is the state of being either odd or even.
In serial communications parity may be used to check for errors in the transmission of data.
When performing a parity check, the instrument or PC sending messages counts the number of 1's in a group of data bits.
Depending on the result, the value of another bit - the Parity Bit - is set.
The device receiving the data also counts the 1's and checks whether the Parity Bit is as it should be.
|
|
Types of parity |
To perform a parity check the computer and the instrument must obviously agree on how they are calculating the Parity Bit.
Are they setting it on for an even or odd number of 1's?
When a device uses Even Parity, the data bits and the parity bit will always contain an even number of 1's.
The reverse is true for Odd Parity.
|

|
Mark and Space parity |
Two other parity options often available in driver software are Mark and Space.
These aren't effective in error checking.
Mark means the device always sets the Parity Bit to 1 and Space always to 0.

|
|
Detect all errors? |
Parity is a rudimentary error checking mechanism.
It can detect an error in transmitting 1 bit, but if 2 bits happened to be wrong it would not pick this up.
It also provides no help as to which bit is wrong.
Other error checking mechanisms include the Start and Stop Bits described below,
and cyclic redundancy checks which are often used in Modbus communications.
|

|
Example |
In the example above you can see how the data frame is composed of and synchronised with the clock signal.
This example uses an 8 bit word with even parity and 1 stop bit also refered to as an 8E1 setting.

Note: Clock line - for asynchronous communication
is internal only
|
|
Start bit |
The data line has two states - on and off.
An idle line is always on.
When the instrument or computer wants to send data it sets the line to off - this is the Start Bit.
The bits immediately after the start bit are therefore the data bits.
|

|
Stop bit |
The Stop Bit is present to allow the instrument and computer to re-synchronise should anything go wrong: noise on the line masking the start bit for example.
The period of time between the start and stop bit is constant, according to the baud rate and number of data and parity bits.
The stop bit is always on. If the receiver detects an off value when the stop bit should be present, it knows there has been an error.
|

|
Setting of Stop bit |
The stop bit is not actually 1 bit but a minimum length of time the line must be on at the end of each data transmission.
On PCs this is normally equal to 1 or 2 bits, and you must specify this in the driver software.
Although 1 stop bit is most common, selecting 2 will at worst slow the message down slightly.
(You might see an option to set the stop bit to 1.5.
This is only used when the number of Data Bits is less than 7.
If this is the case then ASCII characters cannot be transmitted and so 1.5 is rarely used.)

|
|
HANDSHAKING
What is it HANDSHAKING ? |
The Handshaking represent ways, that the device can control data stream from transmitting device.
Sometime, the device cann't transform receiving data, that receive from computer or another device.
The device use Handshaking to terminated data stream.
Its can applay Hardware's or Software's Handshaking.
|

|
HW HANDSHAKING |
Hardware flow control is also known as RTS/CTS
flow control. It uses two wires in your serial cable rather
than extra characters transmitted in your data lines. Thus hardware
flow control will not slow down transmission times like Xon-Xoff
does.
When the computer wishes to send data it takes active the Request to Send line. If the modem has room for this data, then the modem will reply by taking active the Clear to Send line and the computer starts sending data. If the modem does not have the room then it will not send a Clear to Send.
|

|
SW HANDSHAKING |
Software flow control, sometimes expressed as Xon/Xoff uses two characters Xon and Xoff. Xon is normally indicated by the ASCII 17 character where as the ASCII 19 character is used for Xoff.
The modem will only have a small buffer so when the computer fills it up the modem sends a Xoff character to tell the computer to stop sending data. Once the modem has room for more data it then sends a Xon character and the computer sends more data.
This type of flow control has the advantage that it doesn't require any more wires as the characters are sent via the TD/RD lines. However on slow links each character requires 10 bits which can slow communications down.
|

|
Converter RS-232 to TTL MAX232
RS-232 Transceiver background |
Two RS-232 devices still in use today, the
1488 and 1489, exemplify the early origins of this standard.
Devices from that era are powered by bipolar power supplies
because the RS-232 standard requires each transmitter to provide
a +5V (minimum) signal for a low and a -5V (minimum) signal
for a high. These higher voltages ensure greater noise immunity
after they travel through lossy cables to RS-232 receivers.
But they require a dual power supply and many PC boards included
a negative power supply solely to power devices such as the
1488 and 1489. |
Datasheet |
The MAX220-MAX249 family of
line drivers/receivers is intended for all EIA/TIA-232E and
V.28/V.24 communications interfaces, particularly applications
where ±12V is not available.
You can use the ICL232 as aalternative. It's a dual RS-232
transmitter/receiver interface circuit that meets all ElA
RS-232C and V.28 specifications. It requires a single +5V
power supply, and features two onboard charge pump voltage
converters which generate +10V and -10V supplies from the
5V supply.
Download datasheet:
Our mirror:
|
|
Pin configuration of the MAX232 |
The MAX232 quickly became an industry standard.
Many board designers still use it, despite the fact that single-supply
devices have undergone extensive improvements over the years.
Typical pin onfiguration of MAX232:
|
|
Diagram of the internals of the MAX232A |
Here is a diagram of the internals of the
MAX232A. It shows a double charge pump voltage doubler and a
+10v to -10v voltage inverter. The voltages output are used
to generate the RS-232 compliant signals. The MAX232A has provisions
for two serial ports on the same physical package.
|
|
Current loop
History |
Until the early 1960's, teleprinters used 60mA current loops
to communicate over long distances. In 1962, the Model 33 teletype
was introduced and 20mA current loop interfaces became widely
used. Throughout the 60's, 70's and 80's, 20mA current loop
interfaces were applied in many types of equipment. This interface
type became popular because it offers the most cost-effective
approach to long distance and noise immunity data transmission. |

|
Description |
A current loop interface is a transmission
technique that recognizes current flows, rather than voltage levels.
Each loop can be configured as full or half-duplex and
as active or passive.
When the converter is active, a 12 volt power
supply is required for the current loop side. This communications
standard allows cable lengths up to 2000 feet at data rates up to 19.2k
baud.
|

|
Main features |
- long distance than RS-232
- noise immunity data transmission
- lengths up to 2000 feet
- data rates up to 19.2k baud
|

|
Full-duplex 20 mA Circuit
|
Simultaneous two-way
communications is possible with this circuit. Two 20 mA current
generators are necessary with this circuit. It is possible to
have one of the two current generators in one current loop interface
and the other current generator in the other interface. For
example, the original IBM PC serial adapter card had a current
loop interface that contained only one current generator. When
you made a correct connection to this current loop interface,
the second current loop device would need to provide one current
loop generator.
Full-duplex 20 mA Circuit |
|
The Simplex 20 mA Circuit |
The fundamental elements
of a 20 mA current loop are a current source, a current switch,
and a current detector. The transmitter is the current switch
and the receiver is the current detector. The interface that
contains the current source is called the active unit and all
other units are referred to as passive units. The figure below
is a diagram of the levels in an RS-232 interface and how they
relate to the presence and absence of current in a 20 mA current
loop circuit. In a 20 mA loop the current flows when the loop
is idle (no data being transmitted). In a simplex type circuit
a number of transmitters and receivers are put in series in
a current loop. As long as only one transmitter sends data,
all receivers receive the data.
Simplex 20 mA Circuit (Only one device can transmit at a time)
|
|
Comparison of signal levels in an RS-232 Circuit and a 20-mA Current Loop Circuit
|
A diagram of the levels
in an RS-232 interface and how they relate to the presence and
absence of current in a 20 mA current loop circuit. In a 20
mA loop the current flows when the loop is idle (no data being
transmitted). In a simplex type circuit a number of transmitters
and receivers are put in series in a current loop. As long as
only one transmitter sends data, all receivers receive the data.
Comparison of signal levels in an RS-232 Circuit and a 20-mA
Current Loop Circuit |
|
4 to 20 mA Analog Current Loop |
This circuit is mentioned here because it is sometimes
confused with 20 mA digital current loop. The purpose of 4 to
20 mA analog current loop is to transmit the signal from an
analog sensor over some distance in the form of current signal.
Only two wires are required to send the analog signal and also
supply power to the sensor. A loop supply voltage (24 volts)
is used to power the remote sensor. The remote sensor regulates
the loop current such that the loop current represents the value
of the parameter being measured by the sensor. A series resistor
RL at loop power supply converts this current to a voltage that
can be used by the electronics to record or distribute the parameter
being measured.
4 to 20 mA analog current loop
|
|
HART® 4 to 20 mA Current Loops |
This is another example
of a type of 4 to 20 mA combined analog & digital current
loop. This current loop uses HART® Communications protocol.
The HART® (Highway Addressable Remote Transducer) protocol
is used for SMART remote transducers that are compatible with
4 to 20 mA analog current loops but also have digital communications
on the same two wires. This is accomplished by superimposing
a two-tone Frequency Shift Keyed (FSK) digital current signal
on the 4 to 20 mA analog signal.
4 to 20 mA analog current loop with digital communications
using HART protocol |

|
Software
Hercules SETUP Utility
Hercules
SETUP utility is useful terminal for the Serial port (RS-232
or RS-485), UDP/IP and TCP/IP (Client or Server). With original
HW Ethernet devices (Serial/Ethernet Converter, RS-232/Ethernet
Buffer or I/O Controller) it can be used for the UDP Setup.
Hercules was created for internal use only, but today it's
includes many functions in one utility and it's Freeware!
General useful parts:
- Serial port terminal - COM5 and higher support
- TCP/IP Client terminal
- TCP/IP Server "terminal"
- UDP "terminal"
Download:
|
|
Main features:
- No instalation required, just one .EXE file.
- It's working with the Virtual Serial Port, (COM12 for
example)
- You can use easy MACRO functions, include easy sending HEX commands.
Macro is saved to the registers, so Hercules remember it..
- Serial Terminal indicates and can control modem pins (CTS, RTS,
DTR, DSR, RI, CD)
- You can use sending files and store incomming data to the LOG
file.
- It supports TEA
- safe TCP/IP authorization in the TCP/IP Client, Server,
Test mode tabs..
- Support of TCP/IP data transmission in raw TCP/IP server
or TCP/IP client.
- Support of UDP/IP data transmission in raw UDP/IP "terminal"
- Support the NVT
(Network Virtual Terminal) in the Test mode tab.
- Using Telnet extended with NVT allows serial port configuration
(RFC2217), device identification, confirmation of data sequence,
etc.
- It's FREEWARE you can use and share this software free
without any limitations!
|
Terminal
Terminal is a simple serial port (COM) terminal emulation program.
It can be used for communication with different devices such as modems, routers, embedded uC systems, GSM phones,...
It is very useful debugging tool for serial communication applications.
Download:
Our site:
Original site:
Article about Terminal |
Article about the Terminal sotfware on HW-server.com.
|
|
|
Main features:
- small .exe file only 246k
- simple file send
- character counter
- 6x com ports
- baudrate up to 256kbps
- log to file (hex & string)
- transmit macros
|
Tera Term
Tera Term (Pro) is a free software terminal emulator for MS-Windows.
It supports VT100 emulation, telnet connection, serial port connection,
and so on.
Download:
Our site:
Oroginal site:
|

|
Main features:
- Serial ports larger than COM4.
- Baud rate of 14400.
- User shortcut key "EditCLS",
"EditCLB", "ControlOpenTEK" and
"ControlCloseTEK".
- Macro commands "clearscreen",
"code2str", "enablekeyb",
"filemarkptr", "fileseekback",
"filestrseek2", "findclose",
"findfirst", "findnext",
"getdir", "kmtfinish",
"kmtget", "makepath",
"sendkcode", "setdir",
"setexitcode", "str2code" and
"testlink".
- Macro operator "%".
- Macro: a comment can be placed in any line.
- Pass-through printing directly to a port
- Special options in the setup file
"AutoFileRename", "BackWrap",
"Beep", "EnableStatusLine",
"MaxComPort", "PassThruDelay",
"PassThruPort", "PrnConvFF",
"RussPrint" and "TitleFormat".
- New [Setup] TCP/IP dialog box.
- History list of hosts.
- New Russian character sets (CP 866 and ISO 8859-5).
- New icons.
- Selecting text in a rectangular region.
- Executing menu commands by user defined keys.
- Tera Term extension interface.
|
Related links
Beyond Logic
- Interfacing the Serial / RS-232 Port - http://www.beyondlogic.org
Explains the details of the Serial Ports Registers for the PC (8250
to 16750 UARTs) and the Serial Port's Addresses in the PC.
|
|
Jan Axelson's Lakeview Research
- Serial Port Central - http://www.lvr.com
These information sources cover many of the basics of RS-232, RS-485, and similar communications. Other good sources are the product vendors and chip manufacturers.
|
|
RAD University
|
 |
Lammert Bies, RS-232 general info
- Serial Port Central - http://www.lammertbies.nl
These pages contain information about various types of cables used to
connect computers and peripheral equipment over RS-232.
|
|
Computer TIPs
- RS-232 Serial Port - http://www.ctips.com
The page about RS-232 standard with detailed signal description.
|
|
CableEye PC
|
|
proAV / data and information
|
|
B&B Electronics
|
 |
www.HW.cz
- RS-232 - http://rs232.hw.cz
The page describe the standard RS-232 comprehensive. Internet journal
for Electronics design - czech version.
|
|