Networking method and device of communication system, computer equipment and storage medium

The RS485 communication system enables self-networking of devices by using host device instructions and random delays to manage simultaneous responses, enhancing networking success rates and reducing hardware costs.

CN119172194APending Publication Date: 2024-12-20ZHEJIANG CHINT ELECTRIC CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411178578.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

Existing RS485 communication systems require professional technicians to manually modify device addresses on-site, leading to increased hardware costs and low success rates in device networking due to multiple slaves responding simultaneously and compatibility issues.

Method used

A communication system networking method that allows slave devices to self-network by entering a networking state based on host device instructions, determining data reception within a set time period, and sending device identification after a delay if no data is received, using random values and device IDs to reduce simultaneous responses.

Benefits of technology

Enables device networking without additional communication methods, reducing bus conflicts and improving networking success rates by ensuring only one slave responds at a time, thus simplifying the networking process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119172194A_ABST
    Figure CN119172194A_ABST
Patent Text Reader

Abstract

The invention provides a networking method and device of a communication system, computer equipment and a storage medium, and belongs to the technical field of communication.The networking method enters a networking state based on a networking instruction sent by host equipment, whether data transmitted by a bus are received within a set time period is judged, and if the data transmitted by the bus are received within the set time period, the communication system is started. If so, exiting the networking state; and if the data transmitted by the bus is not received within the set time period, sending the equipment identifier of the slave equipment to the host equipment after delaying the set time period. And then, the host device allocates a communication address to the slave device through the identifier of the slave device. Therefore, the communication equipment which does not have the carrier monitoring conflict detection capability does not need to be assisted by other communication modes to carry out equipment networking, so that the bus conflict is reduced in the networking process, and the networking success rate is improved.
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 networking method, device, computer equipment and storage medium of a communication system. Background Art

[0002] In RS485 communication system, master-slave communication is generally adopted, that is, one host with multiple slaves. RS485 communication is half-duplex mode, and the host and slave are connected in parallel on a bus, so only one direction of data can be transmitted on the bus at the same time. The host on the RS485 bus sends a request to the slave, and the slave responds with data. If the host does not send a request, the slave cannot actively initiate transmission.

[0003] At present, based on the characteristics of the communication system, when networking RS485 devices, professional technicians are generally required to modify the device addresses on site one by one. In order to solve the problem of on-site address allocation, there is a way to automatically modify the device address through radio frequency or other communication means to achieve self-networking communication of devices, but it increases the hardware cost. There is also a way to network through RS485 broadcast, but there are problems such as multiple slaves responding at the same time, low success probability, and difficulty in compatibility with existing devices.

[0004] However, for communication devices with characteristics similar to the existing RS485 communication system, how to achieve device self-networking without the help of other communication methods and improve the success rate of device networking is still a problem to be solved. Summary of the invention

[0005] The purpose of this application is to provide a communication system networking method, device, computer equipment and storage medium to achieve device self-networking and improve the device networking success rate.

[0006] In order to achieve the above-mentioned object, the first aspect of the present application provides a communication system networking method, which is applied to a slave device in the communication system, and the slave device communicates with a host device in the communication system through a bus, and the method includes:

[0007] Entering the networking state based on the networking command sent by the host device;

[0008] Determine whether the data transmitted by the bus is received within a set time period;

[0009] If the data transmitted by the bus is received within the set time period, the networking state will be exited;

[0010] If no data transmitted by the bus is received within the set time period, the device identification of the slave device is sent to the host device after a delay of the set time.

[0011] In one embodiment of the present application, the method further includes:

[0012] Determine the delay range according to the networking instructions;

[0013] Generate a random value within the delay range;

[0014] Determine the set time period based on the random value. In one embodiment of the present application, generate a random value within the delay range, including:

[0015] Use the device ID of the slave device as a random seed;

[0016] Generates random values ​​based on a random seed.

[0017] In one embodiment of the present application, the networking instruction includes a grouping mask, and entering a networking state based on the networking instruction sent by the host device includes:

