[go: up one dir, main page]

CN116701286B - On-line switching system for RS485 communication - Google Patents

On-line switching system for RS485 communication Download PDF

Info

Publication number
CN116701286B
CN116701286B CN202310980511.3A CN202310980511A CN116701286B CN 116701286 B CN116701286 B CN 116701286B CN 202310980511 A CN202310980511 A CN 202310980511A CN 116701286 B CN116701286 B CN 116701286B
Authority
CN
China
Prior art keywords
communication
module
unit
repeater
common mode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310980511.3A
Other languages
Chinese (zh)
Other versions
CN116701286A (en
Inventor
韩学禹
黄吕超
刘迪
方金国
王永贵
胡源源
李云鹏
张航
刘超
邓思阳
高远
邢玉龙
王振东
梅昕苏
陈楷铭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Information and Telecommunication Group Co Ltd
Original Assignee
State Grid Information and Telecommunication Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Information and Telecommunication Group Co Ltd filed Critical State Grid Information and Telecommunication Group Co Ltd
Priority to CN202310980511.3A priority Critical patent/CN116701286B/en
Publication of CN116701286A publication Critical patent/CN116701286A/en
Application granted granted Critical
Publication of CN116701286B publication Critical patent/CN116701286B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0002Serial port, e.g. RS232C
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)
  • Cable Transmission Systems, Equalization Of Radio And Reduction Of Echo (AREA)

Abstract

本发明属于信号传输技术领域,具体涉及一种RS485通信的在线切换系统,包括中央处理模块、电源模块、电压转换模块、通信模块和多条RS485通信通道,每条通信通道均包括RS485通信单元、防护单元和RS485中继器;中央处理模块通过通信模块连接到多个外部主端设备,中央处理模块依次通过RS485中继器、防护单元和RS485通信单元连接到外部从端设备,中央处理模块、RS485中继器和RS485通信单元均通过电压转换模块连接到电源模块;本发明能够根据不同的收发状态切换生成的不同波特率,实现不同波特率串口通信,本发明还能够对通信通道进行选择切换,防止出现当多台主机同时发送信号到通讯总线上,造成的数据出错,无法完成通讯的问题。

The invention belongs to the field of signal transmission technology, and specifically relates to an online switching system for RS485 communication, which includes a central processing module, a power supply module, a voltage conversion module, a communication module and multiple RS485 communication channels. Each communication channel includes an RS485 communication unit, Protection unit and RS485 repeater; the central processing module is connected to multiple external master devices through the communication module, and the central processing module is connected to external slave devices through the RS485 repeater, protection unit and RS485 communication unit in turn. The central processing module, Both the RS485 repeater and the RS485 communication unit are connected to the power module through the voltage conversion module; the present invention can switch the different baud rates generated according to different transceiver states to realize serial communication at different baud rates. The present invention can also perform communication channel modification. Select switching to prevent data errors and inability to complete communication when multiple hosts send signals to the communication bus at the same time.

Description

