[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN112104760A - Address code allocation method, host and slave - Google Patents

Address code allocation method, host and slave Download PDF

Info

Publication number
CN112104760A
CN112104760A CN202010813376.XA CN202010813376A CN112104760A CN 112104760 A CN112104760 A CN 112104760A CN 202010813376 A CN202010813376 A CN 202010813376A CN 112104760 A CN112104760 A CN 112104760A
Authority
CN
China
Prior art keywords
address code
address
slave
slave machine
host
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010813376.XA
Other languages
Chinese (zh)
Inventor
周广飞
刘启武
操四胜
赵寰
王映娟
赵勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Hongmei Intelligent Technology Co Ltd
Original Assignee
Sichuan Hongmei Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Hongmei Intelligent Technology Co Ltd filed Critical Sichuan Hongmei Intelligent Technology Co Ltd
Priority to CN202010813376.XA priority Critical patent/CN112104760A/en
Publication of CN112104760A publication Critical patent/CN112104760A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/30Managing network names, e.g. use of aliases or nicknames
    • H04L61/3015Name registration, generation or assignment
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/12Discovery or management of network topologies

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention provides an address code allocation method, a host and a slave. Sending communication content aiming at the address code corresponding to each slave; judging whether at least one abnormal address code exists according to the feedback result of the slave machine corresponding to each address code, and if so, setting the at least one abnormal address code as at least one unallocated address code; resetting the address code of the slave machine corresponding to each abnormal address code to a reset address code; performing for each of said unassigned address codes: generating an address preemption instruction aiming at the current unallocated address code; sending the address preemption instruction to at least one slave machine corresponding to the reset address code; when an address preemption request returned by a first slave machine aiming at the current unallocated address code is received firstly, the address code of the first slave machine is set as the current unallocated address code. The scheme of the invention can allocate the address code under the condition of abnormal address code.

Description

Address code allocation method, host and slave
Technical Field
The present invention relates to the field of communications technologies, and in particular, to an address code allocation method, a master device, and a slave device.
Background
The multiple devices are widely popularized and popularized, and generally, the multiple devices need to set address codes of controlled devices in a bus communication process through a one-to-many bus communication mode, and the address codes of each controlled device are set according to the number of the controlled devices. However, when there are many controlled devices, the address code is likely to be abnormal.
At present, when the address code is abnormal, the control machine gives a default initial address code to the controlled machine with the abnormal address code. However, the initial address code is likely to correspond to another controlled device, and thus, the address code is duplicated, so that the multi-connected device cannot operate normally. Therefore, there is a need for a way to allocate address codes in the event of an address code exception.
The invention of patent No. CN201510886736.8 provides a method and system for detecting and processing MAC address collision of server management system, in the invention, the MAC address management process in the SMC acquires the Slot ID and the MAC address of the SMC and each blade BMC, establishes a mapping table of the Slot ID and the MAC address of a server management system, searches whether a conflicting MAC address exists in the table, if the MAC address conflict exists, the Slot ID of the corresponding blade is recorded, the IPMI command is used for clearing the MAC address corresponding to the BMC which has the MAC address conflict but does not execute the MAC address clearing operation, recording a 'MAC address conflict' log in a shared experience base SEL, prompting an administrator to check information such as a blade with MAC address conflict and an original MAC address thereof displayed in a management page through an alarm LED, resetting the MAC address, therefore, the whole server management system can not be incapable of normal network access due to MAC address conflict. The invention only provides a method for solving the address conflict phenomenon of the server management system, but cannot solve the address code allocation problem under the condition of abnormal address codes of the multi-connected equipment.
Disclosure of Invention
The embodiment of the invention provides an address code allocation method, a host and a slave, which can allocate address codes under the condition of abnormal address codes.
In a first aspect, an embodiment of the present invention provides an address code allocation method, which is applied to a master, where the master is connected to at least two slaves; each slave corresponds to an address code; an address code is assigned by the host;
sending communication content aiming at the address code corresponding to each slave;
judging whether at least one abnormal address code exists according to the feedback result of the slave machine corresponding to each address code;
if yes, setting the at least one abnormal address code as at least one unallocated address code;
resetting the address code of the slave machine corresponding to each abnormal address code to a reset address code;
performing for each of said unassigned address codes:
generating an address preemption instruction aiming at the current unallocated address code;
sending the address preemption instruction to at least one slave machine corresponding to the reset address code;
when an address preemption request returned by a first slave machine aiming at the current unallocated address code is received firstly, the address code of the first slave machine is set as the current unallocated address code.
Preferably, the first and second electrodes are formed of a metal,
the determining whether there is at least one abnormal address code according to the feedback result of the slave machine corresponding to each address code includes:
and when communication content responses returned by at least two slave machines are received aiming at the first address code and the communication content responses are not received aiming at the second address code, judging that the first address code and the second address code are abnormal address codes.
Preferably, the first and second electrodes are formed of a metal,
the resetting the address code of the slave machine corresponding to each abnormal address code to the reset address code includes:
and sending an address exception broadcast message corresponding to the exception address code to trigger the slave machine corresponding to the exception address code to modify the address code corresponding to the slave machine into a reset address code.
Preferably, the first and second electrodes are formed of a metal,
the address preemption request carries a random number and equipment parameters corresponding to the first slave machine;
the setting the address code of the first slave machine to be the currently unallocated address code includes:
and after the preemption request is verified, sending an address verification success notification to the first slave machine, wherein the address verification success notification carries the random number and the equipment parameter corresponding to the first slave machine, so as to trigger the first slave machine to modify the address code of the first slave machine into the currently unallocated address code after the first slave machine successfully verifies according to the random number and the equipment parameter carried in the address verification success notification.
In a second aspect, an embodiment of the present invention provides an address code allocation method, which is applied to slaves, where each slave is connected to a host; each slave corresponds to an address code distributed by the master;
receiving communication content sent by the host computer, and sending a feedback result to the host computer so that the host computer judges whether at least one abnormal address code exists;
resetting the address code to a reset address code by using a slave machine corresponding to each abnormal address code;
and utilizing each slave corresponding to the reset address code to receive an address preemption instruction which is sent by a host and aims at the current unallocated address code, so that a first slave in each slave corresponding to the reset address code firstly returns an address preemption request to the host, and the host sets the address code of the first slave as the current unallocated address code.
Preferably, the first and second electrodes are formed of a metal,
the resetting of the address code to the reset address code by the slave machine corresponding to each abnormal address code comprises the following steps:
and each slave machine corresponding to the abnormal address code receives the abnormal address broadcast message sent by the host machine and modifies the corresponding address code into the reset address code according to the abnormal broadcast message.
Preferably, the first and second electrodes are formed of a metal,
the first slave in each slave corresponding to the reset address code firstly returns an address preemption request to the master, and the method comprises the following steps:
and each slave machine corresponding to the reset address code correspondingly generates a random number, and delays according to the following delay formula by the random number:
Figure BDA0002631828050000041
wherein, T is delay time, A is the random number, and B is communication baud rate;
the first slave machine which is the first slave machine of the slave machines corresponding to the reset address code and finishes time delay sends the address preemption request to the host machine, wherein the address preemption request carries a random number and equipment parameters corresponding to the first slave machine so as to verify the host machine;
and after each other slave machine corresponding to the reset address code determines that the first slave machine has sent the address preemption request, determining that the address preemption fails, and ending timing.
Preferably, the first and second electrodes are formed of a metal,
the first slave machine receives an address verification success notification sent by the master machine, wherein the address verification success notification carries a random number and equipment parameters corresponding to the first slave machine;
and when the first slave machine receives the address verification success notification, verifying whether the random number and the equipment parameter are the same as the random number and the equipment parameter of the first slave machine, if so, determining that the verification is successful, and modifying the address code of the first slave machine into the currently unallocated address code.
In a third aspect, an embodiment of the present invention provides a host based on any one of the address code allocation methods in the first aspect, including:
a transmitting unit and a first processing unit;
the sending unit is used for sending communication content aiming at the address code corresponding to each slave;
the first processing unit is used for judging whether at least one abnormal address code exists according to the feedback result of the slave machine corresponding to each address code;
if yes, setting the at least one abnormal address code as at least one unallocated address code; resetting the address code of the slave machine corresponding to each abnormal address code to a reset address code;
performing for each of said unassigned address codes: generating an address preemption instruction aiming at the current unallocated address code;
sending the address preemption instruction to at least one slave machine corresponding to the reset address code;
when an address preemption request returned by a first slave machine aiming at the current unallocated address code is received firstly, the address code of the first slave machine is set as the current unallocated address code.
In a fourth aspect, an embodiment of the present invention provides a slave based on the address code allocation method provided in any one of the second aspects, where the slave includes:
a communication unit and a second processing unit;
the communication unit is used for receiving the communication content sent by the host and sending a feedback result to the host so that the host judges whether at least one abnormal address code exists;
the second processing unit is used for resetting the address code to a reset address code when the abnormal address code corresponds to the abnormal address code; when the slave machine corresponds to the reset address code, receiving an address preemption instruction which is sent by a host machine and is generated aiming at the current unallocated address code, and enabling a first slave machine in each slave machine corresponding to the reset address code to firstly return an address preemption request to the host machine so as to enable the host machine to set the address code of the first slave machine as the current unallocated address code.
The embodiment of the invention provides an address code allocation method, a host and a slave. According to the scheme, each host is connected with at least two slaves, and each slave corresponds to the address code allocated by one host. The host machine sends communication content according to the address code corresponding to each slave machine, the slave machines recover feedback results after receiving the communication content, the host machine can judge whether at least one abnormal address code exists according to the feedback results, if at least one abnormal address code exists, the abnormal address codes are set as at least one corresponding unallocated address code, and the address code of the slave machine corresponding to each abnormal address code is reset into a default reset address code in a reset state. And generating an address preemption instruction for the current unallocated address code in each unallocated address code, sending the address preemption instruction to at least one slave machine corresponding to the reset address code in a reset state, firstly returning a first slave machine in the slave machines to an address preemption request to the master machine, setting the address code of the first slave machine as the current unallocated address code by the master machine, and repeating the steps until all the unallocated address codes are allocated to the slave machines corresponding to the reset address code. Therefore, according to the scheme provided by the invention, the abnormal address code can be accurately detected through the feedback result of the slave machine on the communication content, and under the condition that the address code is abnormal, the slave machine corresponding to the abnormal address code is reset, so that the slave machine corresponding to the abnormal address code is corresponding to the reset address code in the reset state to distribute the unallocated address code, and the slave machine distributed to the address code sets the address code of the slave machine, so that the abnormal address code is redistributed under the condition that the address code is abnormal.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart of an address code allocation method according to an embodiment of the present invention;
fig. 2 is a flowchart of another address code allocation method according to an embodiment of the present invention;
FIG. 3 is a diagram of a host according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a slave according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer and more complete, the technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention, and based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts belong to the scope of the present invention.
As described above, the multi-connected device generally uses the one-to-many bus communication mode, and needs to set the address code of the controlled device during the bus communication, and sets the address code of each controlled device according to the number of the controlled devices. However, when there are many controlled devices, the address code is likely to be abnormal.
At present, when the address code is abnormal, the control machine gives a default initial address code to the controlled machine with the abnormal address code. However, the initial address code is likely to correspond to another controlled device, and thus, the address code is duplicated, so that the multi-connected device cannot operate normally. Therefore, there is a need for a way to allocate address codes in the event of an address code exception.
The following describes an intelligent device control panel and an intelligent device control system according to embodiments of the present invention in detail with reference to the accompanying drawings.
As shown in fig. 1, an embodiment of the present invention provides an address code allocation method, which is applied to a master, where the master is connected to at least two slaves; each slave corresponds to an address code; an address code is assigned by the host;
step 101: and transmitting communication content aiming at the address code corresponding to each slave.
Step 102: and judging whether at least one abnormal address code exists according to the feedback result of the slave machine corresponding to each address code, and if so, setting the at least one abnormal address code as at least one unallocated address code.
Step 103: and resetting the address code of the slave machine corresponding to each abnormal address code into a reset address code.
Step 104: performing for each of said unassigned address codes: and generating an address preemption instruction aiming at the currently unallocated address code, and sending the address preemption instruction to at least one slave machine corresponding to the reset address code.
Step 105: when an address preemption request returned by a first slave machine aiming at the current unallocated address code is received firstly, the address code of the first slave machine is set as the current unallocated address code.
Specifically, according to the scheme, each master is connected with at least two slaves, and each slave corresponds to an address code allocated by the master. The host machine sends communication content according to the address code corresponding to each slave machine, the slave machines recover feedback results after receiving the communication content, the host machine can judge whether at least one abnormal address code exists according to the feedback results, if at least one abnormal address code exists, the abnormal address codes are set as at least one corresponding unallocated address code, and the address code of the slave machine corresponding to each abnormal address code is reset into a default reset address code in a reset state. And generating an address preemption instruction for the current unallocated address code in each unallocated address code, sending the address preemption instruction to at least one slave machine corresponding to the reset address code in a reset state, firstly returning a first slave machine in the slave machines to an address preemption request to the master machine, setting the address code of the first slave machine as the current unallocated address code by the master machine, and repeating the steps until all the unallocated address codes are allocated to the slave machines corresponding to the reset address code. Therefore, according to the scheme provided by the invention, the abnormal address code can be accurately detected through the feedback result of the slave machine on the communication content, and under the condition that the address code is abnormal, the slave machine corresponding to the abnormal address code is reset, so that the slave machine corresponding to the abnormal address code is corresponding to the reset address code in the reset state to distribute the unallocated address code, and the slave machine distributed to the address code sets the address code of the slave machine, so that the abnormal address code is redistributed under the condition that the address code is abnormal.
In an embodiment of the present invention, the determining whether there is at least one abnormal address code according to the feedback result of the slave corresponding to each address code includes:
and when communication content responses returned by at least two slave machines are received aiming at the first address code and the communication content responses are not received aiming at the second address code, judging that the first address code and the second address code are abnormal address codes.
Specifically, for example, a multi-connected one-to-four device is used, 1 master is connected to 4 slaves, and the steps during normal communication are as follows:
step 1: the host sends 1# address communication content → 1# slave receives 1# address communication content sent by the host and then returns data to the host
Step 2: the host sends 2# address communication content → 2# slave receives 2# address communication content sent by the host and then returns data to the host
And step 3: the host sends 3# address communication content → 3# slave receives the 3# address communication content sent by the host and then returns data to the host
And 4, step 4: the host sends the 4# address communication content → 4# slave receives the 4# address communication content sent by the host and then returns data to the host.
The normal communication timing is performed alternately from timing 1 to timing 4.
Therefore, each slave corresponds to one address code, each slave feeds back when receiving the communication content which is sent by the master and corresponds to the slave, and under the condition of normal communication, the master sends the communication content to one address code each time and receives the feedback result of the slave corresponding to the address code.
When the address code is abnormal, if the address in the slave device is 1#, 2#, 2#, 3#, the communication timing sequence of the host is:
step 1: the host sends 1# address communication content → 1# slave receives 1# address communication content sent by the host and then returns data to the host. (ii) a
Step 2: the host sends 2# address communication content → 2# slave receives the 2# address communication content sent by the host and then returns data to the host → the host can receive the data returned by the 2# address but has a check error (the host cannot correctly receive the 2# slave return data);
and step 3: the host sends 3# address communication content → the 3# slave receives the 3# address communication content sent by the host and then returns data to the host →;
and 4, step 4: the host sends the communication content of the 4# address → no 4# slave, and no data is transmitted back to the host.
When a communication cycle is finished, the slave machines with the returned data which cannot be correctly verified and the slave machines without the returned data appear in the whole communication cycle, the abnormality of the address code is preliminarily judged, in order to prevent the misjudgment, a timer or a counter is started, in order to avoid the misjudgment, the timing (counting) is increased, and only if the slave machines with the communication verification error and the equipment with the unreturned communication data continuously appear, the address conflict is judged. When the timer or the counter reaches a preset value, in a communication period of the host equipment, all slave machines have data reply or no slave machine returned data, which cannot be correctly checked, the timer or the counter clears 0, otherwise, when the timer (the counter) reaches the preset value, the timer (the counter) is reset, the host judges that the address code of the equipment is abnormal, and the address code is distributed.
In an embodiment of the present invention, the resetting the address code of the slave corresponding to each abnormal address code to a reset address code includes:
and sending an address exception broadcast message corresponding to the exception address code to trigger the slave machine corresponding to the exception address code to modify the address code corresponding to the slave machine into a reset address code.
Specifically, after the missing and conflicting addresses are determined, the host sends a broadcast command to reset the current address codes 2# and 4#, and after the 2# address receives the reset address codes, the address codes of the two slaves of the 2# address are reset to the reset address codes. The reset address code is a special address code, and when the normal communication or the host performs address code allocation, the reset address code is not allocated to the slave, and the reset address code is only used for resetting when the address code is abnormal, for example, the reset address code may be a 0# address. The address codes of two slaves that were previously at the 2# address are both changed to 0 #.
In an embodiment of the present invention, the address preemption request carries a random number and an equipment parameter corresponding to the first slave;
the setting the address code of the first slave machine to be the currently unallocated address code includes:
and after the preemption request is verified, sending an address verification success notification to the first slave machine, wherein the address verification success notification carries the random number and the equipment parameter corresponding to the first slave machine, so as to trigger the first slave machine to modify the address code of the first slave machine into the currently unallocated address code after the first slave machine successfully verifies according to the random number and the equipment parameter carried in the address verification success notification.
Specifically, the host receives and checks the right preemption command sent by the slave (the preemption command includes the variation parameters of the equipment such as random number, temperature parameter and the like), after the slave sending the preemption 2# address command receives the 2# address confirmation command sent by the host, if the check data in the 2# address confirmation command is consistent with the sent preemption command and the check is successful, the 2# address confirmation command is sent back; if the received 2# address confirmation instruction sent by the host is inconsistent with the preemption instruction sent by the slave, the slave is indicated to be in preemption failure, and no confirmation address code instruction is sent back. And after the host receives the returned confirmation instruction and successfully verifies, successfully distributing the 2# address, if the address code confirmation instruction received by the host is not successfully verified and the 2# address code is unsuccessfully distributed, sending the initialized 2# equipment address again, and repeating the process.
As shown in fig. 2, an embodiment of the present invention provides another address code allocation method, which is applied to slaves, where each slave is connected to a master; each slave corresponds to an address code distributed by the master; the method comprises the following steps:
step 201: and receiving the communication content sent by the host, and sending a feedback result to the host so that the host judges whether at least one abnormal address code exists.
Step 202: and resetting the address code to a reset address code by using the slave machine corresponding to each abnormal address code.
Step 203: and utilizing each slave corresponding to the reset address code to receive an address preemption instruction which is sent by a host and aims at the current unallocated address code, so that a first slave in each slave corresponding to the reset address code firstly returns an address preemption request to the host, and the host sets the address code of the first slave as the current unallocated address code.
Specifically, as described above, after each slave receives the communication content sent by the host, the slave returns the feedback result of the corresponding address code, and the specific communication steps are described in the above embodiments and are not described again here. After the missing and collision addresses are judged, the host sends a broadcast instruction to reset the current address codes 2#, 4#, after the 2# address receives the reset address code, the address code corresponding to the 2# address code of the 2 slaves is reset to the reset address code 0#, then the host sends a 2# address preemption instruction, when the host sends the 2# address code, after the 2 slaves corresponding to the 0# address code receive 2# address code allocation information, a first slave firstly returns an address preemption request to the host, and the host sets the address of the first slave to be 2 #.
In an embodiment of the present invention, the resetting, by the slave device corresponding to each abnormal address code, the address code to the reset address code includes:
and each slave machine corresponding to the abnormal address code receives the abnormal address broadcast message sent by the host machine and modifies the corresponding address code into the reset address code according to the abnormal broadcast message.
Specifically, after the missing and conflicting addresses are determined, the host sends a broadcast command to reset the current address codes 2# and 4#, and after the 2# address receives the reset address codes, the address codes of the two slaves of the 2# address are reset to the reset address codes. The reset address code is a special address code, and when the normal communication or the host performs address code allocation, the reset address code is not allocated to the slave, and the reset address code is only used for resetting when the address code is abnormal, for example, the reset address code may be a 0# address. The address codes of two slaves that were previously at the 2# address are both changed to 0 #.
In an embodiment of the present invention, the step of returning an address preemption request to the master by a first slave in the slaves corresponding to the reset address code includes:
and each slave machine corresponding to the reset address code correspondingly generates a random number, and delays according to the following delay formula by the random number:
Figure BDA0002631828050000111
wherein, T is delay time, A is the random number, and B is communication baud rate;
the first slave machine which is the first slave machine of the slave machines corresponding to the reset address code and finishes time delay sends the address preemption request to the host machine, wherein the address preemption request carries a random number and equipment parameters corresponding to the first slave machine so as to verify the host machine;
and after each other slave machine corresponding to the reset address code determines that the first slave machine has sent the address preemption request, determining that the address preemption fails, and ending timing.
Specifically, when the host sends the 2# address code, after two slaves corresponding to the reset address code 0# receive the 2# address code allocation information, delay is carried out according to the generated random number A (the delay time rule is T ═ A × 1/communication baud rate), in the process of delaying and waiting for sending data, the data level states of other slaves are monitored simultaneously, if the level state change of the receiving end is monitored in the process of waiting for delay, the slave seizes the address allocation failure, and stops to wait for delay, the next time the host sends the address allocation instruction is waited; if the slave computer waits for the delay time to arrive, the data receiving end has no level state change, and the slave computer sends a command of preempting the 2# address. Different random numbers generated by the slave machines are used for time delay, so that the slave machines are prevented from simultaneously returning data, for example, the slave machine 1 delays for 1 millisecond, the slave machine 2 delays for 2 milliseconds, and when the slave machine 1 delays to the back, the data are sent. When the slave machine 2 detects that the receiving end has data transmission, the slave machine abandons the data transmission and reenters the address allocation process. After the slave device address is successfully occupied, the device parameter is required to be sent to the host for address code confirmation, after the host receives the slave device data and checks the slave device data correctly, an address allocation success command is returned, and the slave device receives the command and compares and checks the command with the data sent to the host last time.
In an embodiment of the present invention, the first slave machine receives an address verification success notification sent by the master machine, where the address verification success notification carries a random number and device parameters corresponding to the first slave machine;
and when the first slave machine receives the address verification success notification, verifying whether the random number and the equipment parameter are the same as the random number and the equipment parameter of the first slave machine, if so, determining that the verification is successful, and modifying the address code of the first slave machine into the currently unallocated address code.
Specifically, after the slave device address is successfully preempted, the device parameter is required to be sent to the host for address code confirmation, the host receives the slave data and checks the slave data correctly, then an address allocation success instruction is returned, the slave receives the instruction and compares and checks the slave data with the data sent to the host last time, if the address comparison is successful and the check is correct, the slave sends the address allocation success confirmation instruction, the host receives the address confirmation instruction and checks the address confirmation instruction, then whether an unallocated address code exists is checked, if the address correction allocation flow is not finished, and if the unallocated address code exists, the spare address code continues to be allocated. If communication data check errors occur in the address allocation process, the instruction is incorrect, the data comparison is incorrect, the address allocation fails, and the address is newly allocated.
As shown in fig. 3, an embodiment of the present invention provides a host based on any one of the address code allocation methods provided in the foregoing embodiments, including:
a transmitting unit 301 and a first processing unit 302;
the sending unit 301 is configured to send communication content to an address code corresponding to each slave;
the first processing unit 302 is configured to execute determining whether there is at least one abnormal address code according to a feedback result of the slave corresponding to each address code;
if yes, setting the at least one abnormal address code as at least one unallocated address code; resetting the address code of the slave machine corresponding to each abnormal address code to a reset address code;
performing for each of said unassigned address codes: generating an address preemption instruction aiming at the current unallocated address code;
sending the address preemption instruction to at least one slave machine corresponding to the reset address code;
when an address preemption request returned by a first slave machine aiming at the current unallocated address code is received firstly, the address code of the first slave machine is set as the current unallocated address code.
It is to be understood that the illustrated structure of the embodiment of the present invention does not specifically limit the host. In other embodiments of the invention, the host may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
As shown in fig. 4, an embodiment of the present invention provides a slave device based on any one of the address code allocation methods provided in the foregoing embodiments, including:
a communication unit 401 and a second processing unit 402;
the communication unit 401 is configured to receive communication content sent by the host, and send a feedback result to the host, so that the host determines whether there is at least one abnormal address code;
the second processing unit 402 is configured to reset an address code to a reset address code when an abnormal address code corresponds to the abnormal address code; when the slave machine corresponds to the reset address code, receiving an address preemption instruction which is sent by a host machine and is generated aiming at the current unallocated address code, and enabling a first slave machine in each slave machine corresponding to the reset address code to firstly return an address preemption request to the host machine so as to enable the host machine to set the address code of the first slave machine as the current unallocated address code.
It is to be understood that the illustrated structure of the embodiment of the present invention does not specifically limit the slave. In other embodiments of the invention, a slave may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Because the information interaction, execution process, and other contents between the units in the device are based on the same concept as the method embodiment of the present invention, specific contents may refer to the description in the method embodiment of the present invention, and are not described herein again.
It should be noted that not all steps and modules in the above flows and system structure diagrams are necessary, and some steps or modules may be omitted according to actual needs. The execution order of the steps is not fixed and can be adjusted as required. The system structure described in the above embodiments may be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by a plurality of physical entities, or some components in a plurality of independent devices may be implemented together.
In the above embodiments, the hardware unit may be implemented mechanically or electrically. For example, a hardware element may comprise permanently dedicated circuitry or logic (such as a dedicated processor, FPGA or ASIC) to perform the corresponding operations. The hardware elements may also comprise programmable logic or circuitry, such as a general purpose processor or other programmable processor, that may be temporarily configured by software to perform the corresponding operations. The specific implementation (mechanical, or dedicated permanent, or temporarily set) may be determined based on cost and time considerations.
While the invention has been shown and described in detail in the drawings and in the preferred embodiments, it is not intended to limit the invention to the embodiments disclosed, and it will be apparent to those skilled in the art that various combinations of the code auditing means in the various embodiments described above may be used to obtain further embodiments of the invention, which are also within the scope of the invention.

Claims (10)

1. The address code allocation method is characterized by being applied to a host, wherein the host is connected with at least two slaves; each slave corresponds to an address code; an address code is assigned by the host;
sending communication content aiming at the address code corresponding to each slave;
judging whether at least one abnormal address code exists according to the feedback result of the slave machine corresponding to each address code, and if so, setting the at least one abnormal address code as at least one unallocated address code;
resetting the address code of the slave machine corresponding to each abnormal address code to a reset address code;
performing for each of said unassigned address codes:
generating an address preemption instruction aiming at the current unallocated address code;
sending the address preemption instruction to at least one slave machine corresponding to the reset address code;
when an address preemption request returned by a first slave machine aiming at the current unallocated address code is received firstly, the address code of the first slave machine is set as the current unallocated address code.
2. The method of claim 1, wherein the determining whether there is at least one abnormal address code according to the feedback result of the slave corresponding to each address code comprises:
and when communication content responses returned by at least two slave machines are received aiming at the first address code and the communication content responses are not received aiming at the second address code, judging that the first address code and the second address code are abnormal address codes.
3. The method of claim 1, wherein resetting the address code of the slave corresponding to each abnormal address code to a reset address code comprises:
and sending an address exception broadcast message corresponding to the exception address code to trigger the slave machine corresponding to the exception address code to modify the address code corresponding to the slave machine into a reset address code.
4. The method according to any one of claims 1 to 3, wherein the random number and the device parameter corresponding to the first slave are carried in the address preemption request;
the setting the address code of the first slave machine to be the currently unallocated address code includes:
and after the preemption request is verified, sending an address verification success notification to the first slave machine, wherein the address verification success notification carries the random number and the equipment parameter corresponding to the first slave machine, so as to trigger the first slave machine to modify the address code of the first slave machine into the currently unallocated address code after the first slave machine successfully verifies according to the random number and the equipment parameter carried in the address verification success notification.
5. An address code allocation method, applied to slaves, each of which is connected to a master; each slave corresponds to an address code distributed by the master;
receiving communication content sent by the host computer, and sending a feedback result to the host computer so that the host computer judges whether at least one abnormal address code exists;
resetting the address code to a reset address code by using a slave machine corresponding to each abnormal address code;
and utilizing each slave corresponding to the reset address code to receive an address preemption instruction which is sent by a host and aims at the current unallocated address code, so that a first slave in each slave corresponding to the reset address code firstly returns an address preemption request to the host, and the host sets the address code of the first slave as the current unallocated address code.
6. The method of claim 5,
the resetting of the address code to the reset address code by the slave machine corresponding to each abnormal address code comprises the following steps:
and each slave machine corresponding to the abnormal address code receives the abnormal address broadcast message sent by the host machine and modifies the corresponding address code into the reset address code according to the abnormal broadcast message.
7. The method of claim 5,
the first slave in each slave corresponding to the reset address code firstly returns an address preemption request to the master, and the method comprises the following steps:
and each slave machine corresponding to the reset address code correspondingly generates a random number, and delays according to the following delay formula by the random number:
Figure FDA0002631828040000021
wherein, T is delay time, A is the random number, and B is communication baud rate;
the first slave machine which is the first slave machine of the slave machines corresponding to the reset address code and finishes time delay sends the address preemption request to the host machine, wherein the address preemption request carries a random number and equipment parameters corresponding to the first slave machine so as to verify the host machine;
and after each other slave machine corresponding to the reset address code determines that the first slave machine has sent the address preemption request, determining that the address preemption fails, and ending timing.
8. The method according to any one of claims 5 to 7,
the first slave machine receives an address verification success notification sent by the master machine, wherein the address verification success notification carries a random number and equipment parameters corresponding to the first slave machine;
and when the first slave machine receives the address verification success notification, verifying whether the random number and the equipment parameter are the same as the random number and the equipment parameter of the first slave machine, if so, determining that the verification is successful, and modifying the address code of the first slave machine into the currently unallocated address code.
9. Host according to any of claims 1 to 4, characterized in that it comprises:
a transmitting unit and a first processing unit;
the sending unit is used for sending communication content aiming at the address code corresponding to each slave;
the first processing unit is used for judging whether at least one abnormal address code exists according to the feedback result of the slave machine corresponding to each address code;
if yes, setting the at least one abnormal address code as at least one unallocated address code; resetting the address code of the slave machine corresponding to each abnormal address code to a reset address code;
performing for each of said unassigned address codes: generating an address preemption instruction aiming at the current unallocated address code;
sending the address preemption instruction to at least one slave machine corresponding to the reset address code;
when an address preemption request returned by a first slave machine aiming at the current unallocated address code is received firstly, the address code of the first slave machine is set as the current unallocated address code.
10. The slave according to any one of claims 5 to 8, wherein the slave comprises:
a communication unit and a second processing unit;
the communication unit is used for receiving the communication content sent by the host and sending a feedback result to the host so that the host judges whether at least one abnormal address code exists;
the second processing unit is used for resetting the address code to a reset address code when the abnormal address code corresponds to the abnormal address code; when the slave machine corresponds to the reset address code, receiving an address preemption instruction which is sent by a host machine and is generated aiming at the current unallocated address code, and enabling a first slave machine in each slave machine corresponding to the reset address code to firstly return an address preemption request to the host machine so as to enable the host machine to set the address code of the first slave machine as the current unallocated address code.
CN202010813376.XA 2020-08-13 2020-08-13 Address code allocation method, host and slave Pending CN112104760A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010813376.XA CN112104760A (en) 2020-08-13 2020-08-13 Address code allocation method, host and slave

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010813376.XA CN112104760A (en) 2020-08-13 2020-08-13 Address code allocation method, host and slave

Publications (1)

Publication Number Publication Date
CN112104760A true CN112104760A (en) 2020-12-18

Family

ID=73753629

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010813376.XA Pending CN112104760A (en) 2020-08-13 2020-08-13 Address code allocation method, host and slave

Country Status (1)

Country Link
CN (1) CN112104760A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113645322A (en) * 2021-07-15 2021-11-12 大力电工襄阳股份有限公司 Address code identification method and device based on optical fiber serial communication and application thereof
CN114238189A (en) * 2021-11-30 2022-03-25 浙江灵鹿智能科技有限公司 Method, device and system for automatically allocating addresses
CN115955460A (en) * 2023-03-10 2023-04-11 中山大洋电机股份有限公司 Address allocation method of multi-motor networking control system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030050083A1 (en) * 1999-12-13 2003-03-13 Jean-Pierre Metais Method for controlling a communications channel shared by several stations
CN101197855A (en) * 2007-12-25 2008-06-11 三一重工股份有限公司 Equipment node address code distribution method and distributing system, and address configuration node
CN103826316A (en) * 2014-02-24 2014-05-28 江苏林洋电子股份有限公司 Micropower wireless self-organized network broadcast communication method
WO2015120339A1 (en) * 2014-02-07 2015-08-13 Bayer Healthcare Llc Methods and apparatus for a multiple master bus protocol
CN105516386A (en) * 2015-12-07 2016-04-20 浪潮集团有限公司 Method and system for detecting and processing MAC address conflict of server management system
CN108737590A (en) * 2018-05-15 2018-11-02 浙江正泰电器股份有限公司 A kind of method that address is distributed automatically, system, Modbus main websites, Modbus slave stations
CN109428951A (en) * 2017-08-31 2019-03-05 亚瑞源科技(深圳)有限公司 Address automatic allocating method in serial communication system
CN111147619A (en) * 2019-12-20 2020-05-12 海丰通航科技有限公司 Method and system for realizing automatic address allocation of RS485 slave equipment locally
US20200195300A1 (en) * 2017-08-22 2020-06-18 Harxon Corporation Method and Device for Controlling Frequency Hopping, Transmitter and Receiver

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030050083A1 (en) * 1999-12-13 2003-03-13 Jean-Pierre Metais Method for controlling a communications channel shared by several stations
CN101197855A (en) * 2007-12-25 2008-06-11 三一重工股份有限公司 Equipment node address code distribution method and distributing system, and address configuration node
WO2015120339A1 (en) * 2014-02-07 2015-08-13 Bayer Healthcare Llc Methods and apparatus for a multiple master bus protocol
CN103826316A (en) * 2014-02-24 2014-05-28 江苏林洋电子股份有限公司 Micropower wireless self-organized network broadcast communication method
CN105516386A (en) * 2015-12-07 2016-04-20 浪潮集团有限公司 Method and system for detecting and processing MAC address conflict of server management system
US20200195300A1 (en) * 2017-08-22 2020-06-18 Harxon Corporation Method and Device for Controlling Frequency Hopping, Transmitter and Receiver
CN109428951A (en) * 2017-08-31 2019-03-05 亚瑞源科技(深圳)有限公司 Address automatic allocating method in serial communication system
CN108737590A (en) * 2018-05-15 2018-11-02 浙江正泰电器股份有限公司 A kind of method that address is distributed automatically, system, Modbus main websites, Modbus slave stations
CN111147619A (en) * 2019-12-20 2020-05-12 海丰通航科技有限公司 Method and system for realizing automatic address allocation of RS485 slave equipment locally

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113645322A (en) * 2021-07-15 2021-11-12 大力电工襄阳股份有限公司 Address code identification method and device based on optical fiber serial communication and application thereof
CN114238189A (en) * 2021-11-30 2022-03-25 浙江灵鹿智能科技有限公司 Method, device and system for automatically allocating addresses
CN114238189B (en) * 2021-11-30 2024-01-30 浙江灵鹿智能科技有限公司 Method, device and system for automatically distributing addresses
CN115955460A (en) * 2023-03-10 2023-04-11 中山大洋电机股份有限公司 Address allocation method of multi-motor networking control system
CN115955460B (en) * 2023-03-10 2023-07-11 中山大洋电机股份有限公司 Address allocation method for multi-motor networking control system

Similar Documents

Publication Publication Date Title
CN112104760A (en) Address code allocation method, host and slave
US4581734A (en) Multipriority communication system
US4677612A (en) Communication system with subdivided transmission cycles
US7370226B2 (en) System and method for communicating a software-generated pulse waveform between two servers in a network
US20040001449A1 (en) System and method for supporting automatic protection switching between multiple node pairs using common agent architecture
US5210871A (en) Interprocessor communication for a fault-tolerant, mixed redundancy distributed information processing system
EP3675416B1 (en) Consensus process recovery method and related nodes
CN111683118B (en) Block chain-based consensus method and device, master node equipment and slave node equipment
US6868067B2 (en) Hybrid agent-oriented object model to provide software fault tolerance between distributed processor nodes
CN108259618B (en) Synchronous data interaction processing method and device
US6574744B1 (en) Method of determining a uniform global view of the system status of a distributed computer network
CN110708400B (en) Network address allocation method, device, node equipment and storage medium
CN108833602A (en) A kind of bus address auto-allocation method and system based on component manufacturing variation
CN106982133B (en) Method, equipment and system for changing configuration information of virtual network card
CN107948063B (en) Method for establishing aggregation link and access equipment
US4947317A (en) Communication protocol for a three nodes system having dedicated connections and bit indicating function of exchanged message
CN114205139A (en) Computing resource management method, node, system and storage medium
CN113179166A (en) High-robustness Byzantine fault-tolerant-based alliance chain data safe real-time uplink method
CN108600156B (en) Server and security authentication method
CN110138668B (en) Stream description processing method and device, network entity and storage medium
CN115664599B (en) Data transmission method and device, electronic equipment and storage medium
WO1985003826A1 (en) Multipriority communication system
CN111190754A (en) Block chain event notification method and block chain system
CN110022310B (en) Authorization method and device based on cloud computing open network operating system
CA2501375A1 (en) Method for modifying a parameter for the operation of a network, and subscribers for carrying out the method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201218

RJ01 Rejection of invention patent application after publication