[0018] Get the number of the first byte of the packet mask;

[0019] Perform byte operation on the device identifier according to the number of the first byte to obtain a second byte;

[0020] Perform a target operation on the first byte and the second byte to obtain an operation result;

[0021] If the operation result is not the set value, the networking state is entered. In one embodiment of the present application, the networking state is entered based on the networking instruction sent by the host device, including:

[0022] Determining whether a communication address has been assigned based on the networking instruction;

[0023] If no communication address is assigned, it will enter the networking state;

[0024] If a communication address has been assigned, it will not respond to the current networking instruction.

[0025] In one embodiment of the present application, the networking instruction further includes a networking sequence number. After the set time ends, the method further includes:

[0026] The networking serial number is sent to the host device so that the host device can perform networking based on the networking serial number and the device identification.

[0027] In one embodiment of the present application, after sending the device identification of the slave device to the host device, the method further includes:

[0028] Receive communication address allocation information sent by the host device.

[0029] In one embodiment of the present application, the communication system includes multiple slave devices, the host device is networked with the multiple slave devices multiple times, and during each networking process, the host device is networked with one of the multiple slave devices.

[0030] A second aspect of the present application provides a networking device for a communication system, the networking device for the RS485 communication system comprising:

[0031] A receiving module, used for receiving a networking instruction sent by a host device to enter a networking state;

[0032] A judgment module, used to judge whether the data transmitted by the bus is received within a set time period;

[0033] An exit module is used to exit the networking state when receiving data transmitted by the bus within a set time period;

[0034] The sending module is used to send the device identification of the slave device to the host device after a delay of a set time when no data transmitted by the bus is received within a set time period.

[0035] A third aspect of the present application provides a computer device, including:

[0036] a memory configured to store instructions; and

[0037] The processor is configured to call instructions from the memory and implement the above-mentioned communication system networking method when executing the instructions.

[0038] A fourth aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, configures the processor to execute the networking of the above-mentioned communication system.

[0039] In an embodiment of the present application, the networking state is first entered based on the networking instruction sent by the host device, and then it is determined whether the data transmitted by the bus is received within the set time period. If the data transmitted by the bus is received within the set time period, the networking state is exited. If the data transmitted by the bus is not received within the set time period, the device identification of the slave device is sent to the host device after a delay of the set time period. Afterwards, the host device assigns a communication address to the slave device through the identification of the slave device. The above method enables communication devices that do not have carrier sensing conflict detection capabilities to perform device networking without the need to use other communication methods to assist communication devices, thereby reducing bus conflicts during the networking process and improving the networking success rate.

[0040] Other features and advantages of the present application will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0042] Figure 1 A schematic diagram of the structure of a communication system provided in an embodiment of the present application;

[0043] Figure 2 A schematic diagram of a communication system networking method provided in an embodiment of the present application Figure 1 ;

[0044] Figure 3 A schematic diagram of a communication system networking method provided in an embodiment of the present application Figure 2 ;

[0045] Figure 4 A schematic diagram of the structure of a networking device of a communication system provided in an embodiment of the present application;

[0046] Figure 5 This is a structural block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0048] In the description of the present application, it should be understood that the terms "first" and "second" are used only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined. In the present application, the word "exemplary" is used to mean "used as an example, illustration or description". Any embodiment described as "exemplary" in the present application is not necessarily interpreted as being more preferred or more advantageous than other embodiments. In order to enable any technician in the field to implement and use the present application, the following description is given. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present application can also be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid unnecessary details that make the description of the present application obscure. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in the present application.

[0049] See also Figure 1 , Figure 1 Schematic diagram of the structure of a communication system in the embodiment of the present application. The application scenario of the networking method of the communication system in the embodiment of the present application is as follows Figure 1 The communication system shown. The communication system may include a host device 101, N slave devices 102 (N is an integer greater than or equal to 1) and a bus 103. The host device 101 is connected to N slave devices 102 (slave device 1, slave device 2, slave device 3...slave device N) through the bus 103 and sends and receives data. Among them, the bus 103 is used for data transmission between the host device 101 and the N slave devices 102, and can be a transmission medium such as RS485, RS232C, optical fiber, radio, etc. The communication protocol between the host device 101 and the slave device 102 can be Modbus communication protocol, serial communication, Ethernet communication, etc., which is not limited here.

