Automatic addressing method and system and computer readable medium

Through the automatic addressing method, the host querys slave configuration information, filters and updates the communication addresses that need to be updated, solving the problem of low addressing efficiency of existing sensors and realizing a more efficient and flexible addressing process.

CN120111030APending Publication Date: 2025-06-06METTLER TOLEDO (CHANGZHOU) PRECISION INSTR CO LTD +2
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202311671372.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-06
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

The existing sensor addressing methods mainly rely on manual configuration, with low efficiency, flexibility and poor fault tolerance, making it difficult to efficiently complete sensor addressing in complex field environments.

Method used

The automatic addressing method is adopted, and the query configuration information command is sent to the slave through the host, the slave serial number and addressing record number are collected, and the slaves that need to be updated according to the preset addressing algorithm are filtered out, and finally the addressing slave list is generated and the slave communication address is updated.

Benefits of technology

Improves the efficiency of sensor addressing, simplifies the installation and maintenance process of sensors, reduces the use and economic losses of cable marking, and improves the flexibility and fault tolerance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120111030A_ABST
    Figure CN120111030A_ABST
Patent Text Reader

Abstract

The invention relates to an automatic addressing method and system and a computer readable medium, and the method comprises the following steps: a configuration information query step: each slave sends own configuration information to a host according to a delay reply time parameter and a current communication address, and the configuration information comprises a slave serial number and an addressing record number; a screening and addressing step: the host judges whether the current communication address corresponding to each slave has a conflict or not, if so, the slave of which the communication address needs to be updated is screened out according to a preset addressing algorithm and an addressing record number, and an addressing slave list is generated; a new address setting step: the host sends a new address setting command to the corresponding slave according to the addressing slave list; the slave updates the current communication address; an addressing confirmation step: the host sends an addressing record number of the batch to each slave; and each slave uses the addressing record number of the batch as the latest addressing record number. The addressing efficiency of the sensor can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention mainly relates to the technical field of sensor addressing, and in particular to an automatic addressing method, system and computer-readable medium. Background Art

[0002] Weighing sensors can be used for weighing in large tank scales, vehicle scales and other application scenarios. Multi-point measurement is usually used for weighing, that is, multiple weighing sensors are used to measure an object. Each weighing sensor is connected to the host through the field bus as a slave. The host can be a programmable logic controller (PLC) or a weighing meter. The host PLC or weighing meter can collect data such as the weight of multiple slave weighing sensors, which will participate in the corresponding process control or be displayed to the user through the terminal interface.

[0003] The half-duplex communication interface based on the serial bus is a common communication method. The typical half-duplex communication mode usually has a host and several slaves in the bus. The communication protocol adopts a strict master-slave communication mode, that is, the host asks and the polled slave responds (one question and one answer). The host needs to know the communication address of each slave in advance, and then use polling to obtain the data of each slave. The half-duplex communication mode is mostly used between PLC or weighing instrument and weighing sensor.

[0004] At present, the addressing of sensors (such as weighing sensors) mostly adopts manual addressing. The technicians configure the communication address of the weighing sensor through hardware or software in a fixed addressing mode. After the addressing is completed, the weighing sensor is powered on step by step and remains powered on by hardware cascading. The fixed addressing method relies on hardware, has low flexibility and low fault tolerance. Due to the complex on-site weighing environment, there are usually situations where the weighing sensor is installed in a hidden place, the communication cable is mixed with other cables, the connection is hidden, the cable marking is unclear, the cable passes through the relay, the slave communication address is repeated or wrong, and the sensor is added or replaced. The use of manual addressing will make the on-site technicians spend a lot of energy and time for this, and the existing sensor addressing method has the problem of low addressing efficiency. Summary of the invention

[0005] The technical problem to be solved by the present application is to provide an automatic addressing method, system and computer-readable medium, which can improve the addressing efficiency of sensors.

[0006] The technical solution adopted by the present application to solve the above technical problems is an automatic addressing method, including: a configuration information query step: the host sends a configuration information query command to each slave; in response to the configuration information query command, each slave sends its own configuration information to the host according to a delayed reply time parameter and a current communication address, and the configuration information includes: a slave serial number and an addressing record number, and the addressing record number is a mark used to indicate a batch of addressing; an address screening step: the host determines whether there is a conflict between the current communication addresses corresponding to each slave, and if the judgment is yes, the addressing record number that needs to be updated is screened out according to a preset addressing algorithm and an addressing record number. The host updates the communication address of the slave as needed to generate an addressed slave list, wherein the addressed slave list includes the slave serial number and the communication address corresponding to the slave serial number; a new address setting step: the host sends a set new address command to the corresponding slave according to the addressed slave list; in response to the set new address command, the slave updates the current communication address according to the communication address in the set new address command; and a confirmation addressing step: the host sends the addressing record number of this batch and a confirmation addressing command to each slave; in response to the confirmation addressing command, each slave uses the addressing record number of this batch as the latest addressing record number.

