CN112272243B - Address allocation method - Google Patents

Address allocation method Download PDF

Info

Publication number
CN112272243B
CN112272243B CN202011079632.3A CN202011079632A CN112272243B CN 112272243 B CN112272243 B CN 112272243B CN 202011079632 A CN202011079632 A CN 202011079632A CN 112272243 B CN112272243 B CN 112272243B
Authority
CN
China
Prior art keywords
address
allocated
instruction
active addressing
original
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.)
Active
Application number
CN202011079632.3A
Other languages
Chinese (zh)
Other versions
CN112272243A (en
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.)
Shenzhen Kexin Communication Technology Co Ltd
Original Assignee
Shenzhen Kexin Communication 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 Shenzhen Kexin Communication Technology Co Ltd filed Critical Shenzhen Kexin Communication Technology Co Ltd
Priority to CN202011079632.3A priority Critical patent/CN112272243B/en
Publication of CN112272243A publication Critical patent/CN112272243A/en
Application granted granted Critical
Publication of CN112272243B publication Critical patent/CN112272243B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/50Address allocation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5038Address allocation for local use, e.g. in LAN or USB networks, or in a controller area network [CAN]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses an address allocation method, which comprises the following steps of: receiving an active addressing instruction sent by a main device through a bus network, wherein the active addressing instruction comprises at least one original address; if the local storage medium does not contain the allocated address, receiving a reply instruction which is sent by the calibration slave device through the bus network and contains the allocated address within the timeout period; determining at least one address to be allocated according to at least one original address and the allocated address; and determining a target address from at least one address to be allocated, and storing the target address as an allocated address in a local storage medium. The address allocation method provided by the invention realizes automatic determination of the target address, does not need to increase a dialing device, effectively reduces cost, has simple and efficient determination process, is suitable for all slave devices to be allocated, and has good compatibility.

Description