On-line switching system for RS485 communication
Technical Field
The invention belongs to the technical field of signal transmission, and particularly relates to an on-line switching system for RS485 communication.
Background
In the RS485 communication system, not only one host is connected with a plurality of devices for communication, all communication scheduling commands are initiated by the host, the devices with matched addresses return response messages after the devices receive the commands, and only 1 host can be arranged in the system. When 2 or more hosts need to be connected with each device in the system, because multiple hosts send signals to the communication bus at the same time, data errors can be caused, and communication cannot be completed. The RS485 bus is a conventional communication bus, which cannot perform automatic arbitration of the bus, that is, in order to avoid bus contention, data cannot be simultaneously sent to the bus, so that the communication efficiency of the whole system is necessarily lower, the data redundancy is larger, and the RS485 bus is not suitable for application places with high speed requirements.
In order to realize reliable data communication between the intelligent terminal of the platform area and a plurality of main devices, an RS485 communication interface is usually used, but because the devices of the terminal at the side of the platform area which is accessed at present are various, and the real-time requirement on data reading of a plurality of downlink slave terminal devices is met, a plurality of UART interfaces are generally required to be arranged at the moment, but the UART interfaces occupy too much resources, and the interface resources of a terminal processor are wasted.
In addition, in the actual scene, a plurality of master terminal devices acquire a certain downlink slave terminal device at the same time, and under the condition that a plurality of parties such as equipment manufacturers, operation and maintenance manufacturers, power plants, power distribution network management control (power distribution scheduling system) and the like have requirements on data, the communication mode of a slave terminal corresponding to a plurality of master terminals faces the problem of data transmission conflict, and the reliability of data communication is affected. On the basis, a plurality of master terminal devices and a plurality of downlink slave terminal devices are connected, and data interaction is conducted in a cooperative operation scene which is closer to the actual large-scale distributed device access.
With the increase of the master equipment and the slave equipment, the equipment interaction has the problems that the master equipment adopts one baud rate and the slave equipment adopts another baud rate, or different slave equipment adopts different baud rates, the communication modes are not uniform, and the transmission efficiency is reduced.
Disclosure of Invention
Aiming at the defects that in the prior art, when 2 or more hosts need to be connected with each device simultaneously in the system, data errors can be caused and communication can not be completed due to the fact that a plurality of hosts send signals to a communication bus simultaneously, the invention provides an on-line switching system for RS485 communication, and aims to solve the technical problems.
The invention provides an on-line switching system for RS485 communication, which comprises: the system comprises a central processing module, a power supply module, a voltage conversion module, a communication module and a plurality of RS485 communication channels, wherein each communication channel comprises an RS485 communication unit, a protection unit and an RS485 repeater; the central processing module is connected to a plurality of external master terminal devices through the communication module, the central processing module is connected to external slave terminal devices through the RS485 repeater, the protection unit and the RS485 communication unit in sequence, and the central processing module, the RS485 repeater and the RS485 communication unit are all connected to the power supply module through the voltage conversion module;
the RS485 communication unit comprises an RS485 communication A line, an RS485 communication B line, a resistor R1, a gas discharge tube TV1, a thermistor PTC2, a transient suppression diode TVS1, a transient suppression diode TVS2, a transient suppression diode TVS3 and a double-path common mode filter T1;
the first end of the gas discharge tube TV1 is connected to the first end of external slave end equipment through an RS485 communication A line, the second end of the gas discharge tube TV1 is connected to the second end of the external slave end equipment through an RS485 communication B line, a resistor R1 is connected between the RS485 communication A line and the RS485 communication B line, the first end of the gas discharge tube TV1 is connected to the first end of a transient suppression diode TVS1 through a thermistor PTC1, the second end of the transient suppression diode TVS1 is grounded, the second end of the gas discharge tube TV1 is connected to the first end of a transient suppression diode TVS3 through a thermistor PTC2, the second end of the transient suppression diode TVS3 is grounded, the first end of the transient suppression diode TVS1 is also connected to the first end of a double-circuit common mode filter T1, the first end of the double-circuit common mode filter T1 is also connected to the second end of the double-circuit common mode filter T1, a transient suppression diode TVS2 is connected between the first end of the double-circuit common mode filter T1 and the second end of the double-circuit common mode filter T1, and the second end of the double-circuit common mode filter T1 is connected to the first end of the TVS1 and the first end of the double-circuit common mode protection unit.
The technical scheme is that the protection unit comprises an isolation chip U1, a resistor R2, a resistor R3, a capacitor C1 and an optocoupler;
the first pin of the isolation chip U1 is connected to the fourth end of the double-circuit common mode filter T1 through a resistor R2, the second pin of the isolation chip U1 is also connected to the fourth end of the double-circuit common mode filter T1, the third pin of the isolation chip U1 is connected to the third end of the double-circuit common mode filter T1, the third pin of the isolation chip U1 is grounded through a resistor R3, the fourth pin of the isolation chip U1 is grounded, the first end of the capacitor C1 is grounded, the second end of the capacitor C1 is grounded, and the fifth pin, the sixth pin, the seventh pin and the eighth pin of the isolation chip U1 are all connected to the RS485 repeater through optocoupler devices.
The technical scheme is further that the isolation chip U1 is an isolation chip with the model number of TDH541S 485H.
According to the technical scheme, the RS485 repeater is further connected with a debugging unit, the debugging unit comprises a first dial switch and a second dial switch, the first dial switch and the second dial switch are both connected to the RS485 repeater, the first dial switch is used for setting the baud rate of external main terminal equipment, and the baud rate of external slave terminal equipment of the second dial switch is set.
The technical scheme further comprises that the voltage conversion module comprises a 3.3V voltage conversion unit and a 5V voltage conversion unit, the central processing module and the RS485 repeater are connected to the power supply module through the 3.3V voltage conversion unit, and the RS485 communication unit is connected to the power supply module through the 5V voltage conversion unit.
Further still, the communication module of the present technical solution includes a 4G communication unit, a LORA communication unit, and an HPLC communication unit.
The intelligent power distribution network system has the beneficial effects that the intelligent power distribution network system is used for data acquisition and information interaction between various power distribution side terminals (main terminals) and various downlink equipment (auxiliary terminals) so as to meet the requirements of the construction of a novel power system and an intelligent power distribution network; the baud rate conversion can be carried out in the communication process, and the serial port communication with different baud rates can be realized according to different baud rates generated by switching different receiving and transmitting states; when the main end has the wireless communication conditions of 4G, LORA and the like or the wired communication transmission conditions of the power carrier, the RS485 communication can be realized through the conversion of the central processing module; finally, the invention can also select and switch the communication channel, thereby preventing the problem that the communication cannot be completed due to data errors caused by the fact that a plurality of hosts send signals to the communication bus simultaneously.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic block diagram of a system of one embodiment of the present invention.
Fig. 2 is a schematic circuit diagram of the RS485 communication unit and the protection unit.
Fig. 3 is a schematic diagram of the connection of an RS485 repeater.
110 is a central processing module, 120 is a power module, 130 is a voltage conversion module, 140 is a communication module, 151 is an RS485 communication unit, 152 is a protection unit, and 153 is an RS485 repeater.
Detailed Description
In order to make the technical solution of the present invention better understood by those skilled in the art, the technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
The following explains key terms appearing in the present invention.
MCU, microcontroller Unit, the micro-control unit, also known as a single chip microcomputer (Single Chip Microcomputer) or a single chip microcomputer, is to properly reduce the frequency and specification of the CPU (Central Process Unit, CPU), integrate peripheral interfaces such as memory (memory), counter (Timer), USB, A/D conversion, UART, PLC, DMA, etc., and even LCD driving circuits on a single chip to form a chip-level computer, and perform different combination control for different application occasions. Such as mobile phones, PC periphery, remote controllers, automotive electronics, industrial stepper motors, control of robotic arms, etc., can see the shadow of the MCU.
FPGA, field-Programmable Gate Array, a Field programmable gate array, is a product of further development on the basis of programmable devices such as PAL, GAL, CPLD. The programmable device is used as a semi-custom circuit in the field of Application Specific Integrated Circuits (ASICs), which not only solves the defect of custom circuits, but also overcomes the defect of limited gate circuits of the original programmable device.
The Long, which is called Long Range in its entirety, is a wireless digital communication Modulation technique of a physical layer, which is called a spread spectrum continuous frequency Modulation (Chirp Modulation) technique. The method is characterized in that the method is farther than other wireless modes in transmission under the same power consumption, the unification of low power consumption and long distance is realized, and the radio frequency communication distance is enlarged by 3-5 times compared with the traditional wireless communication under the same power consumption.
HPLC is a high-speed power line carrier, also known as a broadband power line carrier, which is a broadband power line carrier technology that performs data transmission on a voltage power line. The broadband power line carrier communication network uses a power line as a communication medium to realize convergence, transmission and interaction of power consumption information of a low-voltage power user. The broadband power line carrier mainly adopts an Orthogonal Frequency Division Multiplexing (OFDM) technology, and the frequency band is 2MHz-12MHz. Compared with the traditional low-speed narrow-band power line carrier technology, the HPLC technology has large bandwidth and high transmission rate, and can meet the higher requirements of the low-speed narrow-band power line carrier communication.
In this embodiment, the RS485 communication online switching system may be divided into a plurality of functional modules according to the functions performed by the system, as shown in fig. 1. The functional module may include: the central processing module 110, the power module 120, the voltage conversion module 130, the communication module 140, and a plurality of RS485 communication channels, each of which includes an RS485 communication unit 151, a guard unit 152, and an RS485 repeater 153. In the present embodiment, the functions of the respective modules will be described in detail in the following embodiments.
The external master terminal equipment comprises a plurality of public transformer area acquisition equipment and systems such as an intelligent transformer area fusion terminal, an intelligent power distribution terminal and a power distribution scheduling system, and n downlink equipment which are correspondingly acquired can be used as external slave terminal equipment for RS485 communication and can be a plurality of distributed new energy sources such as a photovoltaic inverter and a charging pile. The original communication modes of the master end and the slave end can comprise a wireless mode such as 4G, LORA and micropower wireless mode and a wired mode such as a power line carrier. In order to ensure the flexibility, expandability and rapid iteration performance of the system, the whole system comprises a central processing module 110, a power module 120, a voltage conversion module 130, a communication module 140 and a plurality of RS485 communication channels, wherein each communication channel comprises an RS485 communication unit 151, a protection unit 152 and an RS485 repeater 153; specifically, the central processing module is connected to a plurality of external master terminal devices through the communication module, the central processing module is connected to external slave terminal devices through the RS485 repeater, the protection unit and the RS485 communication unit in sequence, and the central processing module, the RS485 repeater and the RS485 communication unit are connected to the power supply module through the voltage conversion module. The communication module comprises a 4G communication unit, a LORA communication unit and an HPLC communication unit.
One end of the power supply module is connected with a 220V external power supply, and the other end of the power supply module is connected to each functional module through the voltage conversion module to supply power to the functional module; the voltage conversion module comprises a 3.3V voltage conversion unit and a 5V voltage conversion unit, the central processing module and the RS485 repeater are connected to the power supply module through the 3.3V voltage conversion unit, and the RS485 communication unit is connected to the power supply module through the 5V voltage conversion unit.
As shown in fig. 2, the RS485 communication unit includes an RS485 communication a line, an RS485 communication B line, a resistor R1, a gas discharge tube TV1, a thermistor PTC2, a transient suppression diode TVs1, a transient suppression diode TVs2, a transient suppression diode TVs3, and a two-way common mode filter T1; the first end of the gas discharge tube TV1 is connected to the first end of external slave end equipment through an RS485 communication A line, the second end of the gas discharge tube TV1 is connected to the second end of the external slave end equipment through an RS485 communication B line, a resistor R1 is connected between the RS485 communication A line and the RS485 communication B line, the first end of the gas discharge tube TV1 is connected to the first end of a transient suppression diode TVS1 through a thermistor PTC1, the second end of the transient suppression diode TVS1 is grounded, the second end of the gas discharge tube TV1 is connected to the first end of a transient suppression diode TVS3 through a thermistor PTC2, the second end of the transient suppression diode TVS3 is grounded, the first end of the transient suppression diode TVS1 is also connected to the first end of a double-circuit common mode filter T1, the first end of the double-circuit common mode filter T1 is also connected to the second end of the double-circuit common mode filter T1, a transient suppression diode TVS2 is connected between the first end of the double-circuit common mode filter T1 and the second end of the double-circuit common mode filter T1, and the second end of the double-circuit common mode filter T1 is connected to the first end of the TVS1 and the first end of the double-circuit common mode protection unit.
As shown in fig. 3, when RS485 is in communication, a signal cannot directly enter the central processing module, and needs to pass through the protection unit, and then enter the central processing module, where the protection unit specifically includes an isolation chip U1, a resistor R2, a resistor R3, a capacitor C1 and an optocoupler; the first pin of the isolation chip U1 is connected to the fourth end of the double-path common mode filter T1 through a resistor R2, the second pin of the isolation chip U1 is also connected to the fourth end of the double-path common mode filter T1, the third pin of the isolation chip U1 is connected to the third end of the double-path common mode filter T1, the third pin of the isolation chip U1 is grounded through a resistor R3, the fourth pin of the isolation chip U1 is grounded, the first end of the capacitor C1 is grounded, the second end of the capacitor C1 is grounded, and the fifth pin, the sixth pin, the seventh pin and the eighth pin of the isolation chip U1 are all connected to the RS485 repeater through optocoupler devices; the isolation chip U1 is a TDH541S485H isolation chip.
In addition, the RS485 repeater is also connected with a debugging unit, the debugging unit comprises a first dial switch and a second dial switch, the first dial switch and the second dial switch are both connected to the RS485 repeater, the first dial switch is used for setting the baud rate of external main terminal equipment, and the second dial switch is used for setting the baud rate of external slave terminal equipment.
The external slave device realizes data communication (RS 485_A and RS 485_B) through two-wire RS485 (RS 485 communication A wire and RS485 communication B wire), firstly performs first-stage lightning surge protection through a gas discharge tube TV1, performs line overcurrent protection through a thermistor PTC1 and a thermistor PTC2, suppresses overvoltage through a parallel bidirectional transient suppression diode TVS2, then performs further common mode noise suppression on an input 485 signal through a double-path common mode filter T1, and selects a DFN packaged RS485 isolation chip U1 to perform physical isolation on a signal finally transmitted to an RS485 bus of a central processing module. The capacitor C1 between the isolation ground GND (power supply ground) and the signal ground gnd_o1 functions to filter out high-frequency signal disturbances. The RS485 repeater plays a role in the baud rate conversion of the master end and the slave end, and the baud rate of the communication serial ports of the master end and the slave end is preset through a debugging port in an installation site generally, but the baud rates may be different when different downlink slave end equipment data are acquired through the RS485 repeater, the site debugging is required, and when the software debugging is inconvenient, the baud rate setting of the slave end of the master end can be respectively completed through two dial switches. And the output signal of the RS485 communication unit enters the MCU of the RS485 repeater after being isolated by an optical coupler to perform baud rate conversion, and then the signal is forwarded to the central processing module. Meanwhile, in the communication process, an information acquisition request is usually initiated from a master end to a slave end, and in the process that the central processing module sends data to the MCU of the RS485 repeater, the MCU of the repeater can automatically identify and store the baud rate of the master end.
In addition, an FPGA programmable logic device can be used for replacing a central processing module and two dial switches, and the FPGA programmable logic device is realized through hardware logic. The FPGA design mainly comprises a sending module, a receiving module and an interface module, wherein the sending module is used for data caching and parallel-serial conversion of 485 asynchronous communication, the receiving module is mainly used for data serial-parallel conversion, data frame zone bit identification and data caching, and the interface module is mainly used for completing data communication with a terminal MCU, the sending module and the receiving module.
The main terminal corresponds to the intelligent fusion terminal body of the platform region, and the slave terminal corresponds to the downlink equipment collected by the intelligent fusion terminal of the platform region; it is assumed that n paths of devices are shared to perform data collection communication on downlink devices at the same time, namely, a multi-master one-slave communication mode is adopted.
The working principle of the system is as follows: firstly, controlling external master terminal equipment to send an information acquisition request frame to target external slave terminal equipment; then judging whether all communication channels corresponding to the target external slave terminal equipment are idle or not; if yes, judging the serial port state of the external main terminal equipment which sends the information acquisition request frame; if the Ready flag bit and the Lock flag bit in the serial port on the external main terminal equipment sending the information acquisition request frame are both 0, the Lock flag positions on other external main terminal equipment are 1, and interlocking is formed; the target external slave terminal equipment can receive data from the external master terminal equipment through a communication channel with the Ready flag bit and the Lock flag bit being 0, and send the data to the external master terminal equipment through the communication channel to wait for the next receiving; if not, determining the occupied communication channel, controlling the external master terminal equipment corresponding to the occupied channel to send data to the external slave terminal equipment, and waiting for the next receiving.
In addition, when judging that the Ready flag bit and the Lock flag bit in the serial port on the external main terminal equipment sending the information acquisition request frame are both 0, setting the serial port state on the external main terminal equipment sending the information acquisition request frame as a NOTRADY state, after the serial port state is set, interrupting a direct memory access idle channel, and then judging whether frame data is completed; and after the frame data transmission is judged to be completed, setting the Lock mark position on other external master terminal equipment to 0.
In order to facilitate understanding of the present invention, the working principle of the system is used to further describe the working method of the RS485 communication online switching system provided by the present invention.
Firstly, initializing a system, and initializing and configuring interfaces such as a system clock, a system interrupt, a serial port and the like; and then the master end sends frame data of the information acquisition request to the slave end, and then judges whether the current serial port channel is idle (an occupied channel mark is set in the serial port, when the mark bit is 0, the serial port is idle), and as 485 communication is in a half duplex mode, the receiving and the transmitting cannot be simultaneously carried out, when the occupied channel is 0, the downstream slave end equipment 485 is in a receivable state, the slave end is idle to monitor the channel, after receiving the data, the slave end can enter a sending state to reply, and then when the occupied channel value is no longer 0, the channel occupied by the slave end is set (1, 2, 3..and n), the 485 channel is in a master end 485 state, and at the moment, the master end 485 is in a transmittable state, and after the master end completes the sending, the slave end can enter a receiving state.
Further, when the occupied channel value is judged to be 0, the slave 485 mode is entered. And continuously judging whether the serial port state of the main end of each path is 'Ready' and whether the Lock flag bit is 0, and when a certain path of serial port is found to be in the state, indicating that the path of serial port receives the data of the main end and that the data need to be returned to the main end. At this time, the serial port of the path is selected, and the Lock positions of the serial ports of other paths are needed to be 1 to form interlocking, so that the data transmission of the other paths cannot be carried out at the same time; then, data is sent and waiting for receiving, and the current serial port state is set as NOTRADY while receiving, so that the current serial port state is ensured not to enter the process before the completion of one-time receiving and transmitting; after the serial port state is set, entering DMA idle interrupt, and then judging the completion of frame data transmission, so as to avoid the resources of data packaging and multiple judgment. In the receiving process of the slave 485, the received data is firstly judged and then replied. If the Modbus protocol is used for communication, the slave terminal device has fixed frame length, frame head, frame tail and CRC check parameter model selection, and can determine whether the data received by the slave terminal is Modbus protocol data or not by judging the received data, and if not, the data is directly forwarded to the slave terminal in a transparent transmission mode. After the slave end 485 sends, the master end judges the value (1-n) of the occupied channel according to the serial number of the master end, and after the occupied channel is determined, data receiving and sending are carried out, so that the data interaction collection of the station area terminal and a certain downlink device is completed. Meanwhile, the current serial port state is set as NOTRADY, so that the data cannot enter the process before the completion of one-time transceiving, the DMA idle interrupt judging frame data transmission is completed, the Lock of the communication with a certain serial port is released by marking the position 0 of the Lock mark of the other serial ports, the occupied channel value is set as 0, the completion of data transceiving is indicated, and the data can enter the monitoring state of serial port transmission at the moment. If the occupied channel value is not any value of 1-n, the channel is unoccupied and no serial port is used for transmitting data, the main terminal is in a monitoring state of data receiving continuously, meanwhile, the occupied channel value is set to 0, and the serial port waits for transmitting data. The invention can realize transparent transmission in a network serial port and adaptive conversion of Modbus protocol so as to meet the hot plug requirement of equipment, and has message analysis, CRC check and frame failure retransmission mechanisms in Modbus mode.
Although the present invention has been described in detail by way of preferred embodiments with reference to the accompanying drawings, the present invention is not limited thereto. Various equivalent modifications and substitutions may be made in the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and it is intended that all such modifications and substitutions be within the scope of the present invention/be within the scope of the present invention as defined by the appended claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (5)

