Serial Ports a Tutorial
Electronic data communications between elements will generally fall into two broad categories: single-ended and differential. RS232 (single-ended) was introduced in 1962, and despite rumors for its early demise, has remained widely used through the industry.
Independent channels are established for two-way (full-duplex) communications. The RS232 signals are represented by voltage levels with respect to a system common (power / logic ground). The "idle" state (MARK) has the signal level negative with respect to common, and the "active" state (SPACE) has the signal level positive with respect to common. RS232 has numerous handshaking lines (primarily used with modems), and also specifies a communications protocol.
The RS-232 interface presupposes a common ground between the DTE and DCE. This is a reasonable assumption when a short cable connects the DTE to the DCE, but with longer lines and connections between devices that may be on different electrical busses with different grounds, this may not be true.
RS232 data is bi-polar.... +3 TO +12 volts indicates an "ON or 0-state (SPACE) condition" while A -3 to -12 volts indicates an "OFF" 1-state (MARK) condition.... Modern computer equipment ignores the negative level and accepts a zero voltage level as the "OFF" state. In fact, the "ON" state may be achieved with lesser positive potential. This means circuits powered by 5 VDC are capable of driving RS232 circuits directly, however, the overall range that the RS232 signal may be transmitted/received may be dramatically reduced.
The output signal level usually swings between +12V and -12V. The "dead area" between +3v and -3v is designed to absorb line noise. In the various RS-232-like definitions this dead area may vary. For instance, the definition for V.10 has a dead area from +0.3v to -0.3v. Many receivers designed for RS-232 are sensitive to differentials of 1v or less.
This can cause problems when using pin powered widgets - line drivers, converters, modems etc. These type of units need enough voltage & current to power them self's up. Typical URART (the RS-232 I/O chip) allows up to 50ma per output pin - so if the device needs 70ma to run we would need to use at least 2 pins for power. Some devices are very efficient and only require one pin (some times the Transmit or DTR pin) to be high - in the "SPACE" state while idle.
An RS-232 port can supply only limited power to another device. The number of output lines, the type of interface driver IC, and the state of the output lines are important considerations.
The types of driver ICs used in serial ports can be divided into three general categories:
Data is transmitted and received on pins 2 and 3 respectively. Data Set Ready (DSR) is an indication from the Data Set (i.e., the modem or DSU/CSU) that it is on. Similarly, DTR indicates to the Data Set that the DTE is on. Data Carrier Detect (DCD) indicates that a good carrier is being received from the remote modem.
Pins 4 RTS (Request To Send - from the transmitting computer) and 5 CTS (Clear To Send - from the Data set) are used to control. In most Asynchronous situations, RTS and CTS are constantly on throughout the communication session. However where the DTE is connected to a multipoint line, RTS is used to turn carrier on the modem on and off. On a multipoint line, it's imperative that only one station is transmitting at a time (because they share the return phone pair). When a station wants to transmit, it raises RTS. The modem turns on carrier, typically waits a few milliseconds for carrier to stabilize, and then raises CTS. The DTE transmits when it sees CTS up. When the station has finished its transmission, it drops RTS and the modem drops CTS and carrier together.
Clock signals (pins 15, 17, & 24) are only used for synchronous communications. The modem or DSU extracts the clock from the data stream and provides a steady clock signal to the DTE. Note that the transmit and receive clock signals do not have to be the same, or even at the same baud rate.
Note: Transmit and receive leads (2 or 3) can be reversed depending on the use of the equipment - DCE Data Communications Equipment or a DTE Data Terminal Equipment.
Glossary of Abbreviations etc.
Is Your Interface a DTE or a DCE?
One of the stickiest areas of confusion in datacom is over the terms "transmit" and "receive" as they pertain to DTE (data terminal equipment) and DCE (data communication equipment). In synchronous communication, this confusion is particularly acute, because more signals are involved. So why is it that you sometimes send data on TD, and other times you send data on RD? Is this just a cruel form of mental torture? Not really. The secret lies in adopting the proper perspective. In data-com, the proper perspective is always from the point of view of the DTE. When you sit at a PC, terminal or workstation (DTE) and transmit data to somewhere far away, you naturally do so on the TD (transmit data) line. When your modem or CSU/DSU (DCE) receives this incoming data, it receives the data on the TD line as well. Why? Because the only perspective that counts in data-com is the perspective of the DTE. It does not matter that the DCE thinks it is receiving data; the line is still called "TD". Conversely, when the modem or CSU/DSU receives data from the outside world and sends it to the DTE, it sends it on the RD line. Why? Because from the perspective of the DTE, the data is being received! So when wondering, "Is this line TD or RD? Is it TC or RC?" Ask yourself, "What would the DTE say?" Find out by following these steps: The point of reference for all signals is the terminal (or PC).
2) If the voltage on pin 2 is more negative than -3 Volts, then it is a DTE, otherwise it should be near zero volts.
3) If the voltage on pin 3 is more negative than -3 Volts, then it is a DCE.4) If both pins 2 & 3 have a voltage of at least 3 volts, then either you are measuring incorrectly, or your device is not a standard EIA-232 device. Call technical support.
5) In general, a DTE provides a voltage on TD, RTS, & DTR, whereas a DCE provides voltage on RD, CTS, DSR, & CD.
X.21 interface on a DB 15 connector
also see X.21 write up
The X.21 interface was recommended by the CCITT in 1976. It is defined as a digital signaling interface between customers (DTE) equipment and carrier's equipment (DCE). And thus primarily used for telecom equipment.
All signals are balanced. Meaning there is always a pair (+/-) for each signal, like used in RS422. The X.21 signals are the same as RS422, so please refer to RS422 for the exact details.
Pinning according to ISO 4903
RS232D uses RJ45 type connectors
This a DTE port as on the back of a PC Com Port - EIA-574 RS-232/V.24 pin out on a DB-9 pin used for Asynchronous Data
One byte of async data
Cabling considerations - you should use cabling made for RS-232 data but I have seen low speed data go over 250' on 2 pair phone cable. Level 5 cable can also be used but for best distance use a low capacitance data grade cable.
The standard maxim length is 50' but if data is async you can increase that distance to as much as 500' with a good grade of cable.
The RS-232 signal on a single cable is impossible to screen effectively for noise. By screening the entire cable we can reduce the influence of outside noise, but internally generated noise remains a problem. As the baud rate and line length increase, the effect of capacitance between the different lines introduces serious crosstalk (this especially true on synchronous data - because of the clock lines) until a point is reached where the data itself is unreadable. Signal Crosstalk can be reduced by using low capacitance cable and shielding each pair
Using a high grade cable (individually shield low capacitance pairs) the distance can be extended to 4000'
At higher frequencies a new problem comes to light. The high frequency component of the data signal is lost as the cable gets longer resulting in a rounded, rather than square wave signal.
The maxim distance will depend on the speed and noise level around the cable run.
On longer runs a line driver is needed. This is a simple modem used to increase the maxim distance you can run RS-232 data.
of the specifications
It can be
difficult to qualify whether shielding is required in a particular system or
not, until problems arise. We recommend erring on the safe side and using
shielded cable. Shielded cable is only slightly more expensive than
RS232 - V.24/V.28 - IS2110 - X.20 bis (for Async) -
|4||Request To Send||CA||105||8||7|
|5||Clear To Send||CB||106||7||8|
|8||Received Line Signal Detector||CF||109||2||1|
|23||Data Signal Rate Select
|24||Transmit Signal Element Timing
|15||Transmitter Signal Element Timing
|17||Receiver Signal Element Timing
|18||Local Loopback / Quality Detector||LL||141|
|14||Secondary Transmitted Data||SBA||118|
|16||Secondary Received Data||SBB||119|
|19||Secondary Request To Send||SCA||120|
|13||Secondary Clear To Send||SCB||121|
|12||Secondary Received Line Signal Detector/
Data signal Rate Select (DCE Source)
|9||Reserved for Testing|
|10||Reserved for Testing|
All signals are measured in reference to a common ground,
which is called the signal ground (AB). A positive voltage between 3 and 15 Vdc
represents a logical 0 and a negative voltage between 3 and 15 Vdc represents a
This switching between positive and negative is called bipolar. The zero state is not defined in RS232 and is considered a fault condition (this happens when a device is turned off).
According to the above a maximum distance of 50 ft or 15 m. can be reached at a maximum speed of 20k bps. This is according to the official specifications, the distance can be exceeded with the use of Line Drivers.
|Shield Ground||AA||Also known as protective ground. This is the chassis ground connection between DTE and DCE.|
|Signal Ground||AB||The reference ground between a DTE and a DCE. Has the value 0 Vdc.|
|Transmitted Data||BA||Data send by the DTE.|
|Received Data||BB||Data received by the DTE.|
|Request To Send||CA||Originated by the DTE to initiate transmission by the DCE.|
|Clear To Send||CB||Send by the DCE as a reply on the RTS after a delay in ms, which gives the DCEs enough time to energize their circuits and synchronize on basic modulation patterns.|
|DCE Ready||CC||Known as DSR. Originated by the DCE indicating that it is basically operating (power on, and in functional mode).|
|DTE Ready||CD||Known as DTR. Originated by the DTE to instruct the DCE to setup a connection. Actually it means that the DTE is up and running and ready to communicate.|
|Ring Indicator||CE||A signal from the DCE to the DTE that there is an incomming call (telephone is ringing). Only used on switched circuit connections.|
|Received Line Signal Detector||CF||Known as DCD. A signal send from DCE to its DTE to indicate that it has received a basic carrier signal from a (remote) DCE.|
Signal Rate Select
|CH/CI||A control signal that can be used to change the transmission speed.|
|Transmit Signal Element Timing
|DA||Timing signals used by the DTE for transmission, where the clock is originated by the DTE and the DCE is the slave.|
|Transmitter Signal Element Timing
|DB||Timing signals used by the DTE for transmission.|
|Receiver Signal Element Timing
|DD||Timing signals used by the DTE when receiving data.|
|Local Loopback / Quality Detector||LL|
|Remote Loopback||RL/CG||Originated by the DCE that changes state when the analog signal received from the (remote) DCE becomes marginal.|
|Reserved for Testing|
The secondary signals are used on some DCE's. Those units have the possibility to transmit and/or receive on a secondary channel. Those secondary channels are mostly of a lower speed than the normal ones and are mainly used for administrative functions.
Here are some cable pinning that might be useful. Not all applications are covered, it is just a help:
|Straight DB25 Cable||DB25 Null- modem
or cross over cable (Async)
|DB25 Tail- circuit
or cross over cable cable (Sync)
|DB25 to DB9 DTE - DCE cable|
This cable should be used for DTE to DCE (for instance computer to modem) connections with hardware handshaking.
9 PIN D-SUB FEMALE to the Computer
25 PIN D-SUB MALE to the Modem
|Request to Send||7||4|
|Clear to Send||8||5|
|Data Set Ready||6||6|
|Data Terminal Ready||4||20|
Use this cable between two DTE devices (for instance two computers).
(To Computer 1).
(To Computer 2).
25 PIN D-SUB FEMALE to Computer 1.
25 PIN D-SUB FEMALE to Computer 2.
|D-Sub 1||D-Sub 2|
|Recieve 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|
RS232 (25 pin) Tail Circuit Cable
Cross Pinned cables for Async data.
(in-depth write ups)