Master-slave communication control method, master, slave and system

By sending high-priority data request frames when the communication bus is idle, the problem of high-priority data transmission delay is solved, efficient multi-task parallel communication is realized, and the real-time performance and stability of industrial automation control systems are improved.

CN122179381APending Publication Date: 2026-06-09ROYPOW TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ROYPOW TECH CO LTD
Filing Date
2026-03-26
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In industrial automation control systems, the transmission delay of high-priority data affects the dynamic response and stability of the system due to the long response time of low-priority data. Existing technical solutions are complex, costly, or wasteful of resources.

Method used

While waiting for the slave to generate a low-priority data response frame, the master uses the idle time of the communication bus to send a high-priority data request frame and receive a response frame. Multi-task parallel communication is achieved through software scheduling to avoid high-priority data waiting for low-priority responses.

Benefits of technology

It significantly reduces the response latency of high-priority data, improves the utilization of the communication bus, reduces hardware costs, simplifies the implementation process, and enhances the real-time performance and stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122179381A_ABST
    Figure CN122179381A_ABST
Patent Text Reader

Abstract

The application discloses a master-slave communication control method, a master, a slave and a system, and belongs to the technical field of master-slave communication. The method comprises the following steps: a master sends a request frame of first priority data to a slave; whether a response frame of the first priority data returned by the slave is received is monitored; if the response frame of the first priority data returned by the slave is not received, and the current communication state of a communication bus is idle, a request frame of second priority data is sent to the slave, and a response frame of the second priority data returned by the slave is received, wherein the priority of the second priority data is higher than that of the first priority data; if the response frame of the first priority data returned by the slave is received, the first priority data in the response frame of the first priority data is updated to a buffer. Through the above method, the response delay of high-priority data is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of master-slave communication technology, and particularly relates to a control method, master, slave and system for master-slave communication. Background Technology

[0002] Industrial automation control systems typically employ a master-slave multiprocessor architecture. The master processor handles system-level control, human-machine interaction, and parameter management; the slave processors handle function implementation, real-time adjustment, fault protection, and other rapid response tasks. The master and slave processors usually exchange two distinct types of data—high-priority data and low-priority data—through a communication link. High-priority data is characterized by: 1. Small total data volume, typically a few bytes; 2. High update frequency and real-time requirements, with response latency in the microsecond to millisecond range; 3. Directly impacting the system's dynamic response and stability. Low-priority data is characterized by: 1. Large total data volume, potentially tens to hundreds of bytes; 2. Low update frequency and real-time requirements, allowing for delays of hundreds of milliseconds or even seconds, typically triggered during system initialization, parameter modification, or manual queries; 3. No direct impact on the system's real-time dynamic performance.

[0003] In industrial settings, polling-based communication protocols are widely used for data exchange. Taking the MODBUS-RTU serial communication protocol as an example, the typical master-slave communication sequence is as follows: the master sends request frames to the slave sequentially; the slave prepares data and returns a response frame upon receiving the request frame; and the master initiates the next round of request frames after receiving the response frame. When high-priority and low-priority data need to be transmitted between the master and slave, this scheme can lead to significant delays in the transmission of high-priority data due to the long response time for low-priority data. Summary of the Invention

[0004] The embodiments of this application provide a control method, master, slave and system for master-slave communication, which can reduce the transmission delay of high-priority data to at least a certain extent.

[0005] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.

[0006] According to a first aspect of the embodiments of this application, a master-slave communication control method is provided, applied to a master, the method comprising: Send a request frame for first-priority data to the slave device; Monitor whether a response frame containing first-priority data is received from the slave device; If no response frame for first-priority data is received from the slave device, and the current communication state of the communication bus is idle, a request frame for second-priority data is sent to the slave device, and a response frame for second-priority data is received from the slave device, wherein the priority of the second-priority data is higher than the priority of the first-priority data. If a response frame containing first-priority data is received from the slave device, the first-priority data in the response frame is updated to the buffer.

