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

CN120499149BActive Publication Date: 2026-08-14SHENZHEN CITY SAMKOON TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

然而,这种节点号配置方式会带来大量的人力成本与时间成本,使得节点号的配置效率较为低下

Benefits of technology

[0045]The node number configuration method, bus system, and computer-readable storage medium proposed in this application, through a cascaded connection structure of a master and at least two slave devices, combined with the transmission of node number configuration messages on the bus, enable automated configuration of slave node numbers. Specifically, the master sends a control signal to the receiving module of the first slave device through a first control terminal module, and the second control terminal module of each slave device (except the last slave device) is sequentially connected to the receiving module of the next slave device. The master sends node number configuration messages to each slave device through the bus, and each slave device only sets its own node number according to the node number configuration message after its receiving module detects a control signal (such as a high level). Furthermore, the slave device can also send a control signal to the receiving module of the next slave device through its second control terminal module, thereby triggering the node number configuration process of the next slave device. This automates the configuration of node numbers, eliminating the need for manual configuration and significantly reducing the labor and time costs associated with configuring node numbers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120499149B_ABST
    Figure CN120499149B_ABST
Patent Text Reader

Abstract

This application provides a node number configuration method, a bus system, and a computer-readable storage medium, relating to the field of communication technology. The method includes: determining a preset first node number as a target node number; generating and sending a node number configuration message based on the target node number; when the target node number is the first node number, sending a control signal to cause a slave device to set a node number in response to the control signal; updating the target node number to obtain a second node number in response to receiving a node number configuration completion message from the slave device, and determining the second node number as the target node number; and returning to the step of generating the node number configuration message based on the target node number when the target node number differs from a preset termination node number threshold. This application embodiment can automatically configure the node number of a device, reducing the cost of configuring node numbers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This 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 Technology

[0002] Serial communication protocols are communication protocols used to transmit data in computer networks. In network systems built using bus-based serial communication protocols (such as CAN protocol, CANopen protocol, etc.) (e.g., CANopen network system), each device needs to be connected to the bus and send messages through the bus to achieve information exchange between multiple devices. Each device needs to be configured with a unique node number. The node number serves as an identifier to distinguish between devices, and it also determines the receiving device for messages transmitted on the bus.

[0003] Currently, node numbers for devices are typically configured manually. For example, users can use hardware such as DIP switches to manually set the node number. However, this method of configuring node numbers incurs significant labor and time costs, resulting in low efficiency.

[0004] Therefore, how to reduce the cost of configuring node numbers has become an urgent technical problem to be solved. Summary of the Invention

[0005] The main objective of this application is to propose a node number configuration method, a bus system, and a computer-readable storage medium, which aims to achieve automatic configuration of device node numbers and reduce the cost of configuring node numbers.

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

[0007] A host and at least two slave devices; wherein the host includes a first control terminal module, and each slave device includes a second control terminal module and a receiving terminal module;

[0008] The host is communicatively connected to each of the slave devices via a bus; the receiving module of each slave device is electrically connected to the second control module of another slave device or the first control 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 module of the slave device electrically connected to the host through the first control terminal module;

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

[0011] In some embodiments, the host further includes a first main control module; the first control module includes an inverting unit, an optocoupler 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 optocoupler unit; the optocoupler unit is electrically connected to the first interface unit; the first interface unit is used to electrically connect to the receiving module.

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

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

[0015] In some embodiments, the slave device further includes a second master control module; the receiving 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 the first control terminal module or the second control terminal 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 objectives, a second aspect of this application provides a node number configuration method, which is applied to a host in the bus system described in the first aspect, the method comprising:

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

[0020] Generate a node number configuration message based on the target node number, and send the node number configuration message;

[0021] If the target node number is the first node number, a control signal is sent to cause the slave device to set the node number in response to the control signal;

[0022] In response to receiving the node number configuration complete message sent by the slave device, the target node number is updated to obtain a second node number, and the second node number is determined as the target node number;

[0023] If the target node number is different from the preset termination node number threshold, return to the step of generating a node number configuration message based on the target node number.

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

[0025] The time when the node number configuration message is sent is determined as the start time;

[0026] The signal detection period is determined based on the start time and the preset signal response duration threshold.

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

[0028] In some embodiments, the host is electrically connected to the receiver of the slave device;

[0029] The step of sending a control signal to cause the slave device to set the node number in response to the control signal includes:

