A Practical Method to Solve RS-232 Long Distance Serial Communication Problem

Publisher:悠闲时光Latest update time:2011-01-27 Source: 国外电子元器件 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

RS-232 serial communication is a standard developed in the early days to promote public telephone network communication. It is currently the most widely used standard bus in asynchronous communication and is suitable for the interface between data terminal equipment and data communication equipment. Figure 1 shows a simple schematic diagram of RS-232 serial communication. However, since there is a common signal ground (GND) between the transmitter (TXD) and the receiver (RXD), double-ended signals cannot be used, which may cause common-mode noise to couple into the signal system. Therefore, designers have to use higher transmission voltages for transmission. In addition, the signal transmission speed of this transmission method is up to 20kB/s, and the longest distance is only 15m. Obviously, such transmission speed and distance can no longer meet the requirements of modern network communication. In order to enable many devices with RS-232 communication interfaces to achieve long-distance serial communication while minimizing hardware costs and software workload, the author has developed a long-distance serial communication system with photoelectric isolation function by using a current loop to interface with RS-232.

2 20mA current loop data transmission signal principle

The 20mA current loop serial interface is also a widely used interface circuit. Its serial communication interface circuit is shown in Figure 2. Since it has not formed a formal standard, the data transmission equipment of general computers does not have this interface. However, its interface circuit is simple. The four wires of sending positive, sending negative, receiving positive and receiving negative respectively form the input current loop and the output current loop. When sending data, the loop is regularly turned on and off according to the logic 1 and logic 0 of the data (the switch is used to indicate the presence or absence of current in Figure 2). The biggest advantage of the current loop serial communication interface is that the low impedance transmission line is not sensitive to electrical noise, and it is easy to achieve photoelectric isolation, and the transmission distance is very long.

3 Circuit loop interface with RS-232 serial communication circuit

Combining the above characteristics of current loop transmission, and making full use of the RS-232 serial communication port of the device itself, the author designed an interface circuit as shown in Figure 3 to convert RS-232 signals into current loops for signal transmission. The ICL232 chip in Figure 3 is used to complete the adjustment between the RS-232 interface signal and the TTL level signal. The sending end (TXD) signal of the RS-232 bus is converted into a TTL level signal by the ICL232 chip, and then driven by the chip SN75452 through an optical coupler (4N25). On the transmission line, digital signals are transmitted in the form of current or not. Similarly, at the receiving end, the current signal is shaped by the optical coupler and the inverter. After forming a TTL level signal, it is conditioned by the ICL232 chip, and then the generated standard RS-232 level signal is sent to the receiving end (RXD) of the RS-232 serial communication to complete the sending and receiving of serial communication. As shown in Figure 3, the transmission and reception of the current loop are isolated from the ground. Even if the transmission line is subject to strong interference, the standard RS-232 communication interface devices at both ends of the communication will not be affected, thereby isolating the communication line from the equipment and between the equipment, ensuring the safety of the equipment. Using this method to transmit signals not only has a long transmission distance (at a speed of 9.6kB/s, the transmission distance can reach more than 1km), but also has a strong anti-interference ability, which can ensure the normal operation of communication even in very harsh environmental conditions.

4 Application Examples

In the sewage treatment monitoring system of a five-star hotel, the circuits at both ends of the transmission line in Figure 3 are made into two circuit boards, one of which is placed at the computer end to convert the computer serial port signal into a current loop signal and send it out or convert the current signal into an RS-232 level signal for information reception; the other is placed at the programmable controller (PLC) end to convert the current signal into a standard RS-232 signal and send it to the serial port of the PLC or convert the signal sent by the PLC serial port into current and send it out through the current loop to realize the serial communication between the computer and the PLC. The system working diagram is shown in Figure 4. The adoption of this solution not only overcomes the phenomenon of more communication errors when using RS-232 serial communication alone, and the complete failure of communication when a high-power electric pump is started or thunderstorms occur, but also avoids the problem of frequent ring damage of the serial port of the PLC and the computer, thereby realizing the dual functions of isolation and long-distance communication. At the same time, this method has simple software programming (same as the RS-232 standard interface) and low hardware cost (only about 150 yuan is required). Compared with the RS-422 bus currently used to solve long-distance serial communication, its performance-price ratio has been improved by dozens of times or even more. At present, the communication interface designed by the author has been running for two years without any problems.

In addition, in the automatic detection system of air-conditioning motor parameters, most of the electrical parameter test equipment has RS-232 interface, and the central control computer of the system generally exchanges information and collects data with each device through the serial port. However, test equipment such as power meter, insulation resistance tester, leakage current tester, etc. have high-voltage signals, which often pass through the ground wire to the computer during serial communication and burn the serial port in the computer. In this case, the scheme in Figure 3 can be used to effectively isolate the common ground wire between the computer and each test equipment, ensuring the communication security of the detection equipment and the computer.

The circuit structure and implementation principle of the scheme shown in Figure 3 are relatively simple. Compared with other types of serial communication buses such as RS-422, RS-423, and RS-449, this scheme has the advantages of low cost (it can make use of the original RS-232 interface of the equipment), simple interface, good software support, simple programming, versatility and practicality, etc., especially in the field of communication engineering applications, it has high practical value.

Reference address:A Practical Method to Solve RS-232 Long Distance Serial Communication Problem

Previous article:Application example of pro-face touch screen and PLC communication in water purification system
Next article:System Diagnosis Technology Based on PROFIBUS Fieldbus

Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号