[0007] In some embodiments, the first priority data includes at least one of configuration parameters, historical fault information, and operation logs, and the second priority data includes at least one of control variables, actual output sampling parameters, and operating status.

[0008] In some embodiments, the control method for master-slave communication further includes: If the duration of not receiving a response frame for the first priority data reaches the preset duration, then a request frame for the first priority data is resent to the slave device.

[0009] According to a second aspect of the embodiments of this application, a master-slave communication control method is provided, applied to a slave device, the method comprising: If a request frame for first-priority data is received from the host, during the process of generating a response frame for first-priority data based on the request frame for first-priority data, it is monitored whether a request frame for second-priority data is received from the host, wherein the priority of the second-priority data is higher than the priority of the first-priority data. If a request frame for second-priority data is received from the host, a response frame for second-priority data is generated based on the request frame and returned to the host. After generating a response frame with first-priority data based on the request frame with first-priority data, the response frame with first-priority data is returned to the host.

[0010] In some embodiments, during the process of generating a response frame with first priority data based on a request frame with first priority data, monitoring whether a request frame with second priority data sent by the host is received includes: The steps of generating a response frame with first priority data based on a request frame with first priority data based on a background task execution, and the steps of monitoring whether a request frame with second priority data sent by the host is received based on a background task execution; A response frame with second-priority data is generated based on the request frame with second-priority data, and a response frame with second-priority data is returned to the host, including: The steps are: executing an interrupt service routine to generate a response frame with second-priority data based on a request frame with second-priority data, and returning the response frame with second-priority data to the host.

[0011] In some embodiments, generating a response frame with second priority data based on a request frame containing second priority data includes: The request frame based on the second priority data reads the second priority data from the control register or random access memory of the slave digital signal processor (DSP) and generates a response frame based on the second priority data.

[0012] In some embodiments, the control method for master-slave communication further includes: During the process of generating a response frame with first-priority data based on a request frame with first-priority data, a data update request frame is sent to the host so that the host can send a request frame with second-priority data based on the data update request frame.

[0013] According to a third aspect of the embodiments of this application, a host computer is provided, including a processor and a memory, wherein the memory stores computer program instructions executable by the processor, and when the processor executes the computer program instructions, it implements the steps of the method described in the first aspect.

[0014] According to a fourth aspect of the embodiments of this application, a slave device is provided, including a processor and a memory, the memory storing computer program instructions executable by the processor, wherein when the processor executes the computer program instructions, it implements the steps of the method described in the second aspect.

[0015] According to a fifth aspect of the embodiments of this application, a master-slave communication control system is provided, including a master as described in the third aspect and a slave as described in the fourth aspect.

[0016] In this application, after the master sends a request frame for lower-priority first-priority data to the slave, while waiting for the slave to generate and return a response frame for first-priority data, if the current communication state of the communication bus is idle, a request frame for higher-priority second-priority data is sent to the slave, and a response frame for second-priority data generated and returned by the slave is received. This scheme makes full use of the waiting time during which the slave generates and returns a response frame for lower-priority data, and sends a request frame for higher-priority data and receives a response frame during this waiting time, so that higher-priority data does not need to wait for the lower-priority data to finish responding before being polled, thus reducing the response delay of higher-priority data.

[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings: Figure 1 An architecture diagram of a master-slave communication control system according to some embodiments of this application is shown; Figure 2 A flowchart illustrating a master-slave communication control method according to some embodiments of this application is shown; Figure 3 A flowchart illustrating a master-slave communication control method according to other embodiments of this application is shown; Figure 4 A timing diagram of a master-slave communication control method according to other embodiments of this application is shown; Figure 5 A schematic diagram of the structure of a host or slave device according to some embodiments of this application is shown. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.

[0021] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0022] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0023] To enable those skilled in the art to better understand this application, firstly, in conjunction with Figure 1 A brief description is given of the master-slave communication control system involved in this application.

