Node number configuration method, bus system and computer readable storage medium

Through the cascading connection structure between the master and the slave, the bus system sends node number configuration messages and control signals, and the slave's automated node number configuration is realized, solving the problem of inefficient manual configuration, reducing costs and improving configuration efficiency.

CN120499149AActive Publication Date: 2025-08-15SHENZHEN CITY SAMKOON TECH
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510528519.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-08-15
Estimated Expiration
2045-04-25

AI Technical Summary

Technical Problem

In the prior art, node number configuration relies on manual operation, resulting in high labor and time costs and low configuration efficiency.

Method used

Through the cascading connection structure between the host and the slave, the node number configuration message and control signal are sent using the bus system to realize the automatic node number configuration of the slave.

Benefits of technology

The automated configuration of node numbers is realized, which significantly reduces labor and time costs, improves configuration efficiency, and is suitable for large-scale industrial control scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120499149A_ABST
    Figure CN120499149A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a node number configuration method, a bus system and a computer readable storage medium, and relates to the technical field of communication. The method comprises the following steps: determining a preset first node number as a target node number; generating a node number configuration message according to the target node number, and sending the node number configuration message; under the condition that the target node number is the first node number, sending a control signal, so that the slave computer performs node number setting in response to the control signal; in response to a received node number configuration completion message sent by the slave, performing node number updating on the target node number to obtain a second node number, and determining the second node number as the target node number; and when the target node number is different from the preset termination node number threshold, returning to the step of generating the node number configuration message according to the target node number. According to the embodiment of the invention, the node number of the equipment can be automatically configured, and the node number configuration cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a node number configuration method, a bus system, and a computer-readable storage medium. Background Art

[0002] A serial communication protocol is a communication protocol used to transmit data within a computer network. In a network system (such as a CANopen network system) built using bus-based serial communication protocols (e.g., CAN and CANopen), each device must be connected to the bus, and messages are sent over the bus to enable information exchange between multiple devices. Each device must be assigned a unique node number. This node number serves as a device identifier to distinguish between devices and can also be used to determine the receiving device of messages transmitted on the bus.

[0003] Currently, manual configuration of device node numbers is often done manually. For example, users can use hardware such as dip switches to manually set the device's node number. However, this method of node number configuration incurs significant labor and time costs, making node number configuration inefficient.

[0004] Therefore, how to reduce the cost of configuring node numbers has become a technical problem that needs to be solved urgently. Summary of the Invention

[0005] The main purpose of the embodiments of the present application is to propose a node number configuration method, a bus system and a computer-readable storage medium, aiming to realize automatic configuration of the node number of the device and reduce the cost of configuring the node number.

[0006] To achieve the above objectives, a first aspect of an embodiment of the present application provides a bus system, comprising:

[0007] A host and at least two slaves; wherein the host includes a first control end module, and each of the slaves includes a second control end module and a receiving end module;

[0008] The host is communicatively connected to each of the slaves via a bus; the receiving end module of each of the slaves is electrically connected to the second control end module of another slave or the first control end module of the host;

[0009] The host is used to send a node number configuration message through the bus, and the host is also used to send a control signal to the receiving end module of the slave electrically connected to the host through the first control end module;

[0010] The slave is used to set the node number according to the node number configuration message in response to receiving the control signal; the slave is also used to send the control signal through the second control end module when the second control end module of the slave is electrically connected to another slave.

[0011] In some embodiments, the host further includes a first main control module; the first control end module includes an inverting unit, a photoelectric coupling unit and a first interface unit;

[0012] The first main control module is electrically connected to the inverting unit; the inverting unit is electrically connected to the photoelectric coupling unit; the photoelectric coupling unit is electrically connected to the first interface unit; and the first interface unit is used to electrically connect to the receiving end module.

[0013] In some embodiments, the inverting unit includes a first resistor, a first capacitor, and an inverter; the photoelectric coupling unit includes a second resistor and a photoelectric coupler;

[0014] The first resistor is electrically connected to the inverter and one end of the first capacitor; the other end of the first capacitor is grounded; the inverter is electrically connected to the photoelectric coupler and one end of the second resistor, and the other end of the second resistor is electrically connected to the photoelectric coupler; the photoelectric coupler is electrically connected to the first interface unit.

[0015] In some embodiments, the slave device further includes a second master control module; the receiving end module includes a second interface unit, a third resistor, a fourth resistor, and a fifth resistor;

[0016] The second interface unit is used to electrically connect to the first control end module or the second control end module;

[0017] The second interface unit is electrically connected to the third resistor, one end of the fourth resistor, and one end of the fifth resistor; the other end of the fourth resistor is grounded; and the other end of the fifth resistor is electrically connected to the second main control module.

[0018] To achieve the above-mentioned object, a second aspect of an embodiment of the present application provides a node number configuration method, which is applied to a host in the bus system described in the first aspect above, and includes:

[0019] Determine the preset first node number as the target node number;

[0020] generating a node number configuration message according to the target node number, and sending the node number configuration message;

[0021] When the target node number is the first node number, sending a control signal so that the slave device sets the node number in response to the control signal;

[0022] In response to receiving a node number configuration completion message sent by the slave, updating the target node number to obtain a second node number, and determining the second node number as the target node number;

[0023] In the case that the target node number is different from the preset termination node number threshold, the process returns to the step of generating a node number configuration message according to the target node number.

[0024] In some embodiments, before updating the target node number in response to receiving the node number configuration completion message sent by the slave to obtain the second node number, the method further includes:

[0025] Determine the time of sending the node number configuration message as the starting time;

[0026] Determining a signal detection period according to the starting time and a preset signal response duration threshold;

[0027] If the node number configuration completion message sent by the slave is not received within the signal detection period, the node number configuration message is sent.

[0028] In some embodiments, the host is electrically connected to a receiving end of the slave;

[0029] The sending of the control signal so that the slave device sets the node number in response to the control signal includes:

[0030] determining the level of the receiving end of the slave to be a first level, so that the slave sets the node number when the level of the receiving end is the first level;

[0031] After sending the control signal, the method further includes:

[0032] If the target node number is the first node number, in response to receiving the node number configuration completion message sent by the slave, the level of the receiving end of the slave is determined to be a second level; wherein the second level is different from the first level.

[0033] In some embodiments, updating the target node number to obtain the second node number includes:

[0034] Summing the target node number and a preset unit value to obtain a second node number;

[0035] When the target node number is different from a preset termination node number threshold, returning to the step of generating a node number configuration message according to the target node number includes:

[0036] Obtaining the number of at least two slaves to obtain the total number of slaves;

[0037] Summing the product of the total number of slaves and the unit value and the first node number to obtain a target total value, and determining the target total value as the termination node number threshold;

[0038] If the target node number is smaller than the termination node number threshold, return to the step of generating a node number configuration message according to the target node number.

[0039] To achieve the above-mentioned object, a third aspect of an embodiment of the present application provides a node number configuration method, which is applied to a slave in the bus system described in the first aspect above, wherein the slave includes a second control end module, and the method includes:

[0040] Obtaining a node number configuration message sent by a host; wherein the node number configuration message includes a target node number;

[0041] In the case of receiving the control signal, determining the control signal as a first control signal, and performing a node number setting operation according to the target node number;

[0042] Sending a node number configuration completion message to the host;

[0043] In a case where the second control end module is electrically connected to another slave, a second control signal is sent through the second control end module, so that the other slave performs a node number setting operation in response to the second control signal.

[0044] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method described in the second aspect or the method described in the third aspect.

[0045] The node number configuration method, bus system and computer-readable storage medium proposed in the present application, which are connected by a cascade connection structure of a host and at least two slaves, combined with the transmission of the node number configuration message on the bus, can realize the automatic configuration of the slave node number. Specifically, the host sends a control signal to the receiving end module of the first slave through the first control end module, and the second control end module of each slave (except the last slave) is connected to the receiving end module of the next slave in sequence. The host sends the node number configuration message to each slave through the bus, and each slave will set its own node number according to the node number configuration message only after its receiving end module detects the control signal (such as a high level). In addition, the slave can also send a control signal to the receiving end module of the next slave through the second control end module, thereby triggering the node number configuration process of the next slave. In this way, the node number can be automatically configured without manually configuring the node number, which can significantly reduce the labor cost and time cost of configuring the node number. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 This is a module block diagram of the bus system provided by an embodiment of the present application;

[0047] Figure 2 This is a system architecture diagram of the bus system provided by an embodiment of the present application;

[0048] Figure 3 This is a module block diagram of the host provided in an embodiment of the present application;

[0049] Figure 4 is a circuit schematic diagram of the first control end module provided in an embodiment of the present application;

[0050] Figure 5 This is a circuit diagram of a receiving module provided in an embodiment of the present application;

[0051] Figure 6 This is a flowchart of the node number configuration method provided in an embodiment of the present application;

[0052] Figure 7 is a flowchart of a node number configuration method provided by another embodiment of the present application;

[0053] Figure 8 is a flowchart of a node number configuration method provided by another embodiment of the present application;

[0054] Figure 9 is a flowchart of a node number configuration method provided by another embodiment of the present application;

[0055] Figure 10 This is a configuration flow chart of a host of an application example provided in an embodiment of the present application;

[0056] Figure 11is a flowchart of a node number configuration method provided by another embodiment of the present application;

[0057] Figure 12 This is a configuration flow chart of a slave device of an application example provided in an embodiment of the present application.

[0058] Reference numerals: host 100; slave 200; first control end module 110; first main control module 120; receiving end module 210; second control end module 220; inverting unit 111; photoelectric coupling unit 112; first interface unit 113; second interface unit 211;

[0059] Photocoupler U1; inverter U2; first capacitor C1; first resistor R1; second resistor R2; third resistor R3; fourth resistor R4; and fifth resistor R5. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0061] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.

[0062] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0063] First, let’s analyze some of the terms used in this application:

[0064] CAN (Controller Area Network) protocol: A serial communication protocol. Originally developed for communication between electronic control units (ECUs) within automobiles, the CAN protocol is currently widely used in industrial measurement and control and automation. It defines the high and low levels of the physical layer and the frame structure of the data link layer. In a network system using the CAN protocol, multiple devices communicate via the CAN bus. The CAN bus is a multi-master bus, allowing all devices connected to the bus to send messages, all of which are composed and sent according to a fixed format. This means that multiple devices can initiate communication simultaneously. When multiple devices begin sending messages simultaneously, priority is determined based on the identifier (ID) in the message. The identifier does not indicate the destination address of the message, but rather the priority of the message accessing the bus.

[0065] CANopen protocol: A high-level protocol based on the CAN protocol, it defines an application-layer communication protocol based on the CAN protocol. The CANopen protocol defines multiple communication objects, such as process data objects (PDOs), service data objects (SDOs), and emergency objects (EMCYs). PDOs are used for fast transmission of real-time data, such as motor speed and position information, and their transmission is event-driven or periodic. SDOs are primarily used for configuring and reading device parameters, such as setting the frequency of an inverter, and are based on a request-response mechanism. Emergency objects are used to send alarm information when an emergency occurs in the device.

[0066] Node ID: A unique identifier used to identify each device. In a CAN network system, the master device can communicate and exchange data with slave devices based on the node ID. The node ID can be a number.

[0067] LSS (Layer setting service) protocol: It is the setting service and protocol of CANopen. It allows a CANopen device with LSS master function to query or change the three data of the physical layer, data link layer and application layer on the CANopen device through the CAN network, including the node number (Node_ID), baud rate, etc.

[0068] CANopen Object Dictionary (OD): An ordered group of objects. In a CANopen network, each device has an OD. The OD describes all parameters of the device and its network behavior.

[0069] The node number configuration method, bus system and computer-readable storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the bus system in the embodiments of the present application is described.

[0070] Figure 1 It is an optional module block diagram of the bus system provided in the embodiment of the present application. Figure 1 The bus systems in the CAN bus include:

[0071] A host 100 and at least two slaves 200; wherein the host 100 includes a first control end module 110, and each slave 200 includes a second control end module 220 and a receiving end module 210;

[0072] The host 100 is connected to each slave 200 through a bus; the receiving end module 210 of each slave 200 is electrically connected to the second control end module 220 of another slave 200, or the first control end module 110 of the host 100;

[0073] The host 100 is used to send a node number configuration message via the bus, and the host 100 is also used to send a control signal to the receiving end module 210 of the slave 200 electrically connected to the host 100 through the first control end module 110;