[0030] The voltage level of the receiving end of the slave device is determined to be a first voltage level, so that the slave device can set the node number when the voltage level of the receiving end is the first voltage 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 complete message sent by the slave device, the voltage level of the slave device's receiving end is determined to be a second voltage level; wherein the second voltage level is different from the first voltage level.

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

[0034] The target node number and the preset unit value are summed to obtain the second node number;

[0035] The step of returning the node number configuration message based on the target node number when the target node number is different from a preset termination node number threshold includes:

[0036] Obtain the number of at least two slave devices to get the total number of slave devices;

[0037] The product of the total number of slave devices and the unit value, plus the first node number, is summed to obtain a target total value, and the target total value is determined as the termination node number threshold.

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

[0039] To achieve the above objectives, a third aspect of this application provides a node number configuration method, which is applied to a slave device in the bus system described in the first aspect, wherein the slave device includes a second control terminal module, and the method includes:

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

[0041] Upon receiving a control signal, the control signal is identified as the first control signal, and a node number setting operation is performed according to the target node number.

[0042] Send a node number configuration complete message to the host;

[0043] When the second control terminal module is electrically connected to another slave device, a second control signal is sent through the second control terminal module to cause the other slave device to perform a node number setting operation in response to the second control signal.

[0044] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, 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 this application, through a cascaded connection structure of a master and at least two slave devices, combined with the transmission of node number configuration messages on the bus, enable automated configuration of slave node numbers. Specifically, the master sends a control signal to the receiving module of the first slave device through a first control terminal module, and the second control terminal module of each slave device (except the last slave device) is sequentially connected to the receiving module of the next slave device. The master sends node number configuration messages to each slave device through the bus, and each slave device only sets its own node number according to the node number configuration message after its receiving module detects a control signal (such as a high level). Furthermore, the slave device can also send a control signal to the receiving module of the next slave device through its second control terminal module, thereby triggering the node number configuration process of the next slave device. This automates the configuration of node numbers, eliminating the need for manual configuration and significantly reducing the labor and time costs associated with configuring node numbers. Attached Figure Description

[0046] Figure 1 This is a block diagram of the bus system provided in the embodiments of this application;

[0047] Figure 2 This is a system architecture diagram of the bus system provided in the embodiments of this application;

[0048] Figure 3 This is a module block diagram of the host provided in the embodiments of this application;

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

[0050] Figure 5 This is a circuit schematic diagram of the receiving module provided in the embodiments of this application;

[0051] Figure 6 This is a flowchart of the node number configuration method provided in the embodiments of this application;

[0052] Figure 7 This is a flowchart of a node number configuration method provided in another embodiment of this application;

[0053] Figure 8 This is a flowchart of a node number configuration method provided in another embodiment of this application;

[0054] Figure 9 This is a flowchart of a node number configuration method provided in another embodiment of this application;

[0055] Figure 10 This is a configuration flowchart of a host for an application example provided in an embodiment of this application;

[0056] Figure 11This is a flowchart of a node number configuration method provided in another embodiment of this application;

[0057] Figure 12 This is a configuration flowchart of a slave device for an application example provided in this application embodiment.

[0058] Reference numerals: Master unit 100; Slave unit 200; First control terminal module 110; First master control module 120; Receiver module 210; Second control terminal module 220; Inverting unit 111; Optocoupler unit 112; First interface unit 113; Second interface unit 211;

[0059] Optocoupler U1; inverter U2; first capacitor C1; first resistor R1; second resistor R2; third resistor R3; fourth resistor R4; fifth resistor R5. Detailed Implementation

[0060] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0061] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0062] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is 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: This is a serial communication protocol. Originally developed for communication between electronic control units (ECUs) in automobiles, CAN is now widely used in industrial measurement and control and industrial automation. It defines the high and low voltage levels of the physical layer and the frame structure of the data link layer. In a network system using the CAN protocol, multiple devices are connected and communicate via the CAN bus. The CAN bus is a multi-master bus; all devices connected to the bus can 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 start sending messages at the same time, the priority is determined by the identifier (ID) in the message. The identifier does not represent 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 on top of the CAN protocol. The CANopen protocol defines various communication objects, such as Process Data Objects (PDOs), Service Data Objects (SDOs), and Emergency Objects (EMCYs). PDOs are used for the rapid transmission of real-time data, such as motor speed and position information; their transmission is event-driven or periodic. SDOs are mainly used for configuring and reading equipment parameters, such as setting the frequency of a frequency converter, and are based on a request-response mechanism. Emergency Objects are used to send alarm information when an emergency occurs in the equipment.

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