[0050] The embodiment of the present application takes the bus between the host device 101 and the slave device 102 as RS485, and the communication protocol between the host device 101 and the slave device 102 as the Modbus protocol as an example, and specifically explains how to assist the communication device to achieve device self-networking and improve the success rate of device networking without relying on other communication methods in the networking process of communication devices similar to the RS485 communication system.

[0051] Understandably, Figure 1The host device 101 and the slave device 102 in the communication system shown, or the devices included in the host device 101 and the slave device 102, do not constitute a limitation on the embodiments of the present application, that is, the number of devices and types of devices included in the communication system, or the number of devices and types of devices included in each device do not affect the overall implementation of the technical solution in the embodiments of the present application, and can all be regarded as equivalent replacements or derivatives of the technical solution claimed to be protected in the embodiments of the present application.

[0052] In the embodiment of the present application, the host device 101 and the slave device 102 can be independent devices, or they can be a device network or a device cluster composed of devices. For example, the host device 101 described in the embodiment of the present application includes but is not limited to a computer, a network host, a single network device, a plurality of network device sets or a cloud device composed of a plurality of devices. Among them, the cloud device is composed of a large number of computers or network devices based on cloud computing. The host device and the slave device can also include a memory and a processor, and the memory is used to store information about the networking method of the communication system.

[0053] It should be noted that Figure 1 The application scenario of the networking method of the communication system shown is only an example. Specifically, the communication system of the present application can be a management system applied to the medical industry, where the host device is the main control end, and multiple slave devices are medical devices with different functions, such as blood sample detectors, particle detectors, etc. The host device and the slave device can be networked through the embodiments of the present application to establish a communication connection to enable the subsequent host device to issue control commands to the slave device to control the operation of the slave device, or other possible functions. The communication system of the present application can also be applied to the Modbus and Bluetooth networking solutions of existing NB2 circuit breakers, and the Bluetooth module of the NB2 circuit breaker can be removed to reduce costs and then realize networking.

[0054] The application scenario of the communication system networking method described in the embodiment of the present application is to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application.

[0055] Based on the application scenario of the networking method of the communication system, an embodiment of the networking method of the communication system is proposed, which is described in detail below with reference to the accompanying drawings.

[0056] Figure 2 A schematic diagram of a communication system networking method provided in an embodiment of the present application Figure 1 In the embodiment of the present application, the networking method of the communication system is applied to any slave device in the communication system, and the slave device communicates with the host device in the communication system through a bus, which is specifically implemented through steps 201 to 204, which are described in detail below.

[0057] Step 201: The slave device enters a networking state based on a networking instruction sent by the host device.

[0058] In an embodiment of the present application, the host device can use a broadcast mode to send a networking instruction to all slave devices. For example, in serial communication, the host device can set the slave address to 0 for broadcasting. At this time, all slave devices connected to the same serial bus will receive the data frame sent by the host device. In other words, the host device sends a broadcast networking instruction and sets a suitable slave address to ensure that all target slave devices can receive this instruction.

[0059] After receiving the networking instruction sent by the host device, the slave device can parse the networking instruction. In addition, the slave device can also perform operations corresponding to the networking instruction, such as entering the networking state, in which the slave device may perform steps such as initialization of the slave device and whether the slave device exits the networking state.

[0060] Step 202: The slave device determines whether data transmitted by the bus is received within a set time period.