Address allocation method
Technical Field
The invention relates to the technical field of electronic communication engineering, in particular to an address allocation method.
Background
The RS485 communication system requires that the master device assign an address to each current slave device in order to enable the master device to communicate with the current slave devices. At present, the address allocation of the master device to the slave device to be allocated is usually realized by means of a hardware dial switch, and because the hardware dial switch needs to be manually set, the problems of high cost, complex operation and easy occurrence of allocation errors exist, and the number of addresses is limited by the dial switch, so that the master device is not applicable to address allocation of a plurality of current slave devices. Or the master device is required to send a series of protocols to the slave device to be distributed in advance, the slave device to be distributed is transformed, the workload is large, and the implementation process is complex.
Disclosure of Invention
The embodiment of the invention provides an address allocation method, which aims to solve the problems of high cost, complex operation, large workload and complex implementation process in allocating addresses to slave equipment.
An address allocation method, comprising: the current slave device performs the following steps:
receiving an active addressing instruction sent by a main device through a bus network, wherein the active addressing instruction comprises at least one original address;
if the local storage medium does not contain the allocated address, receiving a reply instruction which is sent by the calibration slave device through the bus network and contains the allocated address within the timeout period;
determining at least one address to be allocated according to at least one original address and the allocated address;
and determining a target address from at least one address to be allocated, and storing the target address as an allocated address in a local storage medium.
Preferably, the receiving, within the timeout period, a reply instruction sent by the calibration slave device and containing the allocated address includes:
if the local storage medium contains the allocated address, the current slave device is a calibration slave device, and a reply instruction containing the allocated address is generated according to the active addressing instruction;
and sending the reply instruction of the allocated address to the master device and the original slave devices except the current slave device through the bus network.
Preferably, the receiving the active addressing instruction sent by the master device includes:
receiving an active addressing instruction sent by the main equipment, and checking the active addressing instruction by adopting check logic to obtain a check result;
and if the verification result is that the verification is accurate, analyzing the active addressing instruction to obtain at least one original address.
Preferably, the analyzing the active addressing instruction to obtain at least one original address includes:
and analyzing the active addressing instruction by adopting a preset instruction format, acquiring a data composition of the active addressing instruction, and acquiring an original address from the data composition.
Preferably, the local storage medium is any one of EEPROM, internal FLASH or external FLASH.
Preferably, the storing the target address as an allocated address in a local storage medium includes: and acquiring a physical tag, and storing the physical tag and the allocated address in a local storage medium.
Preferably, said storing said physical tag and said assigned address in a local storage medium comprises: and adding a specific identifier on the physical label and the allocated address to form an address data packet, and writing the address data packet into a local storage medium.
The invention provides an address allocation method, which comprises the following steps of:
forming an active addressing instruction based on at least one original address in an address sequence list, and transmitting the active addressing instruction to current slave equipment through a bus network;
receiving a reply instruction containing an allocated address within a timeout period, and determining an address to be allocated according to the original address and the allocated address of the reply instruction;
obtaining the number of the calibrated slave devices corresponding to all the allocated addresses, and obtaining the number of all original slave devices connected with the master device through a bus network;
and if the number of the calibrated slave devices is not matched with the number of the original slave devices, repeatedly executing the step of sending the active addressing instruction to the current slave device through a bus network.
Preferably, before the forming the active addressing instruction based on at least one original address in the address sequence list, the address allocation method further comprises: and sequencing the original addresses according to a preset sequencing rule to obtain an address sequence list.
According to the address allocation method, an active addressing instruction sent by the main equipment through the bus network is received, wherein the active addressing instruction comprises at least one original address; when the local storage medium does not contain the allocated address, if the allocated address is matched with at least one original address, a reply instruction which is sent by the calibrated slave device through the bus network is received within a timeout period, technical support is provided for automatically determining the address to be allocated for subsequent realization, and allocation efficiency is effectively improved. And determining at least one address to be allocated according to the at least one original address and the allocated address, wherein the process of determining the address to be allocated according to the original address and the allocated address is simple and quick, and no dialing equipment is required to be added, so that the cost is effectively reduced. And the target address is determined from at least one address to be allocated, so that the automatic determination of the target address is realized, the number dialing equipment is not required to be added, the cost is effectively reduced, the determination process is simple and efficient, and the method is suitable for all slave equipment to be allocated and has good compatibility. The target address is stored in the local storage medium as the allocated address, so that the long-term effectiveness of the allocated address is ensured, and the problems of losing the allocated address caused by downtime, re-electrifying and the like are avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an application environment of an address allocation method according to an embodiment of the present invention;
FIG. 2 is a flow chart of an address allocation method according to an embodiment of the invention;
FIG. 3 is another flow chart of an address allocation method according to an embodiment of the present invention;
FIG. 4 is another flow chart of an address allocation method according to an embodiment of the invention;
FIG. 5 is another flow chart of an address allocation method according to an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The invention provides an address allocation method, which can be applied to various RS485 communication systems, for example, the communication system can be a base station communication system or a lead-acid lithium-exchange communication system, the communication system comprises a master device and at least one original slave device connected with the master device, as shown in figure 1, the master device and the original slave device are connected in parallel through a bus network, and the original slave device comprises a calibrated slave device with an allocated address and a slave device to be allocated with an unallocated address. The invention can rapidly and simply allocate the address for the slave equipment to be allocated, has high efficiency, effectively saves cost, has strong practicability, and can effectively solve the problems that when the address is allocated for the slave equipment to be allocated in the existing communication system, a hardware dial switch is needed, the cost is high, the operation is complex, and the allocation error is easy to occur; or in the existing communication system, the master device is required to send a series of handshake protocols to the slave device to be allocated so as to modify the slave device to be allocated, and then reassign the address, so that the allocation process is complex and has weak practicability. For example, the communication system is a base station communication system, and the base station communication system comprises thousands of base stations, each base station comprises slave equipment to be allocated or a battery box for calibrating the slave equipment and a master controller carrying the master equipment, if a series of handshake protocols need to be sent to the slave equipment to be allocated in advance when the slave equipment to be allocated is allocated with the address to be allocated, the slave equipment to be allocated is transformed, and the process is complex and difficult to realize.
In an embodiment, the present invention provides an address allocation method applied to at least one original slave device connected to a master device, in this example, the original slave device currently executing the address allocation method is identified as a current slave device, and as shown in fig. 2, the current slave device in the address allocation method performs the following steps:
s201: and receiving an active addressing instruction sent by the main equipment through the bus network, wherein the active addressing instruction comprises at least one original address.
The active addressing instruction refers to an instruction carrying an original address sent by the main equipment. The active addressing instruction is sent to the bus network in a broadcast mode, and the master device and the current slave device (namely the calibration slave device and the slave device to be distributed) are connected in parallel through the bus network, so that the current slave device can receive the active addressing instruction sent by the master device from the bus network.
The original address is an allocated address or an address to be allocated. The allocated address is an address which has been allocated to the nominal slave device, and communication between the master device and the nominal slave device is effected by the allocated address. The address to be allocated is an address that has not been allocated to the slave device to be allocated.
S202: if the local storage medium does not contain an allocated address, if there is a match between the allocated address and at least one original address, a reply instruction is received within a timeout period that identifies the allocated address sent by the slave device over the bus network.
The timeout period is a predetermined time to respond to an active addressing instruction, and may be, for example, 3 seconds. It can be understood that if the current slave device is the calibration slave device, the local storage medium contains the allocated address, when the active addressing instruction is received, the original address of the active addressing instruction is matched with the allocated address of the calibration slave device, whether the original address is the allocated address of the calibration slave device is judged, if yes, a reply instruction is sent, and if not, the reply instruction is not sent; if the current slave device is an address to be allocated, the local storage medium does not contain the allocated address, when an active addressing instruction is received, the original address of the active addressing instruction is recorded, and a reply instruction which is sent by the calibrated slave device through the bus network and contains the allocated address is received within a timeout period, so that whether the original address is the address to be allocated or the allocated address is judged according to the reply instruction.
The reply instruction refers to an instruction which is responded by the target slave device according to the active addressing instruction and contains the allocated address. The active addressing instruction comprises a main equipment identifier, and the reply instruction comprises a calibration slave equipment identifier, so that the slave equipment to be allocated can rapidly and accurately identify the active addressing instruction and the reply instruction through the main equipment identifier and the calibration slave equipment identifier, and the intelligent determination of the address of the slave equipment to be allocated is realized.
In this embodiment, after the calibration slave device and the slave device to be allocated receive the active address instruction, timing is started, for the current slave device whose local storage medium contains the allocated address, if the allocated address matches at least one original address, the calibration slave device sends a reply instruction containing the allocated address to the bus network within a timeout period, and the master device and the current slave devices except for the calibration slave device can receive the reply instruction, where the original address in the active address instruction is determined as the allocated address by the slave device to be allocated in the current slave device. And if the local storage medium does not contain the slave equipment to be allocated with the allocated address, the slave equipment to be allocated in the current slave equipment does not send a reply instruction within the timeout period, and at the moment, the slave equipment to be allocated in the current slave equipment determines the original address in the active addressing instruction as the address to be allocated, so that technical support is provided for automatically determining the address to be allocated for the follow-up implementation, and the allocation efficiency is effectively improved.
Typically, the master device and the current slave device communicate via a bus network at a very high speed. When the calibration slave device receives the active addressing instruction sent by the master device, the calibration slave device can quickly respond and send a reply instruction, and the slave device to be allocated can realize quick and autonomous address allocation according to the reply instruction and the active addressing instruction, so that the process is simple and efficient. In this embodiment, the number of slave devices to be allocated is one, so as to avoid the problem of error in address allocation.
S203: at least one address to be allocated is determined from the at least one original address and the allocated address.
Specifically, the slave device to be allocated receives the active addressing instruction, records all original addresses, determines the original address matched with the allocated address as the allocated address when receiving the reply instruction containing the allocated address of the calibration slave device, determines all the original addresses not matched with the allocated address as the addresses to be allocated, determines the addresses to be allocated according to the original address and the allocated addresses, realizes automatic determination of the addresses to be allocated, does not need to increase dial equipment, and effectively reduces cost. For example, the original address in the first active address is: 01. 02, 03, and 04; the allocated addresses in the reply instruction are 02 and 03, and 01 and 04 are addresses to be allocated.
S204: determining a target address from at least one address to be allocated, and storing the target address as an allocated address in a local storage medium.
Specifically, the target address is determined from at least one address to be allocated, automatic determination of the target address is realized, the number dialing equipment is not required to be added, the cost is effectively reduced, the determination process is simple and efficient, the method is suitable for all slave equipment to be allocated, and the compatibility is good. Selecting an address to be allocated from all the addresses to be allocated as an allocated address according to a preset rule, and storing the allocated address as the allocated address in a local storage medium so as to ensure that the allocated address is effective for a long time and avoid the problems of losing the allocated address caused by downtime, re-electrifying and the like.
In an embodiment, if the number of addresses to be allocated is multiple, the slave device to be allocated selects one of the addresses to be allocated as the target address according to a preset allocation rule, for example, the preset allocation rule may be to select the address to be allocated with the smallest address as the target address, or select the address to be allocated with the largest address as the target address, so as to order the allocation process, and facilitate management of the original address.
According to the address allocation method provided by the embodiment, an active addressing instruction sent by a main device through a bus network is received, wherein the active addressing instruction comprises at least one original address; when the local storage medium does not contain the allocated address, if the allocated address is matched with at least one original address, a reply instruction which is sent by the calibrated slave device through the bus network is received within a timeout period, technical support is provided for automatically determining the address to be allocated for subsequent realization, and allocation efficiency is effectively improved. And determining at least one address to be allocated according to the at least one original address and the allocated address, wherein the process of determining the address to be allocated according to the original address and the allocated address is simple and quick, and no dialing equipment is required to be added, so that the cost is effectively reduced. And the target address is determined from at least one address to be allocated, so that the automatic determination of the target address is realized, the number dialing equipment is not required to be added, the cost is effectively reduced, the determination process is simple and efficient, and the method is suitable for all slave equipment to be allocated and has good compatibility. The target address is stored in the local storage medium as the allocated address, so that the long-term effectiveness of the allocated address is ensured, and the problems of losing the allocated address caused by downtime, re-electrifying and the like are avoided.
In one embodiment, as shown in fig. 3, step S202, that is, receiving a reply instruction including the allocated address sent by the calibration slave device through the bus network within the timeout period, includes:
s301: if the local storage medium contains the allocated address, the current slave device is the calibration slave device, and a reply instruction containing the allocated address is generated according to the active addressing instruction.
S302: and sending the reply instruction of the allocated address to the master device and the original slave devices except the current slave device through the bus network.
In this embodiment, both the calibration slave device and the slave device to be allocated, which are connected in parallel with the master device, can receive the active addressing instruction sent by the master device, and for the calibration slave device whose local storage medium contains the allocated address, when the active addressing instruction is received, it is determined whether the original address of the active addressing instruction is matched with the allocated address of the local storage medium, if so, a reply instruction containing the allocated address is generated, and a reply instruction containing the allocated address is generated, so that the master device and the slave device to be allocated quickly determine the address to be allocated, and technical support is provided for automatically determining the target address for the slave device to be allocated. If not, a reply instruction is not sent.
In one embodiment, as shown in fig. 4, step S201, that is, receiving an active addressing instruction sent by a master device, includes:
s401: and receiving an active addressing instruction sent by the main equipment, and checking the active addressing instruction by using check logic to obtain a check result.
The checking result refers to whether the data information carried in the active addressing instruction is accurate and complete.
The verification logic is used for verifying whether the data information carried in the active addressing instruction is accurate and complete, because the accurate and complete of the active addressing instruction is related to factors such as the distance between the master device and the calibration slave device and the slave device to be distributed, and if the distance between the master device and the calibration slave device and the slave device to be distributed is far, the risk of losing the data information is stored. Therefore, in this embodiment, the data information carried by the active addressing instruction is checked by using the check logic, so as to ensure that the data information of the active addressing instruction is complete.
As an example, the check logic is an odd check logic or an even check logic, where the number of 1 s in the binary number representing the data information carried in the active addressing instruction is an odd number; the even parity logic is an even number of 1 s in the binary number representing the data information carried in the active addressing instruction. Because the data information of the active addressing instruction is known, the number of 1 s in the binary number is added in the active addressing instruction, so that the data information of the active addressing instruction is checked by adopting check logic later to obtain a check result, the accuracy of the active addressing instruction is ensured, and the follow-up operation can be performed based on the accurate active addressing instruction.
S402: if the verification result is that the verification is accurate, analyzing the active addressing instruction to obtain at least one original address.
In this embodiment, when the verification result is that the active addressing instruction is complete, the active addressing instruction is parsed by adopting a preset instruction format, so that the current slave device obtains the specific meaning represented by the active addressing instruction, and obtains at least one original address from the specific meaning, so as to realize intelligent address allocation subsequently, and the allocation process is simple and efficient, thereby being applicable to the low-frequency communication system of the current number of slave devices. Judging whether the original address is matched with the self allocated address or not when the current slave device is the calibration slave device, and if so, sending a reply instruction; if the two types of the images are matched, the operation is not performed; and storing the original address for the slave to be allocated when the current slave is the slave to be allocated, determining the original address as an allocated address if a reply instruction is received within a timeout period, and determining the original address as the address to be allocated if the reply instruction is not received within the timeout period.
According to the address allocation method provided by the embodiment, the active addressing instruction sent by the main equipment is received, the active addressing instruction is checked by the check logic, and the check result is obtained, so that the accuracy of the active addressing instruction is ensured, and the follow-up operation can be performed based on the accurate active addressing instruction. If the verification result is that the verification is accurate, the active addressing instruction is analyzed to obtain at least one original address so as to realize intelligent address distribution later, and the distribution process is simple and efficient and is suitable for the communication system with large quantity and large scale of the current slave devices.
In one embodiment, step S402, i.e. resolving the active addressing instruction, obtains at least one original address, includes:
analyzing the active addressing instruction by adopting a preset instruction format, acquiring a data composition of the active addressing instruction, and acquiring an original address from the data composition.
The preset instruction format is a format of data information carried in a preset active addressing instruction. Analyzing the active addressing instruction by adopting a preset instruction format to quickly obtain the data composition of the active addressing instruction, wherein the data composition of the active addressing instruction can be a head part, an address section, a function section, a data section, a check section, a tail part, or the head part, the address section, the function section, the data section, the tail part and the like
Specifically, the active addressing instruction is analyzed by adopting a preset instruction format to obtain the head part, the address section, the function section, the data section, the tail part and the like of the active addressing instruction, and the original address is determined according to the address section, so that technical support is provided for automatically determining the address to be allocated for subsequent realization.
In one embodiment, the local storage medium is any one of EEPROM, internal FLASH, or external FLASH.
In one embodiment, step S204, storing the target address as an allocated address in the local storage medium, includes: the physical tag is acquired and the physical tag and the assigned address are stored in a local storage medium.
The physical tag refers to a tag which is actually visible or recognizable by a computer, and for example, the physical tag can be a two-dimensional code, a bar code, an identification code of an MCU or a serial number of the MCU. The physical tag is typically attached to the outside of the current slave device.
For a large number of calibration slave devices, it is often difficult for a user to quickly determine the calibration slave device to be found according to the allocated address. In this embodiment, the physical tag and the allocated address are stored in a local storage medium, so that a user can quickly locate and calibrate the slave device, and maintenance or modification can be performed.
In one embodiment, step S402, storing the physical tag and the assigned address in the local storage medium, includes: and adding a specific identifier on the physical label and the allocated address to form an address data packet, and writing the address data packet into a local storage medium.
The specific identifier is an identifier for indicating the accuracy of the allocated address, and it can be understood that when the address data packet is read, the allocated address or information in the physical label may be accidentally lost, so that the specific identifier is added on the physical label and the allocated address, and when the physical label and the allocated address are subsequently read, whether the physical label and the allocated address are accurately verified can be judged according to the integrity of the specific identifier, so that the accuracy of the allocated address and the physical label can be quickly judged by using the unified identifier.
An address packet refers to a packet that includes a physical tag, an assigned address, and a specific identification.
Specifically, the address data packet is written into the local storage medium, when the physical label and the allocated address are needed, the calling program reads the address data packet, the program matches the specific identification with the preset checking identification to judge whether the specific identification is accurate or not so as to verify whether the physical label and the allocated address are accurate or not, and if the specific identification is matched with the preset checking identification, the physical label and the allocated address are accurate, so that the accuracy of the physical label and the allocated address obtained by a user is guaranteed. The test identifier is an identifier which is matched with the specific identifier and is known by the program, so that the program can judge whether the specific identifier is accurate or not.
The present embodiment provides an address allocation method, as shown in fig. 5, where the master device performs the following steps:
s501: and acquiring original addresses with the number not less than the number of the current slave devices from the address sequence list, forming an active addressing instruction based on at least one of all the original addresses in the address sequence list, and transmitting the active addressing instruction to the current slave devices through a bus network.
Wherein the address sequence list means that the number of original addresses in the address sequence list is not less than the number of current slave devices due to storing the list of original addresses.
Specifically, the header, the original address, the functional segment, the data segment, the check segment, the tail and the like are combined to form an active addressing instruction, and the active addressing instruction is sent to the bus network in a broadcast mode, so that the active addressing instruction is acquired from the bus network by the slave device at present.
S502: and receiving a reply instruction containing the allocated address within the timeout period, and determining the address to be allocated according to the original address and the allocated address of the reply instruction.
In this embodiment, when a reply instruction containing an allocated address is not received within a timeout period, it is indicated that the original address of the active addressing instruction is an address to be allocated, and the original address is marked as an unallocated address, so that whether the slave device to be allocated, which has no allocated address, successfully receives the allocated address is determined according to the address to be allocated, and automation of allocating the address to the slave device to be allocated is realized. It will be appreciated that when a reply instruction containing an allocated address is received within a timeout period, indicating that the original address of the active addressing instruction is the allocated address of the current slave device, i.e. the original address of the active addressing instruction is the already allocated address, the original address is marked as the allocated address.
S503: and obtaining the number of the calibrated slave devices corresponding to all the allocated addresses, and obtaining the number of all original slave devices connected with the master device through a bus network.
Specifically, after the transmission of the active addressing instruction formed according to all original addresses is completed, the master device determines the number of the calibrated slave devices corresponding to all allocated addresses according to the reply instruction, and simultaneously acquires the number of all original slave devices connected with the master device through the bus network, so as to judge whether to resend the active addressing instruction formed based on the original addresses according to the number of the original slave devices and the data of the calibrated slave devices until the slave devices to be allocated are allocated to the addresses.
S504: if the number of the calibrated slave devices is not matched with the number of the original slave devices, the active addressing instruction is repeatedly executed and sent to the current slave device through the bus network.
Specifically, if the number of the calibrated slave devices is not matched with the number of the original slave devices, determining an address to be allocated according to the original address and an allocated address in the reply instruction, forming an active addressing instruction according to the address to be allocated, repeatedly executing the active addressing instruction, and sending the active addressing instruction to the current slave device through a bus network until each slave device is allocated with the address, and when the number of the calibrated slave devices is matched with the number of the original slave devices, indicating that all the original slave devices are allocated with the address, wherein the master device can determine the address of the original slave devices, and ensuring that the subsequent communication work is normally performed.
According to the address allocation method provided by the embodiment, the original addresses with the number not smaller than that of the current slave devices are obtained from the address sequence list, an active addressing instruction is formed based on at least one of all the original addresses in the address sequence list, and the active addressing instruction is sent to the current slave devices through a bus network. If a reply instruction containing the allocated address is received within the timeout period, determining the address to be allocated according to the original address and the allocated address of the reply instruction, so as to determine whether the slave equipment to be allocated without the address to be allocated successfully receives the allocated address according to the address to be allocated later, and realizing automation of the address allocation of the slave equipment to be allocated. And obtaining the number of the calibrated slave devices corresponding to all the allocated addresses, and obtaining the number of all original slave devices connected with the master device through a bus network. And if the number of the calibrated slave devices is not matched with the number of the original slave devices, repeatedly executing the transmission of the active addressing instruction to the current slave devices through the bus network until the addresses are distributed to each device, and ensuring that the subsequent communication work is normally carried out.
In an embodiment, before step S501, that is, before the original addresses of which the number is not less than the number of the current slave devices are obtained from the address sequence list, an active addressing instruction is formed based on at least one of all the original addresses in the address sequence list, and the active addressing instruction is sent to the current slave devices through the bus network, the method further includes: and sequencing the original addresses according to a preset sequencing rule to obtain an address sequence list.
In this embodiment, the original addresses are ordered according to a preset ordering rule, and the ordered original addresses are stored in an address sequence list for summarization, so that a subsequent master device can send an active addressing instruction carrying the original addresses according to a preset order. In this embodiment, the master device sends the active addressing instruction carrying the original addresses according to the preset sequence, so that the allocation situation of all the original addresses can be orderly identified, and errors are avoided. The preset order may be to arrange the original addresses in order from large to small or to sort the original addresses in order from small to large.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (6)