[0024] Figure 1 An architecture diagram of a master-slave communication control system according to some embodiments of this application is shown. Figure 1 As shown, a master-slave communication control system includes a master A and a slave B, with a communication line between them. In master-slave communication, the master typically initiates a request, and the slave responds. Currently, in polling-based communication protocols, the master sequentially sends request frames to the slave. Upon receiving a request frame, the slave prepares data and returns a response frame. The master then initiates the next round of request frames after receiving the response frame. When high-priority and low-priority data need to be transmitted between the master and slave, the high-priority data cannot be polled until the low-priority data has responded. This leads to a large delay in high-priority data transmission due to the long waiting time for low-priority data responses, severely impacting the dynamic control performance of industrial automation control systems (such as digital signal processor (DSP) digital power control systems), and may even cause system oscillation or protection malfunctions.

[0025] In related technologies, transmission delay optimization is typically achieved through master-slave role switching or adding communication lines. The master-slave role switching scheme involves allowing the slave device to initiate communication under specific conditions during master-slave communication, temporarily transferring bus control to the slave. After gaining bus control, the slave actively sends data to the master. Once the slave has finished sending data, it returns bus control to the master, which then continues polling. This scheme reduces the time the master spends waiting for the slave to prepare data, theoretically improving bus utilization. However, it has several drawbacks: 1. Complex implementation and significant protocol modifications: It requires adding a master-slave handshake process to the standard MODBUS-RTU protocol, significantly altering the existing protocol stack. DSP digital power control systems typically require high reliability, necessitating extensive verification of these protocol stack modifications and making compatibility with existing monitoring systems difficult. 2. Strong hardware dependency: It requires the slave device to have detection capabilities. 1. **The ability to detect bus idle and actively send signals:** This requires high time accuracy and interrupt response speed from the slave device. Low-cost slave devices may not meet real-time requirements or may require valuable timer resources. 2. **Insufficient data type differentiation:** This scheme treats all data equally, failing to consider the special real-time requirements of high-priority data (such as voltage control quantities). When a slave transmits low-priority data, high-priority data remains blocked in the slave's transmission queue, unable to obtain priority transmission rights, leading to dynamic response delays in the power supply. 3. **Bus conflict risk:** When multiple slaves request transmission simultaneously, complex conflict detection and arbitration mechanisms are required, increasing software complexity and potentially introducing unpredictable delays, which is detrimental to the deterministic control of the system. 4. **Increased slave device burden:** Slaves need to maintain complete master functions, including bus monitoring, conflict detection, and timeout retransmission, increasing slave software complexity and potentially affecting the real-time performance of their core control tasks.

[0026] The proposed solution involves adding a dedicated serial port or CAN bus, a high-speed bus for transmitting high-priority data, and a low-speed bus for transmitting low-priority data. The workflow is as follows: the master sends request frames sequentially according to a polling table; when the master needs to read low-priority data (e.g., reading a long historical record), it sends a request frame for low-priority data via the low-speed bus; when the master needs to read high-priority data (e.g., voltage control requests), it sends a request frame for high-priority data via the high-speed bus. This solution has several drawbacks: 1. Significant waste of communication resources: During the extended period when the slave device is processing low-priority data, the low-priority data communication bus remains completely idle, wasting valuable bandwidth resources; 2. Increased hardware costs: additional transceiver chips, isolation devices, etc., printed circuit board (PCB) layout space, increased wiring complexity, and reduced system reliability.

[0027] Based on this, the inventors provide a master-slave communication control method and system that can significantly improve the real-time performance of high-priority data without changing the physical layer and link layer protocols, without increasing hardware costs.