[0061] Since the slave device based on RS485 bus communication cannot realize conflict detection through its own hardware. Therefore, it is possible to judge whether the bus is busy by whether the slave device receives the data on the bus, reduce the conflict caused by sending data to the bus, and cause abnormal data transmission. In the RS485 bus, the slave devices in the idle state are all in the receiving state. The slave devices in the idle state can detect whether there is data on the bus before the host sends data. Once the slave device receives any data from the bus, the slave device directly ends this networking and waits for the next networking instruction of the host, making the communication process of the slave device simple. In addition, after the host device sends the networking instruction, there may be two slave devices that send data to the host device via the main line based on the networking instruction at the same time. For example, due to the simultaneous response time, the two slaves send data to the bus at the same time. When sending data, the two slave devices cannot detect whether there are other devices in the bus that are transmitting data, so the data sent by the two slave devices to the bus are abnormal.

[0062] In an embodiment of the present application, by setting a time period for different slave devices, using the set time period as a set delay time, and determining whether data transmitted by the bus is received within the set time period before performing subsequent networking operations, the situation in which two or more slave devices send data simultaneously based on networking instructions can be reduced.

[0063] During the networking process, the networking instructions may include the delay range of the slave device. By generating a random value within the delay range and then determining the set time period for each slave device based on the random value, the set time period for each slave device is different, thereby reducing the situation where networking is performed at the same time.

[0064] In the embodiment of the present application, the set time periods of different slave devices can be determined in a variety of ways, two of which are specifically described below.

[0065] In a possible implementation, the slave device can determine the delay range according to the networking instruction, generate a random value within the delay range, and determine the set time period based on the random value. For example, if the delay range of the slave device is within 100ms, and the slave device generates a random value of 80ms within the delay range, then the slave device sets the time period to 1ms-80ms.

[0066] In order to increase the probability of different random values, in another possible implementation of the embodiment of the present application, the slave device may also use the device identification of the slave device as a random seed, generate a random value based on the random seed, and then set a time period based on the random value.

[0067] It should be noted that the slave device may be provided with a device identification, which may be a unique identification symbol of the slave device, used to distinguish different slave devices. For example, the device identification may be a device serial number (SN), which is a unique code assigned to the device during the production process. For another example, the device identification may be a MAC address of the device, etc. Using the device identification of the slave device as a random seed can further reduce the situation where the random values ​​generated by different slave devices are the same.

[0068] In one example, the device identification is used as a random seed to generate a random value. The specific implementation can be: obtain the device identification, and then pass the device identification as a seed to the random.seed() function. Use the functions in the random module in the slave device (such as random.random(), random.randint(), etc.) to generate the required random numbers or random sequences. For example, the device identification of the slave device is ABC123XYZ, and the seed is set to ABC123XYZ using the random.seed(ABC123XYZ) function, and then use print(random.randint(1,100)) to generate a random value between 1 and 100. The above example is only an example, and random values ​​can also be generated according to random seeds through other functions or calculation methods with the same effect, which will not be repeated here. In addition, the above delay range of less than 100ms is only an example, and the delay range can be set according to the communication baud rate or the specific number of slaves, etc., and is not limited here.

[0069] Step 203: if data transmitted by the bus is received within the set time period, the networking state is exited.

[0070] According to the judgment result of step 202, if the slave device receives the data transmitted by the bus within the set time period, the slave device will no longer respond to the networking instruction sent by the host device this time, and the slave device exits the networking state. When the slave device receives the networking instruction sent by the host device again, the slave device can repeat the above steps 201-202 again.

[0071] Step 204: If no data transmitted by the bus is received within the set time period, then after a delay of the set time, the device identification of the slave device is sent to the host device.

[0072] According to the judgment result of step 202, if the slave device does not receive the data transmitted by the bus within the set time period, it means that there is no data transmission on the bus. After the delay set time, the slave device can send the device identification of the slave device to the host device, so that the host device sends the communication address allocation information to the slave device according to the device identification.

[0073] It should be noted that step 203 and step 204 are parallel steps, which are different operations corresponding to different judgment results in step S202.

[0074] In summary, the networking state is first entered based on the networking instruction sent by the host device, and then it is determined whether the data transmitted by the bus is received within the set time period. If the data transmitted by the bus is received within the set time period, the networking state is exited. If the data transmitted by the bus is not received within the set time period, the device identification of the slave device is sent to the host device after a delay of the set time period. The above method enables communication devices that do not have the ability to detect carrier sense conflicts to assist communication devices in device networking without the need for other communication methods, thereby reducing bus conflicts during the networking process and improving the networking success rate.