[0067] LSS (Layer Setting Service) protocol: This is the CANopen setting service and protocol. It enables CANopen devices with LSS master functionality to query or modify three types of data on the CANopen device—physical layer, data link layer, and application layer—through the CAN network, including node number (Node_ID), baud rate, etc.

[0068] The CANopen Object Dictionary (OD) is an ordered set of objects. In a CANopen network, each device has its own object dictionary. The object dictionary describes all the device's parameters, as well as parameters related to the device's network behavior.

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

[0070] Figure 1 This is an optional module block diagram of the bus system provided in the embodiments of this application. Figure 1 The bus system in the system includes:

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

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

[0073] The host 100 is used to send node number configuration messages via the bus, and the host 100 is also used to send control signals to the receiving module 210 of the slave 200 electrically connected to the host 100 via the first control module 110.

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

[0075] The beneficial effects of this application embodiment include, but are not limited to, the ability to automatically configure node numbers through a cascaded connection structure of the host 100 and at least two slaves 200, combined with the transmission of node number configuration messages on the bus. Specifically, the host 100 sends a control signal to the receiving module 210 of the first slave 200 via the first control terminal module 110, and the second control terminal module 220 of each slave 200 (except the last slave 200) is sequentially connected to the receiving module 210 of the next slave 200. The host 100 sends node number configuration messages to each slave 200 via the bus, and each slave 200 only sets its own node number according to the node number configuration message after its receiving module 210 detects a control signal (such as a high level). Furthermore, the slave 200 can also send a control signal to the receiving module 210 of the next slave 200 via the second control terminal module 220, thereby triggering the node number configuration process of the next slave 200. This allows for automated configuration of node numbers, eliminating the need for manual configuration and significantly reducing the human and time costs associated with it.

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

[0077] In some embodiments, the bus system may employ a master-slave serial bus communication protocol. For example, the bus system may use any one of the CAN protocol, CANopen protocol, or MODBUS RTU protocol, or other master-slave serial bus communication protocols, and is not limited to these. It should be noted that the multiple devices in the bus system include the master 100 and the slave 200. Devices in the bus system are also called network nodes. For example, in the case of the bus system using the CANopen protocol, CANopen devices in the bus system are also called CANopen nodes. Specifically, devices in the bus system can be computers, such as personal computers (PCs), desktop computers, and laptop computers.

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

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

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

[0081] It should be noted that, Figure 1 In this context, BUS stands for bus. Specifically, a bus can be a serial bus, such as the CAN bus.

[0082] In some embodiments, such 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 device 100 and n slave devices 200. Each device is electrically connected to both the CAN_H and CAN_L communication lines. For example, device 1 can be designated as the master device 100, and a preset node number can be assigned to it. The master device 100 then manages the node numbers of the subsequent slave devices 200. Specifically, the node number of the master device 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 sent messages are visible to all devices. This means that devices receiving messages from the bus (such as the slave devices 200) cannot easily determine whether a message was intended for them. This embodiment of the application takes into account the above problem and uses a control line (see reference...) Figure 2 The master unit 100 and each slave unit 200 are connected sequentially, and control signals are transmitted via control lines to determine the device receiving the node number configuration message. Specifically, when the control line level is high, it means that the device on the right end of the control line has received the control signal. The level of the control line (e.g., high or low) is controlled by the device on the left end of the control line. For example, the first control terminal of the master unit 100 is connected to the receiving terminal of the first slave unit 200 via a control line. The master unit 100 is the device on the left end of this control line and can control the level of this control line, that is, control the level of the receiving terminal of the first slave unit 200.

[0084] In some embodiments, such as Figure 2 As shown, the first control module 110 of the host 100 is electrically connected to the receiving module 210 of the first slave 200, and the second control module 220 of the first slave 200 is electrically connected to the receiving module 210 of the second slave 200. The connection relationships of the above modules can be found in [reference needed]. Figure 1 It should be noted that, Figure 2 The ellipsis in the text indicates that there may be two or more slave devices 200 connected in sequence. For example, if there are n slave devices 200, then the second control terminal module 220 of the second to last slave device 200 (i.e., the (n-1)th slave device 200) is electrically connected to the receiving terminal module 210 of the last slave device 200 (i.e., the nth slave device 200).

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

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

[0087] It should be noted that the second control terminal module 220 of slave device 200 is electrically connected to another slave device 200, indicating that this slave device 200 is connected to the next slave device 200, meaning that this slave device 200 is not the last slave device 200. Therefore, this slave device 200 can send control signals to the next slave device 200. For example, in Figure 2 In this process, the first slave device 200 can send a control signal to the second slave device 200, so that after receiving the control signal, the second slave device 200 can configure the node number according to the node number configuration message broadcast by the master device 100 through the bus.