[0007] In one embodiment of the present application, before the step of querying the configuration information, it also includes: the step of entering the addressing mode: the host broadcasts a start automatic addressing command and a delayed reply time parameter to each slave; in response to the start automatic addressing command, each slave enters the automatic addressing mode and does not reply to the host by default; wherein the delayed reply time parameter includes: the minimum time for the slave to delay replying to the host and the maximum time for the slave to delay replying to the host, and the delayed reply time parameter is used to control the slave to reply to the host at a specific time.

[0008] In one embodiment of the present application, in the configuration information query step, the step of each slave sending its own configuration information to the host according to the delayed response time parameter and the current communication address includes: each slave generates its own corresponding random number seed n, wherein the random number seed n of each slave is different, and the random number seed n is less than or equal to a preset multiple of the number of slaves; each slave uses the following formula to generate a corresponding delayed response time Td:

[0009] Td=n*Tmin

[0010] Among them, Tmin represents the minimum time for the slave to delay replying to the host, and the delayed reply time Td is less than or equal to the maximum time Nmax for the slave to delay replying to the host; after waiting for the corresponding delayed reply time Td, each slave sends its own slave serial number and current addressing record number to the host according to the current communication address.

[0011] In one embodiment of the present application, in the step of querying configuration information, after the step of each slave sending its own configuration information to the host according to the delayed reply time parameter and the current communication address, it also includes: the host collects a combination of valid slave serial numbers, addressing record numbers and communication addresses; the host broadcasts a silent command to the corresponding slaves according to the collected slave serial numbers; in response to the silent command, the slave stops replying to the query configuration information command; and the step of querying configuration information is repeated until no slave replies to the query configuration information command.

[0012] In one embodiment of the present application, in the addressing screening step, the step of screening out slaves whose communication addresses need to be updated according to a preset addressing algorithm and an addressing record number includes: the host adds slaves whose communication addresses conflict to the first slave group and adds slaves whose communication addresses do not conflict to the second slave group; the host screens out slaves whose communication addresses need to be updated in the first slave group according to the addressing record numbers of the slaves in the first slave group and the addressing record numbers of the slaves in the second slave group.

[0013] In one embodiment of the present application, in the addressing screening step, the host screens out the slaves in the first slave group that need to update the communication address according to the addressing record number of each slave in the first slave group and the addressing record number of each slave in the second slave group; and the step of the host generating an addressing slave list for the slaves whose communication addresses need to be updated includes: step a: the host selects two slaves with the same communication address from the first slave group as slave A and slave B, wherein the current communication addresses of slave A and slave B are both address01; step b: the host determines the second Whether there is an addressing record number identical to that of slave A in the slave group, and the host determines whether there is an addressing record number identical to that of slave B in the second slave group; step c: if it is determined that there is an addressing record number identical to that of slave A, and there is no addressing record number identical to that of slave B, the host assigns the communication address address01 to slave A and assigns a new communication address with a low value and which is not in use to slave B; step d: the host generates an addressing slave list SlaList based on slave B.

[0014] In one embodiment of the present application, in the address screening step, if there are multiple slaves with the same communication address in the first slave group, steps a to d are repeated until there are no slaves with the same communication address in the first slave group.

[0015] In one embodiment of the present application, in the step of setting a new address, the step of the slave updating the current communication address according to the communication address in the command of setting a new address includes: the slave determines whether the slave serial number in the command of setting a new address is the same as its own slave serial number; if the judgment is yes, the slave uses the communication address in the command of setting a new address as the current communication address, and replies to the host with an addressing success command; if the judgment is no, the slave does not reply to the host.

[0016] In one embodiment of the present application, after the confirmation addressing step, it also includes: an exit addressing mode step: the host broadcasts an exit addressing mode command to each slave; in response to the exit addressing mode command, the slave determines whether a confirmation addressing command is received, if it is determined to be yes, the slave exits the addressing mode; if it is determined to be no, the slave discards the addressing results of this batch.

[0017] In one embodiment of the present application, after the step of exiting the addressing mode, it also includes: a step of reviewing the addressing results: the host sends a slave serial number query command to the corresponding slave according to the communication address in the addressed slave list; in response to the slave serial number query command, the slave sends its own slave serial number to the host; the host determines whether the received slave serial number matches the slave serial number in the addressed slave list. If it is determined that there is a mismatch, the host issues an alarm to indicate that the addressing is unsuccessful.