[0075] The networking instruction in the embodiment of the present application may also include a grouping mask. Before step 201 of the embodiment of the present application, the slave device may first obtain the number of the first byte of the grouping mask. Then, the device identification is byte-operated according to the number of the first byte to obtain the second byte. Then, the first byte and the second byte are subjected to a target operation to obtain an operation result. If the operation result is not a set value, the networking state is entered. If the operation result is a set value, the networking state is exited. Based on this method, the range of slave devices in the networking process can be controlled, and the probability of simultaneous responses of slave devices can be further reduced by grouping the slave devices.

[0076] In the present application, the packet mask is a bit mask for identifying and distinguishing different devices or data types. It can be a binary sequence of one byte or multiple bytes, in which each bit represents a specific meaning or attribute. Generally, the meaning of these bits is defined and explained by the design specification of the communication protocol or system. The packet mask in the present application can be used to filter slave devices so that only some slave devices are networked. The above-mentioned first byte is the binary sequence of the packet mask in the present application, and the second byte is a byte operation for the device identification of the slave device, and the device identification is converted into a binary sequence with the same number of bits as the first byte. Then, the first byte and the second byte are subjected to an OR operation or an AND operation, and based on whether the operation result meets the preset conditions, it is determined to exit the networking or perform subsequent networking steps.

[0077] Exemplarily, the group mask is 1 byte. Taking the group mask of 00001111 as an example, the device serial number of the slave device is ABC123XYZ, and each character has a unique numerical representation in the ASCII table, 'A' is 65, 'B' is 66, 'C' is 67, '1' is 49, '2' is 50, '3' is 51, 'X' is 88, 'Y' is 89, and 'Z' is 90. The ASCII code value of each character is added to get 615, and then 615 is converted to a byte (that is, modulo 256). 615 is divided by 256 to get the remainder 103, which is then converted to binary 01100111. 00001111 and 01100111 are ANDed to get 00000111 (that is, decimal 7). The set value is zero, and the operation result is a non-zero value, and the slave device enters the networking state.

[0078] It should be noted that the packet mask may be 1 byte, 2 bytes or 3 bytes, etc. No matter how many bytes the packet mask received by the slave device is, it is only necessary to make the number of bytes of the device identifier the same as that of the device identifier during the byte operation and perform byte operations. The set value can also be 1, 2 and other possible values, which will not be given one by one here.

[0079] Before step 201 of the embodiment of the present application, the slave device can determine whether it has been assigned a communication address based on the networking instruction. If the communication address has not been assigned, the networking state is entered. If the communication address has been assigned, the current networking instruction is not responded to. In other words, when networking, the slave device that has been assigned a communication address through the self-organizing network no longer responds to the networking instruction of the host device, and only the slave device that has not been assigned an address through the self-organizing network responds to the networking instruction of the host device. Under the action of this mechanism, the number of slave devices with unassigned addresses on the bus during multiple networking processes will become fewer and fewer, and the probability of conflict will also become lower and lower, making the networking success rate higher. Or it can be said that the slave device that has been assigned a communication address will not respond to the networking instruction when it receives the networking instruction.

[0080] In the embodiment of the present application, the networking device may further include a networking sequence number. In step S204, when the slave device sends the device identification to the host device, the networking sequence number may also be sent to the host device, so that the host device performs networking based on the networking sequence number and the device identification. The networking sequence number may enable the host device to determine which networking instruction the slave device specifically responds to, and to send the device identification and the networking sequence number to perform networking.

[0081] After step 204 of the embodiment of the present application, that is, after the slave device sends the device identification of the slave device to the host device, the host device sends the communication address allocation information to the slave device, and the slave device receives the communication address allocation information sent by the host device. Then, the slave device can send a message to the slave device indicating the successful reception of the communication address allocation information, so that the host device determines that the communication address allocation is successful and subsequently sends information to the slave device.