1.一种RS485通信的在线切换系统,其特征在于,包括:中央处理模块、电源模块、电压转换模块、通信模块和多条RS485通信通道,每条通信通道均包括RS485通信单元、防护单元和RS485中继器;中央处理模块通过通信模块连接到多个外部主端设备,中央处理模块依次通过RS485中继器、防护单元和RS485通信单元连接到外部从端设备,中央处理模块、RS485中继器和RS485通信单元均通过电压转换模块连接到电源模块;1. An online switching system for RS485 communication, characterized in that it includes: a central processing module, a power module, a voltage conversion module, a communication module and multiple RS485 communication channels. Each communication channel includes an RS485 communication unit, a protection unit and RS485 repeater; the central processing module is connected to multiple external master devices through the communication module. The central processing module is connected to external slave devices through the RS485 repeater, protection unit and RS485 communication unit in turn. The central processing module and RS485 relay Both the transmitter and the RS485 communication unit are connected to the power module through the voltage conversion module; RS485通信单元包括RS485通信A线、RS485通信B线、电阻R1、气体放电管TV1、热敏电阻PTC1、热敏电阻PTC2、瞬态抑制二极管TVS1、瞬态抑制二极管TVS2、瞬态抑制二极管TVS3和双路共模滤波器T1;The RS485 communication unit includes RS485 communication line A, RS485 communication line B, resistor R1, gas discharge tube TV1, thermistor PTC1, thermistor PTC2, transient suppression diode TVS1, transient suppression diode TVS2, transient suppression diode TVS3 and Dual common mode filter T1; 气体放电管TV1的第一端通过RS485通信A线连接到外部从端设备的第一端,气体放电管TV1的第二端通过RS485通信B线连接到外部从端设备的第二端,RS485通信A线和RS485通信B线之间连接有电阻R1,气体放电管TV1的第一端通过热敏电阻PTC1连接到瞬态抑制二极管TVS1的第一端,瞬态抑制二极管TVS1的第二端信号接地,气体放电管TV1的第二端通过热敏电阻PTC2连接到瞬态抑制二极管TVS3的第一端,瞬态抑制二极管TVS3的第二端信号接地,瞬态抑制二极管TVS1的第一端还连接到双路共模滤波器T1的第一端,瞬态抑制二极管TVS3的第一端还连接到双路共模滤波器T1的第二端,双路共模滤波器T1的第一端和双路共模滤波器T1的第二端之间连接有瞬态抑制二极管TVS2,双路共模滤波器T1的第三端和第四端均连接到防护单元;The first end of the gas discharge tube TV1 is connected to the first end of the external slave device through the RS485 communication line A, and the second end of the gas discharge tube TV1 is connected to the second end of the external slave device through the RS485 communication line B. RS485 communication Resistor R1 is connected between line A and RS485 communication line B. The first end of the gas discharge tube TV1 is connected to the first end of the transient suppression diode TVS1 through the thermistor PTC1. The second end of the transient suppression diode TVS1 is connected to the signal ground. , the second end of the gas discharge tube TV1 is connected to the first end of the transient suppression diode TVS3 through the thermistor PTC2, the second end of the transient suppression diode TVS3 signal is grounded, and the first end of the transient suppression diode TVS1 is also connected to The first end of the dual common mode filter T1 and the first end of the transient suppression diode TVS3 are also connected to the second end of the dual common mode filter T1. The first end of the dual common mode filter T1 and the dual A transient suppression diode TVS2 is connected between the second terminals of the common mode filter T1, and the third and fourth terminals of the dual common mode filter T1 are connected to the protection unit; RS485中继器还连接有调试单元,调试单元包括第一拨码开关和第二拨码开关,第一拨码开关和第二拨码开关均连接到RS485中继器,第一拨码开关用于对外部主端设备的波特率进行设置,第二拨码开关外部从端设备的波特率进行设置。The RS485 repeater is also connected to a debugging unit. The debugging unit includes a first DIP switch and a second DIP switch. The first DIP switch and the second DIP switch are both connected to the RS485 repeater. The first DIP switch is used for For setting the baud rate of the external master device, the second DIP switch sets the baud rate of the external slave device. 2.根据权利要求1所述的RS485通信的在线切换系统,其特征在于,防护单元包括隔离芯片U1、电阻R2、电阻R3、电容C1和光耦器件;2. The online switching system of RS485 communication according to claim 1, characterized in that the protection unit includes an isolation chip U1, a resistor R2, a resistor R3, a capacitor C1 and an optocoupler device; 隔离芯片U1的第一引脚通过电阻R2连接到双路共模滤波器T1的第四端,隔离芯片U1的第二引脚也连接到双路共模滤波器T1的第四端,隔离芯片U1的第三引脚连接到双路共模滤波器T1的第三端,隔离芯片U1的第三引脚通过电阻R3信号接地,隔离芯片U1的第四引脚信号接地,电容C1的第一端信号接地,电容C1的第二端电源接地,隔离芯片U1的第五引脚、第六引脚、第七引脚和第八引脚均通过光耦器件连接到RS485中继器。The first pin of the isolation chip U1 is connected to the fourth terminal of the dual common mode filter T1 through the resistor R2, and the second pin of the isolation chip U1 is also connected to the fourth terminal of the dual common mode filter T1. The isolation chip The third pin of U1 is connected to the third end of the dual common mode filter T1. The third pin of the isolation chip U1 is grounded through the resistor R3 signal. The fourth pin signal of the isolation chip U1 is grounded. The first pin of the capacitor C1 is grounded. The terminal signal is grounded, the second terminal power supply of capacitor C1 is grounded, and the fifth, sixth, seventh and eighth pins of isolation chip U1 are all connected to the RS485 repeater through optocoupler devices. 3.根据权利要求2所述的RS485通信的在线切换系统,其特征在于,隔离芯片U1采用型号为TDH541S485H的隔离芯片。3. The online switching system for RS485 communication according to claim 2, characterized in that the isolation chip U1 adopts an isolation chip model TDH541S485H. 4.根据权利要求1所述的RS485通信的在线切换系统,其特征在于,电压转换模块包括3.3V电压转换单元和5V电压转换单元,中央处理模块和RS485中继器均通过3.3V电压转换单元连接到电源模块,RS485通信单元通过5V电压转换单元连接到电源模块。4. The online switching system for RS485 communication according to claim 1, wherein the voltage conversion module includes a 3.3V voltage conversion unit and a 5V voltage conversion unit, and both the central processing module and the RS485 repeater pass through the 3.3V voltage conversion unit. Connected to the power module, the RS485 communication unit is connected to the power module through the 5V voltage conversion unit. 5.根据权利要求1所述的RS485通信的在线切换系统,其特征在于,通信模块包括4G通信单元、LORA通信单元和HPLC通信单元。5. The online switching system for RS485 communication according to claim 1, wherein the communication module includes a 4G communication unit, a LORA communication unit and an HPLC communication unit.
CN202310980511.3A 2023-08-07 2023-08-07 On-line switching system for RS485 communication Active CN116701286B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310980511.3A CN116701286B (en) 2023-08-07 2023-08-07 On-line switching system for RS485 communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310980511.3A CN116701286B (en) 2023-08-07 2023-08-07 On-line switching system for RS485 communication