[0018] In order to solve the above technical problems, the present application also proposes an automatic addressing system, comprising: a memory for storing instructions executable by a processor; a processor for executing the instructions to implement the above automatic addressing method.

[0019] In order to solve the above technical problems, the present application also proposes a computer-readable medium storing computer program codes, and the computer program codes implement the above automatic addressing method when executed by a processor.

[0020] The technical solution of the present application can connect the sensor as a slave and communicate with the host. The host can obtain the corresponding information of the slave through the query configuration information step; the host can automatically determine which slaves need to be re-addressed through the screening addressing step; the slaves that need to update the communication address are addressed through the setting new address step; and all slaves in this batch of addressing operations can have the same addressing record number through the confirmation addressing step, which is convenient for recording the addressing situation. The technical solution of the present application designs the communication process between the slave and the host, and adopts an automatic addressing method instead of the traditional manual fixed addressing method, which improves the addressing efficiency, simplifies the installation and maintenance process of the sensor, can reduce the use of sensor cable markers, and reduce the economic losses caused by the failure to update the cable markers in time. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below with reference to the accompanying drawings, wherein:

[0022] Figure 1 is an exemplary flow chart of an automatic addressing method according to an embodiment of the present application;

[0023] Figure 2 is a swim lane diagram of the communication process between the host and the slave in one embodiment of the present application;

[0024] Figure 3 It is a system block diagram of an automatic addressing system according to an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are described in detail below with reference to the accompanying drawings.

[0026] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein, and therefore the present application is not limited to the specific embodiments disclosed below.

[0027] As shown in this application and claims, unless the context clearly indicates an exception, the words "a", "an", "an" and / or "the" do not refer to the singular and may also include the plural. Generally speaking, the terms "include" and "comprise" only indicate the inclusion of the steps and elements that have been clearly identified, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements.

[0028] Flowcharts are used in the present application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed accurately in order. On the contrary, various steps may be processed in reverse order or simultaneously. At the same time, other operations may be added to these processes, or one or more operations may be removed from these processes.

[0029] The present application proposes an automatic addressing method, which can be applied to components such as weighing sensors and instruments, and the sensors can be connected as slaves and hosts. The scenarios to which this application is applicable include: adjustments to on-site wiring cause changes in the correspondence between sensors and cables; unexpected changes in the communication address of the sensor, such as restoring factory settings or staff misoperation; the need to replace, add, or remove sensors, etc. In actual weighing scenarios, according to the automatic addressing method of this application, on-site technicians only need to record the serial number and actual installation location of each weighing sensor (such as a load-bearing foot of a tank), and enter this information in the upper system.

[0030] The automatic addressing method of the present application can be run in a weighing scale, for example, in a controller of the weighing scale, or in a cloud platform. When the automatic addressing method is run on a cloud platform, the data of the weighing scale interacts with the data of the cloud platform through a wireless network. For example, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an interconnected cloud, and multiple clouds, or any combination thereof. The present application does not limit the operating environment of the automatic addressing method.

[0031] Figure 1 is an exemplary flow chart of an automatic addressing method according to an embodiment of the present application, refer to Figure 1 As shown, the automatic addressing method of this embodiment includes the following steps:

[0032] Step S110: Configuration information query step: the host sends a configuration information query command to each slave; in response to the configuration information query command, each slave sends its own configuration information to the host according to the delayed reply time parameter and the current communication address, and the configuration information includes: the slave serial number and the addressing record number, and the addressing record number is a mark used to indicate a batch of addressing.

[0033] Step S120: addressing screening step: the host determines whether there is a conflict in the current communication address corresponding to each slave. If it is judged to be so, the slaves whose communication addresses need to be updated are screened out according to the preset addressing algorithm and the addressing record number; the host generates an addressed slave list according to the slaves whose communication addresses need to be updated, wherein the addressed slave list includes the slave serial number and the communication address corresponding to the slave serial number.

[0034] Step S130: Setting a new address step: the host sends a setting new address command to the corresponding slave according to the addressing slave list; in response to the setting new address command, the slave updates the current communication address according to the communication address in the setting new address command.

[0035] Step S140: Confirmation of addressing step: the host sends the addressing record number of this batch and a confirmation addressing command to each slave; in response to the confirmation addressing command, each slave uses the addressing record number of this batch as the latest addressing record number.

[0036] The above steps S110 to S140 are described in detail below:

[0037] In some embodiments, before step S110: querying configuration information, the process further includes:

[0038] Step S100: Entering addressing mode step: the host broadcasts a start automatic addressing command and a delayed reply time parameter to each slave; in response to the start automatic addressing command, each slave enters the automatic addressing mode and does not reply to the host by default; wherein the delayed reply time parameter includes: the minimum time for the slave to delay replying to the host and the maximum time for the slave to delay replying to the host, and the delayed reply time parameter is used to control the slave to reply to the host at a specific time.

