A data converter based on Modbus protocol

By designing a data converter based on the Modbus bus protocol, directly accessing the Modbus slave equipment and simplifying the PLC software program, the existing Modbus bus network has solved the difficulties in the large number of devices, signal reflection and troubleshooting, and efficient data updates and simplified PLC programming are achieved.

CN117891768BActive Publication Date: 2025-03-14QINHUANGDAO FANER TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410162005.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-05
Publication Date
2025-03-14
Estimated Expiration
2044-02-05

AI Technical Summary

Technical Problem

The existing Modbus bus network has difficulties in the number of devices, signal reflection and troubleshooting, and the PLC program is cumbersome to write, which cannot meet the requirements of real-time data updates.

Method used

Design a data converter based on the Modbus bus protocol, directly access the Modbus slave device through the data acquisition port, and use configuration registers to match the port parameters and command parameters to realize the connection between the high-speed reading port and the Modbus master device, simplifying the PLC software program.

Benefits of technology

It reduces production costs, improves wiring and troubleshooting efficiency, reduces the volume of electrical control cabinets, shortens the polling time of equipment, improves the operating reliability of the automation system, and adapts to a variety of automation system application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117891768B_ABST
    Figure CN117891768B_ABST
Patent Text Reader

Abstract

A data converter based on the Modbus bus protocol comprises: at least two data acquisition ports for connecting with various Modbus slave devices; a register area, comprising a configuration register, a user data area and a status register, wherein the data converter directly accesses the corresponding Modbus slave devices through various data acquisition ports with the port parameters and command parameters of the configuration register, images the read and written data to the user data area, and writes the status of each communication command into the status register; a high-speed reading port, wherein the Modbus master device directly accesses the user data area and the status register data through the high-speed reading port; the present invention not only realizes the effects of differentiated connection of different slave devices, simpler on-site wiring and troubleshooting, and more stable network system, but also greatly simplifies PLC programs while effectively shortening the total polling time; in addition, the application of the present invention effectively solves the problem of high wiring cost of electric control cabinets and improves the applicability in various automation systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data communication, and in particular to a data converter based on the Modbus bus protocol. Background Art

[0002] At present, most automation control systems are mainly based on process control, that is, temperature, pressure, flow, load, position, angle, composition, etc. are used as controlled variables, and the corresponding actuators (motors, valves, etc.) are automatically controlled by computers (or PLCs) with optimal parameters. In the actual production process, factory equipment often stores various data collected by the automation system in the database, and optimizes production processes, fault diagnosis, etc. through the evolution of historical data stored in the database. At present, most domestic instruments support the Modbus protocol. PLC reads the data of Modbus devices through the serial port, and participating in the calculation and control of the automation system is the main solution of the current automation system.

[0003] Modbus is a serial communication protocol that was published by Modicon (now Schneider Electric) in 1979 for communication with programmable logic controllers (PLCs). Modbus has become the industry standard for communication protocols in the industrial field (Defacto), and is now a common connection method between industrial electronic devices. Modbus is most widely used in sensor instrument applications because of its low cost, open publication and no copyright requirements, easy deployment and maintenance, and no restrictions on modifying local bits or bytes.

[0004] However, RS485-MODBUS device networks usually have the following defects:

[0005] The RS485 bus usually uses shielded twisted pair cables to connect the gateway and each serial device node through a hand-in-hand daisy chain topology (such as Figure 1 As shown); This connection method not only requires that the communication parameters of all slave devices must be consistent (baud rate, parity, data bit, stop bit, flow control), but also a MODBUS network can only configure the entire network parameters according to the slave device with the worst performance; at the same time, this connection method has complex wiring and is difficult to troubleshoot. If a node fails, the entire bus needs to be disassembled to find the fault point;

[0006] When the RS485 bus connection is arranged in a star connection or a tree connection, it is easy to cause signal reflection, which leads to bus instability and limited transmission distance.