[0074] The slave 200 is used to set the node number according to the node number configuration message in response to receiving the control signal; the slave 200 is also used to send the control signal through the second control end module 220 when the second control end module 220 of the slave 200 is electrically connected to another slave 200.

[0075] The beneficial effects of the embodiments of the present application include but are not limited to: through the cascade connection structure of the host 100 and at least two slaves 200, combined with the transmission of the node number configuration message on the bus, it is possible to realize the automatic configuration of the node number. Specifically, the host 100 sends a control signal to the receiving end module 210 of the first slave 200 through the first control end module 110, and the second control end module 220 of each slave 200 (except the last slave 200) is connected to the receiving end module 210 of the next slave 200 in sequence. The host 100 sends the node number configuration message to each slave 200 through the bus, and each slave 200 will only set its own node number according to the node number configuration message after its receiving end module 210 detects the control signal (such as a high level). In addition, the slave 200 can also send a control signal to the receiving end module 210 of the next slave 200 through the second control end module 220, thereby triggering the node number configuration process of the next slave 200. This allows for automatic configuration of node numbers without the need for manual configuration, significantly reducing the labor and time costs of configuring node numbers.

[0076] In some embodiments, a bus system refers to a network system composed of multiple devices (including a host 100 and at least two slaves 200), and the bus system uses a bus-based communication protocol. Specifically, in the bus system, the host 100 and each slave 200 are connected to the bus, that is, all devices in the bus system are mounted on the bus for communication.

[0077] In some embodiments, the bus system can adopt a serial bus communication protocol with one master and multiple slaves. For example, the bus system can adopt any one of the CAN protocol, the CANopen protocol, and the MODBUS RTU protocol, or can adopt other serial bus communication protocols with one master and multiple slaves, but is not limited thereto. It should be noted that the multiple devices in the bus system include a host 100 and a slave 200. The devices in the bus system are also referred to as network nodes. For example, when the bus system adopts the CANopen protocol, the CANopen devices in the bus system are also referred to as CANopen nodes. Specifically, the devices in the bus system can be computers, such as any one of a personal computer (PC), a desktop computer, and a laptop computer.

[0078] In some embodiments, the first control-end module 110 refers to the control end of the host 100 and is used to send control signals. The second control-end module 220 refers to the control end of the slave 200 and is used to send control signals. The receiving-end module 210 of the slave 200 refers to the receiving end of the slave 200 and is used to receive control signals sent by the host 100 (or other slaves 200).

[0079] In some embodiments, each device in the bus system, such as the host 100 or the slave 200, may include a bus interface (not shown in the figure). The bus interface is electrically connected to the bus.

[0080] In some embodiments, as Figure 1 As shown, in the same slave 200 , the receiving end module 210 is electrically connected to the second control end module 220 .

[0081] It should be noted that Figure 1 The BUS in the description represents a bus. Specifically, the bus may be a serial bus, such as a CAN bus.

[0082] In some embodiments, as Figure 2As shown, the CAN bus includes two communication lines, CAN_H and CAN_L. The bus system includes n+1 devices, specifically a master 100 and n slaves 200. Each device is electrically connected to the CAN_H communication line and the CAN_L communication line. For example, device 1 can be identified as the master 100, and then a preset node number can be assigned to the master 100. The master 100 then manages the node numbers of the subsequent slaves 200. Specifically, the node number of the master 100 can be set to a preset maximum node number, such as 127.

[0083] It should be noted that in a CAN network system (i.e., a bus system), all devices can send messages via the bus, and the messages sent are visible to all devices. In other words, it is difficult for a device (such as each slave 200) that receives a message from the bus to determine whether the message is sent to itself. In consideration of the above problem, the embodiment of the present application uses a control line (see Figure 2 ) The host 100 and each slave 200 are connected in sequence, and a control signal is transmitted by a control line to determine the device that receives the node number configuration message based on the control signal. Specifically, when the level of the control line is high, it is equivalent to the device at the right end of the control line receiving the control signal. The level of the control line (such as high or low) is controlled by the device at the left end of the control line. For example, the first control end of the host 100 is connected to the receiving end of the first slave 200 via a control line. The host 100 is the device at the left end of the control line and can control the level of the control line, that is, control the level of the receiving end of the first slave 200.

[0084] In some embodiments, as Figure 2 As shown, the first control end module 110 of the host 100 is electrically connected to the receiving end module 210 of the first slave 200, and the second control end module 220 of the first slave 200 is electrically connected to the receiving end module 210 of the second slave 200. The connection relationship of the above modules can be referred to Figure 1 It should be noted that Figure 2 The ellipsis in the figure indicates that there may be more than two slaves 200 connected in sequence. For example, if the number of slaves 200 is n, then the second control-end module 220 of the second-to-last slave 200 (i.e., the n-1th slave 200) is electrically connected to the receiving-end module 210 of the last slave 200 (i.e., the nth slave 200).

[0085] In some embodiments, when the receiving end of the slave 200 (ie, the receiving end module 210) is connected to the control end of the host 100 (ie, the first control end module 110), the control signal received by the slave 200 is sent by the host 100. For example, Figure 2 The first slave 200 can receive the control signal sent by the host 100.

[0086] In another embodiment, when the receiving end of the slave 200 is connected to the control end (ie, the second control end module 220) of the previous slave 200, the control signal received by the slave 200 is sent by the previous slave 200. For example, Figure 2 The second slave 200 can receive the control signal sent by the first slave 200.

[0087] It should be noted that the second control end module 220 of the slave 200 is electrically connected to another slave 200, indicating that the slave 200 is connected to the next slave 200, that is, the slave 200 is not the last slave 200. Therefore, the slave 200 can send a control signal to the next slave 200. For example, Figure 2 In the embodiment, the first slave 200 can send a control signal to the second slave 200, so that after receiving the control signal, the second slave 200 performs node number configuration according to the node number configuration message broadcast by the host 100 through the bus.

[0088] In some embodiments, Figure 2 In the bus network shown, the process of the host 100 configuring the node number of the slave 200 may specifically include:

[0089] (1) The host 100 raises the level of the control line to which it is connected, that is, raises the level of the receiving module 210 of the first slave 200. Then, the host 100 sends a message to configure node number 1 (i.e., a node number configuration message) via the bus.