[0082] In an embodiment of the present application, the communication system may include multiple slave devices. The host device and multiple slave devices may be networked multiple times. Moreover, in each networking process, the host device is networked with one of the multiple slave devices. That is to say, in each networking process, only one slave device is added to communicate with the host device, and once the slave device in the networking state finds that there is data on the bus, it exits the current networking state and enters the normal state. Still taking the Modbus protocol as an example, there may be multiple Modbus slave devices on an RS485 bus, and after the Modbus host device issues a networking broadcast, there may be corresponding problems with multiple slave devices. Through the networking method of the embodiment of the present application, the probability of multiple slave devices responding at the same time can be greatly reduced, and it is basically guaranteed that only one slave device responds to each host device broadcast networking. In this way, without changing the hardware structure, the host device and the slave device can realize self-networking, reducing the conflict of multiple slave devices responding at the same time.

[0083] Combination of the above Figure 2 The networking method of the communication system provided in the embodiment of the present application is described in detail. Figure 3 Introduce the specific application scenarios of the networking method of the communication system.

[0084] Figure 3 Schematic diagram of the process of the networking method of the communication system provided in the embodiment of the present application Figure 2 The networking method of the communication system is suitable for Figure 1 The communication system shown mainly involves: a host device, a bus, and a slave device.

[0085] Specifically, Figure 3 As shown, the process of the networking method of the communication system may include steps 301-311.

[0086] Step 301: the host device broadcasts a networking instruction to the slave devices on the bus, and the slave devices receive the networking instruction and enter a networking state.

[0087] Step 302, determining whether the slave device has been assigned a communication address.

[0088] Step 303 , the slave device that has been assigned a communication address exits the networking state, and the slave device that has not been assigned a communication address continues to execute step 304 .

[0089] Step 304 , the slave device obtains the number of the first bytes of the packet mask, performs a byte operation on the device identifier according to the number of the first byte to obtain a second byte, and performs an AND operation on the first byte and the second byte to obtain an AND operation result.

[0090] The networking instruction in step 301 includes a grouping mask.

[0091] Step 305, determining whether the AND operation result is a set value of zero.

[0092] Step 306 , if yes, the slave device exits the networking state; if no, the slave device continues to execute step 307 .

[0093] Step 307, determining whether data transmitted by the bus is received within a set time period.

[0094] The specific setting method of the set time period can refer to the description in step 202, which will not be repeated here.

[0095] Step 308: When the slave device receives data transmitted by the bus within a set time period, it exits the networking state.

[0096] Step 309: When the slave device does not receive data transmitted by the bus within the set time period, it sends the device identification and networking serial number of the slave device to the host device after a delay of the set time.

[0097] Step 310: After receiving the device identification and networking serial number sent by the slave device, the host device sends communication address allocation information to the slave device.

[0098] Step 311, after receiving the communication address allocation information, the slave device sends a reception success message to the host device.

[0099] Among them, step 311 is an optional step, and the slave device may not feed back the successful reception information. After the host device sends the communication address allocation information, it is assumed that the allocation has been completed, and the networking of the slave device is completed.

[0100] Figure 4 FIG. 1 is a schematic diagram of a networking device of a communication system according to an embodiment of the present application. Figure 4As shown, an embodiment of the present application provides a networking device of a communication system, which may include: a receiving module 401, a judging module 402, an exit module 403 and a sending module 404. The receiving module 401 is used to receive a networking instruction sent by a host device to enter a networking state. The judging module 402 is used to judge whether bus-transmitted data is received within a set time period. The exit module 403 is used to exit the networking state when bus-transmitted data is received within a set time period. The sending module 404 is used to send a device identifier of a slave device to the host device after a delay setting time if no bus-transmitted data is received within a set time period.

[0101] Among them, the receiving module 401, the judgment module 402, the exit module 403 and the sending module 404 can be used to execute steps 201-204 in the embodiment corresponding to the networking method of the above-mentioned communication system respectively. For the specific implementation methods of these modules and more details, please refer to the corresponding method part, which will not be repeated here.

