Search

CN-122027706-A - Universal RS485 communication conversion method and system based on power line carrier

CN122027706ACN 122027706 ACN122027706 ACN 122027706ACN-122027706-A

Abstract

The invention discloses a universal RS485 communication conversion method and system based on a power line carrier, and aims to solve the problems of high cost, poor flexibility, insufficient reliability, weak maintainability and the like of the existing independent protocol conversion gateway. The method is characterized in that a message mapping rule is established through configurable command parameters, a communication reliability strategy is optimized through user-defined retransmission times, transmission intervals and timeout time, and real-time diagnosis of physical states such as idle load, short circuit and the like of an RS485 bus is realized through ADC sampling analysis. The system does not need an independent hardware gateway, remarkably reduces the complexity and cost of the system, has extremely high flexibility, expandability and robustness, can be quickly adapted to RS485 devices with different protocols, shortens the fault detection time, and is suitable for the fields of smart grids, industrial control and the like.

Inventors

  • YAN LUNYAO
  • WU CANLUAN
  • LUO HAOQIANG
  • MA XIAOBIN

Assignees

  • 广东金朋科技有限公司

Dates

Publication Date
20260512
Application Date
20260212

Claims (8)

  1. 1. The universal RS485 communication conversion method based on the power line carrier is characterized by comprising the following steps of: Establishing a bidirectional mapping rule between PLC data and an RS485 message through a pre-configured command parameter; configuring reliability parameters of RS485 communication, wherein the reliability parameters comprise retransmission times, transmission intervals and overtime time, and applying the reliability parameters to the transmission flow of an RS485 message to control message transmission time sequence, overtime waiting and retransmission logic; And monitoring the electrical characteristics of the RS485 bus in real time, and judging the physical connection state of the bus according to the monitoring result, wherein the physical connection state comprises normal state, no-load state and short circuit state.
  2. 2. The method of claim 1, wherein the pre-configured command parameters include an output action command, an output message command, an input action command and an input message command, wherein the output action command is used for designating a PLC data identifier for triggering the transmission of the RS485 message, the output message command is used for defining a format of an RS485 transmission frame and a data filling rule, the input action command is used for configuring the RS485 message identifier to be responded, and the input message command is used for defining a rule for extracting data from the RS485 frame and converting the data into the PLC data frame.
  3. 3. The universal RS485 communication conversion method based on the power line carrier according to claim 1, wherein the method for judging the physical connection state of the bus is as follows: The method comprises the steps of sampling the A line grounding voltage and the B line grounding voltage of an RS485 bus through an ADC module of a microcontroller, calculating bus differential voltage, judging that the bus is in an idle state when the absolute value of the differential voltage is continuously lower than a preset threshold value, otherwise, judging that the bus is in a normal connection state, and judging that the bus is in a short circuit state when the A line grounding voltage and the B line grounding voltage are detected to be simultaneously abnormally close to the ground potential or the power supply potential.
  4. 4. The method for converting power line carrier based universal RS485 communication according to claim 1, wherein the receiving process of RS485 communication adopts a mode of combining DMA transmission with UART idle interrupt to determine that the receiving of the data frame is completed.
  5. 5. A universal RS485 communication conversion system based on a power line carrier, which is used for implementing the method according to any one of claims 1 to 4, wherein the system is embedded in a PLCSTA node, and comprises a processor and a memory, and the memory stores embedded software and program instructions, and when the program instructions are executed by the processor, the universal RS485 protocol conversion method according to any one of claims 1 to 4 is implemented.
  6. 6. The universal RS485 communication conversion system based on the power line carrier according to claim 5, further comprising an RS485 transceiver and a bias circuit, wherein the RS485 transceiver is used for realizing the receiving and transmitting of the RS485 signal, and the bias circuit is used for maintaining the stable level of the RS485 bus.
  7. 7. The system of claim 5, wherein the embedded software includes a protocol mapping and communication control engine for interpreting and executing configurable command parameters, controlling bi-directional conversion of PLC data and RS485 messages, and integrating a bus status diagnostic module and a reliability parameter control module.
  8. 8. The universal RS485 communication conversion system based on the power line carrier according to claim 7, wherein the bus state diagnosis module is used for monitoring and judging the physical connection state of the bus and reporting a physical layer error event when an abnormality is detected, and the reliability parameter control module is used for storing and calling configured retransmission times, transmission intervals and timeout time parameters and precisely controlling the RS485 message transmission flow.