[0007] Second, the Modbus protocol is a master-slave protocol, which requires the master station to poll the data of the slave devices one by one; if there are a large number of slave devices in a bus network, the polling time of the devices will become very long. For example, the following network parameters: baud rate 4800bit / s, data bit 8 bits, stop bit 1 bit, no parity; on this basis, the Modbus RTU communication master station sends a request of 5 words to the slave station (slave address: H01, data address H0001), as shown in the following table:

[0008]

[0009] Therefore, the command time is approximately: (8+1)x8*1000 / 4800=14ms;

[0010] Slave station waiting time: 5ms;

[0011] The response time is approximately: (8+1)x15*1000 / 4800=28ms;

[0012] At this point, the total time for the master to send a command + the slave to wait + the slave to reply is at least 47ms. If the CPU calculation time inside the sensor meter is taken into account, reading the data of an instrument is often greater than 50ms. Assuming that there are 10 slave devices on the network, the data update cycle of the 10 devices polling once will be no less than 500ms; in addition, if any device in the network fails, the entire polling time will be extended by more than 200ms (reason: when the MBUS_MSG instruction is activated, a Modbus request message frame will be sent. If the master station does not receive a response from the slave station within the time interval defined by the Timeout parameter, the Modbus RTU master station protocol library will send two more Modbus request message frames by default; after the last request message frame is sent, if no response is received after the time interval defined by the Timeout parameter, the Done completion bit of the MBUS_MSG instruction will be set to 1; this DONE bit being 1 will cause the polling to continue), which is greater than 700ms, which is undoubtedly unable to meet the requirements for systems with high requirements for real-time update of monitoring data (such as hydropower station ecological flow online monitoring system, shock wave test system).

[0013] Third, when the programmable controller (PLC) reads slave device data through the Modbus protocol, the PLC program must write the corresponding communication program, and each Modbus slave device requires at least one communication instruction. When there are 10 slave devices in the network, at least 10 communication instructions must be written. Because Modbus is a polling access device, when writing the program, it is necessary to consider the logical order of each device, device performance, communication status, time interval and other conditions, so the PLC program becomes very cumbersome.

[0014] In addition, although expanding the number of serial ports of the automation control system and controlling the number of Modbus slave devices connected to each port can reduce the communication polling time, this solution is costly and the PLC program cannot be simplified. Summary of the invention

[0015] In view of the above problems, the present invention proposes a data converter based on the Modbus bus protocol, and the technical solution adopted is as follows:

[0016] A data converter based on the Modbus bus protocol, characterized in that it includes:

[0017] At least two data acquisition ports for connecting to various Modbus slave devices;

[0018] The register area includes a configuration register, a user data area and a status register; the configuration register is used to match the corresponding port parameters and command parameters of each of the above-mentioned data acquisition ports, and the data converter directly accesses the corresponding Modbus slave station device through each data acquisition port with the port parameters and command parameters of the configuration register, and images the read and written data to the user data area, and writes the status of each communication command accessed to the status register;

[0019] High-speed read port, used to connect to the Modbus master device. The Modbus master device directly accesses the data in the user data area and status register through the high-speed read port;

[0020] The power module is used to provide DC power to the data converter.

[0021] Furthermore, each of the high-speed reading port and data acquisition port is provided with an isolated power supply and an optical coupling module.

[0022] Furthermore, the high-speed reading port includes an RJ45 port and a COM port.

[0023] Furthermore, the number of the data acquisition ports is eight. Beneficial Effects

[0024] 1. The present invention adopts a method of directly accessing the corresponding Modbus slave device through each data acquisition port, which effectively solves the problem of complex wiring and difficult troubleshooting of external Modbus slave devices. Compared with the prior art, it greatly reduces the production cost, improves the wiring and troubleshooting efficiency, and reduces the volume of the electric control cabinet.

[0025] 2. The present invention realizes differentiated configuration for different devices by configuring registers to match corresponding port parameters and command parameters for different data acquisition ports. Setting corresponding parameters according to the performance and communication distance of the field equipment can more effectively improve the response speed of the equipment;