[0028] This application divides the data communicated between the master and slave into a lower-priority first-priority data and a higher-priority second-priority data. After the master sends a request frame for the lower-priority first-priority data to the slave, while waiting for the slave to generate and return a response frame for the first-priority data, if the current communication state of the communication bus is idle, the master sends a request frame for the higher-priority second-priority data to the slave and receives the response frame for the second-priority data generated and returned by the slave. This scheme makes full use of the waiting time during which the slave generates and returns a response frame for the lower-priority data, sending a request frame for the higher-priority data and receiving a response frame during this waiting time. This ensures that the higher-priority data does not need to wait for the lower-priority data to complete its response before being polled, reducing the response latency of the higher-priority data. This scheme does not require changes to the physical layer and link layer protocols, does not require additional hardware costs, and features high utilization of the communication bus, ease of engineering implementation, and promotion.

[0029] Figure 2 A flowchart illustrating a master-slave communication control method according to some embodiments of this application is shown. Figure 2 As shown, a master-slave communication control method is provided, which is applied to... Figure 1 Taking the host in the example as an example, the method may include the following steps: Step 201: Send a request frame for first-priority data to the slave device; Step 202: Monitor whether a response frame containing first-priority data is received from the slave device; Step 203: If no response frame of first priority data is received from the slave, and the current communication state of the communication bus is idle, then send a request frame of second priority data to the slave and receive a response frame of second priority data from the slave, wherein the priority of the second priority data is higher than the priority of the first priority data. Step 204: If a response frame of first priority data is received from the slave device, the first priority data in the response frame of first priority data is updated to the buffer.

[0030] The first-priority data refers to data with relatively low priority. This type of data is characterized by: 1. Large total data volume, potentially ranging from tens to hundreds of bytes; 2. Low update frequency and real-time requirements, allowing for delays of hundreds of milliseconds or even seconds, typically triggered during system initialization, parameter modification, or manual querying; 3. No direct impact on the system's real-time dynamic performance. In some embodiments, the first-priority data includes at least one of configuration parameters, historical fault information, and operation logs. Configuration parameters can include overvoltage protection thresholds, overcurrent protection thresholds, etc.

[0031] Second-priority data refers to data with relatively high priority. This type of data is characterized by: 1. Small total data volume, typically a few bytes; 2. High update frequency and real-time requirements, with response latency in the microsecond to millisecond range; 3. Direct impact on the system's dynamic response and stability. In some embodiments, second-priority data includes at least one of control quantities, actual output sampling parameters, and operating status. The control quantity can be a voltage control quantity, current control quantity, etc.; the actual output sampling parameters can be a real-time output voltage, real-time output current, etc.; and the operating status can be a fault flag, operating mode, etc.

[0032] In step 201, when the current time reaches the preset polling time, the host can execute the step of sending a request frame for first priority data to the slave in the background task to obtain the first priority data.

[0033] In step 202, after the host sends a request frame for first priority data to the slave, it can monitor whether it receives a response frame for first priority data returned by the slave. If no response frame for first priority data is received, step 203 is executed. If a response frame for first priority data is received, step 204 is executed.

[0034] In step 203, after the master sends a request frame for first-priority data to the slave, it does not release the communication bus. Instead, it monitors the current communication status of the communication bus. If it detects that the current communication status is idle (at which point the slave is processing first-priority data), it sends a request frame for second-priority data to the slave. After receiving a response frame for second-priority data from the slave, the master can repeat step 203 until it receives a response frame for first-priority data from the slave.

[0035] The above scheme breaks through the serial limitation of "question and answer" in standard Modbus-RTU and other protocols, and realizes multi-task parallel communication within a single cycle by using software scheduling without modifying the physical layer and hardware circuit.

[0036] In step 204, if a response frame of first priority data is received from the slave device, the master device can update the first priority data in the response frame of the first priority data to the buffer. After the data update is completed, the master device can repeat steps 201 to 204 to start a new round of data transmission and update.

[0037] In some embodiments, if the duration for which a response frame for first priority data is not received reaches a preset duration, the host resends a request frame for first priority data to the slave.

[0038] It is understandable that if the duration of the failure to receive the response frame for the first priority data reaches the preset duration, it indicates that the slave response has timed out. In this case, the request frame for the first priority data is resent to the slave to improve the success rate of obtaining the first priority data.