1. An address allocation method, wherein the current slave device performs the steps of:
receiving an active addressing instruction sent by a main device through a bus network, wherein the active addressing instruction comprises the number of 1 in binary numbers;
checking the number of 1 in binary numbers in the active addressing instruction by adopting odd check logic or even check logic to obtain a check result; if the verification result is that verification is accurate, analyzing the active addressing instruction by adopting a preset instruction format, acquiring data components such as a head part, an address section, a functional section, a data section, a tail part and the like of the active addressing instruction, and acquiring at least one original address from the address section, wherein the preset instruction format is the format of data information carried in the active addressing instruction;
if the local storage medium does not contain the allocated address, receiving a reply instruction which is sent by the calibration slave device through the bus network and contains the allocated address within the timeout period;
determining at least one address to be allocated according to at least one original address and the allocated address;
determining a target address from at least one address to be allocated, and storing the target address as an allocated address in a local storage medium;
the method comprises the steps of obtaining a physical label, adding a specific identifier on the physical label and an allocated address to form an address data packet, and writing the address data packet into a local storage medium; the specific identifier is an identifier for indicating the accuracy of the allocated address.
2. The address allocation method according to claim 1, wherein receiving within the timeout period a reply instruction containing the allocated address sent by the nominal slave device comprises:
if the local storage medium contains the allocated address, the current slave device is a calibration slave device, and a reply instruction containing the allocated address is generated according to the active addressing instruction;
and sending the reply instruction of the allocated address to the master device and the original slave devices except the current slave device through the bus network.
3. The address allocation method according to claim 1, wherein the local storage medium is any one of EEPROM, internal FLASH, or external FLASH.
4. The address allocation method according to claim 1, wherein the storing the target address as an allocated address in a local storage medium comprises:
and acquiring a physical tag, and storing the physical tag and the allocated address in a local storage medium.
5. An address allocation method, wherein a master device performs the steps of:
the method comprises the steps that original addresses with the number not smaller than that of current slave devices are obtained from an address sequence list, an active addressing instruction is formed based on at least one original address in the address sequence list, the active addressing instruction comprises the number of 1 in binary numbers, the active addressing instruction is sent to the current slave devices through a bus network, so that the current slave devices verify the number of 1 in the binary numbers in the active addressing instruction by adopting odd check logic or even check logic, and a verification result is obtained; if the verification result is that verification is accurate, analyzing the active addressing instruction by adopting a preset instruction format, acquiring data components such as a head part, an address section, a functional section, a data section, a tail part and the like of the active addressing instruction, and acquiring at least one original address from the address section, wherein the preset instruction format is the format of data information carried in the active addressing instruction;
receiving a reply instruction containing an allocated address within a timeout period, and determining an address to be allocated according to the original address and the allocated address of the reply instruction;
obtaining the number of the calibrated slave devices corresponding to all the allocated addresses, and obtaining the number of all original slave devices connected with the master device through a bus network;
and if the number of the calibrated slave devices is not matched with the number of the original slave devices, repeatedly executing the step of sending the active addressing instruction to the current slave device through a bus network.
6. The address allocation method of claim 5, wherein before forming an active addressing instruction based on at least one original address in the list of address sequences, the address allocation method further comprises:
and sequencing the original addresses according to a preset sequencing rule to obtain an address sequence list.
CN202011079632.3A 2020-10-10 2020-10-10 Address allocation method Active CN112272243B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011079632.3A CN112272243B (en) 2020-10-10 2020-10-10 Address allocation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011079632.3A CN112272243B (en) 2020-10-10 2020-10-10 Address allocation method