[0090] (2) After receiving the message for configuring node number 1, the first slave 200 checks whether its receiving module 210 is at a high level. If the receiving module 210 of the first slave 200 is at a high level, it indicates that the node number configuration message needs to be received by the first slave 200. Therefore, the first slave 200 sets its node number to 1 in this case.

[0091] (3) The first slave 200 sends a message indicating that the configuration of node number 1 is complete (i.e., a node number configuration complete message) via the bus. At the same time, the first slave 200 raises the level of the control line connected to its second control module, which in turn raises the level of the receiving end module 210 of the second slave 200.

[0092] (4) After receiving the message indicating that the configuration of node number 1 is complete, the master 100 pulls the level of the control line connected to the master 100 low, indicating that the first slave 200 is not the recipient of the configuration message for the next node number. The master 100 then sends a message to configure node number 2 via the bus.

[0093] (5) After receiving the message for configuring node number 2, the second slave 200 checks whether its receiving end module 210 is at a high level. If the receiving end module 210 of the second slave 200 is at a high level, the second slave 200 sets its node number to 2. Then, the second slave 200 sends a message through the bus indicating that the configuration of node number 2 is complete. In addition, if the second control end module 220 of the second slave 200 is connected to the next slave 200, the second slave 200 pulls the control line connected to its second control end module 220 high to set the next slave 200 as the receiving device of the node number configuration message.

[0094] (6) After receiving the message indicating that the configuration of node number 2 is completed, the master 100 sends a message indicating that the configuration of node number 3 is completed. By repeating the above steps, the node number of each slave 200 can be automatically configured.

[0095] See also Figure 3 In some embodiments, the host 100 further includes a first main control module 120; the first control end module 110 includes an inverting unit 111, a photoelectric coupling unit 112 and a first interface unit 113;

[0096] The first main control module 120 is electrically connected to the inverting unit 111 ; the inverting unit 111 is electrically connected to the photoelectric coupling unit 112 ; the photoelectric coupling unit 112 is electrically connected to the first interface unit 113 ; the first interface unit 113 is used to electrically connect to the receiving end module 210 .

[0097] The advantage of this embodiment is that the host 100 is jointly constructed by the first main control module 120, the inverting unit 111, the photoelectric coupling unit 112 and the first interface unit 113 for automatically configuring the node number. Specifically, the first main control module 120 realizes signal logic conversion by electrically connecting the inverting unit 111, and then performs electrical isolation through the photoelectric coupling unit 112, and finally connects to the receiving end module 210 of the slave 200 through the first interface unit 113. In this way, the hardware circuit can automatically complete the configuration process of the node number of the device in the bus system, reducing the dependence on manual operation, being able to automatically configure the node number, and improving the anti-interference ability of the system. It can significantly reduce the labor cost and time cost required to configure the node number, improve the efficiency of node number configuration, and is suitable for large-scale industrial control scenarios.

[0098] It should be noted that the first main control module 120 is the main control module in the host 100. The first main control module 120 can be used to process messages (such as node number configuration messages, node number configuration completion messages) or process control signals. Specifically, the first main control module 120 can be any one of a central processing unit (CPU), a microcontroller unit (MCU), and a programmable logic controller (PLC). The first main control module 120 can also be other types of control chips, which are not limited in the embodiments of the present application.

[0099] In some embodiments, the inverting unit 111 is used to perform logic conversion on the signal, such as performing signal inversion processing.

[0100] In some embodiments, the first control module 110 of the host 100 has the same circuit structure as the second control module 220 of each slave 200. The structure and function of the second control module 220 can be referred to the detailed explanation of the first control module 110 and will not be repeated here.

[0101] See also Figure 4 In some embodiments, the inverting unit 111 includes a first resistor R1, a first capacitor C1, and an inverter U2; the photoelectric coupling unit 112 includes a second resistor R2 and a photoelectric coupler U1;

[0102] The first resistor R1 is electrically connected to the inverter U2 and one end of the first capacitor C1; the other end of the first capacitor C1 is grounded; the inverter U2 is electrically connected to the photoelectric coupler U1 and one end of the second resistor R2, and the other end of the second resistor R2 is electrically connected to the photoelectric coupler U1; the photoelectric coupler U1 is electrically connected to the first interface unit 113.

[0103] The advantage of this embodiment is that a control signal is sent to the slave 200 through the first control end module 110 composed of a first resistor R1, a first capacitor C1, an inverter U2, a second resistor R2, an optocoupler U1 and a first interface unit 113, so that the slave 200 that receives the control signal sets its own node number according to the node number configuration message, thereby realizing the automatic configuration of the node number of the slave 200 in the bus system, reducing the labor cost and time cost required for configuring the node number, improving the node number configuration efficiency, and being suitable for large-scale industrial control scenarios.

[0104] In some embodiments, the first interface unit 113 may include a pin H1. For example, the pin H1 may be a 4-pin pin.

[0105] It should be noted that in Figure 4In FIG, CAN_K1 represents an interface, and the CAN_K1 interface is used to electrically connect the first main control module 120. CAN_H represents a communication line, and CAN_L represents another communication line, and the CAN_H communication line and the CAN_L communication line (see Figure 2 ) are both CAN buses in the bus system. In some embodiments, the resistance of the first resistor R1 can be 1 kΩ (kilo-ohm). The capacitance of the first capacitor C1 can be 0.1 μF (microfarad). The resistance of the second resistor R2 can be 330 Ω (ohm). In some embodiments, the second resistor R2 can be connected to a 3.3V constant voltage power supply.

[0106] In some embodiments, the inverter U2 is used to improve the driving capability and load capacity of the first control end module 110 .

[0107] In some embodiments, the optocoupler U1 (optocoupler for short) has pins 1, 2, 3, and 4. When pin 2 of the optocoupler U1 is at 0V, pins 3 and 4 of the optocoupler U1 are conductive.

[0108] See also Figure 5 , in some embodiments, the slave 200 further includes a second master control module (not shown in the figure); the receiving end module 210 includes a second interface unit 211, a third resistor R3, a fourth resistor R4 and a fifth resistor R5;

[0109] The second interface unit 211 is used to electrically connect to the first control end module 110 or the second control end module 220;

[0110] The second interface unit 211 is electrically connected to the third resistor R3, one end of the fourth resistor R4, and one end of the fifth resistor R5; the other end of the fourth resistor R4 is grounded; the other end of the fifth resistor R5 is electrically connected to the second main control module.