[0088] In some embodiments, such as Figure 2 In the bus network shown, the process of configuring node numbers for slave devices by master device 100 can specifically include:

[0089] (1) The host 100 pulls the level of the control line connected to the host 100 high, that is, pulls the level of the receiving module 210 of the first slave 200 high. Then, the host 100 sends a message configuring node number 1 (that is, node number configuration message) through the bus.

[0090] (2) After receiving the message configuring node number 1, the first slave 200 checks whether its receiving module 210 is high. If the receiving module 210 of the first slave 200 is high, it means 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 device 200 sends a message that node number 1 has been configured (i.e., node number configuration complete message) through the bus. At the same time, the first slave device 200 pulls the level of the control line connected to its second control module high, which also pulls the level of the receiving module 210 of the second slave device 200 high.

[0092] (4) After receiving the message that node number 1 has been configured, the host 100 pulls the level of the control line connected to the host 100 low, which indicates that the first slave 200 is not the receiving device for the next node number configuration message. Then, the host 100 sends the message to configure node number 2 through the bus.

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

[0094] (6) After receiving the message that node number 2 has been configured, host 100 sends a message to configure node number 3. By repeating the above steps, the node numbers of each slave 200 can be automatically configured.

[0095] Please see Figure 3 In some embodiments, the host 100 further includes a first main control module 120; the first control terminal module 110 includes an inverting unit 111, an optocoupler 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 optocoupler unit 112; the optocoupler unit 112 is electrically connected to the first interface unit 113; the first interface unit 113 is used to electrically connect to the receiving module 210.

[0097] The advantage of this embodiment is that the host 100 is constructed by the first master control module 120, the inverting unit 111, the optocoupler unit 112, and the first interface unit 113 for automated configuration of node numbers. Specifically, the first master control module 120 performs signal logic conversion through an electrical connection to the inverting unit 111, then performs electrical isolation via the optocoupler unit 112, and finally connects to the receiving module 210 of the slave 200 through the first interface unit 113. This allows the hardware circuit to automatically complete the configuration process of the node numbers of the devices in the bus system, reducing reliance on manual operation, automating the configuration of node numbers, improving the system's anti-interference capability, significantly reducing the labor and time costs required for configuring node numbers, improving node number configuration efficiency, and making it 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 and node number configuration completion messages) or to process control signals. Specifically, the first main control module 120 can be any of a central processing unit (CPU), a microcontroller unit (MCU), or a programmable logic controller (PLC). The first main control module 120 can also be other types of control chips, which are not limited in this embodiment.

[0099] In some embodiments, the inverting unit 111 is used to perform logical transformation on the signal, such as 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 specific explanation of the first control module 110, and will not be repeated here.

[0101] Please see Figure 4 In some embodiments, the inverting unit 111 includes a first resistor R1, a first capacitor C1, and an inverter U2; the optocoupler unit 112 includes a second resistor R2 and an optocoupler U1.

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

[0103] The advantage of this embodiment is that the first control terminal 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, sends control signals to the slave 200, so that the slave 200, upon receiving the control signals, sets its own node number according to the node number configuration message. This realizes the automated configuration of the node number of the slave 200 in the bus system, reduces the manpower and time costs required for configuring node numbers, improves the efficiency of node number configuration, and is 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 the diagram, CAN_K1 represents the interface, which is used for electrical connection to the first main control module 120. CAN_H represents the communication line, and CAN_L represents another communication line. The CAN_H and CAN_L communication lines (see reference...) Figure 2 Both are CAN buses in the bus system. In some embodiments, the resistance of the first resistor R1 can be 1kΩ. The capacitance of the first capacitor C1 can be 0.1μF. The resistance of the second resistor R2 can be 330Ω. 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-carrying capacity of the first control module 110.

[0107] In some embodiments, the optocoupler U1 (referred to as optocoupler) has pin 1, pin 2, pin 3, and pin 4. When pin 2 of optocoupler U1 is 0V (volts), pins 3 and 4 of optocoupler U1 are turned on.

[0108] Please see Figure 5 In some embodiments, the slave device 200 further includes a second master control module (not shown in the figure); the receiver 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 the first control terminal module 110 or the second control terminal module 220;

[0110] The second interface unit 211 is electrically connected to one end of 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; and 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 receiver module 210, 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 host 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 automates the configuration of the slave 200's node number, reducing the manpower and time costs required for node number configuration, improving node number configuration efficiency, and making it suitable for large-scale industrial control scenarios.

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