Publications (2)

Publication Number Publication Date
CN112272243A CN112272243A (en) 2021-01-26
CN112272243B true CN112272243B (en) 2023-06-06

Family

ID=74338434

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011079632.3A Active CN112272243B (en) 2020-10-10 2020-10-10 Address allocation method

Country Status (1)

Country Link
CN (1) CN112272243B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113179338B (en) * 2021-05-13 2022-11-01 深圳市英威腾电气股份有限公司 Communication method, electronic device, and storage medium
CN113382094B (en) * 2021-05-20 2023-09-12 西安麦格米特电气有限公司 Module address determining method and device, power module and communication network
CN117135142B (en) * 2023-10-26 2024-02-06 浙江大学 Address allocation device and method for performance test of flexible production line of electric automobile motor
CN117544598B (en) * 2024-01-03 2024-03-29 成都电科星拓科技有限公司 I2C bus address automatic allocation method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013539309A (en) * 2010-09-30 2013-10-17 ローベルト ボッシュ ゲゼルシャフト ミット ベシュレンクテル ハフツング How to automatically assign addresses to similar bus subscribers
CN105847456A (en) * 2015-01-13 2016-08-10 浙江大华技术股份有限公司 RS485 automatic address distribution method, device and system
CN108521474A (en) * 2018-03-30 2018-09-11 青岛海尔空调电子有限公司 The address challenges method of multiple control system
CN111294262A (en) * 2018-12-07 2020-06-16 施耐德电气工业公司 Method and slave device for a bus system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013539309A (en) * 2010-09-30 2013-10-17 ローベルト ボッシュ ゲゼルシャフト ミット ベシュレンクテル ハフツング How to automatically assign addresses to similar bus subscribers
CN105847456A (en) * 2015-01-13 2016-08-10 浙江大华技术股份有限公司 RS485 automatic address distribution method, device and system
CN108521474A (en) * 2018-03-30 2018-09-11 青岛海尔空调电子有限公司 The address challenges method of multiple control system
CN111294262A (en) * 2018-12-07 2020-06-16 施耐德电气工业公司 Method and slave device for a bus system

