Multi-bus input and output circuit system and control method
By presetting the priority and output mode for the external controller in the multi-bus input and output circuit system, the problem of low data exchange efficiency and resource competition between multiple devices is solved, and efficient communication and simplified device interconnection are achieved.
Patent Information
- Application Number
- CN202311705549.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-12
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-12-12
AI Technical Summary
In the existing robot input and output circuit system, the data exchange efficiency between multiple devices is low and resource competition is serious, and it is inconvenient to install due to the complex lead interconnection.
Design a multi-bus input and output circuit system, including a main controller module, an external controller, an output module and an input module. The main controller module presets the priority for each external controller and uses priority output mode and safety output. Patterns manage resources, reducing resource contention and lead interconnections.
It improves the communication efficiency between multiple devices, reduces resource competition, simplifies the interconnection process between devices, and reduces costs.
Smart Images

Figure CN117872841B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of circuit technology, and in particular to a multi-bus input-output circuit system and a control method. Background Art
[0002] In the current robot input and output circuit systems, single bus controller systems are mostly used. However, with the development of electronic equipment and the rise of unmanned factories, the need for efficient data exchange between different buses is increasing. When multiple devices need to communicate, more conversion modules are often needed, which will cause problems such as resource competition and low communication efficiency. In addition, there are a large number of wires interconnected between multiple controllers, which is not easy to install. Summary of the invention
[0003] The main purpose of the embodiments of the present application is to provide a multi-bus input and output circuit system and control method, which can improve communication efficiency and reduce resource competition, and does not require a large number of wires to interconnect multiple controllers.
[0004] To achieve the above objectives, one aspect of an embodiment of the present application provides a multi-bus input and output circuit system, the system comprising:
[0005] A main controller module, an external controller, an output module and an input module; wherein there are multiple external controllers;
[0006] The main controller module includes a plurality of bus interfaces, each of which is connected to a bus, and each of which is connected to at least one of the external controllers;
[0007] The main controller module presets a priority for each external controller and presets a priority output mode for each output port of the output module; the priority output mode is to perform a priority output according to the priority preset by the main controller module for each external controller.
[0008] In some embodiments, the main controller module also presets a safety output mode for each output port of the output module, and the safety output mode is that the main controller module outputs a safety result, and the safety result is a high-level signal.
[0009] In some embodiments, the input module is used to receive an external level signal, the main controller module is used to receive the external level signal of the input module, and the output module is used to output the output signal of the main controller module and output a level signal corresponding to the output signal.
[0010] In some embodiments, the external controller is used to periodically request and read the signals of the input module and the output module from the main controller module through a corresponding bus.
[0011] In some embodiments, the external controller is used to actively release occupied resources, so that an external controller with a lower priority can communicate with the main controller module.
[0012] In some embodiments, the main controller module is used to periodically query the status of all the external controllers;
[0013] When the main controller module does not receive reply data from the external controller within a preset time period, the external controller that has not replied is set to an offline state and the resources occupied by it are released.
[0014] In some embodiments, the main controller module further receives an output signal of the external controller;
[0015] When the main controller module receives the output signal of the external controller, if the output port of the output module is occupied by an external controller with a higher priority, a warning signal is returned to the external controller; otherwise, a success signal is returned to the external controller.
[0016] In some embodiments, the multi-bus input-output circuit system further comprises a host computer, wherein the host computer is connected to the main controller module;
[0017] The host computer is used to preset a priority allocation method for the main controller module; when the main controller module does not preset a priority for the external controller through the host computer, the priority of the external controller is set directly from high to low according to the communication sequence between the external controller and the main controller module.
[0018] In some embodiments, the host computer is further used to send the output mode of each output port of the output module to the main controller module;
[0019] When the main controller module does not preset an output mode for each output port of the output module through the host computer, the output mode of each output port adopts a priority output mode.
[0020] To achieve the above object, another aspect of the embodiment of the present application provides a multi-bus input / output circuit control method, which is applied to a multi-bus input / output circuit system. The control method comprises the following steps:
[0021] The external controller sends a data frame of output instructions to the main controller module;
[0022] After receiving the output signal sent by the external controller, the main controller module parses the data frame to obtain the address of the output port to be controlled, and determines whether the output mode of the output port is a priority output mode or a safety output mode;
[0023] If the output mode of the output port is a priority output mode, the main controller module performs a priority judgment on the right to use the output port; when the output port of the output module is occupied by an external controller with a higher priority, a warning signal is returned to the external controller; otherwise, a success signal is returned to the external controller, and a preempted signal is sent to the preempted external controller;
[0024] If the output mode of the output port is a safe output mode, the main controller module judges the output result; when the output result meets the safety output requirements, a success signal is returned to the external controller, and a preempted signal is sent to the preempted external controller; otherwise, an error signal is returned to the external controller.
[0025] Compared with the prior art, the present invention has at least one of the following advantages / benefits:
[0026] The multi-bus input-output circuit system of this solution includes a main controller module, an external controller and an output module; wherein, there are multiple external controllers; the main controller module includes multiple bus interfaces, each bus interface is connected to a bus, and each bus is connected to at least one of the external controllers; the main controller module presets a priority for each of the external controllers and a priority mode for each output port of the output module; the priority mode is to output preferentially according to the priority preset by the main controller module for each of the external controllers. The main controller module of this solution is compatible with multiple external controllers, effectively reducing the cost of interconnection between devices; by setting priorities for external controllers, high-priority external controllers can seize the right to use low-priority external controllers, effectively avoiding competition for resources by multiple external controllers and improving communication efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. 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.
[0028] Figure 1 A schematic diagram of the structure of a multi-bus input and output circuit system provided by an embodiment of the present invention;
[0029] Figure 2 A flowchart of a multi-bus input / output circuit control method provided by an embodiment of the present invention;
[0030] Figure 3A flow chart of a main controller module periodically querying an external controller provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.
[0032] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0033] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0035] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.
[0036] Controller Area Network (CAN) is a serial communication protocol bus used for real-time applications and is one of the most widely used field buses in the world.
[0037] Ethernet: It is a computer local area network technology and the most common communication protocol standard used in current local area networks.
[0038] ModbusRTU (Remote Terminal Unit): This method often uses RS485 as the physical layer. The serial port of the chip is generally used to send and receive data messages, and the message data uses binary data for communication.
[0039] ModbusTCP: This is a Modbus variant that uses a TCP network for communication and connects through port 502. Since the Ethernet underlying layer has implemented CRC32 data integrity check, the message does not require checksum calculation.
[0040] CANopen: It is an application layer protocol. It does not specify the implementation of the physical layer and data link layer. Therefore, it does not have to be implemented based on the CAN bus. It can also be implemented based on Ethercat.
[0041] The embodiments of the present invention provide a multi-bus input-output circuit system and a control method, which can improve communication efficiency and reduce resource competition, and do not require a large number of wires to interconnect multiple controllers.
[0042] The following is a detailed description with reference to the accompanying drawings.
[0043] See also Figure 1 , the multi-bus input-output circuit system of the embodiment of the present invention comprises a main controller module, an external controller, an output module and an input module; wherein there are multiple external controllers;
[0044] The main controller module includes a plurality of bus interfaces, each bus interface is connected to a bus, and each bus is connected to at least one external controller;
[0045] The main controller module presets a priority for each external controller and a priority output mode for each output port of the output module; the priority output mode is to perform a priority output according to the priority preset by the main controller module for each external controller.
[0046] Specifically, the main controller module of the embodiment of the present invention may be a microcontroller unit controller (Microcontroller Unit, i.e. Figure 1 The main controller module supports multiple communication protocols, including but not limited to ModbusRTU, ModbusTCP and CANopen. The bus includes a variety of different bus types, including controller area network (i.e. Figure 1 CAN bus in), Ethernet (i.e. Figure 1The bus and the external controller may be in a one-to-one or one-to-many relationship, that is, each bus may correspond to one external controller or each bus may correspond to multiple external controllers.
[0047] As an optional implementation, the main controller module of the embodiment of the present invention mainly plays the role of master control, and can schedule and allocate resources for external controllers to use. The main controller module communicates with the external controller through different buses and is compatible with multiple external controllers, effectively reducing the cost of interconnection between devices.
[0048] In addition, the embodiment of the present invention sets priorities for external controllers and presets priority output modes for output modules, so that high-priority external controllers preempt the right to use low-priority external controllers, effectively avoiding competition for resources among multiple external controllers and improving communication efficiency.
[0049] For example, when two external controllers need to communicate, the external controller with a high priority will seize the right to use the external controller with a low priority, thus avoiding competition for communication resources between the two external controllers and effectively improving the efficiency of communication. When three external controllers need to communicate, the external controller with a high priority will seize the right to use the external controllers with medium and low priorities, and the controller with medium priority will seize the right to use the external controller with low priority. Similarly, by setting priorities for external controllers and presetting priority output modes for output modules, it is possible to effectively avoid competition for resources among multiple external controllers and improve the efficiency of communication.
[0050] In some embodiments, the main controller module also presets a safety output mode for each output port of the output module. The safety output mode is that the main controller module outputs a safety result, and the safety result is a high-level signal.
[0051] As an optional implementation, the safety output mode of the embodiment of the present invention is mainly used for equipment emergency stop signals. For example, when the emergency stop of an external device is connected to one of the IO ports (i.e., the output port) of the output module and the high level is the trigger signal, and when multiple external controllers are occupied at the same time, as long as one external controller needs to emergency stop the external device (i.e., needs to output a high-level signal), the main controller module will immediately output a high-level output result after receiving the signal; and only when all occupied external controllers do not need to emergency stop will a low-level signal be output (i.e., all dangers are eliminated). In addition, the safety output mode of the embodiment of the present invention can be controlled by multiple external controllers, ensuring the safety of personnel on site when the multi-bus input and output circuit system is in operation.
[0052] In some embodiments, the input module is used to receive an external level signal, the main controller module is used to receive the external level signal of the input module, and the output module is used to output the output signal of the main controller module and output a level signal corresponding to the output signal.
[0053] In some embodiments, the external controller is used to periodically request and read the signals of the input module and the output module from the main controller module through the corresponding bus.
[0054] As an optional implementation, the external controller of an embodiment of the present invention periodically sends a request to the main controller module through the corresponding bus. If the request response data is returned by the main controller module, the signals of the input module and the output module can be read by the external controller, thereby realizing data synchronization between the external controllers.
[0055] In some embodiments, the external controller is used to actively release occupied resources, so that an external controller with a lower priority can communicate with the main controller module.
[0056] As an optional implementation manner, the embodiment of the present invention can effectively avoid the problem of multiple external controllers competing for resources by actively releasing occupied resources through the external controller.
[0057] In some embodiments, the multi-bus input and output circuit system also includes a host computer, wherein the host computer is connected to the main controller module; the host computer is used to preset a priority allocation method for the main controller module; when the main controller module does not preset a priority for the external controller through the host computer, the priority of the external controller is set directly from high to low according to the communication order between the external controller and the main controller module.
[0058] As an optional implementation, the host computer of the embodiment of the present invention includes a plurality of allocation methods for presetting the priority of the main controller module. For example, the priority of the external controller can be preset by user customization, such as setting a default priority for each external controller; the priority can also be preset by the importance of the external controller, such as setting the priority of the most important external controller to the highest and the priority of the less important external controller to the lowest; the priority can also be preset by the communication order between the external controller and the main controller module, such as setting the priority of the external controller from high to low according to the communication order.
[0059] In some embodiments, the host computer is also used to send the output mode of each output port of the output module to the main controller module; when the main controller module does not preset the output mode for each output port of the output module through the host computer, the output mode of each output port adopts the priority output mode.
[0060] As an optional implementation, the host computer of the embodiment of the present invention communicates only with the main controller module, and the role of the host computer is to preset the output mode for each output port of the output module and to preset the priority allocation method for the main controller module. Whenever an external controller communicates with the main controller module, the main controller module will assign a priority to the external controller according to the preset priority. In practical applications, the host computer can also set a safe output mode for each output port of the output module through the main controller module.
[0061] See also Figure 2 Taking the external controller write instruction as an example, based on the multi-bus input-output circuit system of the present invention, the process of the multi-bus input-output circuit control method of the embodiment of the present invention is as follows:
[0062] Step 1: The external controller sends a data frame of output instructions to the main controller module, wherein the data frame includes but is not limited to a frame header, a control instruction and a CRC check.
[0063] Step 2: After receiving the output signal sent by the external controller, the main controller module parses the data frame to obtain the address of the output port to be controlled, and then determines whether the output mode of the output port is a priority output mode or a safety output mode.
[0064] Step 3: If the result of step 2 is the priority output mode, the main controller module will make a priority judgment on the right to use the output port; when the output port of the output module is occupied by an external controller with a higher priority, a warning signal is returned to the external controller; otherwise, a success signal is returned to the external controller, and a preemption signal is sent to the preempted external controller.
[0065] If the result of step 2 is the safe output mode, the main controller module judges the output result. If the output result meets the safety output requirement, a success signal is returned to the external controller, and a preempted signal is sent to the preempted external controller; otherwise, an error signal is returned to the external controller.
[0066] As an optional implementation, the embodiment of the present invention can reduce resource competition and improve communication efficiency by presetting an output mode for an output port of an output module.
[0067] It can be understood that the contents of the above-mentioned system embodiments are all applicable to the embodiments of the present control method. The functions specifically implemented by the embodiments of the present control method are the same as those of the above-mentioned system embodiments, and the beneficial effects achieved are also the same as those achieved by the above-mentioned system embodiments. Therefore, they will not be repeated here.
[0068] See also Figure 3In some embodiments, the main controller module is also used to periodically query the status of all external controllers (i.e., the main controller module periodically sends query instructions to the external controllers); when the main controller module does not receive reply data from the external controller within a preset time period (i.e., timeout), the unresponsive external controller is set to an offline state and the resources it occupies are released; when the main controller module periodically receives reply data from the external controller, the query is terminated.
[0069] As an optional implementation, the embodiment of the present invention periodically queries the status of the external controller through the main controller module, which can minimize resource usage and improve communication efficiency.
[0070] As an optional implementation, in actual applications, the external controller can also periodically send data read requests to the main controller module to synchronize data and other external controller signals, or send data read requests to the main controller module according to actual needs to reduce bus occupancy.
[0071] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the described embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.
Claims
1. A multi-bus input and output circuit control method, characterized in that: Applicable to a multi-bus input-output circuit system, the multi-bus input-output circuit system comprises a main controller module, an external controller, an output module and an input module; wherein the external controller is multiple; The main controller module includes a plurality of bus interfaces, each of which is connected to a bus, and each of which is connected to at least one of the external controllers; The main controller module presets a priority for each of the external controllers and a priority output mode for each output port of the output module; the priority output mode is to perform a priority output according to the priority preset by the main controller module for each of the external controllers; The multi-bus input-output circuit control method comprises the following steps: The external controller sends a data frame of output instructions to the main controller module; After receiving the output signal sent by the external controller, the main controller module parses the data frame to obtain the address of the output port to be controlled, and determines whether the output mode of the output port is a priority output mode or a safety output mode; If the output mode of the output port is a priority output mode, the main controller module performs a priority judgment on the right to use the output port; when the output port of the output module is occupied by an external controller with a higher priority, a warning signal is returned to the external controller; otherwise, a success signal is returned to the external controller, and a preempted signal is sent to the preempted external controller; If the output mode of the output port is a safe output mode, the main controller module judges the output result; when the output result meets the safety output requirements, a success signal is returned to the external controller, and a preempted signal is sent to the preempted external controller; otherwise, an error signal is returned to the external controller; the safety output is used to indicate that the level signal of the output result is the same as the level signal of the safety result.
2. The multi-bus input / output circuit control method according to claim 1, characterized in that: The main controller module also presets a safety output mode for each output port of the output module, and the safety output mode is that the main controller module outputs the safety result, and the safety result is a high-level signal.
3. The multi-bus input / output circuit control method according to claim 1, characterized in that: The input module is used to receive an external level signal, the main controller module is used to receive the external level signal of the input module, and the output module is used to output the output signal of the main controller module and output a level signal corresponding to the output signal.
4. The multi-bus input / output circuit control method according to claim 3, characterized in that: The external controller is used for periodically requesting and reading the signals of the input module and the output module from the main controller module through the corresponding bus.
5. The multi-bus input / output circuit control method according to claim 1, characterized in that: The external controller is used to actively release occupied resources, so that an external controller with a lower priority can communicate with the main controller module.
6. The multi-bus input / output circuit control method according to claim 1, characterized in that: The main controller module is used to periodically query the status of all external controllers; When the main controller module does not receive reply data from the external controller within a preset time period, the external controller that has not replied is set to an offline state and the resources occupied by it are released.
7. The multi-bus input / output circuit control method according to claim 1, characterized in that: The main controller module also receives an output signal from the external controller; When the main controller module receives the output signal of the external controller, if the output port of the output module is occupied by an external controller with a higher priority, a warning signal is returned to the external controller; otherwise, a success signal is returned to the external controller.
8. The multi-bus input / output circuit control method according to claim 1, characterized in that: The multi-bus input-output circuit system further comprises a host computer, wherein the host computer is connected to the main controller module; The host computer is used to preset a priority allocation method for the main controller module; when the main controller module does not preset a priority for the external controller through the host computer, the priority of the external controller is set directly from high to low according to the communication sequence between the external controller and the main controller module.
9. The multi-bus input / output circuit control method according to claim 8, characterized in that: The host computer is also used to send the output mode of each output port of the output module to the main controller module; When the main controller module does not preset an output mode for each output port of the output module through the host computer, the output mode of each output port adopts a priority output mode.
