Basics Of The Rs-485 Standard
12 Temmuz 2007
Basics of the RS-485 Standard
This information touches on some of the most commonly asked aspects of RS-485 communications. B&B Electronics has a free application note available on RS-422/485 that gives a more complete picture of RS-485 networks. Request B&B’s RS-422/485 Application Note, available by mail or on our websites, www.bb-elec.com or www.bb-europe.com
What is an RS-485 network? RS-485 allows multiple devices (up to 32) to communicate at half-duplex on a single pair of wires, plus a ground wire (more on that later), at distances up to 1200 meters (4000 feet). Both the length of the network and the number of nodes can easily be extended using a variety of repeater products on the market.
How does the hardware work? Data is transmitted differentially on two wires twisted together, referred to as a “twisted pair.” The properties of differential signals provide high noise immunity and long distance capabilities. A 485 network can be configured two ways, “two-wire” or “four-wire.” In a “two-wire” network the transmitter and receiver of each device are connected to a twisted pair. “Four-wire” networks have one master port with the transmitter connected to each of the “slave” receivers on one twisted pair. The “slave” transmitters are all connected to the “master” receiver on a second twisted pair. In either configuration, devices are addressable, allowing each node to be communicated to independently. Only one device can drive the line at a time, so drivers must be put into a high-impedance mode (tri-state) when they are not in use. Some RS-485 hardware handles this automatically. In other cases, the 485 device software must use a control line to handle the driver. (If your 485 device is controlled through an RS-232 serial port, this is typically done with the RTS handshake line.) A consequence of tri-stating the drivers is a delay between the end of a transmission and when the driver is tri-stated. This turn-around delay is an important part of a two-wire network because during that time no other transmissions can occur (not the case in a four-wire configuration). An ideal delay is the length of one character at the current baud rate (i.e. 1 ms at 9600 baud). The device manufacturer should be able to supply information on the delay for their products.
Two-wire or four-wire? Two-wire 485 networks have the advantage of lower wiring costs and the ability for nodes to talk amongst themselves. On the downside, two-wire mode is limited to half-duplex and requires attention to turn-around delay. Four-wire networks allow full-duplex operation, but are limited to master-slave situations (i.e. a “master” node requests information from individual “slave” nodes). “Slave” nodes cannot communicate with each other. Remember when ordering your cable, “two-wire” is really two wires + ground, and “four-wire” is really four wires + ground.
How does the software work? 485 software handles addressing, turn-around delay, and possibly the driver tri-state features of 485. Determine before any purchase whether your software handles these features. Remember, too much or too little turn-around delay can cause troubleshooting fits, and delay should be a function of baud rate. If you’re writing your own software or using software written for an RS-232 application, be certain that provisions are made for driver tri-state control. Luckily, there are usually hardware alternatives for controlling driver tri-stating. Contact B&B Technical Support for further details.
Connecting a multidrop 485 network. The EIA RS-485 Specification labels the data wires “A” and “B”, but many manufacturers label their wires “+” and “-”. In our experience, the “-” wire should be connected to the “A” line, and the “+” wire to the “B” line. Reversing the polarity will not damage a 485 device, but it will not communicate. This said, the rest is easy: always connect A to A and B to B.
Signal ground, don’t forget it. While a differential signal does not require a signal ground to communicate, the ground wire serves an important purpose. Over a distance of hundreds or thousands of feet there can be very significant differences in the voltage level of “ground.” RS-485 networks can typically maintain correct data with a difference of -7 to +12 Volts. If the grounds differ more than that amount, data will be lost and often the port itself will be damaged. The function of the signal ground wire is to tie the signal ground of each of the nodes to one common ground. However, if the differences in signal grounds is too great, further attention is necessary. Optical isolation is the cure for this problem. Contact B&B Technical Support for more details.
115.2 kbps over 2.5 Miles, Handshake Support
Port-Powered RS-232 Asynchronous Fiber Optic Modem
The Model 9PFLST allows any two pieces of RS-232 equipment to communicate full or half duplex over two fibers at a distance up to 2.5 miles with no external power. RS-232 data signals at up to 115.2 kbps and RTS/CTS handshake lines are supported. The 9PFLST provides a transparent cable connection between devices with the EMI/RFI and transient immunity of optical fiber.
The modem is powered from the RS-232 data and handshake lines. A power jack is also provided for connecting an optional +12 VDC supply, allowing the converter to be used with low power ports. The RS-232 connector on the 232FLST is a DB9 female. The multimode fiber is connected via two ST connectors.
Features Asynchronous RS-232 operation Full or half-duplex Supports TD, RD, RTS, and CTS Data rates up to 115.2 kbps Typical range up to 2.5 miles (4 km) on multimode glass fiber EMI/RFI and transient immunity ST connectors Dimensions: 4.3 x 2.3 x 1.0 in (10.9 x 5.8 x 2.4 cm)
DataSheet: 9pflst.pdf 11-27-00 92 KB
RS232, RS422 and V.35 interfaces
school.htm
school.htmRS-232
RS-232 has been around as a standard for decades as an electrical interface between Data Terminal Equipment (DTE) and Data Circuit-Terminating Equipment (DCE) such as modems or DSUs. It appears under different incarnations such as RS-232C, RS-232D, V.24, V.28 or V.10 but essentially all these interfaces are interoperable. RS-232 is used for asynchronous data transfer as well as synchronous links such as SDLC, HDLC, Frame Relay and X.25
There is a standardized pinout for RS-232 on a DB25 connector, as shown below.
The essential feature of RS-232 is that the signals are carried as single voltages referred to a common earth on pin 7.
Data is transmitted and received on pins 2 and 3 respectively. Data set ready (DSR) is an indication from the Dataset (i.e., the modem or DSU/CSU) that it is on. Similarly, DTR indicates to the Dataset that the DTE is on. Data Carrier Detect (DCD) indicates that carrier for the transmit data is on.
Pins 4 and 5 carry the RTS and CTS signals. In most 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 is imperative that only one station is transmitting at a time. When a station wants to transmit, it raises RTS. The modem turns on carrier, typically waits a few milliseconds for carrier to stabilize, and 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. This is explained further in our tutorial on the SDLC protocol, which uses multipoint lines extensively.
The clock signals 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. The auxiliary clock signal on pin 24 is supplied on boards built by Sangoma in order to allow local connections without the need for a modem eliminator. The baud rate of the auxiliary clock is programmable. By jumpering this signal to pins 15 and 17 each side, you can use a simple null-modem cable for synchronous connections. This arrangement is much less expensive that using Modem Eliminator boxes to provide the cable crossover and clocking.
The truth table for RS232 is:
Signal > +3v = 0
Signal < -3v = 1 <-3v>
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 1 volt or less.
RS-232 is simple, universal, well understood and supported everywhere. However, it has some serious shortcomings as an electrical interface.
Firstly, the interface presupposes a common ground between the DTE and DCE. This is a reasonable assumption where a short cable connects a DTE and DCE in the same room, but with longer lines and connections between devices that may be on different electrical busses, this may not be true. We have seen some spectacular electrical events causes by “uncommon grounds”.
Secondly, a signal on a single line is impossible to screen effectively for noise. By screening the entire cable one 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 cables introduces serious crosstalk until a point is reached where the data itself is unreadable.
Crosstalk can be reduced by using low capacitance cable. Also, as it is the higher frequencies that are the problem, control of slew rate in the signal (i.e., making the signal more rounded, rather than square) also decreases the crosstalk. The original specifications for RS-232 had no specification for maximum slew rate.
The standards for RS-232 and similar interfaces usually restrict RS-232 to 20kbps or less and line lengths of 15m (50 ft) or less. These restrictions are mostly throwbacks to the days when 20kbps was considered a very high line speed, and cables were thick, with high capacitance.
However, in practice, RS-232 is far more robust than the traditional specified limits of 20kbps over a 15m line would imply. Most 56kbps DSUs are supplied with both V.35 and RS-232 ports because RS-232 is perfectly adequate at speeds up to 200kbps. You may remember the “zero slot LANs” that were popular a few years ago, using RS-232 ports on PCs running at 115kbps. At Sangoma we have successfully used RS-232 (albeit on short cables) at line speeds of over 1.6Mbps.
Interestingly enough, most RS-232 ports on mainframes and midrange computers are capable of far higher speeds than their rated 19.2kbps. Usually these “low speed” ports will run error free at 56kbps and above.
The 15m limitation for cable length can be stretched to about 30m for ordinary cable, if well screened and grounded, and about 100m if the cable is low capacitance as well. Our standard test cable at Sangoma is an interconnected run of round and flat cable, about 25M in length, with no screening at all. We run error free on this cabling collection at up to 112kbps.
RS-422, RS-485, V.11 and other balanced interfaces.
The limitations of RS-232 are largely eliminated by the balanced line interface.
A pair of wires is used to carry each signal. The data is encoded and decoded as a differential voltage between the two lines. A typical truth table for a balanced interface is as follows:
VA-VB < -0.2v =0
VA-VB > +0.2v=1
As a differential voltage, in principle the interface is unaffected by differences in ground voltage between sender and receiver.
Furthermore, if lines A and B are close together, they will be affected almost identically by external electromagnetic noise. If the lines are also twisted together, then neither line is permanently closer to a noise source than the other. Hence the well known “twisted pair” is extremely effective in eliminating noise from the signal.
Balanced systems are used by LAN topologies like Ethernet and Token Ring. They can support line speeds over 100Mbps and work reliably at distances of several kilometers.
There are several standards that incorporate balanced line signals into DB connectors. These include RS-449 (DB37), X.21 (DB15) and RS530 (DB25). The threshold voltages in the truth table are not identical for these standards, but the standards are usually interoperable.
As line speeds and lengths go up, the problem of signal reflections becomes important. Lines must be properly terminated by a resistor that makes the cable look electrically like it is infinitely long (an infinitely long cable, of course, can have no reflected signals because the far end is infinitely far away). These terminating resistor values depend on the geometry of the cable itself. So you will see cable designated as 75 Ohm cable or 50 ohm cable, etc. What this means is that by installing a 50 ohm resistor, say, between the signal pair, this particular type of cable will have the electrical characteristics of an infinitely long cable. Note that the designation “50 ohm cable” has nothing to do with the electrical impedance of the physical cable itself.
In theory, extraneous noise, input equally on each line of a pair has no effect. In practice, however, the characteristics of the receivers are such that sufficiently high noise levels cause one side of the receiver to saturate, leading to data errors. Resistor networks are frequently included that provide low resistance paths to earth to dissipate noise.
Sangoma cards, such as the S508 used for WANPIPE, generally include the correct terminations on the boards themselves.
V.35 Interface.
The V.35 interface was originally specified by CCITT as an interface for 48kbps line transmissions. It has been adopted for all line speeds above 20kbps, and seems to have acquired a life of its own. It was discontinued by CCITT in 1988, and replaced by recommendations V.10 and V.11.
V.35 is a mixture of balanced (like RS422) and common earth (like RS232) signal interfaces. The control lines including DTR, DSR. DCD, RTS and CTS are single wire common earth interfaces, functionally compatible with RS-232 level signals. The data and clock signals are balanced, RS-422-like signals.
The control signals in V.35 are common earth single wire interfaces because these signal levels are mostly constant or vary at low frequencies. The high frequency data and clock signals are carried by balanced lines. Thus single wires are used for the low frequencies for which they are adequate, while balanced pairs are used for the high frequency data and clock signals.
The V.35 plug is standard. It is a black plastic plug about 20mm by 70mm, often with gold plated contacts and built-in hold down and mating screws. The V.35 plug is roughly 30 times the price of a DB25, making everything to do with V.35 somewhat expensive.
If your DSU supports RS-232 as well as V.35 you are always better off financially by using the RS-232 option. An additional complication with V.35 is that the V.35 plug is too large to fit on many add-in cards, such as those used by PCs. Thus there is very often a non standard cable used to connect a V.35 system, terminating in a DB25 at one end and a V.35 plug at the other. It is very easy to use the wrong cable, and quite difficult to debug if you do.
Debugging any balanced signal is quite tricky. Identification of the “A” and “B” halves of a signal pair is difficult. It is very easy to switch the polarity of the signals on a signal pair. Under certain circumstances, such an interface will appear to be working correctly, except for odd line errors at certain times.
Standard pinouts of the cables used for Sangoma cards are published on the web.
QUICK REFERENCE
FOR
RS485, RS422, RS232 AND RS423
http://www.rs485.com/http://www.rs485.com/
INTRODUCTION
Line drivers and receivers are commonly used to exchange data between two or more points (nodes) on a network. Reliable data communications can be difficult in the presence of induced noise, ground level differences, impedance mismatches, failure to effectively bias for idle line conditions, and other hazards associated with installation of a network.
The connection between two or more elements (drivers and receivers) should be considered a transmission line if the rise and/or fall time is less than half the time for the signal to travel from the transmitter to the receiver.
Standards have been developed to insure compatibility between units provided by different manufacturers, and to allow for reasonable success in transferring data over specified distances and/or data rates. The Electronics Industry Association (EIA) has produced standards for RS485, RS422, RS232, and RS423 that deal with data communications. Suggestions are often made to deal with practical problems that might be encountered in a typical network. EIA standards where previously marked with the prefix “RS” to indicate recommended standard; however, the standards are now generally indicated as “EIA” standards to identify the standards organization. While the standards bring uniformity to data communications, many areas are not specifically covered and remain as “gray areas” for the user to discover (usually during installation) on his own.
SINGLE-ENDED DATA TRANSMISSION
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. The specification allows for data transmission from one transmitter to one receiver at relatively slow data rates (up to 20K bits/second) and short distances (up to 50Ft. @ the maximum data rate).
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. In general if you are not connected to a modem the handshaking lines can present a lot of problems if not disabled in software or accounted for in the hardware (loop-back or pulled-up). RTS (Request to send) does have some utility in certain applications. RS423 is another single ended specification with enhanced operation over RS232; however, it has not been widely used in the industry.
DIFFERENTIAL DATA TRANSMISSION
When communicating at high data rates, or over long distances in real world environments, single-ended methods are often inadequate. Differential data transmission (balanced differential signal) offers superior performance in most applications. Differential signals can help nullify the effects of ground shifts and induced noise signals that can appear as common mode voltages on a network.
RS422 (differential) was designed for greater distances and higher Baud rates than RS232. In its simplest form, a pair of converters from RS232 to RS422 (and back again) can be used to form an “RS232 extension cord.” Data rates of up to 100K bits / second and distances up to 4000 Ft. can be accommodated with RS422. RS422 is also specified for multi-drop (party-line) applications where only one driver is connected to, and transmits on, a “bus” of up to 10 receivers.
While a multi-drop “type” application has many desirable advantages, RS422 devices cannot be used to construct a truly multi-point network. A true multi-point network consists of multiple drivers and receivers connected on a single bus, where any node can transmit or receive data.
“Quasi” multi-drop networks (4-wire) are often constructed using RS422 devices. These networks are often used in a half-duplex mode, where a single master in a system sends a command to one of several “slave” devices on a network. Typically one device (node) is addressed by the host computer and a response is received from that device. Systems of this type (4-wire, half-duplex) are often constructed to avoid “data collision” (bus contention) problems on a multi-drop network (more about solving this problem on a two-wire network in a moment).
RS485 meets the requirements for a truly multi-point communications network, and the standard specifies up to 32 drivers and 32 receivers on a single (2-wire) bus. With the introduction of “automatic” repeaters and high-impedance drivers / receivers this “limitation” can be extended to hundreds (or even thousands) of nodes on a network. RS485 extends the common mode range for both drivers and receivers in the “tri-state” mode and with power off. Also, RS485 drivers are able to withstand “data collisions” (bus contention) problems and bus fault conditions.
To solve the “data collision” problem often present in multi-drop networks hardware units (converters, repeaters, micro-processor controls) can be constructed to remain in a receive mode until they are ready to transmit data. Single master systems (many other communications schemes are available) offer a straight forward and simple means of avoiding “data collisions” in a typical 2-wire, half-duplex, multi-drop system. The master initiates a communications request to a “slave node” by addressing that unit. The hardware detects the start-bit of the transmission and automatically enables (on the fly) the RS485 transmitter. Once a character is sent the hardware reverts back into a receive mode in about 1-2 microseconds (at least with R.E. Smith converters, repeaters, and remote I/O boards).
Any number of characters can be sent, and the transmitter will automatically re-trigger with each new character (or in many cases a “bit-oriented” timing scheme is used in conjunction with network biasing for fully automatic operation, including any Baud rate and/or any communications specification, eg. 9600,N,8,1). Once a “slave” unit is addressed it is able to respond immediately because of the fast transmitter turn-off time of the automatic device. It is NOT necessary to introduce long delays in a network to avoid “data collisions.” Because delays are NOT required, networks can be constructed, that will utilize the data communications bandwidth with up to 100% through put.
Below are the specifications for RS232, RS423, RS422, and RS485. Please give us a call at 513-874-4796 if further information is required. We have solutions to most problems that are encountered in this area. Any comments and/or corrections would be appreciated.
Thanks, Ron Smith
SPECIFICATIONS
RS232
RS423
RS422
RS485
Mode of Operation
SINGLE
-ENDED
SINGLE
-ENDED
DIFFERENTIAL
DIFFERENTIAL
Total Number of Drivers and Receivers on One Line (One driver active at a time for RS485 networks)
1 DRIVER
1 RECVR
1 DRIVER
10 RECVR
1 DRIVER
10 RECVR
32 DRIVER
32 RECVR
Maximum Cable Length
50 FT.
4000 FT.
4000 FT.
4000 FT.
Maximum Data Rate (40ft. - 4000ft. for RS422/RS485)
20kb/s
100kb/s
10Mb/s-100Kb/s
10Mb/s-100Kb/s
Maximum Driver Output Voltage
+/-25V
+/-6V
-0.25V to +6V
-7V to +12V
Driver Output Signal Level (Loaded Min.)
Loaded
+/-5V to +/-15V
+/-3.6V
+/-2.0V
+/-1.5V
Driver Output Signal Level (Unloaded Max)
Unloaded
+/-25V
+/-6V
+/-6V
+/-6V
Driver Load Impedance (Ohms)
3k to 7k
>=450
100
54
Max. Driver Current in High Z State
Power On
N/A
N/A
N/A
+/-100uA
Max. Driver Current in High Z State
Power Off
+/-6mA @ +/-2v
+/-100uA
+/-100uA
+/-100uA
Slew Rate (Max.)
30V/uS
Adjustable
N/A
N/A
Receiver Input Voltage Range
+/-15V
+/-12V
-10V to +10V
-7V to +12V
Receiver Input Sensitivity
+/-3V
+/-200mV
+/-200mV
+/-200mV
Receiver Input Resistance (Ohms), (1 Standard Load for RS485)
3k to 7k
4k min.
4k min.
>=12k
indexframes.html
Please call us at: 513-874-4796
Contact Information:
R.E. Smith, 4311 Tylersville Road, Hamilton, Ohio 45011
513-874-4796 Phone, 513-874-1236 Fax., rs485.com
Go Back (Previous view)
Print Page (Select Landscape)
http://www.rs485.com/http://www.rs485.com/
Kategori: Bilim