[0026] 3. The data converter of the present invention can automatically communicate with the slave device according to the configuration parameters and update the data to the corresponding data area. By reducing the network data update cycle of the automation system, the polling time of each Modbus slave device is shortened as much as possible, thereby ensuring the reliability of the operation of the automation system and further adapting to various automation system application scenarios.

[0027] 4. The present invention uses the address mapping function of the slave data to sort the data of all Modbus slave devices in the internal address area of ​​the data converter, so that the Modbus master device (host computer / PLC) can access all Modbus slave device data only once, greatly simplifying the PLC software program. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 The figure is a schematic diagram of hand-in-hand daisy chain wiring of RS485 bus in the prior art.

[0029] Figure 2 FIG. 4 is a block diagram of the internal registers in the data converter of the present invention.

[0030] Figure 3 Schematic diagram of external wiring of the data converter of the present invention.

[0031] Figure 4 4 is a circuit principle block diagram of the data converter of the present invention.

[0032] Figure 5 It is a structural schematic diagram of the data converter of the present invention. DETAILED DESCRIPTION

[0033] The technical solution of the present invention is further specifically described below by way of embodiments and in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited by the specific embodiments disclosed below. Example

[0034] like Figure 2 , 3 As shown in Figure 5, a data converter based on the Modbus bus protocol includes:

[0035] Eight data acquisition ports, used to connect to various Modbus slave devices; in this embodiment, the data acquisition ports are COM ports, which are divided into COM1, COM2, COM3, COM4, ​​COM5, COM6, COM7 and COM8;

[0036] The register area includes a configuration register, a user data area and a status register; the configuration register is used to match the corresponding port parameters and command parameters of each of the above-mentioned data acquisition ports, and the data converter directly accesses the corresponding Modbus slave station device through each data acquisition port with the port parameters and command parameters of the configuration register, and images the read and written data to the user data area, and writes the status of each communication command corresponding to the access to the status register; it should be noted that, in this embodiment, the data converter complies with the MODBUS RTU general protocol specification, and its internal address type is based on the standard MODBUSRTU protocol;

[0037] In this embodiment, since the corresponding Modbus slave device is directly accessed through each data acquisition port, when the data converter is connected to the Modbus slave device, the RS485 network can be directly arranged into a star structure or a tree structure, and there is no need to consider the problem of signal reflection, which makes on-site wiring more convenient and the network system more stable;

[0038] The high-speed read port is used to connect to the Modbus master device. The Modbus master device directly accesses the data in the user data area and the status register through the high-speed read port. The high-speed read port includes an RJ45 port and a COM port, and the COM port is set to COM0.

[0039] The power module is used to provide 24V DC power to the data converter.

[0040] In this embodiment, the CPU in the data converter is divided into a main CPU and a communication CPU corresponding to each data acquisition port. The main CPU is used to store configuration information, and each communication CPU is used to execute the corresponding relevant instructions sent by the main CPU to realize the data collection of the Modbus slave device and feed back the collected data information to the main CPU; the main CPU sends the data information to the Modbus master device through the high-speed reading port; at the same time, in order to avoid mutual influence between the ports, each high-speed reading port and data acquisition port is provided with an isolated power supply and an optical coupling module, such as Figure 4 shown.

[0041] In this embodiment, the configuration parameters of each port are as follows:

[0042] 1. The port configuration parameters are described as follows:

[0043] Baud rate: 2400, 4800, 9600, 19200, 38400, 51600, 115200;

[0044] Check: NONE / none, ODD / odd, EVEN / even;

[0045] Data bits: 7, 8;

[0046] Stop bits: 1, 2;

[0047] Flow Control: NONE, RTS, XON / XOFF, RTS XON / XOFF.

[0048] 2. The RJ45 port is TCP / IPV4 version, 10M / 100M adaptive network port, supports TCP / IP-MODBUS RTU slave protocol, the port number is the default value: 5050 (cannot be modified), the parameters that need to be set are:

[0049] IP address: occupies 4 bytes. Default value: 192.168.0.100;

[0050] Subnet mask: occupies 4 bytes. Default value: 255.255.255.0;

[0051] Gateway address: occupies 4 bytes Default value: None;

[0052] MAC address: occupies 4 bytes.

[0053] 3. COM0 port supports RS485-MODBUS RTU slave protocol, the parameters that need to be set are:

[0054] Baud rate: Default value: 115200 Kbit / s;

[0055] Verification: Default value: NONE;

[0056] Data bits: Default value: 8 bits;

[0057] Stop bit: Default value: 1 bit;

[0058] Flow Control: Default value: NONE;

[0059] Device ID: Default value: 1.

[0060] 4. COM1-COM8 ports support RS485-MODBUS RTU master protocol. Parameters that need to be set are:

[0061] Baud rate: Default value: 9600 Kbit / s;

[0062] Verification: Default value: NONE;

[0063] Data bits: Default value: 8 bits;

[0064] Stop bit: Default value: 1 bit;

[0065] Flow Control: Default value: NONE.

[0066] In this embodiment, the command parameters of COM1-COM8 ports are described as follows:

[0067]

[0068] In this embodiment, the COM1-COM8 port command status registers are described as follows:

[0069]

[0070] The working steps of this embodiment are as follows:

[0071] First, according to the type of Modbus slave device (such as sensor, instrument, inverter, controller, etc.) and performance, configure the registers and command parameters of each data acquisition port through software settings;

[0072] When working, the data converter directly accesses the corresponding Modbus slave device through each data acquisition port with the port parameters and command parameters of the configuration register, and images the read and written data to the user data area, and writes the status of each communication command accessed to the status register; the Modbus master device directly accesses the data in the user data area and the status register through the high-speed reading port at regular intervals to complete the one-time access to all data;

[0073] When the Modbus master device reads the data corresponding to a Modbus slave device in the status register and finds an abnormal state, the electrical engineer finds the cause of the abnormality based on the 16# code and performs on-site processing.

[0074] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention is disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with the profession can make some changes or modifications to equivalent embodiments of equivalent changes by using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent changes and modifications made to the above embodiments according to the technology of the present invention are within the scope of the technical solution of the present invention without departing from the content of the technical solution of the present invention.

Claims

1. A data converter based on Modbus bus protocol, characterized in that: include: At least two data acquisition ports for connecting to various Modbus slave devices; The register area includes a configuration register, a user data area and a status register; the configuration register is used to match the corresponding port parameters and command parameters of each of the above-mentioned data acquisition ports, and the data converter directly accesses the corresponding Modbus slave station device through each data acquisition port with the port parameters and command parameters of the configuration register, and images the read and written data to the user data area, and writes the status of each communication command accessed to the status register; High-speed read port, used to connect to the Modbus master device. The Modbus master device directly accesses the data in the user data area and status register through the high-speed read port; A power module, used for providing a DC power supply to the data converter; First, configure registers and command parameters of each data acquisition port through software settings according to the type and performance of the Modbus slave device; When working, the data converter directly accesses the corresponding Modbus slave device through each data acquisition port with the port parameters and command parameters of the configuration register, and images the read and written data to the user data area, and writes the status of each communication command accessed to the status register; the Modbus master device directly accesses the data in the user data area and the status register through the high-speed read port at regular intervals to complete one-time access to multiple data.

2. A data converter based on the Modbus bus protocol according to claim 1, characterized in that: Each of the high-speed reading port and the data acquisition port is provided with an isolated power supply and an optical coupling module.

3. A data converter based on the Modbus bus protocol according to claim 1 or 2, characterized in that: The high-speed reading port includes an RJ45 port and a COM port.

4. A data converter based on the Modbus bus protocol according to claim 1 or 2, characterized in that: The number of the data acquisition ports is eight.

Citation Information

Patent Citations

  • Communication system based on Modbus protocol

    CN114422288A

  • Slave station conversion device based on MODBUS protocol

    CN212486527U