Description

Universal RS485 communication conversion method and system based on power line carrier Technical Field The invention relates to the technical field of data communication, in particular to a universal RS485 communication conversion method and system based on a power line carrier. Background In the fields of smart power grids, industrial control and the like, the power line carrier communication (PLC) technology becomes an important choice for data transmission by virtue of the wiring-free advantage of the existing power line, and the RS485 interface is widely used for connecting terminal equipment such as field instruments and sensors due to the characteristics of strong anti-interference capability and long transmission distance. In order to realize data intercommunication between the PLC network and the RS485 device, the closest scheme in the prior art is to adopt independent protocol conversion gateway hardware. One end of the gateway equipment is connected with a power line through a coupling circuit to complete the modulation and demodulation of PLC signals, the other end is provided with an RS485 physical interface, an independent processor and firmware are mounted in the gateway equipment, the gateway equipment is responsible for bidirectional conversion of a PLC communication protocol and an RS485 equipment protocol, such as ModbusRTU, and the gateway equipment analyzes effective data after receiving a PLC data frame and repackages and sends the effective data according to the RS485 equipment protocol, and vice versa. However, the existing independent gateway scheme has the obvious defects that firstly, the system complexity and the cost are high, the additional hardware gateway increases hardware investment, power consumption and installation space requirements, secondly, the flexibility and expandability are poor, communication logic, message mapping relation and core parameters are mostly of a solidification design, or different field network environments and new protocol devices are difficult to adapt through special software complex configuration, thirdly, the reliability guarantee mechanism is insufficient, a fine and configurable communication strategy is lacking, interference and bus conflict of a complex power line channel are difficult to deal with, fourthly, the physical layer diagnosis capability is lacking, the protocol problem or physical line fault cannot be rapidly located when communication is interrupted, and the maintainability is poor. The problems limit the economical efficiency, adaptability and stability of networking of the PLC and the RS485 equipment, and a better technical scheme is needed to solve the problems. Disclosure of Invention The invention aims to overcome the defects of the prior art and provides a universal RS485 communication conversion method and system based on a power line carrier. In order to achieve the above purpose, the invention adopts the following technical scheme: In a first aspect of the present invention, a universal RS485 communication conversion method based on a power line carrier is provided, including the following steps: Establishing a bidirectional mapping rule between PLC data and an RS485 message through a pre-configured command parameter; configuring reliability parameters of RS485 communication, wherein the reliability parameters comprise retransmission times, transmission intervals and overtime time, and applying the reliability parameters to the transmission flow of an RS485 message to control message transmission time sequence, overtime waiting and retransmission logic; And monitoring the electrical characteristics of the RS485 bus in real time, and judging the physical connection state of the bus according to the monitoring result, wherein the physical connection state comprises normal state, no-load state and short circuit state. Preferably, the preconfigured command parameters include an output action command, an output message command, an input action command and an input message command, wherein the output action command is used for designating a PLC data identifier for triggering the RS485 message to transmit, the output message command is used for defining a format of an RS485 transmission frame and a data filling rule, the input action command is used for configuring the RS485 message identifier needing to respond, and the input message command is used for defining a rule for extracting data from the RS485 frame and converting the data into a PLC data frame. Preferably, the method for judging the physical connection state of the bus is as follows: The method comprises the steps of sampling the A line grounding voltage and the B line grounding voltage of an RS485 bus through an ADC module of a microcontroller, calculating bus differential voltage, judging that the bus is in an idle state when the absolute value of the differential voltage is continuously lower than a preset threshold value, otherwise, judging that the bus is in