Rs-485 adopts balanced transmission and differential reception to realize communication: the transmitting end converts the ttl level signal of the serial port into differential signal a, b two outputs, and reduces the differential signal to ttl at the receiving end after transmission through the cable. Flat signal. Since the transmission line usually uses twisted pair and differential transmission, it has strong anti-common mode interference capability, and the bus transceiver has high sensitivity and can detect voltages as low as 200mv. Therefore, the transmission signal can be recovered beyond the kilometer. The maximum communication distance of rs-485 is about 1219m, and the maximum transmission rate is 10mb/s. The transmission rate is inversely proportional to the transmission distance. At the transmission rate of 100kb/s, the maximum communication distance can be achieved. Distance, need to add 485 repeater. Rs-485 adopts half-duplex working mode and supports multi-point data communication. The rs-485 bus network topology generally adopts a terminal-matched bus type structure. That is to say, each bus is connected in series by a bus, and a ring or star network is not supported. If you need to use a star structure, you must use a 485 repeater or a 485 hub. The rs-485 bus generally supports up to 32 nodes. If a special 485 chip is used, it can reach 128 or 256 nodes, and the largest can support up to 400 nodes.
Selection of RS-485 bus chipRS-485 bus chip selection RS-485 interface has been widely used in industrial control, instrumentation, instrumentation, multimedia networks, mechatronics products and many other fields. There are more and more types of chips that can be used for the RS-485 interface. How to find the most suitable chip in a wide variety of interface chips is a problem in front of every user. The RS-485 interface has different requirements and usage methods for the chip in different applications. What factors should be considered by the user in the selection of the chip and the design of the circuit. Some experience summaries in this regard are given below.
Number of nodesThe so-called number of nodes, that is, how many standard RS-485 loads can be driven by the driver of each RS-485 interface chip. According to the regulations, the input impedance of the standard RS-485 interface is ≥12kΩ, and the corresponding number of standard drive nodes is 32. In order to adapt to more node communication occasions, the input impedance of some chips is designed to be 1/2 load (≥24kΩ), 1/4 load (≥48kΩ) or even 1/8 load (≥96kΩ), and the corresponding number of nodes can be increased to 64, 128 and 256. The figure below shows the number of nodes of some common chips.
Half-duplex and full-duplexThe RS-485 interface can be connected to both half-duplex and full-duplex communication modes. The chips for half-duplex communication include SN75176, SN75276, SN75LBC184, MAX485, MAX1487, MAX3082, MAX1483, etc. The chips for full-duplex communication include SN75179, SN75180, MAX488~MAX491, and MAX1482.
(Half-duplex communication method)
(Full-duplex communication method)
Anti-lightning and anti-static shockRS-485 interface chips may be damaged by static electricity during use, soldering or transportation. In the use of the transmission line erected outdoors, the interface chip and even the entire system may be attacked by lightning. The use of anti-static or anti-lightning chips can effectively avoid such losses. Common chips are MAX485E, MAX487E, MAX1487E and so on. Especially the SN75LBC184, it can not only resist the impact of lightning but also withstand electrostatic discharge shocks up to 8kV.
Limited slope driveSince the signal generates electromagnetic interference and terminal reflection during transmission, the effective signal and the invalid signal are superimposed on the transmission line, and the communication may not be performed normally. In order to solve this problem, the driver of some chips is designed to limit the slope, so that the edge of the output signal is not too steep, so as not to generate excessive high-frequency components on the transmission line, thereby effectively suppressing the generation of interference. Such as MAX487, SN75LBC184, etc. have this function.
Fault protectionSome RS-485 chips use fault protection technologies such as the SN75276 and MAX3080~MAX3089. What is fault protection, why is there a fault protection, and what happens if there is no fault protection?
As is known, the RS-485 interface uses a differential transmission method, and communication between nodes is through a pair (half duplex) or two pairs (full duplex) twisted pair as a transmission medium. According to the RS-485 standard, the receiver's receiving sensitivity is ±200mV, that is, when the differential voltage at the receiving end is greater than or equal to +200mV, the receiver output is high; when less than or equal to -200mV, the receiver output is low. Flat; when between ±200mV, the receiver output is indeterminate. When the bus is idle, that is, all nodes on the transmission line are in the receiving state and when the transmission line is open or short-circuited, the receiver may output a high level or a low level if no special measures are taken. Once a receiver's receiver is low, the serial receiver (UART) can't find the start bit, causing communication anomalies. There are two ways to solve this problem:
(1) Using a chip with fault protection, it will make the output of the receiver high when the bus is open, shorted and idle. Ensuring that the receiver is output high when the bus is idle or shorted is accomplished by changing the receiver input threshold. For example, the MAX3080~MAX3089 input sensitivity is -50mV/-200mV, that is, when the differential receiver input voltage UA-B≥-50mV, the receiver outputs a logic high level; if UA-B≤-200mV, the output logic low level . When the receiver input bus is shorted or all transmitters on the bus are disabled, the receiver differential input is 0V, which causes the receiver to output a high level. Similarly, the sensitivity of the SN75276 is 0mV/-300mV, thus achieving the purpose of fault protection.
(2) If you use a chip without fault protection, such as SN75176, MAX1487, etc., you can do some processing on the software to avoid communication anomalies. That is, before entering normal data communication, the host drives the bus to be greater than +200 mV in advance and keeps it for a period of time, so that the receivers of all nodes generate a high level output. Thus, when valid data is issued, all receivers can correctly receive the start bit and receive the complete data.
Three application circuits of the RS-485 chip , the basic RS485 circuitThe above picture is the most basic RS485 circuit. When R/D is low, the transmission is disabled, the reception is valid, and when R/D is high, the transmission is valid and the reception is cut off. Pull-up resistor R7 and pull-down resistor R8 are used to ensure that the unconnected SP485R chip is in an idle state, providing network failure protection, improving the reliability of the RS485 node and the network, and the three resistors R7, R8, and R9 need to be changed according to actual applications. Size, especially when using a termination resistor of 120 ohms or less, R9 is not needed. At this time, R7 and R8 use 680 ohm resistors. Under normal circumstances, generally R7 = R8 = 4.7K, R9 does not.
In the figure, the clamps are located at 6.8V tubes V4, V5, and V6, all of which are designed to protect the RS485 bus from external interference, and can also be integrated with the original bus protection. In addition, L1, L2, C1, and C2 in the figure are optional mounting components to improve the EMI performance of the circuit.
2, with isolated RS485 circuitThe underlying principle is similar to the principle of a basic circuit. Using a DC-DC device, a set of power outputs that are completely isolated from the microprocessor circuitry can be generated for providing +5V power to the RS485 transceiver. The optocoupler device speed in the circuit affects the communication rate of the RS485 circuit. In the above figure, NEC optocoupler PS2501 is selected, and the communication speed of this circuit is controlled at 19200 bps.
3, automatic switching circuitIn the above figure, it is especially important that the TX and RX pins require a pull-up resistor.
Receive: When there is no data by default, TX is high level, the triode is turned on, RE is low level enabled, RO receives data effectively, and MAX485 is receiving state.
Send: When sending data, TX will first have a pull-down level (starting bit - from high to low), indicating that data transmission starts. At this time, the transistor is turned off, and DE is high level to enable. When the data "0" is sent, since the DI interface is equivalent to grounding, the data "0" will be transmitted to the AB buckle at this time, and AB "0, then the transmission "0" will complete the low level transmission, when the "1" is transmitted. At this time, the transistor is turned on, and it is reasonable to say that the RO is enabled. At this time, since the data is still being transmitted, the MAX485 is in a high resistance in this state. At this time, the state is up through A, and the B pull-down resistor is determined. 0 transmits "1" to complete the high level transmission.
RS-485 application experience1. Transceiver timing does not match:
485 is a half-duplex communication. Transceiver conversion takes a certain amount of time. Therefore, it is generally between the transmission and reception conversion, and after each frame of data is sent, there must be a corresponding delay. If the transmission and reception are not normal, or If a bit error occurs after one frame of data, you can increase the delay time appropriately to see if the problem is solved.
2. R0 is connected to pull-up resistor:
Asynchronous communication data is transmitted in bytes, and a handshake is performed with a low start bit before each byte is transferred. In order to prevent the interference signal from falsely triggering the RO (receiver output) to generate a negative transition, so that the receiving MCU enters the receiving state, it is recommended that the RO be connected to a 10kΩ pull-up resistor.
3. Reasonable selection of chips.
For example, in order to prevent strong electromagnetic (thunder) impact, it is recommended to use TI's 75LBC184 and other lightning protection chips, and SP485R with SIPEX is more required for the number of nodes. In addition, our experiments found that ADI's non-isolated 485 chip ADM487E, isolated chip ADM2483, ADM2587 also have a good performance in multi-node, lightning protection.
Precautions for RS-485 wiring constructionBecause of its simple wiring, stable and reliable, the 485 bus is widely used in various fields such as video surveillance, access control intercom, building alarm, etc. However, there are many problems in the 485 bus wiring process due to many incomplete and accurate concepts. Some common considerations are now summarized.
â— The wiring must be covered with multiple shielded twisted pairs. The multiple strands are for standby. The shielding is for debugging in special situations. The twisting is because 485 communication adopts the principle of differential mode communication, and the twisting resistance is the best.
â— Because the half-duplex network consisting of RS-485 interfaces generally only needs two connections, the RS-485 interface uses shielded twisted pair transmission. The 485+ and 485-data lines must be twisted together. Not using twisted pair is extremely wrong. The 485 bus must be a hand-held bus structure that resolutely eliminates star connections and bifurcation connections. The AC power supply and the chassis of the equipment must be grounded properly, and the grounding is good. There are many places where there are triangular sockets on the surface. In fact, there is no grounding at all. Be careful when the grounding is good, you can ensure that the equipment can be matched with equipment when it is struck by lightning or surge. The lightning protection design better releases energy, protects the 485 bus device and related chips from damage, and avoids walking with strong electricity to avoid interference from strong electricity.
â— There are many devices on the market that use RS232 interface and RS485 interface. If there is a 232 interface device that communicates with a 485 interface device, then a converter is needed to convert the 232 signal of the 232 interface device into 485. The signal is then communicated with the 485 interface device, so the RS232 to RS485 converter becomes the standard configuration for the 485 bus system.
â— RS232 to RS485 converter is divided into passive type, active lightning protection type, active lightning protection type. Passive 485 converters use serial stealing technology to supply power, but due to their small size, many protection circuits can't be done, resulting in poor protection for 485 devices and computers. Due to the use of serial port stealing technology, the power supply is insufficient, resulting in a small load. In addition to the 232 and 485 conversions, the active converters ensure electrical isolation between the two! Because the 485 line tends to be long and there is interference on the line, even if there is interference on the 485 line after the isolation measures are taken, the RS232 interface will not be affected.
â— The 485 signal cable cannot be routed along with the power cable. In the actual construction, since the traces are all taken through the pipeline, the construction party sometimes directly binds the 485 signal line and the power line for the convenience of the figure, because the strong electric power has a strong electromagnetic signal to interfere with the weak electricity, thereby The 485 signal is unstable, resulting in unstable communication.
â— You can choose to use the ordinary super five shielded twisted pair cable. Due to the rising prices of raw materials, the wire rods on the market are now mixed, and some bad businessmen use some kind of alloy to replace the copper wire to make the network cable, and copper plating on the outside to mix customers. The specific difference method: look at the cross section of the network cable. If it is copper, it is copper wire. If it is white, it is filled with alloy. Alloys are generally brittle, easy to break, and are far less conductive than copper wire, which can easily cause problems in engineering construction. Generally, it is recommended to select the standard 485 line, which is a shielded twisted pair. The transmission line is not a single strand of copper wire like a network cable, but a plurality of strands of copper wire are twisted together to form a line, so that even a small copper wire Broken, it will not affect the entire use.
â— 485 wiring can be arbitrarily arranged into star wiring and tree wiring by means of 485 hub and 485 repeater. The 485 wiring specification is a wiring that must be hand-held. Once it is not directly connected to a star connection and a tree connection by means of a 485 hub and a 485 repeater, it is easy to cause signal reflection to cause bus instability. Many construction parties use star wiring and tree wiring in the 485 wiring process. Sometimes the whole system is very stable, but sometimes there are always problems, and it is difficult to find the cause, generally due to irregular wiring. Caused by it.
â— The 485 bus must be grounded. In many technical documents, it is mentioned that the 485 bus must be grounded, but there is no detailed description of how to ground. Strictly speaking, the 485 bus must be reliably grounded at a single point. The single point is that there can only be one point grounding on the entire 485 bus, and it is not possible to ground more points because it is grounded because the voltage on the ground wire (generally the shielded wire is used as the ground wire) is kept consistent to prevent common mode interference. If multiple points are grounded, it is counterproductive. When grounding reliably, the ground wire of the entire 485 line must have good contact, so as to ensure the voltage is consistent, because in actual construction, for the convenience of wiring, the wire is cut into multiple sections and then connected, but the shielded wire is not well connected. The ground wire is divided into multiple sections, and the voltage cannot be consistent, resulting in common mode interference.
Right Angle DIP Centronic Connector
Right Angle DIP Centronic Connector.
Current Rating:5A
Dielectric Withstanding Voltage:1000V for one minute
Insulation Resistance:1000MΩ Min.(at 500V DC)
Contact Resistance:35mΩ Max.
Temperature:-55°C to +105°C
Right Angle DIP Centronic Connector
ShenZhen Antenk Electronics Co,Ltd , http://www.coincellholder.com