首页 RS485协议

RS485协议

举报
开通vip

RS485协议 RS-422/485 Application Note Cover Page B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 RS-422 and RS-485 Application Note B&B Electronics Mfg. Co. Inc. P.O. Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100...

RS485协议
RS-422/485 Application Note Cover Page B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 RS-422 and RS-485 Application Note B&B Electronics Mfg. Co. Inc. P.O. Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Internet Addresses: B&B Home Page: http://www.bb-elec.com Customer Service: sales@bb-elec.com Technical Support: techsupt@bb-elec.com Ó B&B Electronics - Revised October 1997 RS-422/485 Application Note Table of Contents i B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Table of Contents CHAPTER 1: OVERVIEW ........................................................................... 1 INTRODUCTION.............................................................................................1 DATA TRANSMISSION SIGNALS ......................................................................1 Unbalanced Line Drivers ......................................................................... 1 Balanced Line Drivers ............................................................................. 1 Balanced Line Receivers.......................................................................... 3 EIA STANDARD RS-422 DATA TRANSMISSION..............................................3 EIA STANDARD RS-485 DATA TRANSMISSION..............................................6 TRISTATE CONTROL OF AN RS-485 DEVICE USING RTS..................................9 SEND DATA CONTROL OF AN RS-485 DEVICE ..............................................11 CHAPTER 2: SYSTEM CONFIGURATION ............................................ 13 NETWORK TOPOLOGIES...............................................................................13 TWO WIRE OR FOUR WIRE SYSTEMS............................................................13 TERMINATION.............................................................................................16 BIASING AN RS-485 NETWORK....................................................................17 EXTENDING THE SPECIFICATION..................................................................19 CHAPTER 3: SELECTING RS-422 AND RS-485 CABLING .................. 20 NUMBER OF CONDUCTORS..........................................................................20 SHIELDING .................................................................................................20 CABLE CHARACTERISTICS...........................................................................20 CHAPTER 4: TRANSIENT PROTECTION OF RS-422 AND RS-485 SYSTEMS.................................................................................................... 23 WHAT DOES A SURGE LOOK LIKE?................................................................23 Surge Specifications............................................................................... 23 Common Mode vs. Differential Mode..................................................... 25 GROUND ¹ GROUND....................................................................................26 TRANSIENT PROTECTION USING ISOLATION ..................................................27 Isolation Theory..................................................................................... 27 Isolation Devices ................................................................................... 28 TRANSIENT PROTECTION USING SHUNTING ..................................................28 Shunting Theory..................................................................................... 28 Connecting Signal Grounds ................................................................... 29 Shunting Devices ................................................................................... 29 COMBINING ISOLATION AND SHUNTING .......................................................29 SPECIAL CONSIDERATION FOR FAULT CONDITIONS.......................................31 CHOOSING THE RIGHT PROTECTION FOR YOUR SYSTEM.................................31 ii Table of Contents RS-422/485 Application Note B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 CHAPTER 5: SOFTWARE ....................................................................... 33 INTRODUCTION...........................................................................................33 RS-422 SYSTEMS .......................................................................................33 RS-485 DRIVER CONTROL..........................................................................33 RS-485 RECEIVER CONTROL.......................................................................34 MASTER-SLAVE SYSTEMS ...........................................................................34 Four Wire Master-Slave Systems............................................................ 34 Two Wire Master-Slave Systems............................................................. 34 MULTI-MASTER RS-485 SYSTEMS ..............................................................35 SYSTEMS WITH PORT POWERED CONVERTERS..............................................35 CHAPTER 6: SELECTING RS-485 DEVICES ........................................ 36 CHAPTER 7: SOURCES OF FURTHER INFORMATION.................... 37 APPENDIX A: EIA SPECIFICATION SUMMARY ................................ 38 APPENDIX B: EIA STANDARD RS-423 DATA TRANSMISSION........ 40 RS-422/485 Application Note 1 B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Chapter 1: Overview Introduction The purpose of this application note is to describe the main elements of an RS-422 and RS-485 system. This application note attempts to cover enough technical details so that the system designer will have considered all the important aspects in his data system design. Since both RS-422 and RS- 485 are data transmission systems that use balanced differential signals, it is appropriate to discuss both systems in the same application note. Throughout this application note the generic terms of RS-422 and RS-485 will be used to represent the EIA/TIA-422 and EIA/TIA-485 Standards. Data Transmission Signals Unbalanced Line Drivers Each signal that transmits in an RS-232 unbalanced data transmission system appears on the interface connector as a voltage with reference to a signal ground. For example, the transmitted data (TD) from a DTE device appears on pin 2 with respect to pin 7 (signal ground) on a DB-25 connector. This voltage will be negative if the line is idle and alternate between that negative level and a positive level when data is sent with a magnitude of ±5 to ±15 volts. The RS-232 receiver typically operates within the voltage range of +3 to +12 and -3 to -12 volts as shown in Figure 1.1. Balanced Line Drivers In a balanced differential system the voltage produced by the driver appears across a pair of signal lines that transmit only one signal. Figure 1.2 shows a schematic symbol for a balanced line driver and the voltages that exist. A balanced line driver will produce a voltage from 2 to 6 volts across its A and B output terminals and will have a signal ground (C) connection. Although proper connection to the signal ground is important, it isn't used by a balanced line receiver in determining the logic state of the data line. A balanced line driver can also have an input signal called an “Enable” signal. The purpose of this signal is to connect the driver to its output terminals, A and B. If the “Enable” signal is OFF, one can consider the driver as disconnected from the transmission line. An RS-485 driver must have the “Enable” control signal. An RS-422 driver may have this signal, but it is not always required. The disconnected or "disabled" condition of the line driver usually is referred to as the “tristate1” condition of the driver. 1 The term “tristate” comes from the fact that there is a third output state of an RS-485 driver, in addition to the output states of “1” and “0.” 2 RS-422/485 Application Note B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Figure 1.1 Figure 1.2 RS-422/485 Application Note 3 B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Balanced Line Receivers A balanced differential line receiver senses the voltage state of the transmission line across two signal input lines, A and B. It will also have a signal ground (C) that is necessary in making the proper interface connection. Figure 1.3 is a schematic symbol for a balanced differential line receiver. Figure 1.3 also shows the voltages that are important to the balanced line receiver. If the differential input voltage Vab is greater than +200 mV the receiver will have a specific logic state on its output terminal. If the input voltage is reversed to less than -200 mV the receiver will create the opposite logic state on its output terminal. The input voltages that a balanced line receiver must sense are shown in Figure 1.3. The 200 mV to 6 V range is required to allow for attenuation on the transmission line. EIA Standard RS-422 Data Transmission The EIA Standard RS-422-A entitled “Electrical Characteristics of Balanced Voltage Digital Interface Circuits” defines the characteristics of RS-422 interface circuits. Figure 1.4 is a typical RS-422 four-wire interface. Notice that five conductors are used. Each generator or driver can drive up to ten (10) receivers. The two signaling states of the line are defined as follows: a. When the “A” terminal of the driver is negative with respect to the “B” terminal, the line is in a binary 1 (MARK or OFF) state. b. When the “A” terminal of the driver is positive with respect to the “B” terminal, the line is in a binary 0 (SPACE or ON) state. Figure 1.5 shows the condition of the voltage of the balanced line for an RS-232 to RS-422 converter when the line is in the “idle” condition or OFF state. It also shows the relationship of the “A” and “B” terminals of an RS- 422 system and the “-“ and “+” terminal markings used on many types of equipment. The “A” terminal is equivalent to the “-“ designation, and the “B” terminal equivalent to the “+” designation. The same relationship shown in Figure 1.5 also applies for RS-485 systems. RS-422 can withstand a common mode voltage (Vcm) of ±7 volts. Common mode voltage is defined as the mean voltage of the A and B terminals with respect to signal ground. 4 RS-422/485 Application Note B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Figure 1.3 Figure 1.4 RS-422/485 Application Note 5 B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Figure 1.5 6 RS-422/485 Application Note B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 EIA Standard RS-485 Data Transmission The RS-485 Standard permits a balanced transmission line to be shared in a party line or multidrop mode. As many as 32 driver/receiver pairs can share a multidrop network. Many characteristics of the drivers and receivers are the same as RS-422. The range of the common mode voltage Vcm that the driver and receiver can tolerate is expanded to +12 to -7 volts. Since the driver can be disconnected or tristated from the line, it must withstand this common mode voltage range while in the tristate condition. Some RS-422 drivers, even with tristate capability, will not withstand the full Vcm voltage range of +12 to -7 volts. Figure 1.6 shows a typical two-wire multidrop network. Note that the transmission line is terminated on both ends of the line but not at drop points in the middle of the line. Termination should only be used with high data rates and long wiring runs. A detailed discussion of termination can be found in Chapter 2 of this application note. The signal ground line is also recommended in an RS-485 system to keep the common mode voltage that the receiver must accept within the -7 to +12 volt range. Further discussion of grounding can be found in Chapter 3 of this application note. RS-422/485 Application Note 7 B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Figure 1.6 8 RS-422/485 Application Note B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Figure 1.7 RS-422/485 Application Note 9 B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 An RS-485 network can also be connected in a four-wire mode as shown in Figure 1.7. Note that four data wires and an additional signal ground wire are used in a “four-wire” connection. In a four-wire network it is necessary that one node be a master node and all others be slaves. The network is connected so that the master node communicates to all slave nodes. All slave nodes communicate only with the master node. This network has some advantages with equipment with mixed protocol communications. Since the slave nodes never listen to another slave response to the master, a slave node cannot reply incorrectly to another slave node. Tristate Control of an RS-485 Device using RTS As discussed previously, an RS-485 system must have a driver that can be disconnected from the transmission line when a particular node is not transmitting. In an RS-232 to RS-485 converter or an RS-485 serial card, this may be implemented using the RTS control signal from an asynchronous serial port to enable the RS-485 driver. The RTS line is connected to the RS- 485 driver enable such that setting the RTS line to a high (logic 1) state enables the RS-485 driver. Setting the RTS line low (logic 0) puts the driver into the tristate condition. This in effect disconnects the driver from the bus, allowing other nodes to transmit over the same wire pair. Figure 1.8 shows a timing diagram for a typical RS-232 to RS-485 converter. The waveforms show what happens if the VRTS waveform is narrower than the data VSD. This is not the normal situation, but is shown here to illustrate the loss of a portion of the data waveform. When RTS control is used, it is important to be certain that RTS is set high before data is sent. Also, the RTS line must then be set low after the last data bit is sent. This timing is done by the software used to control the serial port and not by the converter. When an RS-485 network is connected in a two-wire multidrop party line mode, the receiver at each node will be connected to the line (see Figure 1.6). The receiver can often be configured to receive an echo of its own data transmission. This is desirable in some systems, and troublesome in others. Be sure to check the data sheet for your converter to determine how the receiver “enable” function is connected. 10 RS-422/485 Application Note B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Figure 1.8 RS-422/485 Application Note 11 B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Send Data Control of an RS-485 Device Many of B&B Electronics’ RS-232 to RS-485 converters and RS-485 serial cards include special circuitry, which is triggered from the data signal to enable the RS-485 driver. Figure 1.9 is a timing diagram of the important signals used to control a converter of this type. It is important to note that the transmit data line is “disabled” at a fixed interval after the last bit, typically one character length. If this interval is too short, you can miss parts of each character being sent. If this time is too long, your system may try to turn the data line around from transmit to receive before the node (with the Send Data converter) is ready to receive data. If the latter is the case, you will miss portions (or complete characters) at the beginning of a response. 12 RS-422/485 Application Note B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Figure 1.9 RS-422/485 Application Note 13 B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Chapter 2: System Configuration Network Topologies Network configuration isn’t defined in the RS-422 or RS-485 specification. In most cases the designer can use a configuration that best fits the physical requirements of the system. Two Wire or Four Wire Systems RS-422 systems require a dedicated pair of wires for each signal, a transmit pair, a receive pair and an additional pair for each handshake/control signal used (if required). The tristate capabilities of RS- 485 allow a single pair of wires to share transmit and receive signals for half- duplex communications. This “two wire” configuration (note that an additional ground conductor should be used) reduces cabling cost. RS-485 devices may be internally or externally configured for two wire systems. Internally configured RS-485 devices simply provide A and B connections (sometimes labeled “-“ and “+”). Devices configured for four wire communications bring out A and B connections for both the transmit and the receive pairs. The user can connect the transmit lines to the receive lines to create a two wire configuration. The latter type device provides the system designer with the most configuration flexibility. Note that the signal ground line should also be connected in the system. This connection is necessary to keep the Vcm common mode voltage at the receiver within a safe range. The interface circuit may operate without the signal ground connection, but may sacrifice reliability and noise immunity. Figures 2.1 and 2.2 illustrate connections of two and four wire systems. 14 RS-422/485 Application Note B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Figure 2.1 Typical RS-485 Four Wire Multidrop Configuration RS-422/485 Application Note 15 B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Figure 2.2 Typical RS-485 Two Wire Multidrop Network 16 RS-422/485 Application Note B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Termination Termination is used to match impedance of a node to the impedance of the transmission line being used. When impedance are mismatched, the transmitted signal is not completely absorbed by the load and a portion is reflected back into the transmission line. If the source, transmission line and load impedance are equal these reflections are eliminated. There are disadvantages of termination as well. Termination increases load on the drivers, increases installation complexity, changes biasing requirements and makes system modification more difficult. The decision whether or not to use termination should be based on the cable length and data rate used by the system. A good rule of thumb is if the propagation delay of the data line is much less than one bit width, termination is not needed. This rule makes the assumption that reflections will damp out in several trips up and down the data line. Since the receiving UART will sample the data in the middle of the bit, it is important that the signal level be solid at that point. For example, in a system with 2000 feet of data line the propagation delay can be calculated by multiplying the cable length by the propagation velocity of the cable. This value, typically 66 to 75% of the speed of light (c), is specified by the cable manufacture. For our example, a round trip covers 4000 feet of cable. Using a propagation velocity of 0.66 ´ c, one round trip is completed in approximately 6.2 ms. If we assume the reflections wil
本文档为【RS485协议】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_954845
暂无简介~
格式:pdf
大小:628KB
软件:PDF阅读器
页数:44
分类:互联网
上传时间:2009-10-26
浏览量:60