Publications (2)

Publication Number Publication Date
CN116701286A CN116701286A (en) 2023-09-05
CN116701286B true CN116701286B (en) 2023-10-20

Family

ID=87837860

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310980511.3A Active CN116701286B (en) 2023-08-07 2023-08-07 On-line switching system for RS485 communication

Country Status (1)

Country Link
CN (1) CN116701286B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103116567A (en) * 2013-01-24 2013-05-22 富通集团有限公司 Multi-serial-port selection circuit
CN107171917A (en) * 2017-04-07 2017-09-15 惠州市天泽盈丰物联网科技股份有限公司 A kind of network based on RS485 bus dilatations
JP2017184086A (en) * 2016-03-31 2017-10-05 富士機械製造株式会社 Multiplex communication system and work machine
CN210573267U (en) * 2019-08-02 2020-05-19 重庆琨山电子科技有限公司 RS485 concentrator
CN113820971A (en) * 2021-08-17 2021-12-21 广东智科电子股份有限公司 Isolation repeater and control method thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103116567A (en) * 2013-01-24 2013-05-22 富通集团有限公司 Multi-serial-port selection circuit
JP2017184086A (en) * 2016-03-31 2017-10-05 富士機械製造株式会社 Multiplex communication system and work machine
CN107171917A (en) * 2017-04-07 2017-09-15 惠州市天泽盈丰物联网科技股份有限公司 A kind of network based on RS485 bus dilatations
CN210573267U (en) * 2019-08-02 2020-05-19 重庆琨山电子科技有限公司 RS485 concentrator
CN113820971A (en) * 2021-08-17 2021-12-21 广东智科电子股份有限公司 Isolation repeater and control method thereof