[0039] Exemplarily, the minimum time Tmin for the slave to delay replying to the host can be set to 10ms (milliseconds), and the delay time for the slave to actually reply to the host should be an integer multiple of Tmin. The delay reply time parameter of this application can control the time period in which the slave replies to the host; the maximum time Nmax for the slave to delay replying to the host is equivalent to the preset threshold, and the delay time for the slave to actually reply to the host should not exceed Nmax. By setting the delay reply time parameter, this application allows each slave to communicate with the host in a specific time period, which can ensure that the bus is not occupied and the communication process does not conflict.

[0040] In step S110, the configuration information query step: the host sends a configuration information query command to each slave; in response to the configuration information query command, each slave sends its own configuration information to the host according to the delayed reply time parameter and the current communication address, and the configuration information includes: the slave serial number and the addressing record number, and the addressing record number is a mark used to indicate a batch of addressing. Exemplarily, in a batch addressing process, the automatic addressing method of the present application is fully executed once, and each corresponding slave will have the same addressing record number.

[0041] In some embodiments, in the configuration information query step, the step of each slave sending its own configuration information to the master according to the delayed reply time parameter and the current communication address includes:

[0042] Step S1101: Each slave generates its own corresponding random number seed n, wherein the random number seed n of each slave is different, and the random number seed n is less than or equal to a preset multiple of the number of slaves;

[0043] Step S1102: Each slave uses the following formula (1) to generate a corresponding delayed response time Td:

[0044] Td=n*Tmin (1)

[0045] Wherein, Tmin represents the minimum time for the slave to delay replying to the master, and the delayed reply time Td is less than or equal to the maximum time Nmax for the slave to delay replying to the master;

[0046] Step S1103: After waiting for the corresponding delayed reply time Td, each slave sends its own slave serial number and current addressing record number (ie, the addressing record number of the last batch of successful addressing) to the master according to the current communication address.

[0047] For example, in the aforementioned step S1101, the random number seed n indicates that the slave machine replies to the master machine in the nth time period, and the random number seed n can be set to be less than or equal to 2 times the number of slave machines. In the aforementioned step S1103, the slave machine can reply its own information to the master machine through a communication frame, and the communication frame uses the communication address currently being used by the slave machine. The addressing record number can be set to a 32-bit binary format, which is not limited in this application.

[0048] In some embodiments, in the configuration information query step, after each slave sends its own configuration information to the master according to the delayed reply time parameter and the current communication address, the step further includes:

[0049] Step S111: the host collects valid combinations of slave serial numbers, addressing record numbers and communication addresses;

[0050] Step S112: the host broadcasts a silent command to the corresponding slave according to the collected slave serial numbers;

[0051] Step S113: In response to the silence command, the slave stops replying to the configuration information query command;

[0052] Step S114: Repeat the configuration information query step until no slave responds to the configuration information query command. Exemplarily, the steps S110 to S113 described above may be repeated until no slave responds to the configuration information query command to the master for three consecutive times, and then the process turns to step S120.

[0053] For example, in the aforementioned step S113, if the slave finds that its slave serial number appears in the "silent" command, it enters the silent mode unless it is restarted or receives the "start automatic addressing command" or "exit addressing mode" command. The aforementioned step S114 is used to allow the host to confirm that it has collected all the information of the slaves and has controlled all the slaves to enter the silent mode.

[0054] In step S120, the addressing screening step: the host determines whether there is a conflict in the current communication address corresponding to each slave. If it is judged to be so, the slaves whose communication addresses need to be updated are screened out according to the preset addressing algorithm and the addressing record number; the host generates an addressed slave list according to the slaves whose communication addresses need to be updated, wherein the addressed slave list includes the slave serial number and the communication address corresponding to the slave serial number.

[0055] In some embodiments, in the addressing screening step, the step of screening out slaves whose communication addresses need to be updated according to a preset addressing algorithm and an addressing record number includes: the host adds slaves with conflicting communication addresses to the first slave group and adds slaves with non-conflicting communication addresses to the second slave group; the host screens out slaves whose communication addresses need to be updated in the first slave group according to the addressing record number of each slave in the first slave group and the addressing record number of each slave in the second slave group. Exemplarily, the present application adds the corresponding slaves to the first slave group and the second slave group according to the communication address conflict situation, so as to facilitate the subsequent finding of the slaves whose communication addresses need to be updated.