[0039] It should be noted that in traditional polling methods, the time spent by the slave device processing first-priority data (such as the time spent reading first-priority data from EEPROM) is completely wasted, during which the communication bus is idle. This embodiment utilizes this idle time to transmit second-priority data, significantly improving bus utilization. Furthermore, it eliminates the need for high-priority data to wait for low-priority data to respond (typically over 100ms) before being polled, reducing the response latency of high-priority data (the response latency in this embodiment can reach 1ms). This improves real-time performance by more than two orders of magnitude, which is crucial for control systems requiring rapid response (such as DSP digital power control systems and servo drives), preventing control lag, oscillation, or even loss of control due to communication delays. This solution requires no changes to the physical layer and link layer protocols, incurs no additional hardware costs, and features high communication bus utilization and ease of engineering implementation and promotion.

[0040] Figure 3 A flowchart illustrating a master-slave communication control method according to other embodiments of this application is shown. For example... Figure 3 As shown, a master-slave communication control method is provided, which is applied to... Figure 1 Taking the slave device as an example, this method may include the following steps: Step 301: If a request frame for first priority data is received from the host, during the process of generating a response frame for first priority data based on the request frame for first priority data, it is monitored whether a request frame for second priority data is received from the host, wherein the priority of the second priority data is higher than the priority of the first priority data. Step 302: If a request frame for second priority data is received from the host, a response frame for second priority data is generated based on the request frame for second priority data, and the response frame for second priority data is returned to the host. Step 303: After generating a response frame with first priority data based on the request frame with first priority data, return the response frame with first priority data to the host.

[0041] The first priority data refers to data with relatively low priority. The characteristics of this type of data can be found in the aforementioned embodiments and will not be repeated here. In some embodiments, the first priority data includes at least one of configuration parameters, historical fault information, and operation logs. The configuration parameters can be overvoltage protection thresholds, overcurrent protection thresholds, etc.

[0042] Second-priority data refers to data with relatively high priority. The characteristics of this type of data can be found in the aforementioned embodiments and will not be repeated here. In some embodiments, second-priority data includes at least one of control quantities, actual output sampling parameters, and operating states. The control quantities can be voltage control quantities, current control quantities, etc.; the actual output sampling parameters can be real-time output voltage, real-time output current, etc.; and the operating states can be fault flags, operating modes, etc.

[0043] In step 301, if the slave device receives a request frame for first priority data sent by the master device, it generates a response frame for first priority data based on the request frame for first priority data, and monitors whether a request frame for second priority data sent by the master device is received during the process of generating the response frame for first priority data.

[0044] It is understandable that after the master sends a request frame for first-priority data to the slave, during the period when the slave generates a response frame for first-priority data, the master can determine whether it needs to send a request frame for second-priority data to the slave based on the current communication conditions (e.g., the current communication state of the communication bus is idle). Therefore, the slave needs to monitor whether it receives a request frame for second-priority data sent by the master.

[0045] In step 302, if the slave device receives a request frame for second priority data sent by the master device, it generates a response frame for second priority data based on the request frame and returns the response frame for second priority data to the master device.

[0046] Figure 4 A timing diagram illustrating a master-slave communication control method according to other embodiments of this application is shown. For example... Figure 4 As shown, the slave device can process first-priority data based on background tasks and second-priority data based on interrupt service routines.

[0047] In some embodiments, the steps of generating a response frame based on a request frame with first priority data based on a first priority data can be performed based on a background task, and the steps of monitoring whether a request frame with second priority data sent by the host is received can be performed based on a background task; and the steps of generating a response frame with second priority data based on a request frame with second priority data based on a request frame with second priority data based on a request frame with second priority data can be performed based on an interrupt service routine, and the response frame with second priority data can be returned to the host.

[0048] Understandably, since generating a response frame for first-priority data involves a large amount of data transfer or non-volatile memory operations, the slave device can initiate a background task to handle this step, or it can start an interrupt service routine to determine in real time whether the response frame for first-priority data is complete. If the slave device receives a request frame for second-priority data, it triggers a receive interrupt, enters the interrupt service routine, and generates a response frame for second-priority data based on the request frame for second-priority data, without waiting for the background task.