[0111] The advantage of this embodiment is that the receiving end module 210, which is composed of the second interface unit 211, the third resistor R3, the fourth resistor R4, and the fifth resistor R5, detects whether a control signal sent by the master 100 (or the previous slave 200) has been received. Upon receiving the control signal, the slave 200 sets its own node number according to the node number configuration message. This allows the node number of the slave 200 to be automatically configured, reducing the labor and time required for node number configuration, improving the efficiency of node number configuration, and is suitable for large-scale industrial control scenarios.

[0112] It should be noted that the second main control module is the main control module in the slave 200. The second main control module can be used to process messages (such as node number configuration messages) or process control signals. Specifically, the second main control module can be any one of a central processing unit (CPU), a microcontroller unit (MCU), and a programmable logic controller (PLC). The second main control module can also be other types of control chips, which are not limited in the embodiments of the present application.

[0113] In some embodiments, the second interface unit 211 may include a socket H2. Specifically, the socket H2 may be a 4-pin socket. For example, the pin H1 of the other device (host 100 or other slave 200) (refer to Figure 4 ) can be plugged into the socket H2 of the slave 200 to transmit control signals between different devices.

[0114] It should be noted that in Figure 5 In some embodiments, the CAN_K2 interface is used to electrically connect to the second main control module. In some embodiments, the resistance value of the third resistor R3 is 4.7kR (kilo-ohms), the resistance value of the fourth resistor R4 is 10kR, and the resistance value of the fifth resistor R5 is 470R (ohms). In some embodiments, the third resistor R3 can be connected to a 5V constant voltage power supply.

[0115] In some embodiments, assume that pin H1 of the first control terminal in the host 100 is plugged into socket H2 of the receiving terminal in the slave 200. For example, when the CAN_K1 interface of the first control terminal outputs a high level, pins 1 and 3 of socket H2 are connected, and the level input to the CAN_K2 interface is low. For another example, when the CAN_K1 interface outputs a low level, pins 1 and 3 of socket H2 are disconnected, and the level input to the CAN_K2 interface is high.

[0116] Figure 6 This is an optional flowchart of the node number configuration method provided in an embodiment of the present application, and the node number configuration method is applied to the host in the above-mentioned bus system. Figure 6 The method may include but is not limited to steps 101 to 105.

[0117] Step 101: determine a preset first node number as a target node number;

[0118] Step 102: Generate a node number configuration message according to the target node number and send the node number configuration message;

[0119] Step 103: When the target node number is the first node number, a control signal is sent to enable the slave to set the node number in response to the control signal.

[0120] Step 104: in response to receiving the node number configuration completion message sent by the slave, updating the target node number to obtain a second node number, and determining the second node number as the target node number;

[0121] Step 105: When the target node number is different from the preset termination node number threshold, return to the step of generating a node number configuration message according to the target node number.

[0122] The beneficial effects of the embodiments of the present application include but are not limited to: by generating a node number configuration message corresponding to the target node number, and sending the message to the slave. If the target node number is the preset first node number, it indicates that the slave that needs to be configured with the node number is the first slave connected to the host, so the host sends a control signal to enable the slave (i.e., the slave directly connected to the first control end module of the host) to set the node number in response to the control signal; when the node number configuration completion message fed back by the slave is received, it indicates that the slave that has received the control signal has completed the node number configuration. When the termination condition is not reached, such as when the target node number is different from the preset termination node number threshold, the node number is updated, and the node number configuration message is generated again according to the updated node number (i.e., the second node number), and the above process (steps 102 to 105) is circulated to configure the node number of the next slave. In this way, the node number of each slave can be automatically configured without manually configuring the node number, which can significantly reduce the labor cost and time cost of configuring the node number.

[0123] In step 101 of some embodiments, the first node number is a pre-set node number, for example, the first node number may be 1. The first node number may also be other numerical values or characters, without limitation. The target node number is the node number currently assigned to the slave.

[0124] In step 102 of some embodiments, the node number configuration message is a message for instructing the slave to set a node number. The node number configuration message includes a target node number. For example, assuming the target node number is 2, the node number configuration message generated based on the target node number is used to instruct the slave to set the node number to 2.

[0125] In some embodiments, when the bus network adopts the CAN protocol, the node number configuration message is transmitted on the bus in the form of a data packet, and the maximum byte of each data packet in the CAN protocol is 8 bytes. For example, for the node number configuration message M1 sent by the host (hereinafter referred to as message M1), the value of the first byte of the message M1 can be F0 (hexadecimal), and the value of the second byte can be F1. The values of these two bytes indicate that this message is used to configure related functions, such as configuring the baud rate, configuring the node number, etc. The value of the third byte of the message M1 can be 01, which indicates that the specific function of this message is to configure the node number. The value of the fourth byte of the message M1 is the node number to be configured, that is, the target node number. For example, the value range of the target node number can be 1 to 126.

[0126] In step 103 of some embodiments, if the target node number is the first node number, it indicates that the slave machine that needs to be configured with the node number is the first slave machine connected to the first control end module of the host machine, so the host machine needs to send a control signal to enable the first slave machine to perform the node number setting operation. Specifically, sending a control signal refers to sending a control signal to the receiving end module of the slave machine through the first control end module of the host machine. For example, the host machine can send a high-level signal, specifically to pull up the level of the receiving end module of the slave machine connected to the first control end module. For example, Figure 2 As shown, the host and the first slave are connected via a control line, that is, the first control-end module of the host is electrically connected to the receiving-end module of the first slave. Assuming the first node number is 1, then when the target node number is 1, the host sends a control signal (e.g., a high-level signal). Upon receiving the control signal, the first slave sets its own node number to 1 according to the node number configuration message sent by the host on the bus.

[0127] In step 104 of some embodiments, the node number configuration completion message is used to indicate that the slave has completed the node number configuration. It should be noted that after the slave completes the node number configuration, it will send the node number configuration completion message via the bus. When the master receives the node number configuration completion message sent by the slave, it can determine that the slave has completed the node number configuration.

[0128] In some embodiments, updating the target node number may be performed by adding 1 to the original target node number. For example, assuming the target node number is 2, the value of the second node number is 2+1=3. 3 may be used as the new target node number to configure the node number of the next slave to 3.