[0056] In some embodiments, in the addressing screening step, the host screens out slaves in the first slave group that need to update the communication address according to the addressing record number of each slave in the first slave group and the addressing record number of each slave in the second slave group; and the host generates an addressing slave list according to the slaves whose communication addresses need to be updated, including:

[0057] Step a: The host selects two slaves with the same communication address from the first slave group as slave A and slave B respectively, wherein the current communication addresses of slave A and slave B are both address01;

[0058] Step b: the host determines whether there is an addressing record number identical to the addressing record number of slave A in the second slave group, and the host determines whether there is an addressing record number identical to the addressing record number of slave B in the second slave group;

[0059] Step c: If it is determined that there is an addressing record number identical to the addressing record number of slave A, and there is no addressing record number identical to the addressing record number of slave B, the host assigns the communication address address01 to slave A and assigns a new communication address with a low value and not in use to slave B;

[0060] Step d: The host generates an addressed slave list SlaList according to slave B.

[0061] In some embodiments, in the addressing screening step, if there are multiple slaves with the same communication address in the first slave group, for example, there are more than 3 slaves with the same communication address in the first slave group, steps a to d are repeated until there are no slaves with the same communication address in the first slave group.

[0062] Exemplarily, in the process of resolving slave communication address conflicts in the aforementioned steps a to d of the present application, if the current communication addresses of slave A and slave B (for example, B is newly added) in the first slave group are both address01 (for example, address01 is equal to 3), the addressing record number of slave A is the same as the addressing record numbers of the five slaves in the second slave group, and the addressing record number of slave B is unique to slave B, then the host will preferentially assign communication address 3 (address01) to slave A; if the host inquires that the communication addresses available for allocation and unused are address02, address03, address04, etc., then the host preferentially assigns the new communication address address02 with a low value and unused to slave B. In step d, the host can add the slave serial number of slave B and the newly assigned communication address and other related information to the addressing slave list SlaList.

[0063] The communication address allocation principle of this application can keep the previous communication address allocation result unchanged after adding or replacing a sensor. In the process of allocating communication addresses, the original communication addresses of each slave machine are kept unchanged as much as possible to reduce the operation of the upper computer software after automatic addressing. Prioritizing the allocation of communication addresses with low values ​​can make the communication addresses as continuous as possible and improve the utilization rate of the communication addresses.

[0064] In step S130, the new address setting step: the host sends a set new address command to the corresponding slave according to the addressing slave list; in response to the set new address command, the slave updates the current communication address according to the communication address in the set new address command. Exemplarily, the host can read the data in the addressing slave list SlaveList in sequence and broadcast the "set new address command" command to the slaves in the SlaveList table until the communication addresses of all slaves in the SlaveList table are allocated.

[0065] In some embodiments, in the step of setting a new address, the step of updating the current communication address of the slave according to the communication address in the command of setting a new address includes:

[0066] Step S1301: The slave determines whether the slave serial number in the command to set a new address is the same as its own slave serial number;

[0067] Step S1302: If the judgment is yes, the slave will set the communication address in the new address command as the current communication address, and reply an addressing success command to the host; if the judgment is no, the slave will not reply to the host.

[0068] Exemplarily, in the aforementioned step S1302, a slave that does not reply indicates that addressing is unsuccessful, and the host may subsequently warn the user that a slave with a certain slave serial number is abnormal and that the slave fails to set the communication address.

[0069] In step S140, the addressing step is confirmed: the host sends a randomly generated addressing record number of this batch and a confirmation addressing command to each slave; in response to the confirmation addressing command, each slave uses the addressing record number of this batch as the latest addressing record number. Exemplarily, in response to the confirmation addressing command, each slave also writes the addressing record number of this batch and the communication address into its own non-volatile memory.

[0070] In some embodiments, after the addressing confirmation step, the method further includes:

[0071] Step S150: Exit addressing mode step: the host broadcasts an exit addressing mode command to each slave; in response to the exit addressing mode command, the slave determines whether it has received a confirmation addressing command. If it is determined to be yes, the slave exits the addressing mode and then performs normal business communication; if it is determined to be no, the slave discards the addressing results of this batch. Exemplarily, the addressing results of this batch include information such as the communication address received by the slave and the addressing record number of this batch.

[0072] In some embodiments, after the step of exiting the addressing mode, the method further includes:

[0073] Step S160: Checking the addressing result: The host sends a query slave serial number command to the corresponding slave according to the communication address in the addressing slave list; in response to the query slave serial number command, the slave sends its own slave serial number to the host; the host determines whether the received slave serial number matches the slave serial number in the addressing slave list. If it is determined that they do not match, the host issues an alarm to prompt that the addressing is unsuccessful. Exemplarily, through this step S160, the host can check whether the communication address in the SlaveList table is assigned to a slave with a specific slave serial number, and provide an alarm message when an abnormality occurs. Such a setting can increase the reliability of the automatic addressing method.