[0102] Figure 5 This is a structural block diagram of a computer device provided in an embodiment of the present application. Figure 5 , an embodiment of the present application provides a computer device 500, including:

[0103] Memory 501, configured to store instructions; and

[0104] The processor 502 is configured to call instructions from the memory 501 and implement the above-mentioned communication system networking method when executing the instructions.

[0105] An embodiment of the present application also provides a machine-readable storage medium, on which instructions are stored. When the instructions are executed by a processor, the processor is configured to execute the above-mentioned communication system networking method.

[0106] Since the instructions stored in the computer device and the machine-readable storage medium can execute the steps in the networking method of any communication system provided in the embodiments of the present application, the beneficial effects that can be achieved by the networking method of any communication system provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0107] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0108] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0109] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0110] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0111] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0112] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0113] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated communication signals and carrier waves.

[0114] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0115] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A communication system networking method, It is characterized in that A slave device applied to a communication system, wherein the slave device communicates with a host device in the communication system via a bus, and the method comprises: Entering a networking state based on a networking instruction sent by the host device; Determining whether data transmitted by the bus is received within a set time period; If the data transmitted by the bus is received within the set time period, the networking state is exited; If the data transmitted by the bus is not received within the set time period, the device identification of the slave device is sent to the host device after a delay of a set time.

2. The method according to claim 1, It is characterized in that The method further comprises: Determine the delay range according to the networking instruction; Generate a random value within the delay range; The set time period is determined based on the random value.

3. The method according to claim 2, It is characterized in that Generating a random value within the delay range, comprising: Using the device identification of the slave device as a random seed; A random value is generated based on the random seed.

4. The method according to claim 1, It is characterized in that The networking instruction includes a grouping mask, and the entering into a networking state based on the networking instruction sent by the host device includes: Obtain the number of the first byte of the packet mask; Performing a byte operation on the device identifier according to the number of the first bytes to obtain a second byte; Perform a target operation on the first byte and the second byte to obtain an operation result; If the calculation result is not the set value, the networking state is entered.

5. The method according to claim 1, It is characterized in that The entering into a networking state based on a networking instruction sent by the host device comprises: Determining whether a communication address has been allocated based on the networking instruction; If the communication address is not allocated, the networking state is entered; If a communication address has been assigned, it will not respond to the current networking instruction.

6. The method according to claim 1, It is characterized in that The networking instruction also includes a networking sequence number. After the set time ends, the method further includes: The networking serial number is sent to the host device, so that the host device performs networking based on the networking serial number and the device identifier.

7. The method according to claim 1, It is characterized in that After sending the device identification of the slave device to the host device, the method further includes: Receive communication address allocation information sent by the host device.

8. The method according to claim 1, It is characterized in that The communication system includes a plurality of slave devices, the host device is networked with the plurality of slave devices for multiple times, and in each networking process, the host device is networked with one of the plurality of slave devices.

9. A networking device for a communication system, It is characterized in that The device comprises: A receiving module, used for receiving a networking instruction sent by the host device to enter a networking state; A determination module, used to determine whether the data transmitted by the bus is received within a set time period; An exit module, used to exit the networking state when receiving data transmitted by the bus within the set time period; The sending module is used to send the device identification of the slave device to the host device after a delay of a set time if the data transmitted by the bus is not received within the set time period.

10. A computer device, It is characterized in that include: a memory configured to store instructions; as well as A processor is configured to call the instructions from the memory and implement the networking method of the communication system according to any one of claims 1 to 8 when executing the instructions.

11. A machine-readable storage medium, It is characterized in that The machine-readable storage medium stores instructions, and when the instructions are executed by a processor, the processor is configured to execute the networking method of the communication system according to any one of claims 1 to 8.

Citation Information

Cited By

  • Industrial serial bus equipment ad hoc network method and device based on dynamic time slot mapping

    CN122420282A