[0129] In step 105 of some embodiments, the termination node number threshold is a threshold used to determine whether to terminate the node number configuration. For example, assuming that the target node number is any integer in the range [1, 126] and is updated by incrementing by 1 each time, the termination node number threshold can be set to 127. If the target node number is different from the preset termination node number threshold, such as if the target node number is in the range [1, 126], the process returns to the step of generating a node number configuration message based on the target node number. If the target node number is equal to the termination node number threshold, such as if the target node number is 127, the node number configuration is terminated.

[0130] See also Figure 7 In some embodiments, before step 104, the node number configuration method may further include but is not limited to steps 201 to 203:

[0131] Step 201, determining the time of sending the node number configuration message as the starting time;

[0132] Step 202: determining a signal detection period based on the start time and a preset signal response duration threshold;

[0133] Step 203: If the node number configuration completion message sent by the slave is not received within the signal detection period, a node number configuration message is sent.

[0134] The advantage of this embodiment is that, taking into account the possibility that the slave may not receive the node number configuration message, the time when the node number configuration message is sent is added to the signal response time threshold to obtain a signal detection period, and the reception of the slave message is continuously detected during the signal detection period. If the node number configuration completion message sent by the slave is not received during the signal detection period, it may be because the slave has not received the node number configuration message. Therefore, the node number configuration message is resent to enable the slave to set the node number, thereby improving the reliability of the node number setting for the slave.

[0135] In step 201 of some embodiments, the starting time refers to the time when the host sends the node number configuration message. For example, if the host sends the node number configuration message at (1:30:00), the starting time is (1:30:00).

[0136] In step 202 of some embodiments, the signal response time threshold is a preset time, such as 100 ms (milliseconds). The signal response time threshold may also be other values, not limited thereto.

[0137] It should be noted that the signal detection period is the continuous time period from the start time to the end time obtained by adding the signal response duration threshold to the start time. The duration of the signal detection period is equal to the signal response duration threshold. For example, assuming the start time is (0:00:00) and the signal response duration threshold is 30 seconds, the signal detection period is the period from (0:00:00) to (0:00:30).

[0138] In step 203 of some embodiments, if the node number configuration completion message sent by the slave is not received within the signal detection period, it indicates that an abnormality has occurred in the node number configuration process of the slave, for example, the slave may not have received the node number configuration message sent by the master. In this case, the master can resend the node number configuration message to reconfigure the node number of the slave. In another embodiment, other measures can also be taken, such as sending (or displaying) a node number configuration abnormality message to remind the user of the node number configuration abnormality.

[0139] See also Figure 8 ,In some embodiments, the host is electrically connected to the receiving end of the slave;

[0140] The step 103 of sending a control signal so that the slave device responds to the control signal and sets the node number may include but is not limited to the step 301:

[0141] Step 301: determining the level of the receiving end of the slave to be a first level, so that the slave sets the node number when the level of the receiving end is the first level;

[0142] After step 103, the node number configuration method further includes step 302:

[0143] Step 302: If the target node number is the first node number, in response to receiving a node number configuration completion message sent by the slave, determine the level of the receiving end of the slave to be a second level; wherein the second level is different from the first level.

[0144] The advantage of this embodiment is that, by determining the level of the receiving end of the slave to be a first level (such as a high level), it is clearly indicated that the slave is a receiving device of the node number configuration message, and then the slave is allowed to set the node number, which can reduce the defect of message conflicts that may occur in the bus system and cause node number configuration confusion. If the target node number is the first node number, it indicates that the slave whose node number is configured is the first slave directly connected to the host. By changing the level of the receiving end of the slave to a level different from the first level, that is, a second level (such as a low level), the slave is allowed to exit the configuration state to avoid interference with the slave that has completed the configuration by other node number configuration messages sent subsequently, thereby improving the reliability and accuracy of the node number setting for the slave.

[0145] In step 301 of some embodiments, the receiving end of the slave device refers to the receiving end module mentioned above.

[0146] In step 302 of some embodiments, the second level may be a low level. Figure 2 As shown in the figure, if the target node number is node number 1, after the host receives the message that the configuration of node number 1 is completed, it can be known that the node number configuration of the first slave has been completed. Therefore, the host pulls the voltage level of the receiving end module of the first slave low, that is, pulls the voltage level of the control line between the host and the first slave low.

[0147] See also Figure 9 In some embodiments, step 104 may include, but is not limited to, step 401:

[0148] Step 401, summing the target node number and the preset unit value to obtain a second node number;

[0149] Step 105 may include but is not limited to steps 402 to 404:

[0150] Step 402, obtaining the number of at least two slaves to obtain the total number of slaves;

[0151] Step 403: summing the product of the total number of slaves and the unit value and the first node number to obtain a target sum value, and determining the target sum value as the termination node number threshold;

[0152] Step 404: If the target node number is less than the termination node number threshold, return to the step of generating a node number configuration message according to the target node number.

[0153] The advantage of this embodiment is that, based on the first node number, an incremental update is performed to assign a node number to each slave, and the termination node number threshold is dynamically determined according to the total number of slaves in the bus system to achieve automatic configuration of the node number. Specifically, the termination node number threshold is calculated based on the total number of slaves. If the target node number is less than the termination node number threshold, it indicates that there are slaves whose node numbers have not yet been set, and therefore the step of generating a node number configuration message according to the target node number is returned, that is, the generation of the next round of node number configuration messages is performed. In this way, the node numbers of multiple slaves can be automatically configured, the risk of omission or duplication of node number configuration is reduced, and the node number configuration efficiency and reliability of the device are improved.

[0154] In some embodiments, in step 401, the unit value is a value used to update the node number, and the unit value is equivalent to the difference between the two node numbers before and after the update. For example, if the unit value is 1, the updated node number (i.e., the second node number) is equal to the original target node number plus 1.

[0155] In step 402 of some embodiments, the total number of slaves refers to the total number of slaves in the bus system.

[0156] In step 403 of some embodiments, for example, assuming that the unit value is 1, the first node number is 1, and the total number of slaves is n, then the termination node number threshold is 1*1+n=n+1.

[0157] In step 404 of some embodiments, for example, assuming the unit value is 1, the first node number is 1, and the total number of machines is 3, the ending node number threshold is 4. If the target node number is 3, the target node number is less than the ending node number threshold (3<4), so the master can generate a message to configure node number 3, so that the slave can configure the node number. In another embodiment, if the target node number is greater than or equal to the ending node number threshold, the node number configuration process ends.

[0158] See also Figure 10 In one example application, a node number configuration method applied to a host may include the following process: The host initializes the node number N to be configured (also referred to as the target node number) to 1. The host's node number is pre-set to 127, which corresponds to the termination node number threshold described above. The host then determines the value of the node number N to be configured. If N = 1, indicating that the device currently being configured is the first slave, the host pulls the control line high and then sends a message to configure node number N. If N is greater than 1 and less than or equal to 126, the host does not need to pull the control line high and directly sends a message to configure node number N, also referred to as the node number configuration message described above. The host then waits for 100 milliseconds (milliseconds) to detect whether a message indicating that node number N configuration is complete is received during this wait period, also referred to as the node number configuration complete message. Specifically, if the first and second bytes of the message are F0F1, and the third byte is 02, this indicates that the node number N configuration complete message is received. If the node number N configuration complete message is not received, the node number N configuration message is resent. If the host receives a message indicating that node N is configured and N = 1, it pulls the control line low. If N is greater than 1 and less than or equal to 126, the host does not need to operate the control line. The host updates node N to N + 1, and the above process repeats until N = 127. Since node 127 is occupied by the host, the configuration process ends at this point.

[0159] In some embodiments, the Layer Setting Service (LSS) protocol can currently be used for dynamic node number management. Specifically, LSS is a functional service and protocol provided by the CANopen protocol. An LSS master station can query or modify parameters such as the node number and baud rate of devices in a CAN network. The LSS master station does not distinguish LSS slaves (i.e., devices) by node number, but rather distinguishes each device based on the data indexed in the device's object dictionary (OD). To obtain the data indexed in the OD of a device in a CAN network, the LSS host typically needs to obtain the device's Electronic Data Sheet (EDS) and import the EDS into the LSS host. The EDS contains the device's object dictionary. Based on the data indexed in the object dictionary, the LSS host can distinguish each device in the CAN network and set parameters such as the node number for each device. However, this node number configuration method requires the user to query the EDS for each device and import it into the LSS host. This operation is complex and has a certain operational threshold for users, resulting in low node number configuration efficiency. In another embodiment, node numbers can currently be manually set using hardware methods such as DIP switches. For example, assuming that the value range of the node number includes 1 to 127, the user can use a 7-bit dip switch to set the node number of each device. In another embodiment, for devices such as servos and frequency converters, the node number can also be set through the buttons or screens provided by the device. The common point of the above-mentioned node number configuration methods is that the user is required to manually configure the node number of the device. The node number configuration method of the embodiment of the present application, in order to solve the problem of the high cost of manually configuring the node number, automatically configures the node number of each slave through the host, which can significantly reduce the labor cost and time cost of configuring the node number and improve the efficiency of node number configuration.

[0160] Figure 11 This is an optional flowchart of the node number configuration method provided in an embodiment of the present application. The node number configuration method is applied to a slave in the above-mentioned bus system, and the slave includes a second control end module. Figure 11 The method may include but is not limited to steps 501 to 504:

[0161] Step 501: Obtain a node number configuration message sent by a host; wherein the node number configuration message includes a target node number;

[0162] Step 502: upon receiving the control signal, determining the control signal as a first control signal, and performing a node number setting operation according to the target node number;

[0163] Step 503: Send a node number configuration completion message to the host;

[0164] Step 504: When the second control end module is electrically connected to another slave, a second control signal is sent through the second control end module, so that the other slave performs a node number setting operation in response to the second control signal.

[0165] The beneficial effects of the embodiments of the present application include but are not limited to: by performing a node number setting operation according to the target node number in the node number configuration message sent by the host when a control signal is received, such as setting the node number of the slave itself to the target node number. A node number configuration completion message is sent to the host so that the host configures the node numbers of other slaves in response to the node number configuration completion message. Moreover, when the second control end module is electrically connected to another slave, a second control signal is sent through the second control end module so that the other slave performs a node number setting operation in response to the second control signal. In this way, the node numbers of each slave can be automatically configured without the need for manual configuration of the node numbers, which can significantly reduce the labor cost and time cost of configuring the node numbers.

[0166] In step 501 of some embodiments, the host is in communication with the slave via a bus, and the slave may obtain a node number configuration message sent by the host.

[0167] In step 502 of some embodiments, the first control signal refers to a control signal received by the slave. The first control signal may be a control signal sent by the master, or a control signal sent by the previous slave of the slave. For example, Figure 2 As shown, if the method of the embodiment of the present application is applied to the first slave, the first control signal is a control signal sent by the master. If the method of the embodiment of the present application is applied to the second slave, the first control signal is a control signal sent by the first slave.

[0168] In step 503 of some embodiments, when the bus network utilizes the CAN protocol, the node number configuration completion message can be an 8-byte message. For example, in a node number configuration completion message M2 (hereinafter referred to as message M2) sent by a slave device that has completed node number configuration, the first byte of message M2 can have a value of F0 (hexadecimal) and the second byte can have a value of F1. These two byte values indicate that this message is used for configuration-related functions, such as configuring the baud rate or the node number. The third byte of message M2 can have a value of 02, indicating that the node number configuration is complete. The fourth byte of message M2 indicates whether the node number configuration was successful. For example, if the fourth byte of message M2 has a value of 60, the node number configuration was successful. If the fourth byte of message M2 has a value of 61, the node number configuration failed. Specifically, node number configuration failure may be due to a mismatch in the slave device's software version or an unsupported device model. The fifth byte of message M2 indicates the node number of the slave device that completed the node number configuration. For another example, the sixth byte of message M2 indicates the device model; this field can have any value. The seventh byte and the value of the seventh byte of the message M2 are used to indicate the device software version. These two fields can be any values.

[0169] In step 504 of some embodiments, if the second control end module is electrically connected to another slave, it indicates that the slave is not the last slave, so the slave sends a second control signal through the second control end module to indicate that the next slave is the receiving device of the node number configuration message, thereby automatically performing subsequent node number configuration.

[0170] See also Figure 12 In one application example, the node number configuration method applied to the slave may include the following process: continuously waiting to receive messages on the CAN bus and determining whether the node number configuration message sent by the host has been received. Specifically, if the first byte and the second byte in the message content are F0F1 and the third byte is 01, it indicates that the message is a node number configuration message. If the node number configuration message is not received, then continue to wait for receiving messages on the CAN bus. If the node number configuration message is received, check whether the level of the slave's own receiving end (that is, the receiving end module mentioned above) is high. If it is not high, it indicates that the slave is not the target receiving device of the message and continues to wait for receiving messages on the CAN bus. If it is high, set its own node number according to the content of the message. Then, the slave pulls up the level of the control line connected to the next slave, and sends a node number configuration completion message through the CAN bus, thereby feeding back to the host that its own node number has been configured, so that the next slave can perform subsequent node number configuration.

[0171] It should be noted that the specific implementation of the node number configuration method applied to the slave is basically the same as the specific embodiment of the node number configuration method applied to the master, and will not be repeated here.

[0172] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned node number configuration method is implemented.

[0173] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0174] It should be noted that the non-Company's software tools or components that appear in the embodiments of this application are merely examples and do not represent actual use.

[0175] The embodiments described in this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0176] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0177] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.

[0178] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.

[0179] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0180] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0181] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0182] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0183] In addition, the functional units in the various embodiments of the present application 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. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0184] If the integrated unit is implemented in the form of 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 the present application, 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, which is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0185] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.

Claims

1. A bus system, characterized in that: The bus system includes: A host and at least two slaves; wherein the host includes a first control end module, and each of the slaves includes a second control end module and a receiving end module; The host is communicatively connected to each of the slaves via a bus; the receiving end module of each of the slaves is electrically connected to the second control end module of another slave or the first control end module of the host; The host is used to send a node number configuration message through the bus, and the host is also used to send a control signal to the receiving end module of the slave electrically connected to the host through the first control end module; The slave is used to set the node number according to the node number configuration message in response to receiving the control signal; the slave is also used to send the control signal through the second control end module when the second control end module of the slave is electrically connected to another slave.

2. The bus system according to claim 1, characterized in that The host further includes a first main control module; the first control end module includes an inverting unit, a photoelectric coupling unit and a first interface unit; The first main control module is electrically connected to the inverting unit; The inverting unit is electrically connected to the photoelectric coupling unit; the photoelectric coupling unit is electrically connected to the first interface unit; and the first interface unit is used to electrically connect to the receiving end module.

3. The bus system according to claim 2, characterized in that The inverting unit includes a first resistor, a first capacitor and an inverter; the photoelectric coupling unit includes a second resistor and a photoelectric coupler; The first resistor is electrically connected to the inverter and one end of the first capacitor; the other end of the first capacitor is grounded; the inverter is electrically connected to the photoelectric coupler and one end of the second resistor, and the other end of the second resistor is electrically connected to the photoelectric coupler; the photoelectric coupler is electrically connected to the first interface unit.

4. The bus system according to any one of claims 1 to 3, characterized in that: The slave device further includes a second main control module; the receiving end module includes a second interface unit, a third resistor, a fourth resistor and a fifth resistor; The second interface unit is used to electrically connect to the first control end module or the second control end module; The second interface unit is electrically connected to the third resistor, one end of the fourth resistor, and one end of the fifth resistor; the other end of the fourth resistor is grounded; and the other end of the fifth resistor is electrically connected to the second main control module.

5. A node number configuration method, characterized in that: The method is applied to a host in a bus system according to any one of claims 1 to 4, and the method comprises: Determine the preset first node number as the target node number; generating a node number configuration message according to the target node number, and sending the node number configuration message; When the target node number is the first node number, sending a control signal so that the slave device sets the node number in response to the control signal; In response to receiving a node number configuration completion message sent by the slave, updating the target node number to obtain a second node number, and determining the second node number as the target node number; In the case that the target node number is different from the preset termination node number threshold, the process returns to the step of generating a node number configuration message according to the target node number.

6. The method according to claim 5, characterized in that Before updating the target node number in response to receiving the node number configuration completion message sent by the slave to obtain the second node number, the method further includes: Determine the time of sending the node number configuration message as the starting time; Determining a signal detection period according to the starting time and a preset signal response duration threshold; If the node number configuration completion message sent by the slave is not received within the signal detection period, the node number configuration message is sent.

7. The method according to any one of claims 5 to 6, characterized in that The host is electrically connected to a receiving end of the slave; and the sending of a control signal so that the slave sets a node number in response to the control signal includes: determining the level of the receiving end of the slave to be a first level, so that the slave sets the node number when the level of the receiving end is the first level; After sending the control signal, the method further includes: If the target node number is the first node number, in response to receiving the node number configuration completion message sent by the slave, the level of the receiving end of the slave is determined to be a second level; wherein the second level is different from the first level.

8. The method according to any one of claims 5 to 6, characterized in that The updating of the target node number to obtain a second node number includes: Summing the target node number and a preset unit value to obtain a second node number; When the target node number is different from a preset termination node number threshold, returning to the step of generating a node number configuration message according to the target node number includes: Obtaining the number of at least two slaves to obtain the total number of slaves; Summing the product of the total number of slaves and the unit value and the first node number to obtain a target total value, and determining the target total value as the termination node number threshold; If the target node number is smaller than the termination node number threshold, return to the step of generating a node number configuration message according to the target node number.

9. A node number configuration method, characterized in that: The method is applied to a slave in the bus system according to any one of claims 1 to 4, wherein the slave includes a second control end module, and the method includes: Obtaining a node number configuration message sent by a host; wherein the node number configuration message includes a target node number; In the case of receiving the control signal, determining the control signal as a first control signal, and performing a node number setting operation according to the target node number; Sending a node number configuration completion message to the host; In a case where the second control end module is electrically connected to another slave, a second control signal is sent through the second control end module, so that the other slave performs a node number setting operation in response to the second control signal.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 5 to 8 or the method according to claim 9 is implemented.

Citation Information

Patent Citations

  • Signaling an interrupt request through daisy chained devices

    CN101815991A

  • Bus node address allocation method and related device

    CN115842806A

  • Slave node equipment calibration identification method, interaction method and vehicle

    CN117319190A

  • Signaling an interrupt request through daisy chained devices

    US20090106469A1

  • Method for assigning device identifiers in a bus system, master device, slave device, and bus system

    WO2015090904A1