[0074] Here, an embodiment is used to illustrate the automatic addressing method of the present application. In this embodiment, there are N slaves in total. Figure 2 is a swim lane diagram of the communication process between the host and the slave in one embodiment of the present application, refer to Figure 2 As shown, in step S200: entering the addressing mode step, the host broadcasts and sends a command to start automatic addressing; the slave enters the automatic addressing mode. In step S210: querying the configuration information step, the host broadcasts and sends a command to query the configuration information; slave A replies, slave B replies, and until slave N replies; the host collects the slave serial number, addressing record number and communication address; the host broadcasts and sends a silent command; slave A enters the silent mode, slave B enters the silent mode, and until slave N enters the silent mode. In step S220: screening the addressing step, the host runs the addressing algorithm.

[0075] Continue to refer Figure 2 As shown, in step S230: setting a new address step, the host broadcasts and sends a command to set a new address according to the addressing slave list, and sets the new communication address of slave A; slave A checks that the slave serial number is the same and replies that the addressing is successful; the host sets the new communication address of slave B; slave B checks that the slave serial number is the same and replies that the addressing is successful; the host confirms that the communication addresses of all slaves have been set. In step S240: confirming the addressing step, the host updates the addressing record number of this batch and sends a confirming addressing command; the slave writes the latest addressing record number and the latest communication address into the non-volatile memory. In step S250: exiting the addressing mode step, the host broadcasts and sends a command to exit the addressing mode; the slave exits the addressing mode and performs normal business communication. In step S260: reviewing the addressing result step, the host sends a command to query the slave serial number according to the communication address in the addressing slave list; the slave replies; if the host fails to review the information, it will issue an alarm to prompt that the addressing is unsuccessful.

[0076] The technical solution of the present application connects the sensor as a slave and communicates with the host. The host can obtain the corresponding information of the slave through the query configuration information step; the host can automatically determine which slaves need to be re-addressed through the screening addressing step; the slaves that need to update the communication address are addressed through the setting new address step; and all slaves in this batch of addressing operations can have the same addressing record number through the confirmation addressing step, which is convenient for recording the addressing situation. The technical solution of the present application designs the communication process between the slave and the host based on half-duplex communication technology, and adopts an automatic addressing method instead of the traditional manual fixed addressing method, which improves the addressing efficiency, simplifies the installation and maintenance process of the sensor, can reduce the use of sensor cable markers, and reduce the economic losses caused by the failure to update the cable markers in time.

[0077] The present application also includes an automatic addressing system, including a memory and a processor, wherein the memory is used to store instructions executable by the processor; and the processor is used to execute the instructions to implement the automatic addressing method described above.

[0078] Figure 3 is a system block diagram of an automatic addressing system according to an embodiment of the present application. Figure 3As shown, the automatic addressing system 300 may include an internal communication bus 301, a processor 302, a read-only memory (ROM) 303, a random access memory (RAM) 304, and a communication port 305. The automatic addressing system 300 may also include a hard disk 306. The internal communication bus 301 can realize data communication between the components of the automatic addressing system 300. The processor 302 can make judgments and issue prompts. In some embodiments, the processor 302 can be composed of one or more processors. The communication port 305 can realize data communication between the automatic addressing system 300 and the outside. In some embodiments, the automatic addressing system 300 can send and receive information and data from the network through the communication port 305. The automatic addressing system 300 may also include different forms of program storage units and data storage units, such as a hard disk 306, a read-only memory (ROM) 303 and a random access memory (RAM) 304, which can store various data files used for computer processing and / or communication, and possible program instructions executed by the processor 302. The processor executes these instructions to implement the main part of the method. The processing result of the processor is transmitted to the user device through the communication port and displayed on the user interface.

[0079] The above-mentioned automatic addressing method can be implemented as a computer program, stored in the hard disk 306, and loaded into the processor 302 for execution to implement the automatic addressing method of the present application.

[0080] The present application also includes a computer-readable medium storing a computer program code, which implements the automatic addressing method described above when executed by a processor.

[0081] When the automatic addressing method is implemented as a computer program, it can also be stored in a computer-readable storage medium as an article of manufacture. For example, a computer-readable storage medium can include, but is not limited to, a magnetic storage device (e.g., a hard disk, a floppy disk, a magnetic strip), an optical disk (e.g., a compact disk (CD), a digital versatile disk (DVD)), a smart card, and a flash memory device (e.g., an electrically erasable programmable read-only memory (EPROM), a card, a stick, a key drive). In addition, the various storage media described herein can represent one or more devices and / or other machine-readable media for storing information. The term "machine-readable medium" can include, but is not limited to, wireless channels and various other media (and / or storage media) that can store, contain and / or carry code and / or instructions and / or data.