[0049] In this embodiment, the first priority data is processed in a background task, while the second priority data is processed immediately through an interrupt service routine. When the background task receives a request frame for the second priority data while processing the first priority data, the background task is immediately suspended and the request frame for the second priority data is responded to first.

[0050] By rationally dividing the work between background tasks and interrupt service routines, interrupt service routines remain lightweight to ensure rapid response, while background tasks handle time-consuming operations without blocking critical interrupts. This layered design conforms to best practices in embedded systems, resulting in highly readable and maintainable code.

[0051] In some embodiments, the slave device can read second priority data from the control register or random access memory of the slave device's digital signal processor (DSP) based on a request frame for second priority data, and generate a response frame for the second priority data.

[0052] Understandably, after the slave device enters the interrupt service routine, it can directly read the second-priority data (such as real-time output voltage and real-time output current) from the DSP's control register or random access memory, update the slave device's transmit buffer, and because the amount of data processed is small, the time required from receiving the request frame for second-priority data to the completion of data preparation is short. Before the data preparation is complete, it can respond to the request frame for second-priority data from the master device in real time. After the data preparation is complete, it immediately sends the response frame for second-priority data, exits the interrupt service routine, and returns to the background task.

[0053] It should be noted that in the interrupt service routine for processing second-priority data, the traditional "polling-transfer-filling" buffer process based on EEPROM or Flash is eliminated. The second-priority data is directly read from the control register or designated random access memory and immediately written to the transmit buffer. This solves the problem of long data buffer preparation time and impact on interrupt response speed in the prior art, further shortens the interaction cycle of second-priority data, and improves the system's control bandwidth.

[0054] In some embodiments, the slave device may also send a data update request frame to the master device during the process of generating a response frame for first priority data based on the request frame for first priority data, so that the master device may send a request frame for second priority data based on the data update request frame.

[0055] It is understandable that, in addition to sending a request frame for second-priority data when the current communication state of the communication bus is idle, the master can also have the slave actively send a request frame for data update to the master, so that after the master receives the request frame for data update, it will send a request frame for second-priority data to the slave.

[0056] Based on the same inventive concept, embodiments of this application also provide a host or slave device, see reference. Figure 5 The diagram shows a schematic of the host or slave device in an embodiment of this application. The host or slave device includes one or more memories 504, one or more processors 502, and at least one computer program (computer program instruction) stored in the memory 504 and executable on the processor 502. When the processor 502 executes the computer program, it implements the method as described above.

[0057] Among them, Figure 5 In this document, a bus architecture (represented by bus 500) is used. Bus 500 may include any number of interconnected buses and bridges, linking various circuits including one or more processors represented by processor 502 and memory represented by memory 504. Bus 500 may also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. Bus interface 505 provides an interface between bus 500 and receiver 501 and transmitter 503. Receiver 501 and transmitter 503 may be the same element, i.e., a transceiver, providing a unit for communicating with various other devices over a transmission medium. Processor 502 is responsible for managing bus 500 and general processing, while memory 504 can be used to store data used by processor 502 during operation.

[0058] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the aforementioned method.

[0059] Based on the same inventive concept, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, causes the processor to perform the steps of the method described above.

[0060] Based on the same inventive concept, embodiments of this application provide a master-slave communication control system, including the aforementioned master and slave.

[0061] In some embodiments, the control system for master-slave communication can be a DSP-based digital control power supply system, in which case the master device may include DSP_A and the slave device may include DSP_B.

[0062] See back Figure 1 In the implementation process, host A is responsible for system monitoring, parameter setting, and human-machine interaction; slave B is responsible for power conversion control, real-time sampling of output voltage and current, and execution of PID regulation. The two can be connected via a communication line device, which includes an RS485 bus, a serial communication interface (SCI) peripheral, etc. The communication protocol between host A and slave B can be a polling-based master-slave protocol, such as Modbus-RTU, the industrial communication protocol CANopen, the fieldbus communication protocol Profibus DP, a custom serial port protocol, etc., with a baud rate of 115200bps.