[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 another device (host 100 or other slave 200) (see reference). Figure 4 It can be inserted into socket H2 of slave unit 200 to transmit control signals between different devices.

[0114] It should be noted that, in Figure 5 In this configuration, the CAN_K2 interface is used for electrical connection to the second main control module. In some embodiments, the resistance of the third resistor R3 is 4.7kΩ, the resistance of the fourth resistor R4 is 10kΩ, and the resistance of the fifth resistor R5 is 470Ω. In some embodiments, the third resistor R3 can be connected to a 5V constant voltage power supply.

[0115] In some embodiments, it is assumed that pin H1 of the first control terminal in the host 100 is inserted 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 in a conducting state, and the level input to the CAN_K2 interface is low. As another example, when the CAN_K1 interface outputs a low level, pins 1 and 3 of socket H2 are in a disconnected state, 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 the embodiments of this application. The node number configuration method is applied to the host in the bus system described above. Figure 6 The method may include, but is not limited to, steps 101 to 105.

[0117] Step 101: Determine the preset first node number as the target node number;

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

[0119] Step 103: If the target node number is the first node number, send a control signal so that the slave device responds to the control signal to set the node number;

[0120] Step 104: In response to receiving the node number configuration complete message sent by the slave device, update the target node number to obtain the second node number, and determine the second node number as the target node number.

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

[0122] The beneficial effects of this application embodiment include, but are not limited to: generating a node number configuration message corresponding to the target node number and sending the message to the slave device. If the target node number is a preset first node number, it indicates that the slave device whose node number needs to be configured is the first slave device connected to the master. Therefore, the master sends a control signal to make the slave device (i.e., the slave device directly connected to the master's first control terminal module) respond to the control signal to set the node number. When the slave device sends a node number configuration completion message, it indicates that the slave device that received the control signal has completed the node number configuration. If the termination condition is not met, such as the target node number being different from the preset termination node number threshold, the node number is updated, and the node number configuration message is generated again based on the updated node number (i.e., the second node number). The above process (steps 102 to 105) is repeated to configure the node number of the next slave device. This can automatically configure the node numbers of each slave device without manual configuration, which can significantly reduce the labor and time costs of configuring node numbers.

[0123] In step 101 of some embodiments, the first node number is a pre-defined node number, for example, the first node number can be 1. The first node number can also be other numerical values ​​or characters, and is not limited thereto. The target node number is the node number currently used to assign to the slave device.

[0124] In step 102 of some embodiments, the node number configuration message is a message used to instruct the slave device to set the 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 device to set the node number to 2.

[0125] In some embodiments, when the bus network uses the CAN protocol, the node number configuration message is transmitted on the bus in the form of data packets, and the maximum size of each data packet in the CAN protocol is 8 bytes. For example, for a node number configuration message M1 (hereinafter referred to as message M1) sent by the host, the value of the first byte of message M1 can be F0 (hexadecimal), and the value of the second byte can be F1. These two bytes indicate that this message is used to configure related functions, such as configuring the baud rate or configuring the node number. The value of the third byte of message M1 can be 01, indicating that the specific function of this message is to configure the node number. The value of the fourth byte of message M1 is the node number to be configured, i.e., the target node number. For example, the value range of the target node number can be from 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 device whose node number needs to be configured is the first slave device connected to the first control terminal module of the host. Therefore, the host needs to send a control signal to cause the first slave device to perform the node number setting operation. Specifically, sending a control signal means sending a control signal from the host's first control terminal module to the slave device's receiving terminal module. For example, the host can send a high-level signal, specifically pulling up the level of the receiving terminal module of the slave device connected to the first control terminal module. For example, as... Figure 2 As shown, the master and the first slave are connected via a control line, meaning the master's first control module is electrically connected to the first slave's receiving module. Assuming the first node number is 1, when the target node number is 1, the master sends a control signal (e.g., a high-level signal). Upon receiving this control signal, the first slave sets its own node number to 1 according to the node number configuration message sent by the master on the bus.

[0127] In step 104 of some embodiments, the node number configuration completion message is used to indicate that the slave device has completed node number configuration. It should be noted that after completing node number configuration, the slave device will send a node number configuration completion message via the bus. Upon receiving the node number configuration completion message from the slave device, the master device can determine that the slave device has completed node number configuration.

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

[0129] In step 105 of some embodiments, the termination node number threshold is a threshold used to determine whether to terminate the configuration of node numbers. For example, assuming the target node number is any integer in [1, 126], and the target node number is updated by incrementing by 1 each time, the termination node number threshold can be set to 127. Then, if the target node number is different from the preset termination node number threshold, for example, if the target node number belongs to [1, 126], the step of generating a node number configuration message based on the target node number is returned. If the target node number is equal to the termination node number threshold, for example, if the target node number is equal to 127, then the configuration of node numbers ends.

[0130] Please see Figure 7 In some embodiments, prior to step 104, the node number configuration method may include, but is not limited to, steps 201 to 203:

[0131] Step 201: Determine the time when the node number configuration message is sent as the start time;

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

[0133] Step 203: If no node number configuration completion message is received from the slave device during the signal detection period, send a node number configuration message.

[0134] The advantage of this embodiment is that, considering the possibility that the slave device may not receive the node number configuration message, a signal response duration threshold is added to the time when the node number configuration message is sent to obtain a signal detection period. During this period, the system continuously checks whether a message is received from the slave device. If the node number configuration completion message is not received from the slave device within the signal detection period, it may be because the slave device did not receive the node number configuration message. Therefore, the node number configuration message is resent to enable the slave device to set the node number, thus improving the reliability of node number setting for the slave device.

[0135] In some embodiments, step 201, the start 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), then the start time is (1:30:00).

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

[0137] It should be noted that the signal detection period is a continuous time interval from the start time to the end time, which is the start time plus the signal response duration threshold. 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, then the signal detection period is the time interval between (0:00:00) and (0:00:30).

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

[0139] Please see Figure 8 In some embodiments, the host is electrically connected to the receiver of the slave device;

[0140] Step 103, sending a control signal to cause the slave device to set the node number in response to the control signal, may include, but is not limited to, step 301:

[0141] Step 301: Determine the voltage level of the slave's receiving end as the first voltage level, so that the slave can set the node number when the voltage level of the receiving end is the first voltage level;

[0142] Following 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 the node number configuration complete message sent by the slave device, the voltage level of the slave device's receiving end is determined to be the second voltage level; wherein, the second voltage level is different from the first voltage level.

[0144] The advantage of this embodiment is that by setting the voltage level of the slave device's receiver to a first voltage level (e.g., high voltage), it explicitly indicates that the slave device is the receiving device for node number configuration messages, thereby allowing the slave device to perform node number setting. This reduces the defect of node number configuration confusion caused by message conflicts in the bus system. If the target node number is the first node number, it indicates that the slave device being configured is the first slave device directly connected to the master. By changing the voltage level of the slave device's receiver to a different voltage level than the first voltage level, i.e., a second voltage level (e.g., low voltage), the slave device exits the configuration state, preventing subsequent node number configuration messages from interfering with the already configured slave device, thus improving the reliability and accuracy of node number setting for the slave device.

[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 can be a low level. For example, as... Figure 2 As shown, if the target node number is node number 1, after the host receives the message that node number 1 has been configured, it knows that the first slave has completed the node number configuration. Therefore, the host pulls the level of the receiver module of the first slave low, that is, pulls the level of the control line between the host and the first slave low.

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

[0148] Step 401: Sum the target node number and the preset unit value to obtain the second node number;

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

[0150] Step 402: Obtain the number of at least two slave devices, and then obtain the total number of slave devices;

[0151] Step 403: The product of the total number of slaves and the unit value, and the first node number are summed to obtain the target total value, and the target total value is determined as the threshold for the termination node number.

[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 based on the target node number.

[0153] The advantage of this embodiment lies in its incremental update based on the first node number to assign a node number to each slave device, and its dynamic determination of the termination node number threshold based on the total number of slave devices in the bus system, thereby achieving automated node number configuration. Specifically, the termination node number threshold is calculated based on the total number of slave devices. If the target node number is less than the termination node number threshold, it indicates that there are still slave devices that have not yet been assigned node numbers. Therefore, the process returns to the step of generating a node number configuration message based on the target node number, i.e., the next round of node number configuration message generation is performed. This enables automatic configuration of node numbers for multiple slave devices, reduces the risk of node number omissions or duplications, and improves the efficiency and reliability of device node number configuration.

[0154] In step 401 of some embodiments, 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, then 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 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, then the termination node number threshold is 4. If the target node number is 3, then the target node number is less than the termination node number threshold (3 < 4), so the host 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 termination node number threshold, the above node number configuration process ends.

[0158] Please see Figure 10 In one application example, the node number configuration method applied to the host may include the following process: The host initializes the node number N to be configured (i.e., the target node number mentioned above) to 1. The host's node number is pre-set to 127, which is equivalent to the termination node number threshold mentioned above. Then, the host determines the value of the node number N to be configured. If N = 1, it indicates that the device to be configured is the first slave device, and the host pulls the control line high before sending the 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 the message to configure node number N, i.e., the node number configuration message mentioned above. Then, the host waits for 100ms (milliseconds) to check whether it has received a message indicating that node number N configuration is complete, i.e., the node number configuration completion message mentioned above. Specifically, if the first and second bytes of the message are F0F1 and the third byte is 02, it indicates that the message indicates that node number N configuration is complete. If the message indicating that node number N configuration is complete is not received, the host retransmits the message to configure node number N. If a message indicating that node number N has been configured is received, and N = 1, the host will pull 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 number N to N+1 and then repeats the above process until N = 127. Since node number 127 is already in use 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. The LSS master station can query or modify parameters such as the node number and baud rate of devices in the CAN network. The LSS master station does not distinguish LSS slaves (i.e., devices) by node number, but rather by the data indexed in the device's Object Dictionary (OD). To obtain the data indexed in the CAN network's device OD, the LSS master typically needs to obtain the device's Electronic Data Sheet (EDS) and import it into the LSS master. The EDS contains the device's OD. Based on the data indexed in the OD, the LSS master can distinguish each device in the CAN network and thus set the node number and other parameters for these devices. However, this node number configuration method requires the user to query the EDS for each device and import it into the LSS master. This operation is complex and has a certain operational threshold for users, resulting in low efficiency in node number configuration. In another embodiment, hardware means such as DIP switches can currently be used to manually set the node number. For example, assuming the node number ranges from 1 to 127, the user can use a 7-bit DIP switch to set the node number for each device. In another embodiment, for devices such as servos and frequency converters, the node number can also be set via buttons or a screen built into the device. The common feature of the above node number configuration methods is that they all require the user to manually configure the device's node number. The node number configuration method of this application addresses the problem of high costs associated with manually configuring node numbers by automatically configuring the node numbers of each slave device through the host, which can significantly reduce the labor and time costs of configuring node numbers and improve the efficiency of node number configuration.

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

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

[0162] Step 502: Upon receiving a control signal, the control signal is identified as the first control signal, and a node number setting operation is performed according to the target node number.

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

[0164] Step 504: When the second control terminal module is electrically connected to another slave device, a second control signal is sent through the second control terminal module so that the other slave device responds to the second control signal to perform a node number setting operation.

[0165] The beneficial effects of this application's embodiments include, but are not limited to: upon receiving a control signal, performing a node number setting operation based on the target node number in the node number configuration message sent by the host, such as setting the slave's own node number to the target node number. A node number configuration completion message is sent to the host, causing the host to configure the node numbers of other slaves in response to the node number configuration completion message. Furthermore, when the second control terminal module is electrically connected to another slave, a second control signal is sent through the second control terminal module, causing the other slave to perform a node number setting operation in response to the second control signal. This enables automated configuration of the node numbers of each slave, eliminating the need for manual node number configuration and significantly reducing the labor and time costs associated with configuring node numbers.

[0166] In step 501 of some embodiments, the host communicates with the slave via a bus. The slave can 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 device. The first control signal can be a control signal sent by the master device or a control signal sent by the slave device's predecessor. For example, as... Figure 2 As shown, if the method of this embodiment is applied to the first slave device, the first control signal is a control signal sent by the master device. If the method of this embodiment is applied to the second slave device, the first control signal is a control signal sent by the first slave device.

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

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

[0170] Please see Figure 12 In one application example, the node number configuration method for a slave device may include the following process: Continuously wait to receive messages on the CAN bus and determine whether a node number configuration message sent by the master device has been received. Specifically, if the first and second bytes of the message content are F0F1 and the third byte is 01, it indicates that the message is a node number configuration message. If no node number configuration message is received, continue waiting to receive messages on the CAN bus. If a node number configuration message is received, check if the level of the slave device's own receiving end (i.e., the receiving end module mentioned above) is high. If it is not high, it indicates that the slave device is not the target receiving device for this message, and continue waiting to receive messages on the CAN bus. If it is high, set its own node number according to the message content. Then, the slave device pulls the level of the control line connected to the next slave device high and sends a node number configuration complete message through the CAN bus, thereby reporting to the master that its node number has been configured successfully, so that the next slave device can perform subsequent node number configuration.

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

[0172] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described node number configuration method.

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

[0174] It should be noted that the software tools or components not belonging to our company 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 know 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 this application, and may include more or fewer steps than shown, or combine 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; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

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

[0179] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0180] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

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

[0182] The units described above as separate components may or may not be physically separate. 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 the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0183] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

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

[0185] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A bus system, characterized in that, The bus system includes: A host and at least two slave devices; wherein the host includes a first control terminal module, and each slave device includes a second control terminal module and a receiving terminal module; The host is communicatively connected to each of the slave devices via a bus; the receiving module of each slave device is electrically connected to the second control module of another slave device or the first control 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 module of the slave device electrically connected to the host through the first control terminal module; The slave device is used to set the node number according to the node number configuration message in response to receiving the control signal; the slave device is also used to send the control signal through the second control terminal module when the second control terminal module of the slave device is electrically connected to another slave device; the master device is connected to each of the slave devices in sequence through a control line, and the control line is used to transmit control signals; the level of the control line is controlled by the device at the left end of the control line, and when the level of the control line is high, it is equivalent to the device at the right end of the control line receiving a control signal; The slave device also includes a second master control module; the receiving 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 the first control terminal module or the second control terminal 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. The host also includes a first main control module; the first control module includes an inverting unit, an optocoupler 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 optocoupler unit; the optocoupler unit is electrically connected to the first interface unit; the first interface unit is used to electrically connect to the receiving module. The inverting unit includes a first resistor, a first capacitor, and an inverter; the optocoupler unit includes a second resistor and an optocoupler. The first resistor is electrically connected to one end of the inverter and the first capacitor; the other end of the first capacitor is grounded; the inverter is electrically connected to one end of the optocoupler and the second resistor, and the other end of the second resistor is electrically connected to the optocoupler; the optocoupler is electrically connected to the first interface unit; the inverter is used to improve the driving capability and load capacity of the first control module.

2. A node number configuration method, characterized in that, The method is applied to a host in the bus system of claim 1, and the method includes: Set the preset first node number as the target node number; Generate a node number configuration message based on the target node number, and send the node number configuration message; If the target node number is the first node number, a control signal is sent to cause the slave device to set the node number in response to the control signal; In response to receiving the node number configuration complete message sent by the slave device, the target node number is updated to obtain a second node number, and the second node number is determined as the target node number; If the target node number is different from the preset termination node number threshold, return to the step of generating a node number configuration message based on the target node number.

3. The method according to claim 2, characterized in that, Before updating the target node number to obtain the second node number in response to receiving the node number configuration complete message sent by the slave device, the method further includes: The time when the node number configuration message is sent is determined as the start time; The signal detection period is determined based on the start time and the preset signal response duration threshold. If the node number configuration completion message is not received from the slave device during the signal detection period, the node number configuration message is sent.

4. The method according to any one of claims 2 to 3, characterized in that, The host is electrically connected to the receiver of the slave; the sending of the control signal to cause the slave to set the node number in response to the control signal includes: The voltage level of the receiving end of the slave device is determined to be a first voltage level, so that the slave device can set the node number when the voltage level of the receiving end is the first voltage 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 complete message sent by the slave device, the voltage level of the slave device's receiving end is determined to be a second voltage level; wherein the second voltage level is different from the first voltage level.

5. The method according to any one of claims 2 to 3, characterized in that, The step of updating the target node number to obtain the second node number includes: The target node number and the preset unit value are summed to obtain the second node number; The step of returning the node number configuration message based on the target node number when the target node number is different from a preset termination node number threshold includes: Obtain the number of at least two slave devices to get the total number of slave devices; The product of the total number of slave devices and the unit value, plus the first node number, is summed to obtain a target total value, and the target total value is determined as the termination node number threshold. If the target node number is less than the termination node number threshold, return to the step of generating a node number configuration message based on the target node number.

6. A node number configuration method, characterized in that, The method is applied to a slave device in the bus system of claim 1, wherein the slave device includes a second control terminal module, and the method includes: Obtain the node number configuration message sent by the host; wherein the node number configuration message includes the target node number; Upon receiving a control signal, the control signal is identified as the first control signal, and a node number setting operation is performed according to the target node number. Send a node number configuration complete message to the host; When the second control terminal module is electrically connected to another slave device, a second control signal is sent through the second control terminal module to cause the other slave device to perform a node number setting operation in response to the second control signal.

7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 2 to 5, or the method of claim 6.

Citation Information

Patent Citations

  • Bus node address allocation method and related device

    CN115842806A

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

    CN117319190A