[0082] It should be understood that the embodiments described above are only illustrative. The embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For hardware implementation, the processor may be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, and / or other electronic units designed to perform the functions described herein, or a combination thereof.

[0083] Some aspects of the present application may be performed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as "data blocks", "modules", "engines", "units", "components" or "systems". The processor may be one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DAPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, or combinations thereof. In addition, various aspects of the present application may be expressed as computer products located in one or more computer-readable media, which include computer-readable program codes. For example, computer-readable media may include, but are not limited to, magnetic storage devices (e.g., hard disks, floppy disks, tapes ...), optical disks (e.g., compact disks CDs, digital versatile disks DVDs ...), smart cards, and flash memory devices (e.g., cards, sticks, key drives ...).

[0084] A computer-readable medium may include a propagated data signal containing computer program code, such as in baseband or as part of a carrier wave. The propagated signal may have a variety of manifestations, including electromagnetic, optical, etc., or a suitable combination. A computer-readable medium may be any computer-readable medium other than a computer-readable storage medium, which may be connected to an instruction execution system, device or apparatus to communicate, propagate or transmit a program for use. The program code on the computer-readable medium may be propagated via any suitable medium, including radio, cable, fiber optic cable, radio frequency signal, or similar medium, or any combination of the above mediums.

[0085] The basic concepts have been described above. Obviously, for those skilled in the art, the above application disclosure is only an example and does not constitute a limitation of the present application. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements and amendments to the present application. Such modifications, improvements and amendments are suggested in the present application, so such modifications, improvements and amendments still belong to the spirit and scope of the exemplary embodiments of the present application.

[0086] At the same time, the present application uses specific words to describe the embodiments of the present application. For example, "one embodiment", "an embodiment", and / or "some embodiments" refer to a certain feature, structure or characteristic related to at least one embodiment of the present application. Therefore, it should be emphasized and noted that "one embodiment" or "an embodiment" or "an alternative embodiment" mentioned twice or more in different positions in this specification does not necessarily refer to the same embodiment. In addition, some features, structures or characteristics in one or more embodiments of the present application can be appropriately combined.

[0087] In some embodiments, numbers describing the number of components and attributes are used. It should be understood that such numbers used in the description of the embodiments are modified by the modifiers "about", "approximately" or "substantially" in some examples. Unless otherwise specified, "about", "approximately" or "substantially" indicate that the numbers are allowed to vary by ±20%. Accordingly, in some embodiments, the numerical parameters used in the specification and claims are approximate values, which may change according to the required features of individual embodiments. In some embodiments, the numerical parameters should take into account the specified significant digits and adopt the general method of retaining digits. Although the numerical domains and parameters used to confirm the breadth of their range in some embodiments of the present application are approximate values, in specific embodiments, the setting of such numerical values ​​is as accurate as possible within the feasible range.

Claims

1. An automatic addressing method, It is characterized in that include: Configuration information query steps: the host sends a configuration information query command to each slave; In response to the configuration information query command, each slave sends its own configuration information to the master according to the delayed reply time parameter and the current communication address, wherein the configuration information includes: a slave serial number and an addressing record number, wherein the addressing record number is a mark used to indicate a batch of addressing; Screening addressing step: the host determines whether the current communication address corresponding to each slave has a conflict, and if so, screens out the slaves whose communication addresses need to be updated according to a preset addressing algorithm and the addressing record number; the host generates an addressed slave list according to the slaves whose communication addresses need to be updated, wherein the addressed slave list includes a slave serial number and a communication address corresponding to the slave serial number; Setting a new address step: the host sends a set new address command to the corresponding slave according to the addressing slave list; in response to the set new address command, the slave updates the current communication address according to the communication address in the set new address command; and Confirmation addressing step: the host sends the addressing record number of this batch and a confirmation addressing command to each of the slaves; in response to the confirmation addressing command, each of the slaves uses the addressing record number of this batch as the latest addressing record number.

2. The automatic addressing method according to claim 1, It is characterized in that Before the step of querying configuration information, the method further includes: Steps for entering the addressing mode: the host broadcasts a start automatic addressing command and a delayed reply time parameter to each slave; in response to the start automatic addressing command, each slave enters the automatic addressing mode and does not reply to the host by default; wherein the delayed reply time parameter includes: the minimum time for the slave to delay replying to the host and the maximum time for the slave to delay replying to the host, and the delayed reply time parameter is used to control the slave to reply to the host at a specific time.