[0063] The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions may be stored as one or more instructions or codes on or transmitted via a computer-readable medium. Other examples and embodiments are within the scope and spirit of this application and the appended claims. For example, due to the nature of software, the functions described above may be implemented using software executed by a processor, hardware, firmware, hardwired, or any combination thereof. Furthermore, the functional units may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit.

[0064] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0065] The units described as separate components may or may not be physically separate. Similarly, the components of the control device may or may not be physical units; they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0066] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer program instructions, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0067] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A control method for master-slave communication, characterized in that, Applied to a host, the method includes: Send a request frame for first-priority data to the slave device; Monitor whether a response frame containing the first priority data returned by the slave device is received; If no response frame for the first priority data is received from the slave device, and the current communication state of the communication bus is idle, a request frame for the second priority data is sent to the slave device, and a response frame for the second priority data is received from the slave device, wherein the priority of the second priority data is higher than the priority of the first priority data. If a response frame containing the first priority data returned by the slave device is received, the first priority data in the response frame is updated to the buffer.

2. The control method for master-slave communication according to claim 1, characterized in that, The first priority data includes at least one of configuration parameters, historical fault information, and operation logs, and the second priority data includes at least one of control variables, actual output sampling parameters, and operating status.

3. The control method for master-slave communication according to claim 1, characterized in that, Also includes: If the duration of not receiving a response frame for the first priority data reaches a preset duration, then the request frame for the first priority data is resent to the slave device.

4. A control method for master-slave communication, characterized in that, Applied to a slave device, the method includes: If a request frame for first priority data is received from the host, during the process of generating a response frame for the first priority data based on the request frame for the first priority data, it is monitored whether a request frame for second priority data is received from the host, wherein the priority of the second priority data is higher than the priority of the first priority data; If a request frame for second priority data is received from the host, a response frame for second priority data is generated based on the request frame for second priority data, and the response frame for second priority data is returned to the host. After generating a response frame with the first priority data based on the request frame with the first priority data, the response frame with the first priority data is returned to the host.

5. The control method for master-slave communication according to claim 4, characterized in that, The step of monitoring whether a request frame for second priority data is received from the host during the process of generating a response frame for the first priority data based on the request frame for the first priority data includes: The steps of generating a response frame based on the first priority data based on the request frame of the first priority data based on the background task, and the steps of monitoring whether the second priority data sent by the host is received based on the background task; The process of generating a response frame based on the second priority data from the request frame and returning the response frame with the second priority data to the host includes: The steps are as follows: Execute the request frame based on the second priority data, generate a response frame based on the second priority data, and return the response frame based on the second priority data to the host based on the interrupt service routine.

6. The control method for master-slave communication according to claim 5, characterized in that, The process of generating a response frame based on the second priority data from the request frame includes: The request frame based on the second priority data reads the second priority data from the control register or random access memory of the slave digital signal processor (DSP) and generates a response frame based on the second priority data.

7. The control method for master-slave communication according to claim 4, characterized in that, Also includes: During the process of generating a response frame for the first priority data based on the request frame for the first priority data, a data update request frame is sent to the host so that the host sends a request frame for the second priority data based on the data update request frame.

8. A host computer, comprising a processor and a memory, characterized in that, The memory stores computer program instructions that can be executed by the processor, and when the processor executes the computer program instructions, it implements the steps of the method as described in any one of claims 1 to 3.

9. A slave device, comprising a processor and a memory, characterized in that, The memory stores computer program instructions that can be executed by the processor, and when the processor executes the computer program instructions, it implements the steps of the method as described in any one of claims 4 to 7.

10. A master-slave communication control system, characterized in that, It includes the host as described in claim 8 and the slave as described in claim 9.