Also Published As

Publication number Publication date
CN116701286A (en) 2023-09-05

Similar Documents

Publication Publication Date Title
CN105117319A (en) Method for realizing real-time monitoring of multi-channel MDIO (Management Data Input Output) devices based on FPGA
CN101707402A (en) Power system on-off amount remote monitoring module and monitoring method thereof
CN107831702A (en) A kind of synchronous serial signal acquisition and control device based on gigabit Ethernet
CN210624840U (en) Two-wire power supply communication circuit
CN107241382B (en) Data conversion method and device used between serial port and Ethernet
CN201556978U (en) Remote monitoring module for power system switching value
CN202998098U (en) Optical module port test device
CN107276632A (en) A kind of alignment system and method
CN110474828A (en) A kind of MBUS bus communication and system
CN108063736A (en) A kind of industrial ethernet switch that long-distance cable is supported to communicate and control method
CN116701286B (en) On-line switching system for RS485 communication
CN214504203U (en) Equipment of PLC multimode extension
CN206515666U (en) Ship failure wave-recording harvester
CN110943761B (en) Remote power carrier device with relay
CN202331173U (en) Industrial controller and industrial network control system
CN207801989U (en) A kind of interchanger of long range Industrial Ethernet transmission
CN217643586U (en) A multi-core energy gateway device based on Internet of Things technology
CN114785415B (en) A New CAN Optical Fiber Communication Circuit
CN210895111U (en) EtherCAT-TSN industrial Ethernet control system
CN204168006U (en) A kind of hardware structure of the power automatic device based on LVDS switching system
CN2724281Y (en) Power load monitoring and managing system terminal with relay function
CN207559990U (en) A kind of alignment system
CN2749167Y (en) Terminal of power load monitoring and management system using controller LAN
CN211018828U (en) Multifunctional wireless repeater
CN208999483U (en) A kind of expansible multifunctional electrical parameter measuring instrument table

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant