CN111190846A - Networking method based on bus system and bus system - Google Patents

Networking method based on bus system and bus system Download PDF

Info

Publication number
CN111190846A
CN111190846A CN201811350284.1A CN201811350284A CN111190846A CN 111190846 A CN111190846 A CN 111190846A CN 201811350284 A CN201811350284 A CN 201811350284A CN 111190846 A CN111190846 A CN 111190846A
Authority
CN
China
Prior art keywords
bus
slave
command
slave device
address
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
CN201811350284.1A
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.)
Hangzhou Ezviz Software Co Ltd
Original Assignee
Hangzhou Ezviz Software 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 Hangzhou Ezviz Software Co Ltd filed Critical Hangzhou Ezviz Software Co Ltd
Priority to CN201811350284.1A priority Critical patent/CN111190846A/en
Publication of CN111190846A publication Critical patent/CN111190846A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4004Coupling between buses
    • G06F13/4027Coupling between buses using bus bridges
    • G06F13/404Coupling between buses using bus bridges with address mapping

Abstract

The application provides a networking party and a bus system based on a bus system, which are applied to bus equipment serving as master equipment in the bus system, wherein each bus equipment in the bus system stores a global unique ID in a memory and is used as a bus address of the bus equipment, and the method comprises the following steps: sending a discovery command on a bus in a one-to-many mode, and enabling a slave device to respond to a response command aiming at the discovery command to acquire a bus address of the slave device in the bus system; when determining that the bus addresses of all the slave devices in the bus system are acquired, sending a device adding command to the slave devices which acquire the bus addresses in a one-to-one mode, and enabling the slave devices to acquire the bus addresses of the master devices. The method can realize self-adaptive networking.

Description

Networking method based on bus system and bus system
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a networking method based on a bus system and a bus system.
Background
With the continuous improvement of living standards of people, people have higher and higher requirements on living supporting facilities and the like, so more and more people can consider using intelligent homes, particularly villas and intelligent buildings, intelligent homes can be designed in advance, in order to pursue the stability of control equipment, a wired scheme control is usually considered in a solution, and a scheme of a system which is controlled by a bus and comprises a plurality of intelligent equipment, such as an RS-485 line, is considered.
In the traditional RS-485 bus equipment networking, an internal address is required to be configured for each RS-485 equipment in a network, for example, the address is 1, 2 and 3-N, and the address configuration mode can be configured through hardware dial-up configuration or through man-machine interaction software, so that in actual engineering application, the equipment needs to be manually configured on site, the equipment is very inconvenient in many occasions and is easy to configure and make mistakes, and the mode can be configured only one-to-one off-line, and engineering installation and networking can be carried out after the configuration is finished, so that the process is very complicated.
If the internal address is set repeatedly in the configuration process, the communication of the address repeated equipment in the network causes conflict, which results in communication failure, and to solve the conflict, all the equipment with configured address must be checked to find the equipment with address configuration conflict, and when the number of the equipment is large, it will take much time to find the equipment with address conflict. If the equipment is installed, the equipment needs to be detached again to check the correctness of the equipment, a large amount of labor is needed, and the networking efficiency is not high.
Disclosure of Invention
In view of this, the present application provides a networking method based on a bus system and a bus system, which can implement adaptive networking.
In order to solve the technical problem, the technical scheme of the application is realized as follows:
a networking method based on a bus system is applied to a bus device which is taken as a master device in the bus system, each bus device in the bus system stores a globally unique ID in a memory and is used as a bus address of the bus device, and the networking method comprises the following steps:
sending a discovery command on a bus in a one-to-many mode, and enabling a slave device to respond to a response command aiming at the discovery command to acquire a bus address of the slave device in the bus system;
when determining that the bus addresses of all the slave devices in the bus system are acquired, sending a device adding command to the slave devices which acquire the bus addresses in a one-to-one mode, and enabling the slave devices to acquire the bus addresses of the master devices.
A bus system in which each bus device stores a globally unique ID in a memory as a bus address of the present bus device, the system comprising a master device and a slave device;
the master device sends a discovery command on a bus in a one-to-many mode, and the slave device responds a response command to the discovery command to acquire a bus address of the slave device in the bus system; when determining that the bus addresses of all slave devices in the bus system are acquired, sending a device adding command to the slave devices which acquire the bus addresses in a one-to-one mode;
the slave device responds to a response command in a one-to-one mode aiming at the discovery command when receiving the discovery command sent by the master device and determining that the discovery command is sent to the slave device; and when an equipment adding command sent by the master equipment is received, acquiring the bus address of the master equipment.
A non-transitory computer readable storage medium storing instructions, wherein the instructions, when executed by a processor, cause the processor to perform the steps of the bus system based networking method.
An electronic device comprising a non-transitory computer readable storage medium as described, and the processor having access to the non-transitory computer readable storage medium.
According to the technical scheme, each device stores the global unique ID in the memory in advance as the bus address, the master device sends the discovery command in a one-to-many mode to obtain the bus address of the slave device in the system, and sends the device adding command to the slave device in a one-to-one mode to enable the slave device to obtain the bus address of the host, and networking of the bus system is completed. The scheme can realize self-adaptive networking.
Drawings
FIG. 1 is a schematic diagram of a bus system according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a frame data structure;
fig. 3 is a schematic diagram of a networking process based on a bus system in the embodiment of the present application;
FIG. 4 is a flowchart illustrating a process of determining bus addresses of all slave devices in an acquired bus system according to an embodiment of the present application;
fig. 5 is a schematic flow chart illustrating another process of determining bus addresses of all slave devices in the acquired bus system according to the embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more clearly apparent, the technical solutions of the present invention are described in detail below with reference to the accompanying drawings and examples.
An embodiment of the present application provides a bus system, including: a master device and a slave device.
Referring to fig. 1, fig. 1 is a schematic diagram of a bus system according to an embodiment of the present disclosure. In fig. 1, N slave devices are taken as an example.
Each bus device in the bus system stores a globally unique ID in a memory, and the globally unique ID is used as a bus address of a corresponding bus device, that is, the master device and the slave device both store globally unique IDs in the memory and are used as bus addresses of the corresponding devices, and the specific implementation is as follows:
each bus device is pre-assigned with a globally unique ID when leaving a factory, that is, the assigned IDs for each bus device are different, and the ID assigned for each bus device may be stored in a Memory of the device, where the Memory may be a Flash Memory (Flash Memory) or a read only Memory (EEPROM); but are not limited to the two storage modes described above.
The globally unique ID preassigned for each bus device serves as the bus address for the bus device when the bus device is connected to the bus system. Therefore, as long as the bus equipment is accessed to the bus system, each bus equipment is provided with the bus address, and the bus address of each bus equipment has global uniqueness, even if the bus equipment is switched from one bus system to any other bus system, the bus addresses of the bus equipment can never conflict, and the problem of conflict of the bus addresses is solved.
The master device and the slave device are connected through a bus in a hardware manner to form a bus system, and the self-adaptive networking process based on the bus system is given as follows:
in the bus system, a bus device as a master and a bus device as a slave, which are directly referred to as a master and a slave hereinafter for convenience of description, are included.
In a first step, the master sends a discovery command on the bus in a one-to-many manner.
In this embodiment of the application, an RS-485 bus is taken as an example, the SRC of the discovery command is a bus address of the master device, and the DST is a preset broadcast address, where the broadcast address does not conflict with bus addresses of the bus devices.
Referring to fig. 2, fig. 2 is a schematic diagram of a frame data structure. The address information of the sender is carried in the SRC and the address information of the receiver is carried in the DST.
CMD carries command types such as find command, cancel mute command, etc.
And secondly, when the slave device receives the discovery command sent by the master device and determines that the discovery command is sent to the slave device, responding to the response command by a one-to-one mode aiming at the discovery command.
The slave device determines whether the data frame is the data frame sent to the slave device according to the address information carried by the DST of the data frame, and if the address information carried by the DST is a preset broadcast address, the slave device determines the broadcast data frame sent to the slave device.
And the slave device determines that the command is a discovery command according to the CMD of the data frame, and then performs corresponding processing, namely, responds a response command to the master device.
The slave device carries the bus address of the slave device in the SRC in the responded response command, and carries the bus address of the master device in the DST, that is, the bus address carried by the SRC in the discovery command.
And when the slave equipment sends the response command, the slave equipment preempts the bus resources in a carrier sense mode and sends the response command by using the preempted bus resources.
And thirdly, the master device acquires the bus address of the slave device in the bus system.
After sending the discovery command, the master device is in a state of waiting for receiving a response command responded by the slave device; and when a response command responded by any slave device is received, acquiring the bus address of the slave device in the SRC responding to the command.
And fourthly, when the master device determines that the bus addresses of all the slave devices in the bus system are acquired, the master device sends a device adding command to the slave devices which acquire the bus addresses in a one-to-one mode.
In the bus system, the time for receiving the data of the slave by the master is short, for example, 3 seconds, or the time can be set by itself, in this embodiment of the application, the time for receiving the data of the slave by the master in the existing bus system may not be changed, if the configured time is short, the slave in the entire system may be discovered by sending the discovery command several times, or the discovery command may be sent periodically until no slave responds to the response command. Based on this, the method for determining, by the master device, that the bus addresses of all the slave devices in the bus system have been acquired in this step may be, but is not limited to, the following two implementation manners, specifically:
the first method comprises the following steps:
after sending the discovery command in a one-to-many mode, the master device waits for a first preset time.
When the first preset time is over, the master device determines whether a response command responded by the slave device is received within the first preset time;
when the master device receives a response command responded by the slave device within a first preset time, the bus address of the slave device in the received response command is acquired, a silent command is sent to the slave device which has acquired the bus address within the first preset time, a discovery command is sent again in a one-to-many mode until the response command responded by the slave device is not received within the first preset time which is waited at present, and the bus addresses of all the slave devices in the bus network are determined to be acquired;
and when the master device does not receive the response command responded by the slave device within the first preset time, determining that the bus addresses of all the slave devices in the bus network are acquired.
When the slave device determines the discovery command sent to the slave device, the bus address carrying the slave device responds to the master device to respond to the command.
When the slave device receives the silent command sent by the master device in a one-to-one mode, the slave device is set to be in a silent state, namely when the discovery command is received again, the slave device does not respond to the master device.
This implementation sends a discovery command in a first preset time period until a period occurs in which no response command is received, determining that all slaves in the bus system have been discovered.
And the second method comprises the following steps:
after sending a discovery command in a one-to-many mode, the master device waits for a first preset time;
when the first preset time is over, the master device acquires the bus address of the slave device in the response command received in the first preset time;
the master device determines whether the number of times of sending discovery commands in the secondary networking reaches a preset threshold value, and if so, determines that the bus addresses of all slave devices in the bus network are acquired; otherwise, sending a silent command to the slave equipment which acquires the bus address within the current first preset time; and sending the discovery command again in a one-to-many mode until the number of times of sending the discovery command reaches a preset threshold value, and determining that the bus addresses of all slave devices in the bus network are acquired.
When the slave device determines the discovery command sent to the slave device, the bus address carrying the slave device responds to the master device to respond to the command.
When the slave device receives the silent command sent by the master device in a one-to-one mode, the slave device is set to be in a silent state, namely when the discovery command is received again, the slave device does not respond to the master device.
The implementation mode is that aiming at each networking discovery, a preset threshold value time discovery message is sent, and all slave devices in the bus system can be discovered in a discovery period corresponding to the preset threshold value discovery message.
And fifthly, when the slave equipment receives an equipment adding command sent by the master equipment, acquiring a bus address of the master equipment.
To this end, the bus system completes the adaptive networking process.
The process can be completely automatically completed by the bus equipment without human intervention, and the condition that networking cannot be performed due to the fact that the bus addresses are the same does not occur.
When one bus system needs to perform slave device discovery again, a silence canceling command is sent on the bus in a one-to-many mode, so that all slave devices on the bus can respond to a discovery command sent by a master device and perform slave device discovery again.
When the slave device receives a cancel silence command sent by the master device, the slave device sets the device of the slave device to be in a non-silence state, namely, when a discovery command sent by the master device is received, the slave device can respond to the master device.
Based on the self-adaptive networking method, when slave devices are added or deleted, the self-adaptive networking method can be realized in a mode of occupying less bus resources and being short in time.
Procedure for adding slave:
and when the slave device is connected with the network after being disconnected or a bus system which is already networked is added, the slave device sends a connection command to the master device.
The online command is transmitted in a broadcast manner, and after other slave devices receive the online command, the online command is determined not to be a command transmitted by the master device and is not processed.
After the master device sends information to the slave device, the slave device does not receive a response within a second preset time, and the bus address of the slave device is set to be invalid.
When the master device receives an online command sent by any slave device, determining whether the device has acquired the bus address of the slave device, if so, indicating that the slave device is offline and online, if the bus address of the slave device is invalid, setting the bus address as valid and sending a device adding command to the slave device, so that the slave device acquires the bus address of the master device; otherwise, the slave device which is added into the bus system for the first time acquires the bus address of the slave device, and sends a device adding command to the slave device, so that the slave device acquires the bus address of the master device.
In a specific implementation, the bus address of the host may also be obtained from the device and stored in a Memory, where the Memory may be a Flash Memory (Flash Memory) or a read-only Memory (EEPROM); but are not limited to the two storage modes described above.
After the slave device is disconnected in the storage mode, the stored bus address of the master device is not lost.
When the master device receives an online command sent by any slave device, if the bus address of the slave device is determined to be acquired, the slave device is disconnected and online, whether the bus address of the slave device is set to be valid is determined, and if the bus address of the slave device is set to be invalid, the bus address of the slave device is set to be valid; and no other processing is carried out, and the slave device is defaulted to be in the networking corresponding to the bus system.
Thus, when the master device receives an online command sent by any slave device, if the master device determines that the bus address of the slave device is not acquired, namely the slave device which is added to the bus system for the first time, the bus address of the slave device is acquired, and a device adding command is sent to the slave device, so that the slave device acquires the bus address of the master device.
Procedure for deleting slave devices:
the master device obtains the bus address of the slave device which is to be moved out of the bus network, and deletes the obtained bus address;
the way of obtaining the bus address of the slave device to be moved out of the bus network may be the system configuration, or may be the way of obtaining the bus address of the corresponding slave device from an exit command sent by the device.
This is done by removing the slave device from the bus network in the event that it is determined that the slave device is dropped.
The above-mentioned shifting out and adding are all referred to the implementation on software, and do not include the connection of bus hardware.
The process for adding and deleting slave devices can be implemented by adaptive networking through rediscovery.
Based on the same inventive concept, the embodiment of the application also provides a networking method based on the bus system. The method is applied to the bus device which is taken as a main device in the bus system, and each bus device in the bus system stores the global unique ID in the memory and is used as the bus address of the bus device.
Referring to fig. 3, fig. 3 is a schematic diagram of a networking process based on a bus system in the embodiment of the present application. The method comprises the following specific steps:
step 301, the master device sends a discovery command on the bus in a one-to-many manner, so that the slave device responds to a response command for the discovery command to obtain a bus address of the slave device in the bus system.
The DST of the discovery command carries a preset broadcast address, and the SRC carries a bus address of the master device.
When the slave device receives the discovery command sent by the master device and determines that the discovery command is sent to the slave device, the slave device responds to the response command in a one-to-one mode according to the discovery command.
The slave device determines whether the data frame is the data frame sent to the slave device according to the address information carried by the DST of the data frame, and if the address information carried by the DST is a preset broadcast address, the slave device determines the broadcast data frame sent to the slave device.
And the slave device determines that the command is a discovery command according to the CMD of the data frame, and then performs corresponding processing, namely, responds a response command to the master device.
The slave device carries the bus address of the slave device in the SRC in the responded response command, and carries the bus address of the master device in the DST, that is, the bus address carried by the SRC in the discovery command.
And when the slave equipment sends the response command, the slave equipment preempts the bus resources in a carrier sense mode and sends the response command by using the preempted bus resources.
Step 302, when determining that the bus addresses of all the slave devices in the bus system are acquired, sending a device adding command to the slave devices with the acquired bus addresses in a one-to-one manner, so that the slave devices acquire the bus addresses of the master devices.
In this step, there are two implementations for determining the bus addresses of all slave devices in the acquired bus system, which are respectively as follows:
referring to fig. 4, fig. 4 is a schematic diagram illustrating a process for determining bus addresses of all slave devices in an acquired bus system according to an embodiment of the present application. The method comprises the following specific steps:
step 401, after the master device sends the discovery command, it waits for a first preset time.
Step 402, when the first preset time is over, the master device determines whether a response command responded by the slave device is received within the first preset time, and if so, step 403 is executed; otherwise, step 404 is performed.
Step 403, the master device acquires the bus address of the slave device in the received response command, and sends a mute command to the slave device that has acquired the bus address within the first preset time; and step 401 is performed.
When the slave device receives the silent command sent by the master device in a one-to-one mode, the slave device is set to be in a silent state, namely when the discovery command is received again, the slave device does not respond to the master device.
At step 404, the device determines the bus addresses of all slave devices in the acquired bus network.
This implementation sends a discovery command in a first preset time period until a period occurs in which no response command is received, determining that all slaves in the bus system have been discovered.
Referring to fig. 5, fig. 5 is a schematic diagram of another flow of determining bus addresses of all slave devices in an acquired bus system according to an embodiment of the present application. The method comprises the following specific steps:
step 501, after the master device sends a discovery command, it waits for a first preset time.
Step 502, when the first preset time is over, acquiring the bus address of the slave device in the response command received in the first preset time.
Step 503, the master device determines whether the number of times that the discovery command has been sent in the secondary networking reaches a preset threshold, if so, step 505 is executed; otherwise, step 504 is performed.
Step 504, the master device sends a quiet command to the slave device which has acquired the bus address within the first preset time; and step 501 is performed.
When the slave device receives the silent command sent by the master device in a one-to-one mode, the slave device is set to be in a silent state, namely when the discovery command is received again, the slave device does not respond to the master device.
The master determines 505 that the bus addresses of all slaves in the bus network have been obtained.
The implementation mode is that aiming at each networking discovery, a preset threshold value time discovery message is sent, and all slave devices in the bus system can be discovered in a discovery period corresponding to the preset threshold value discovery message.
When the bus system needs to perform slave device discovery again, a silence canceling command is sent on the bus, so that all slave devices on the bus can respond to a discovery command sent by the master device and perform slave device discovery again.
After the master device sends information to the slave device, the slave device does not receive a response within a second preset time, and the bus address of the slave device is set to be invalid.
When the master device receives an online command sent by any slave device, determining whether the device has acquired the bus address of the slave device, if so, if the bus address of the slave device is set to be invalid, setting the bus address to be valid, and sending a device adding command to the slave device, so that the slave device acquires the bus address of the master device; otherwise, acquiring the bus address of the slave device, and sending a device adding command to the slave device to enable the slave device to acquire the bus address of the master device.
The master device obtains the bus address of the slave device which is to be moved out of the bus network, and deletes the obtained bus address;
in the embodiment of the present application, after the bus system is adaptively networked, communication between the master device and the slave device is implemented in the prior art, and two data communication processes, i.e., one-to-one communication and one-to-many communication, are given below.
One-to-one communication in a bus system, i.e. a device sends a request, only one device responds and sends a response. As the bus system in FIG. 1, RS-485 bus is taken as an example.
If the master device sends a data frame to the slave device 2, the DST of the data frame sent by the host device is the bus address of the slave device, and the SRC is the bus address of the master device.
In the data frame responded by the slave device 2, DST is the bus address of the host, and SRC is the bus address of the slave device 2.
In the bus system, one-to-many communication is that the master device sends data frames to all slave devices, and the slave devices do not need to perform data response to the master device, or perform one-to-one response to the master device, where the data frame DST sent by the master device is a preset broadcast address, and the SRC is a bus address of the host.
Furthermore, a non-transitory computer-readable storage medium is also proposed in an embodiment of the present application, which stores instructions that, when executed by a processor, cause the processor to perform the steps of the bus system-based networking method.
In addition, an electronic device is also proposed, which includes the above-described non-transitory computer-readable storage medium, and the processor that has access to the non-transitory computer-readable storage medium.
In summary, according to the application, each device stores a globally unique ID in a memory as a bus address in advance, the master device sends a discovery command in a one-to-many manner to obtain the bus address of the slave device in the system, and sends an add device command to the slave device in a one-to-one manner, so that the slave device obtains the bus address of the host, and networking of the bus system is completed. The scheme can realize self-adaptive networking.
Because the globally unique ID is planned as the bus address when each bus device leaves the factory, no matter one bus device is firstly networked or switched to another bus system for networking, the bus address does not need to be manually configured, the pre-stored bus address can be used for self-adaptive networking, and the problem of address conflict can not occur.
When the bus equipment is deleted or added for the networked bus system, the networking bus system can be realized by using shorter time and occupying less bus resources.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (14)

1. A networking method based on a bus system is applied to a bus device which is taken as a main device in the bus system, and is characterized in that each bus device in the bus system stores a globally unique ID in a memory to be used as a bus address of the bus device, and the method comprises the following steps:
sending a discovery command on a bus in a one-to-many mode, and enabling a slave device to respond to a response command aiming at the discovery command to acquire a bus address of the slave device in the bus system;
when determining that the bus addresses of all the slave devices in the bus system are acquired, sending a device adding command to the slave devices which acquire the bus addresses in a one-to-one mode, and enabling the slave devices to acquire the bus addresses of the master devices.
2. The method of claim 1, wherein determining the bus addresses of all slaves in the acquired bus system comprises:
after sending a discovery command in a one-to-many mode, waiting for a first preset time;
when the first preset time is over, determining whether a response command responded by the slave equipment is received within the first preset time;
when a response command responded by the slave device is received within a first preset time, the bus address of the slave device in the received response command is acquired, a silent command is sent to the slave device which has acquired the bus address within the first preset time, a discovery command is sent again in a one-to-many mode until the response command responded by the slave device is not received within the first preset time which is waited currently, and the bus addresses of all the slave devices in the acquired bus network are determined;
when the response commands responded by the slave devices are not received within the first preset time, the bus addresses of all the slave devices in the bus network are determined to be acquired.
3. The method of claim 1, wherein determining the bus addresses of all slaves in the acquired bus system comprises:
after sending a discovery command in a one-to-many mode, waiting for a first preset time;
when the first preset time is over, acquiring a bus address of the slave equipment in a response command received in the first preset time;
determining whether the number of times of sending discovery commands in the secondary networking reaches a preset threshold value, and if so, determining that the bus addresses of all slave devices in the bus network are acquired; otherwise, sending a silent command to the slave equipment which acquires the bus address within the current first preset time; and sending the discovery command again in a one-to-many mode until the number of times of sending the discovery command reaches a preset threshold value, and determining that the bus addresses of all slave devices in the bus network are acquired.
4. The method of claim 2 or 3, further comprising:
when the slave equipment discovery needs to be carried out again, a silence canceling command is sent on the bus, so that all the slave equipment on the bus can respond to the discovery command sent by the master equipment and carry out the slave equipment discovery again.
5. The method according to any one of claims 1-3, wherein the method further comprises:
after information is sent to the slave equipment, if the response of the slave equipment is not received within second preset time, setting the bus address of the slave equipment as invalid;
when an online command sent by any slave device is received, determining whether the device has acquired the bus address of the slave device, if so, if the bus address of the slave device is invalid, setting the bus address to be valid, and sending a device adding command to the slave device to enable the slave device to acquire the bus address of the master device; otherwise, acquiring the bus address of the slave device, and sending a device adding command to the slave device to enable the slave device to acquire the bus address of the master device.
6. The method according to any one of claims 1-3, wherein the method further comprises:
the bus address of the slave device to be moved out of the bus network is obtained and the obtained bus address is deleted.
7. A bus system, wherein each bus device in the bus system stores a globally unique ID in a memory for use as a bus address of the bus device, the system comprising a master device and a slave device;
the master device sends a discovery command on a bus in a one-to-many mode, and the slave device responds a response command to the discovery command to acquire a bus address of the slave device in the bus system; when determining that the bus addresses of all slave devices in the bus system are acquired, sending a device adding command to the slave devices which acquire the bus addresses in a one-to-one mode;
the slave device responds to a response command in a one-to-one mode aiming at the discovery command when receiving the discovery command sent by the master device and determining that the discovery command is sent to the slave device; and when an equipment adding command sent by the master equipment is received, acquiring the bus address of the master equipment.
8. The bus system according to claim 7,
the master device is specifically configured to wait for a first preset time after sending the discovery command in a one-to-many manner; when the first preset time is over, determining whether a response command responded by the slave equipment is received within the first preset time; when the master device receives a response command responded by the slave device within a first preset time, the bus address of the slave device in the received response command is acquired, a silent command is sent to the slave device which has acquired the bus address within the first preset time, a discovery command is sent again in a one-to-many mode until the response command responded by the slave device is not received within the first preset time which is waited at present, and the bus addresses of all the slave devices in the bus network are determined to be acquired; when a response command responded by the slave equipment is not received within first preset time, determining that the bus addresses of all the slave equipment in the bus network are acquired;
the slave device is specifically configured to respond to the master device with a bus address of the slave device to respond to the command when determining the discovery command sent to the slave device; and when a silent command sent by the master device in a one-to-one mode is received, setting the slave device to be in a silent state.
9. The bus system according to claim 7,
the master device is specifically configured to wait for a first preset time after sending the discovery command in a one-to-many manner; when the first preset time is over, acquiring a bus address of the slave equipment in a response command received in the first preset time; determining whether the number of times of sending discovery commands in the secondary networking reaches a preset threshold value, and if so, determining that the bus addresses of all slave devices in the bus network are acquired; otherwise, sending a silent command to the slave equipment which acquires the bus address within the current first preset time; sending the discovery command again in a one-to-many mode until the number of times of sending the discovery command reaches a preset threshold value, and determining that the bus addresses of all slave devices in the bus network are obtained;
the slave device is specifically configured to respond to the master device with a bus address of the slave device to respond to the command when determining the discovery command sent to the slave device; when a silent command sent by the master device in a one-to-one mode is received, the slave device is set to be in a silent state, namely, when a discovery command is received again, the master device is not responded.
10. Bus system according to claim 8 or 9,
the master device is further configured to send a mute canceling command on the bus in a one-to-many manner when it is determined that the slave device discovery needs to be performed again, so that all the slave devices on the bus can respond to the discovery command sent by the master device and perform the slave device discovery again;
the slave device is further configured to set the apparatus of the slave device to a non-silent state when receiving a cancel mute command sent by the master device.
11. The bus system according to any of claims 7-9,
the slave equipment is further used for sending an online command to the master equipment when the slave equipment is online after being disconnected or is added into a bus system which is already networked;
the master device is further used for setting the bus address of the slave device as invalid within a second preset time after the master device sends information to the slave device and if the slave device does not respond; when an online command sent by any slave device is received, determining whether the device has acquired the bus address of the slave device, if so, if the bus address of the slave device is invalid, setting the bus address to be valid, and sending a device adding command to the slave device to enable the slave device to acquire the bus address of the master device; otherwise, acquiring the bus address of the slave device, and sending a device adding command to the slave device to enable the slave device to acquire the bus address of the master device.
12. In a bus system according to one of claims 7 to 9,
the master device is further used for obtaining the bus address of the slave device to be moved out of the bus network and deleting the obtained bus address.
13. A non-transitory computer readable storage medium storing instructions, which when executed by a processor, cause the processor to perform the steps of the bus system based networking method of any of claims 1 to 6.
14. An electronic device comprising the non-transitory computer readable storage medium of claim 13, and the processor having access to the non-transitory computer readable storage medium.
CN201811350284.1A 2018-11-14 2018-11-14 Networking method based on bus system and bus system Pending CN111190846A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811350284.1A CN111190846A (en) 2018-11-14 2018-11-14 Networking method based on bus system and bus system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811350284.1A CN111190846A (en) 2018-11-14 2018-11-14 Networking method based on bus system and bus system

Publications (1)

Publication Number Publication Date
CN111190846A true CN111190846A (en) 2020-05-22

Family

ID=70707005

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811350284.1A Pending CN111190846A (en) 2018-11-14 2018-11-14 Networking method based on bus system and bus system

Country Status (1)

Country Link
CN (1) CN111190846A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477506A (en) * 2008-01-04 2009-07-08 鸿富锦精密工业(深圳)有限公司 Addressing system and method of master equipment to slave equipment
CN101895453A (en) * 2010-07-19 2010-11-24 江苏省东方世纪网络信息有限公司 Automatic address identification handshaking method of share type bus under master-slave communication mode
US20110022812A1 (en) * 2009-05-01 2011-01-27 Van Der Linden Rob Systems and methods for establishing a cloud bridge between virtual storage resources
CN103577485A (en) * 2012-08-07 2014-02-12 上海达实联欣科技发展有限公司 Master and slave mode inquiry system and method
CN103826252A (en) * 2014-01-16 2014-05-28 京信通信系统(中国)有限公司 Method of acquiring and sending sequence numbers among main and slave devices and 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

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477506A (en) * 2008-01-04 2009-07-08 鸿富锦精密工业(深圳)有限公司 Addressing system and method of master equipment to slave equipment
US20110022812A1 (en) * 2009-05-01 2011-01-27 Van Der Linden Rob Systems and methods for establishing a cloud bridge between virtual storage resources
CN101895453A (en) * 2010-07-19 2010-11-24 江苏省东方世纪网络信息有限公司 Automatic address identification handshaking method of share type bus under master-slave communication mode
CN103577485A (en) * 2012-08-07 2014-02-12 上海达实联欣科技发展有限公司 Master and slave mode inquiry system and method
CN103826252A (en) * 2014-01-16 2014-05-28 京信通信系统(中国)有限公司 Method of acquiring and sending sequence numbers among main and slave devices and 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

Similar Documents

Publication Publication Date Title
US11723836B2 (en) System and method for dynamic device discovery and address assignment
CN105847456B (en) A kind of RS485 distributes address methods, devices and systems automatically
CN106685776B (en) Intelligent device discovery method and system in local area network
TWI353750B (en) Wireless communication system, wireless lan access
CN107040284B (en) Multi-address access method for improving reliability and stability of data transmission
WO2016169231A1 (en) Method and system for building steady piconet based on bluetooth
CN113518134B (en) Method and device for accessing main router through domain name under MESH networking
JP2005176382A (en) X10 communication of one or more messages between one or more mobile communication devices and one or more module components
WO2020073614A1 (en) Communication method and device for air conditioner, outdoor unit, indoor unit, and air conditioner
JPH07112201B2 (en) Method and apparatus for assigning addresses to remote terminals in a LAN
CN111371659B (en) Method for automatically allocating RS485 slave equipment address
CN111190846A (en) Networking method based on bus system and bus system
US10187222B2 (en) Methods and devices for communicating over a building management system network
CN105635166A (en) Information transmission method, apparatus and system
CN106657093B (en) Gateway protocol for smart home
CN114201424A (en) Communication method, system, computer equipment and storage medium based on RS485 bus
CN108270592A (en) The management-control method and device of a kind of Network resource allocation
KR101543148B1 (en) Automatic searching method of sub-module for direct digital control device
CN115150801B (en) Inter-node communication method and system based on Bluetooth Mesh network
WO2015117452A1 (en) Wireless internet access method, host, communication access device and computer storage medium
CN117527460A (en) Method and device for expanding RS485 interface through local area network
CN115250456A (en) Control method and device of intelligent equipment, computer equipment and storage medium
JP4664022B2 (en) Device for network construction, network construction method, and network construction program
CN115119272A (en) Network communication method between device and server, computer device and storage medium
JP3428779B2 (en) Switching network connection system

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