Also Published As

Publication number Publication date
CN112272243A (en) 2021-01-26

Similar Documents

Publication Publication Date Title
CN112272243B (en) Address allocation method
CN104202201A (en) Log processing method and device and terminal
CN105808407A (en) Equipment management method, equipment and equipment management controller
US10282120B2 (en) Method, apparatus and system for inserting disk
CN111918259A (en) Batch test method, medium and system for Bluetooth modules of printer
CN111314174A (en) Network dial testing method and device based on block chain and SDN edge computing network system
CN108062235B (en) Data processing method and device
CN111263377B (en) Network configuration method, device, equipment and system and distribution network testing method and system
CN112822260B (en) File transmission method and device, electronic equipment and storage medium
CN115314470A (en) RS-485 networking communication address automatic allocation method, host, slave and system
CN111506358B (en) Method and device for updating container configuration
CN113220660A (en) Data migration method, device and equipment and readable storage medium
EP3901766A1 (en) Offline configuration method and apparatus for smart device
CN108804329A (en) A kind of test system and method for data transfer integrity
CN111343300A (en) Address automatic allocation method and communication system
CN108280024B (en) Flow distribution strategy testing method and device and electronic equipment
CN110032341B (en) Module data processing method and device, electronic equipment and medium
CN113938351A (en) Data acquisition method, system and computer readable storage medium
US8554966B2 (en) Method for data exchange
CN115454896A (en) SMBUS-based SSD MCTP control message verification method and device, computer equipment and storage medium
CN113032307A (en) Integrated device access request processing method and related assembly
CN111371799B (en) Method, device and equipment for controlling data receiving and transmitting of MCTP (Multi-channel media Port) controller
CN101783712B (en) Method, user terminal and network node for identifying LTE (Long Term Evolution) version
CN111930582A (en) System management bus detection platform, processor and system management bus detection method
CN112737872B (en) ARINC664P7 end system cross-network testing system and 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
GR01 Patent grant
GR01 Patent grant