3. The automatic addressing method according to claim 2, It is characterized in that In the configuration information query step, the step of each slave sending its own configuration information to the host according to the delayed reply time parameter and the current communication address includes: Each slave generates its own corresponding random number seed n, wherein the random number seed n of each slave is different, and the random number seed n is less than or equal to a preset multiple of the number of slaves; Each slave generates a corresponding delayed response time Td using the following formula: Td=n*Tmin Wherein, Tmin represents the minimum time for the slave to delay replying to the master, and the delayed reply time Td is less than or equal to the maximum time Nmax for the slave to delay replying to the master; Each slave sends its own slave serial number and current addressing record number to the host according to the current communication address after waiting for the corresponding delayed reply time Td.

4. The automatic addressing method according to claim 1, It is characterized in that In the configuration information query step, after the step of each slave sending its own configuration information to the host according to the delayed reply time parameter and the current communication address, the method further includes: The host collects a combination of a valid slave serial number, an addressing record number and a communication address; The host broadcasts a silent command to the corresponding slave according to the collected slave serial numbers; In response to the silence command, the slave stops replying to the query configuration information command; Repeat the configuration information query step until no slave device responds to the configuration information query command.

5. The automatic addressing method according to claim 1, It is characterized in that In the addressing screening step, the step of screening out slaves whose communication addresses need to be updated according to a preset addressing algorithm and the addressing record number includes: the host adds slaves with conflicting communication addresses to the first slave group and adds slaves with non-conflicting communication addresses to the second slave group; the host screens out slaves in the first slave group whose communication addresses need to be updated according to the addressing record numbers of the slaves in the first slave group and the addressing record numbers of the slaves in the second slave group.

6. The automatic addressing method as claimed in claim 5, It is characterized in that In the addressing screening step, the host screens out slaves in the first slave group whose communication addresses need to be updated according to the addressing record numbers of the slaves in the first slave group and the addressing record numbers of the slaves in the second slave group; The step of the host generating an addressed slave list according to the slaves whose communication addresses need to be updated comprises: Step a: the host selects two slaves with the same communication address from the first slave group as slave A and slave B respectively, wherein the current communication addresses of slave A and slave B are both address01; Step b: the host determines whether there is an addressing record number identical to the addressing record number of the slave A in the second slave group, and the host determines whether there is an addressing record number identical to the addressing record number of the slave B in the second slave group; Step c: If it is determined that there is an addressing record number identical to the addressing record number of the slave A, and there is no addressing record number identical to the addressing record number of the slave B, the host assigns the communication address address01 to the slave A and assigns a new communication address with a low value and not in use to the slave B; Step d: The host generates an addressed slave list SlaList according to the slave B.

7. The automatic addressing method according to claim 6, It is characterized in that In the address screening step, if there are multiple slaves with the same communication address in the first slave group, steps a to d are repeated until there are no slaves with the same communication address in the first slave group.

8. The automatic addressing method according to claim 1, It is characterized in that In the step of setting a new address, the step of the slave updating the current communication address according to the communication address in the command of setting a new address comprises: The slave determines whether the slave serial number in the set new address command is the same as its own slave serial number; If the judgment is yes, the slave uses the communication address in the set new address command as the current communication address, and replies an addressing success command to the host; if the judgment is no, the slave does not reply to the host.

9. The automatic addressing method according to any one of claims 1 to 8, It is characterized in that After the addressing confirmation step, the method further includes: Steps for exiting addressing mode: the host broadcasts an exit addressing mode command to each slave; in response to the exit addressing mode command, the slave determines whether the confirmation addressing command is received, and if so, the slave exits the addressing mode; if not, the slave discards the addressing results of this batch.

10. The automatic addressing method according to claim 9, It is characterized in that After the step of exiting the addressing mode, the method further comprises: Steps for reviewing the addressing results: the host sends a slave serial number query command to the corresponding slave according to the communication address in the addressed slave list; in response to the slave serial number query command, the slave sends its own slave serial number to the host; the host determines whether the received slave serial number matches the slave serial number in the addressed slave list, and if it is determined that there is no match, the host issues an alarm to indicate that the addressing is unsuccessful.

11. An automatic addressing system, It is characterized in that include: a memory for storing instructions executable by a processor; A processor, configured to execute the instructions to implement the automatic addressing method as described in any one of claims 1 to 10.

12. A computer readable medium storing computer program code, It is characterized in that When the computer program code is executed by a processor, the computer program code implements the automatic addressing method according to any one of claims 1 to 10.

Citation Information

Cited By

  • Master-slave address dynamic management method and device, electronic equipment and storage medium

    CN121000701A

  • BMS parallel operation addressing method and device, equipment, storage medium and product

    CN121691272A

  • Bms parallel addressing method, device, equipment, storage medium and product

    CN121691272B