Industrial modem 485 and multi-ECU control system
By performing system initialization, handshake, address allocation, parameter control and synchronization operations based on the Modbus protocol, the shortcomings of the traditional Modbus protocol in dynamic expansion and multi-device operation are solved, and a more efficient, flexible and real-time industrial control system is achieved.
Patent Information
- Application Number
- CN202411918570.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-03-25
AI Technical Summary
The traditional Modbus protocol has shortcomings in dynamic expansion and multi-device operation, including static device address, non-support flexible address allocation, and low multi-device operation efficiency.
System initialization, communication interface settings, handshake and slave address allocation, single ECU and multi-ECU oil pressure parameter read and write control, multi-ECU synchronous operation, communication status feedback and exception handling, real-time monitoring and system adjustment are carried out through the Modbus RTU protocol.
It realizes dynamic slave address allocation, improves the efficiency of multi-device operation and the real-time system, enhances the robustness of the communication process, and reduces the learning cost and the difficulty of future function expansion.
Smart Images

Figure CN119689960A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial automation, in particular to an industrial modebus485 and multiple ECU control system. Background Art
[0002] With the development of intelligent manufacturing, industrial automation systems have put forward higher requirements for efficient, stable and flexible communication protocols. Among the many industrial communication protocols, Modbus protocol is widely used in industrial control systems due to its simplicity, openness and strong compatibility, especially in process industry and discrete manufacturing. As its most common implementation form, Modbus RTU protocol has become the communication standard for many industrial equipment and control systems due to its real-time, stability and easy integration.
[0003] The basic structure of the Modbus protocol includes elements such as address identification, function code, data and CRC check, which ensures the reliability and accuracy of data transmission between devices. On this basis, the system can realize functions such as device status monitoring, data reading, parameter setting, etc. For large-scale, distributed industrial control systems, the Modbus protocol provides a simple and effective solution that can meet the needs of device interconnection and information exchange.
[0004] However, with the increasing complexity of industrial equipment, the variability of production environments and the increase in control requirements, the traditional Modbus protocol has shown its shortcomings in some complex application scenarios, especially in the following aspects: Difficulty in dynamic expansion and address allocation: The device address of the Modbus protocol is static, and each device has a fixed address. When the system needs to add a new device, it may be necessary to manually adjust the address configuration, which causes great trouble for the dynamic management of the device and system expansion. In some dynamically changing scenarios, the Modbus protocol does not support a flexible address reallocation mechanism, so when faced with frequently changing slave numbers and states, the protocol has poor scalability and flexibility.
[0005] Inconvenient multi-device operation: Although the Modbus protocol supports broadcasting, when multiple devices need to perform operations at the same time, each device usually replies to the host computer, resulting in a large number of invalid responses and reduced communication efficiency. Especially in large-scale systems, the response processing and data traffic increase greatly, affecting the real-time performance of the system. Summary of the invention
[0006] In view of the deficiencies of the prior art, the present invention provides an industrial modebus485 and multiple ECU control system to solve the problems raised in the above background technology.
[0007] To achieve the above object, the present invention provides the following technical solutions: In a first aspect, an embodiment of the present invention provides an industrial modebus485 and multiple ECU control system, including: S1. Perform system initialization and communication interface settings; When the system starts, the host computer initializes the communication of the Modbus RTU protocol, including the communication parameter settings of baud rate, data bit, and stop bit; the host computer checks whether there is a device response, and verifies whether the communication link is normal through the CRC check code; the host computer sends a broadcast data frame to notify all ECUs through broadcasting to prepare for the next handshake process; S2, perform Modbus RTU handshake and slave address allocation; After the system initialization and communication interface settings are completed, the host computer begins to enter the handshake stage, which assigns a unique slave address to each ECU through the Modbus RTU protocol; S3, read and write control of oil pressure parameters of single ECU; After the handshake and address assignment are successful, each ECU performs independent oil pressure parameter read and write operations according to its slave address; S4: Perform oil pressure confluence and synchronization operation of multiple ECUs; Based on the read-write control of oil pressure parameters of a single ECU, it is extended to the synchronous operation of multiple ECUs to achieve overall coordinated control of oil pressure; S5, perform communication status feedback and exception handling; After the oil pressure of multiple ECUs is synchronized, ensure that the status feedback of each ECU is correctly received and handle any abnormalities in a timely manner; S6. Conduct real-time monitoring and system adjustments; The host computer continuously monitors the status information of all ECUs; if it detects that the oil pressure parameters of a certain ECU are out of the normal range or the equipment fails, the system automatically issues an adjustment command to ensure that the oil pressure parameters are restored to the predetermined range.
[0008] To further optimize the technical solution, in step S1, when the host computer verifies that the communication link is not successfully established, the host computer issues a fault alarm and stops the system startup; During the initialization process, the hardware status of each ECU is detected to confirm whether any device is faulty, offline, or unresponsive.
[0009] To further optimize the technical solution, in step S2, the host computer informs all ECUs to enter the handshake mode by sending a broadcast frame; After receiving the broadcast frame, the ECU responds in sequence according to the preset random delay time to avoid conflicts caused by multiple devices responding at the same time; Each ECU responds with device information and confirms whether it has successfully received the broadcast data.
[0010] To further optimize the technical solution, in step S2, after the host computer receives the response from each ECU, the CRC check code detects whether the response of each ECU is valid, and assigns a unique slave address to each ECU one by one; The ECU that successfully allocates the address replies with a confirmation signal, otherwise it retries the handshake until all ECUs are successfully allocated addresses; The host computer precisely controls each ECU and is ready to enter the parameter control stage.
[0011] To further optimize the technical solution, in step S3, the host computer accurately reads or writes the oil pressure parameters of each ECU through the Modbus RTU protocol, and the oil pressure control parameters of each ECU have a unique address to ensure that the parameters of different ECUs do not interfere with each other.
[0012] To further optimize the technical solution, in step S3, when the host computer reads the oil pressure parameter of a certain ECU, a command with the target ECU address, function code 0x03 read parameter and parameter address is sent; after receiving the command, the ECU returns the corresponding oil pressure value and confirmation signal; When the host computer modifies the oil pressure parameters of a certain ECU, it will send the function code 0x06 to write the parameters and specify the new parameter value; after receiving the write command, the ECU will adjust according to the new oil pressure value and send a response frame to the host computer; If the operation fails, the ECU returns an error code to indicate the abnormality.
[0013] To further optimize the technical solution, in step S4, the oil pressure confluence and synchronous operation of multiple ECUs include: The host computer sends operation commands to all ECUs at one time through the broadcast address of the Modbus RTU protocol; The commands sent through the broadcast address are responded to by all ECUs and the corresponding operations are performed.
[0014] To further optimize the technical solution, in step S4, the host computer also selectively operates certain ECUs, rather than all ECUs, by setting a specific flag bit; The host computer sends a data byte, in which the high-order flag bit indicates the ECU that needs to be operated; The host computer specifies ECU3, ECU4 and ECU6 through the flag bit, that is, the third, fourth and sixth ECUs adjust the oil pressure at the same time, and other ECUs do not respond.
[0015] To further optimize the technical solution, in step S5, after the oil pressure of multiple ECUs are synchronized, the system monitors the execution status of each ECU to ensure that the operation instruction has been executed as expected; The host computer will send a feedback request to each ECU according to the Modbus RTU protocol to obtain the execution result.
[0016] To further optimize the technical solution, in step S6, the status information of the ECU includes oil pressure data, equipment working status, and fault alarm; the host computer periodically sends a query command with function code 0x03 to obtain the latest status data of each ECU and analyzes it.
[0017] In a second aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program instructions are executed by the processor, the steps of an industrial modebus485 and multiple ECU control system as described in the first aspect of the present invention are implemented.
[0018] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program instructions are executed by a processor, the steps of an industrial modebus485 and a plurality of ECU control systems as described in the first aspect of the present invention are implemented.
[0019] Compared with the prior art, the present invention provides an industrial modebus485 and multiple ECU control system, which has the following beneficial effects: The industrial modebus485 and multiple ECU control systems have inherited the core structure of the standard Modbus protocol, while adding more functions to adapt to complex scenarios. Through the handshake mechanism and multi-ECU operation support, it is suitable for industrial scenarios of dynamic expansion and real-time control. The robustness of the communication process is improved through the delay mechanism, error handling and hardware loopback detection. While following the existing Modbus basic specifications, the introduction of improved mechanisms not only reduces the learning cost, but also facilitates future function expansion.
[0020] The advantages include: Continuous random delay handshake mechanism: The random delay mechanism ensures the order of multiple ECUs handshaking at the same time, avoids address allocation conflicts caused by synchronous transmission, and can dynamically allocate slave addresses, making the system suitable for scenarios where the number of slaves or the status of slaves need to change frequently.
[0021] Single ECU parameter read and write control: The design clarifies the independence and consistency of parameters for different ECUs, and simplifies data management by unifying parameter address specifications. It adopts a clear command structure (read parameters and write parameters) in line with the style of the standard ModbusRTU protocol, which is easy to integrate and expand.
[0022] Multi-ECU operation: Through the broadcast address, commands can be sent to all devices at once, which is suitable for scenarios that require full network synchronization, such as global reset or parameter consistency. Through the high-order flag bit of the data byte, it supports one-time operation of multiple specific devices, rather than a single device or full network broadcast, which improves operational flexibility. Unselected ECUs will not reply to the host computer, reducing the amount of response data on the bus and optimizing communication efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 The topological diagram of the host computer and ECU of an industrial modebus485 and multiple ECU control system proposed by the present invention; Figure 2 This is a flow chart of an industrial modebus485 and multiple ECU control system proposed by the present invention; Figure 3 This is a flowchart of ECU delayed handshake between an industrial modebus485 and multiple ECU control systems proposed by the present invention; Figure 4 This is a single ECU control flow chart of an industrial modebus485 and multiple ECU control system proposed by the present invention; Figure 5 This is a multi-ECU control flow chart of an industrial modebus485 and a multi-ECU control system proposed by the present invention. DETAILED DESCRIPTION
[0025] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0026] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0027] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor is it a separate or selective embodiment that is mutually exclusive with other embodiments. Embodiment 1:
[0028] Reference Figure 1 to Figure 5 , which is the first embodiment of the present invention, provides an industrial modebus485 and multiple ECU control system, characterized in that it includes: S1. Perform system initialization and communication interface settings.
[0029] When the system starts, the host computer (PC by default) first needs to perform communication initialization of the Modbus RTU protocol, including setting communication parameters such as baud rate, data bit, stop bit, etc. During the initialization process, the host computer will check whether each device responds, and verify the integrity and correctness of the communication data through the CRC check code. If any communication error is found during the initialization process, the host computer will issue an alarm signal and stop the system startup. This step also includes detecting the hardware status of each ECU device to ensure that no device is offline or faulty. After completing the initialization of the communication interface, the host computer will notify all ECUs to enter the ready state through a broadcast frame and prepare to start the handshake process. During the communication process, each frame of data will be accompanied by a CRC check code to ensure that the data has not been tampered with or lost during transmission.
[0030] S2. Perform Modbus RTU handshake and slave address allocation.
[0031] The host computer starts the handshake process by sending a broadcast frame, and all ECU devices will respond one by one according to the random delay mechanism. Each ECU will carry its device information when responding, and ensure the correctness of data transmission through CRC check. At this stage, the CRC check code is used to detect whether the response of each ECU is valid. If the host computer receives incomplete or incorrect response data, it will re-initiate the handshake until all ECUs successfully respond and obtain a unique slave address. After the address is successfully assigned, the host computer will send a confirmation signal to ensure that each ECU can receive the assigned address. At the end of this step, the communication connection between the host computer and each ECU has been established, each device has an independent address, and is ready for the next step.
[0032] S3: Read and write the oil pressure parameters of a single ECU.
[0033] After each ECU is successfully assigned an address, the host computer can use the Modbus RTU protocol to read or write the oil pressure parameters of each ECU. During the data transmission process, all command frames contain the address of the target ECU, the command type (for example, function code 0x03 for reading and 0x06 for writing), the parameter address, the data value, and the CRC check code. The CRC check code is used to ensure that no errors occur during data transmission. If the read command sent by the host computer is executed correctly, the ECU will return the read oil pressure parameters and a CRC check code for the host computer to verify whether the data is valid. If the write command sent by the host computer is executed correctly, the ECU will adjust according to the new oil pressure value and return a confirmation frame and a CRC check code. If a communication error is found, the ECU will send an error code to prompt the host computer to re-initiate the command. Through CRC verification, ensure that each data interaction is correct and complete.
[0034] S4: Perform oil pressure merging and synchronization operation of multiple ECUs.
[0035] During the multi-ECU operation phase, the host computer sends synchronous operation commands to all ECUs through the broadcast address (0x00) of the Modbus RTU protocol. During this process, the host computer can also selectively operate certain ECU devices through specific flag bits. For example, synchronous operation of multiple ECUs is achieved by setting the flag bit in the data byte (such as 0xAC, indicating that ECU3, ECU4 and ECU6 are controlled at the same time). After each ECU receives the operation command, it will adjust the oil pressure according to the instruction and send a confirmation frame to the host computer through the Modbus protocol. All data frames must contain a CRC checksum to ensure that no errors occur in the operation command during the communication process. If an ECU encounters an abnormality during the operation and cannot execute the command correctly, it will return an error code through an error frame with CRC checksum information, prompting the host computer to resend the command or perform error handling.
[0036] S5. Perform communication status feedback and exception handling.
[0037] After multiple ECUs are operated synchronously, the host computer needs to obtain operation feedback from each ECU to confirm whether all operations are completed successfully. After each ECU completes the operation, it will return a status feedback frame, which includes the execution result (such as success, failure) and CRC checksum. After receiving these feedback frames, the host computer first performs a CRC check to verify whether the data is complete and correct. If the CRC check passes, the host computer will proceed to the next step based on the feedback content. If an error occurs in the feedback (such as operation failure or equipment failure), the host computer will take appropriate exception handling measures (such as retry operation, alarm prompt, etc.) based on the returned error code. This step ensures that the system can respond quickly to various abnormal situations to avoid system failures or unstable operation.
[0038] S6. Conduct real-time monitoring and system adjustments.
[0039] After the system starts to run for a long time, the host computer needs to send query commands (such as function code 0x03) to each ECU regularly to obtain real-time oil pressure parameters and equipment status. The return data of each query command contains a CRC checksum to ensure that the data is not lost or tampered with during transmission. The host computer will monitor the working status of each ECU based on these real-time data and make necessary adjustments to the system. If the oil pressure parameters of a certain ECU exceed the preset range or the equipment fails, the host computer can issue an adjustment command to adjust the system status in real time to ensure the stability and reliability of the entire oil pressure confluence system. In addition, through CRC verification, the accuracy of real-time monitoring data is guaranteed, thereby ensuring that every adjustment and operation of the system can be effectively executed. Embodiment 2:
[0040] This embodiment also provides a computer device, which is suitable for an industrial modebus485 and multiple ECU control systems, including a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement an industrial modebus485 and multiple ECU control systems as proposed in the above embodiment.
[0041] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, an industrial modebus485 and multiple ECU control system as proposed in the above embodiment is implemented.
[0042] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0043] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0044] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk case (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0045] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit with a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit with a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0046] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. An industrial modebus485 and multiple ECU control system, characterized in that: include: S1. Perform system initialization and communication interface settings; When the system starts, the host computer initializes the communication of the Modbus RTU protocol, including the communication parameter settings of baud rate, data bit, and stop bit; the host computer checks whether there is a device response, and verifies whether the communication link is normal through the CRC check code; the host computer sends a broadcast data frame to notify all ECUs through broadcasting to prepare for the next handshake process; S2, perform Modbus RTU handshake and slave address allocation; After the system initialization and communication interface settings are completed, the host computer begins to enter the handshake stage, which assigns a unique slave address to each ECU through the ModbusRTU protocol; S3, read and write control of oil pressure parameters of single ECU; After the handshake and address assignment are successful, each ECU performs independent oil pressure parameter read and write operations according to its slave address; S4: Perform oil pressure confluence and synchronization operation of multiple ECUs; Based on the read-write control of oil pressure parameters of a single ECU, it is expanded to the synchronous operation of multiple ECUs to achieve overall coordinated control of oil pressure; S5, perform communication status feedback and exception handling; After the oil pressure of multiple ECUs is synchronized, ensure that the status feedback of each ECU is correctly received and handle any abnormalities in a timely manner; S6. Conduct real-time monitoring and system adjustments; The host computer continuously monitors the status information of all ECUs; if it detects that the oil pressure parameters of a certain ECU are out of the normal range or the equipment fails, the system automatically issues an adjustment command to ensure that the oil pressure parameters are restored to the predetermined range.
2. The industrial modebus485 and multiple ECU control system according to claim 1, characterized in that: In step S1, when the host computer verifies that the communication link is not successfully established, the host computer issues a fault alarm and stops the system startup; During the initialization process, the hardware status of each ECU is detected to confirm whether any device is faulty, offline, or unresponsive.
3. The industrial modebus485 and multiple ECU control system according to claim 1, characterized in that: In step S2, the host computer informs all ECUs to enter the handshake mode by sending a broadcast frame; After receiving the broadcast frame, the ECU responds in sequence according to the preset random delay time to avoid conflicts caused by multiple devices responding at the same time; Each ECU responds with device information and confirms whether it has successfully received the broadcast data.
4. The industrial modebus485 and multiple ECU control system according to claim 3, characterized in that: In step S2, after the host computer receives the response from each ECU, the CRC check code detects whether the response of each ECU is valid, and assigns a unique slave address to each ECU one by one; The ECU that successfully allocates the address replies with a confirmation signal, otherwise it retries the handshake until all ECUs are successfully allocated addresses; The host computer precisely controls each ECU and is ready to enter the parameter control stage.
5. The industrial modebus485 and multiple ECU control system according to claim 1, characterized in that: In step S3, the host computer accurately reads or writes the oil pressure parameters of each ECU through the Modbus RTU protocol. The oil pressure control parameters of each ECU have a unique address to ensure that the parameters of different ECUs do not interfere with each other.
6. The industrial modebus485 and multiple ECU control system according to claim 1, characterized in that: In step S3, when the host computer reads the oil pressure parameter of a certain ECU, a command with the target ECU address, function code 0x03 read parameter and parameter address is sent; after receiving the command, the ECU returns the corresponding oil pressure value and confirmation signal; When the host computer modifies the oil pressure parameters of a certain ECU, it will send the function code 0x06 to write the parameters and specify the new parameter value; after receiving the write command, the ECU will adjust according to the new oil pressure value and send a response frame to the host computer; If the operation fails, the ECU returns an error code to indicate the abnormality.
7. The industrial modebus485 and multiple ECU control system according to claim 1, characterized in that: In step S4, the oil pressure confluence and synchronous operation of multiple ECUs include: The host computer sends operation commands to all ECUs at one time through the broadcast address of the Modbus RTU protocol; The commands sent through the broadcast address are responded to by all ECUs and the corresponding operations are performed.
8. The industrial modebus485 and multiple ECU control system according to claim 1, characterized in that: In step S4, the host computer also selectively operates certain ECUs, rather than all ECUs, by setting a specific flag bit; The host computer sends a data byte, in which the high-order flag bit indicates the ECU that needs to be operated; The host computer specifies ECU3, ECU4 and ECU6 through the flag bit, that is, the third, fourth and sixth ECUs adjust the oil pressure at the same time, and other ECUs do not respond.
9. The industrial modebus485 and multiple ECU control system according to claim 1, characterized in that: In step S5, after the oil pressure of multiple ECUs are synchronized, the system monitors the execution status of each ECU to ensure that the operation instructions have been executed as expected; The host computer will send a feedback request to each ECU according to the Modbus RTU protocol to obtain the execution result.
10. The industrial modebus485 and multiple ECU control system according to claim 1, characterized in that: In step S6, the status information of the ECU includes oil pressure data, equipment working status, and fault alarm; the host computer periodically sends a query command with function code 0x03 to obtain the latest status data of each ECU and analyzes it.
Citation Information
Patent Citations
Communication method and communication system based on Modbus RTU protocol
CN110851392A
One-master multi-slave-station communication method and system based on MODBUS_RTU protocol
CN113746712A
General slave address dynamic allocation method for one-master multi-slave bus
CN117118951A
Method for automatically assigning addresses in a Modbus communication network
DE102022102143A1