CN114900429A - Equipment communication parameter configuration method and system - Google Patents

Equipment communication parameter configuration method and system Download PDF

Info

Publication number
CN114900429A
CN114900429A CN202210812356.XA CN202210812356A CN114900429A CN 114900429 A CN114900429 A CN 114900429A CN 202210812356 A CN202210812356 A CN 202210812356A CN 114900429 A CN114900429 A CN 114900429A
Authority
CN
China
Prior art keywords
equipment
information reading
slave
reading instruction
configuration
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.)
Granted
Application number
CN202210812356.XA
Other languages
Chinese (zh)
Other versions
CN114900429B (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.)
Zhejiang Zhengtai Iot Technology Co ltd
Original Assignee
Zhejiang Zhengtai Iot 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 Zhejiang Zhengtai Iot Technology Co ltd filed Critical Zhejiang Zhengtai Iot Technology Co ltd
Priority to CN202210812356.XA priority Critical patent/CN114900429B/en
Publication of CN114900429A publication Critical patent/CN114900429A/en
Application granted granted Critical
Publication of CN114900429B publication Critical patent/CN114900429B/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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • 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/40169Flexible bus arrangements
    • H04L12/40176Flexible bus arrangements involving redundancy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0823Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
    • H04L41/0836Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability to enhance reliability, e.g. reduce downtime
    • 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
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40228Modbus
    • 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
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The embodiment of the application provides a method and a system for configuring equipment communication parameters, wherein the method comprises the following steps: a broadcasting equipment information reading instruction; receiving reply information responded by the slave equipment according to the set frame time gap; if the reply information is abnormal, updating the equipment information reading instruction, and broadcasting the updated equipment information reading instruction; if the reply information is correct, communication parameter configuration of the slave equipment end is completed according to the reply information. According to the method and the device, the frame time gap is dynamically adjusted by matching the device information reading instruction sent by the master device end and the device identification of the slave device end, so that the master device end can always be ensured to recognize and obtain correct device information of the slave device end in a frame number reading period, the whole device communication parameter configuration process is realized based on a communication protocol, the workload of device communication parameter configuration is effectively reduced, and the configuration accuracy is improved.

Description

Equipment communication parameter configuration method and system
Technical Field
The embodiment of the application relates to the technical field of communication protocols, in particular to a method and a system for configuring communication parameters of equipment.
Background
The current system capable of modbus data collection mainly comprises 2 parts: a master device side and a slave device side. The master equipment end can be a gateway or an upper computer system, and the slave equipment end is mainly a Modbus slave. The configuration of the device communication parameters, such as the Modbus address, of each slave device is the basis for subsequently implementing the communication between the master device and the slave device.
At present, the configuration mode of the device communication parameters which is more commonly used includes setting the device communication parameters of the slave device end on site, or actively issuing a write command frame associated with the device unique identification code of the device by the master device end to set an address through a self-defined protocol. However, the method has the disadvantages of heavy workload, long operation time and high error probability.
Therefore, the existing communication parameter configuration method has the technical problems of large workload, long operation time and high error probability.
Disclosure of Invention
The embodiment of the application provides a method and a system for configuring equipment communication parameters, and aims to solve the problems of large workload, long operation time and high error probability of the existing communication parameter configuration method.
In one aspect, an embodiment of the present application provides an apparatus communication parameter configuration method, which is executed at a master apparatus end in a master-slave communication system, and includes:
a broadcasting equipment information reading instruction;
receiving reply information responded by a slave device side according to a set frame time gap, wherein the frame time gap is determined according to a device identifier of the slave device side and the device information reading instruction;
if the reply information is abnormal, updating the equipment information reading instruction, and broadcasting the updated equipment information reading instruction to re-receive the reply information responded by the slave equipment end according to the set frame time gap;
and if the reply information is correct, generating a device configuration instruction according to the reply information and broadcasting so as to enable the slave device end to complete the configuration of the communication parameters.
As a possible embodiment of the present application, the frame time gap is determined according to a value at a position corresponding to the device information reading instruction in the device identifier of the slave device.
As a possible embodiment of the present application, the generating of the device configuration instruction according to the reply information includes:
analyzing the target equipment identification in the reply information;
determining a target communication parameter corresponding to the target equipment identifier according to a preset communication parameter distribution rule;
and combining the target equipment identification with the target communication parameters to generate an equipment configuration instruction.
As a possible embodiment of the present application, before the broadcasting device information reading instruction, the method includes:
broadcasting a configuration mode entering instruction;
generating a device configuration instruction according to the reply information and broadcasting the device configuration instruction so as to enable the slave device end to complete configuration of communication parameters, wherein the method comprises the following steps:
and generating an equipment configuration instruction according to the reply information and a preset configuration quitting mode so that the slave equipment end completes configuration of communication parameters and quits the configuration mode.
As a possible embodiment of the present application, after the broadcasting device information reading instruction, the method further includes:
and if the reply information responded by the slave equipment end is not received within the preset time interval, broadcasting the configuration mode quitting instruction.
On the other hand, an embodiment of the present application provides an apparatus communication parameter configuration method, which is executed at a slave apparatus end in a master-slave communication system, and includes:
if an equipment information reading instruction is received, setting a frame time gap according to the equipment information reading instruction and a preset equipment identifier;
sending reply information responding to the equipment information reading instruction according to the frame time gap, wherein the reply information carries the equipment identification;
if receiving an equipment configuration instruction, analyzing the equipment configuration instruction to obtain a target equipment identifier and a target communication parameter;
and if the target equipment identification is matched with a preset equipment identification, configuring communication parameters according to the target communication parameters.
As a possible embodiment of the present application, the step of setting a frame time gap according to the device information reading instruction and a preset device identifier includes:
according to the equipment information reading instruction, determining a numerical value at a position corresponding to the equipment information reading instruction from a preset equipment identifier;
and setting a frame time gap according to the value.
As a possible embodiment of the present application, before setting a frame time gap according to the device information reading instruction and a preset device identifier, the method includes:
acquiring a state parameter;
if the working mode corresponding to the state parameter is a configuration mode, executing the step of setting a frame time gap according to the received equipment information reading instruction and a preset equipment identifier;
after configuring the communication parameters according to the target communication parameters, the method includes:
the state parameters are updated to exit the configuration mode.
As a possible embodiment of the present application, before setting a frame time gap according to a received device information reading instruction and a preset device identifier, the method includes:
acquiring a sending identification parameter;
if the sending identification parameter is matched with the equipment information reading instruction, executing the step of setting a frame time gap according to the received equipment information reading instruction and a preset equipment identification;
after the reply information in response to the device information reading instruction is transmitted according to the frame time slot, the method further includes:
and updating the sending identification parameter.
As a possible embodiment of the present application, before setting a frame time gap according to an apparatus information reading instruction and a preset apparatus identifier if the apparatus information reading instruction is received, the method includes:
receiving a data frame and determining the byte bit number of the received data frame;
and if the byte bit number is equal to a preset standard bit number, setting the received data frame as a device information reading instruction.
As a possible embodiment of the present application, the device identifier is a device unique serial number.
On the other hand, the embodiment of the application also provides a device communication parameter configuration system, which comprises a master device end and a slave device end;
the main device end is used for: executing the method for configuring the communication parameters of the equipment;
the slave device side is used for: executing the steps of the method for configuring the communication parameters of the equipment.
According to the equipment communication parameter configuration method, the frame time gap of the slave equipment end responding to the equipment information reading instruction sent by the master equipment end is related to the equipment identification of the slave equipment end and the equipment information reading instruction sent by the master equipment end, and the equipment identification of each slave equipment is unique, so that the frame time gap is dynamically adjusted through the matching of the equipment information reading instruction sent by the master equipment end and the equipment identification of the slave equipment end, the master equipment end can be guaranteed to recognize and obtain correct equipment information of one slave equipment end in one frame number reading period, the whole equipment communication parameter configuration process is realized based on a communication protocol, the workload of equipment communication parameter configuration is effectively reduced, and the configuration accuracy is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an implementation scenario of a method for configuring a communication parameter of a device according to an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating steps of a method for configuring communication parameters of a device according to an embodiment of the present disclosure;
fig. 3 is a flowchart illustrating a procedure of completing communication parameter configuration according to a reply message according to an embodiment of the present application;
fig. 4 is a flowchart illustrating steps of entering and exiting a configuration mode by broadcasting according to an embodiment of the present application;
fig. 5 is a schematic flowchart illustrating steps of another method for configuring communication parameters of a device according to an embodiment of the present disclosure;
fig. 6 is a flowchart illustrating a step of setting a frame time interval according to an embodiment of the present application;
fig. 7 is a flowchart illustrating a procedure of determining whether to respond to a device information reading instruction according to a status parameter according to an embodiment of the present application;
fig. 8 is a flowchart illustrating a procedure of determining whether to respond to a device information reading instruction by using a sending identifier parameter according to an embodiment of the present application;
fig. 9 is a flowchart illustrating a step of receiving a device information reading instruction according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any inventive step, are within the scope of the present invention.
In the embodiments of the present application, the word "exemplary" is used to mean "serving as an example, instance, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the invention. In the following description, details are set forth for the purpose of explanation. It will be apparent to one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known structures and processes are not shown in detail to avoid obscuring the description of the invention with unnecessary detail. Thus, the present invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed in the embodiments herein.
The embodiments of the present application provide a method and a system for configuring device communication parameters, which are described in detail below.
The device communication parameter configuration method in the embodiment of the application is deployed in a master device end and a slave device end in a master-slave communication system in a program form, and the master device end and the slave device end respectively operate the programs of the corresponding device communication parameter configuration methods to realize the device communication parameter configuration of the slave device end in the master-slave communication system.
As shown in fig. 1, fig. 1 is a schematic view of an implementation scenario of a method for configuring a device communication parameter according to an embodiment of the present application, and may also be understood as an architecture diagram of a master-slave communication system. The implementation scenario diagram provided by the embodiment of the application mainly includes: a master device side 100 and several slave device sides 200. The master device side may be a gateway or an upper computer system, and the slave device side is usually a Modbus slave.
Further, the master device side and the slave device side communicate with each other according to a well-agreed protocol method. Specifically, the configuration of the communication parameters of the slave device is realized between the master device side and the slave device side through the following device communication parameter configuration method:
the main equipment end is used for:
a broadcasting equipment information reading instruction;
receiving reply information responded by a slave device side according to a set frame time gap, wherein the frame time gap is determined according to a device identifier of the slave device side and the device information reading instruction;
if the reply information is abnormal, updating the equipment information reading instruction, and broadcasting the updated equipment information reading instruction to re-receive the reply information responded by the slave equipment end according to the set frame time gap;
if the reply information is correct, generating an equipment configuration instruction according to the reply information and broadcasting so that the slave equipment end completes configuration of communication parameters;
the slave device side is used for:
if receiving an equipment information reading instruction, setting a frame time gap according to the received equipment information reading instruction and a preset equipment identifier;
sending reply information responding to the equipment information reading instruction according to the frame time gap, wherein the reply information carries the equipment identification;
if receiving an equipment configuration instruction, analyzing the equipment configuration instruction to obtain a target equipment identifier and a target communication parameter;
and if the target equipment identification is matched with a preset equipment identification, configuring communication parameters according to the target communication parameters.
It should be noted that the schematic diagram of the implementation scenario of the device communication parameter configuration method shown in fig. 1 is merely an example, and the implementation scenario of the device communication parameter configuration method described in the embodiment of the present application is for more clearly illustrating the technical solution of the embodiment of the present application, and does not constitute a limitation to the technical solution provided in the embodiment of the present application.
Based on the implementation scene schematic diagram of the equipment communication parameter configuration method, the equipment communication parameter configuration method is provided.
As shown in fig. 2, fig. 2 is a schematic flow chart illustrating steps of a device communication parameter configuration method provided in an embodiment of the present application, where the device communication parameter configuration method provided in the embodiment of the present application is mainly executed on the main device 100 in the implementation scenario schematic diagram provided in fig. 1, and specifically, the method includes steps 201 to 205:
a device information reading instruction is broadcast 201.
First, it should be noted that, in order to implement the device communication parameter configuration, the master device needs to first identify the slave devices in the system, so as to configure the communication parameters for each identified slave device. Therefore, in this embodiment of the present application, the device information reading instruction broadcasted by the master device is to enable the slave device to determine the frame time gap according to the device information reading instruction and the device identifier of the slave device and respond to the frame time gap after receiving the device information reading instruction, so as to implement the identification of the slave device by the master device.
Specifically, when a frame time gap where a certain slave device side and other slave device sides respond to the device information reading instruction is different, the master device side can acquire reply information of a unique slave device side in the frame time gap, so as to complete identification of the slave device side. Therefore, in order to realize subsequent identification of the slave device information, the master device end broadcasts consecutive device information reading instructions, so that the slave device end sets corresponding frame time gaps according to response rules corresponding to different device information reading instructions and respective device identifications of the slave device end, thereby completing the response to the device information reading instructions. Thus, since the respective device identifiers of the slave devices are unique and different, it is impossible that the frame time gaps of the two slave devices responding to the device information reading instruction are completely consistent, that is, within a complete frame number reading period, it can always be ensured that the master device identifies and obtains the correct device information of one slave device.
Further, the master device side broadcasts the device information reading instruction, which needs to send the device information reading instruction to all the slave clients, and therefore, the master device side communicates by using a broadcast address, for example, as a possible embodiment of the present application, in the device communication parameter configuration mode, all the information frames sent by the master device side and the slave device side both use the address of 248 (F8H), and certainly, it is also possible to communicate by using other agreed broadcast addresses, and the embodiment of the present application is not described herein again.
And 202, receiving reply information responded by the slave device according to the set frame time gap.
In the embodiment of the application, the slave device responds to the device information reading instruction according to the set frame time interval, and broadcasts the reply information. Specifically, the frame time gap is determined according to the device identifier and the device information reading instruction of the slave device. That is, the device identifier and the device information reading instruction on the slave device side affect the frame time gap for the slave device side to respond. In combination with the above description, it can be known that the device information reading instruction sent by the master device and the device identifier of the slave device cooperate to dynamically adjust the time gap of each frame, so that the master device can always obtain correct device information of one slave device in one frame sequence number reading cycle.
Further, as an alternative embodiment of the present application, the frame time interval is determined according to a value at a position corresponding to the device information reading instruction in the device identifier of the device side, that is, for different device information reading instructions, the device side may be required to set the frame time interval according to the value at the corresponding position in the device identifier, for example, for a first device information reading instruction, the device side may be required to set the frame time interval according to the value of the last bit in the device identifier, for a second device information reading instruction, the device side may be required to set the frame time interval according to the value of the second last bit in the device identifier, of course, the correspondence between the device information reading instruction and the position may be predetermined, and the correspondence is only a feasible solution and does not constitute a limitation to the embodiments of the present application, in fact, as long as the device information reading instruction and the location satisfy the one-to-one correspondence relationship, the embodiments of the present application are not described herein again.
It can be understood that, in order to implement the configuration of the device communication parameters provided in the embodiment of the present application, it is necessary to ensure that the device identifiers of different slave device ends are different, and therefore, in order to further improve the configuration efficiency of the device communication parameters, as a feasible embodiment of the present application, a device unique serial number carried by the slave device end when leaving the factory may be directly used as the device identifier, and manual identification is not required.
And 203, judging whether the reply information is abnormal or not. If yes, go to step 204; if not, go to step 205.
In the embodiment of the application, the main device side mainly realizes the judgment of whether the reply information is abnormal or not by analyzing the received reply information. Specifically, as can be seen from the foregoing description, since the slave device responds to the reply information based on the broadcast address, when multiple slave devices reply at the same frame time interval, the master device receives the reply information responded by the multiple slave devices, and at this time, the master device cannot correctly analyze the received reply information and recognize the received reply information to obtain a unique device identifier, that is, it may be considered that the received reply information by the master device is abnormal at this time, whereas, when only one slave device replies at a certain frame time interval, the master device can correctly analyze the received reply information and recognize the received reply information to obtain the unique device identifier, that is, it may be considered that the reply information received by the master device is not abnormal at this time.
And 204, updating the device information reading instruction, and returning to the step 201.
In the embodiment of the present application, it can be known by combining the foregoing description that, when there is an abnormality in the reply information, that is, after the master device receives reply information responded by multiple slave devices at the same frame time interval, the master device updates the device information reading instruction and rebroadcasts the updated device information reading instruction, so that the slave devices responding at the same frame time interval reset a new frame time interval after receiving the updated device information reading instruction, and respond according to the updated frame time interval. Thereby further completing the identification of these devices.
Specifically, for example, the provided "for different device information reading instructions, the slave device end may be required to set the frame time gap according to the value at the corresponding position in the device identifier", where the master device end broadcasts the first device information reading instruction, at this time, the slave device end may set the frame time gap according to the last bit of the device identifier, if the last bits of the device identifiers of the two slave device ends are the same, the frame time gaps of the two slave device ends in response to the first device information reading instruction are the same, at this time, the master device end cannot accurately identify the two slave device ends, and may further broadcast the second device information reading instruction, at this time, the two slave device ends may set the frame time gap according to the second last bit of the device identifier, and if the master device end still cannot obtain unique identifier information by parsing, it indicates that the second last bits of the device identifiers of the two slave device ends are also the same, at this time, the master device further broadcasts a third device information reading instruction and a fourth device information reading instruction. Because the device identifiers of the two slave device ends cannot be completely the same, after a certain device information reading instruction exists, the two slave device ends can respond according to different frame time gaps, and at this time, the master device end can analyze the received reply information to identify unique identification information, so that the identification of the slave device ends is completed.
And 205, generating a device configuration instruction according to the reply information and broadcasting.
In the embodiment of the present application, it can be known from the foregoing description that, after the master device identifies and obtains the unique device identifier, the master device generates a corresponding device configuration instruction according to the reply information, so that the corresponding slave device can complete configuration of the communication parameters. The communication parameters herein mainly refer to addresses of the slave devices, and certainly, the communication parameters may include baud rate and the like in addition to the addresses, which is not described herein again in this embodiment of the present application. The slave device performs the configuration of the communication parameters specifically, referring to the following fig. 5 and the description thereof.
Specifically, for example, after each new slave device end is identified, the master device end may gradually accumulate the preset starting addresses or sequentially allocate addresses according to a preset address table, and of course, the master device end may also backup the device identifier of the slave device end first after each new slave device end is identified, and after the identification of all the slave device ends is completed, uniformly allocate addresses of the slave device ends according to the preset address table, which is no longer described in detail in the implementation scheme of configuring the communication parameters in this embodiment of the present application.
In order to further improve the configuration efficiency of the communication parameters of the slave device, after a certain slave device is identified and allocated with communication parameters, the slave device no longer responds to the related command for configuring the communication parameters, which is sent by the master device, so that, as an optional embodiment of the present application, after the master device identifies a new slave device, the master device broadcasts the device configuration command to complete the communication configuration of the corresponding target slave device, and notifies the target slave device to push out the communication parameter configuration mode.
Further, in order to better implement management of device communication parameter configuration and avoid repeated identification, before performing the device communication parameter configuration provided by the embodiment of the present application, the master device end broadcasts an instruction to enter the configuration mode, and notifies all the slave device ends to enter the configuration mode, so that after the slave device ends are identified, a subsequent response to the device information reading instruction can be avoided by exiting the configuration mode, thereby avoiding repeated identification of a certain slave device end, and after all the device configurations are completed, the master device end further broadcasts an instruction to exit the configuration mode, so as to end the flow of the device communication parameter configuration provided by the embodiment of the present application. The specific implementation scheme can refer to the content of the following fig. 4 and its explanation.
In order to facilitate understanding of the complete device communication parameter configuration process running on the master device end provided in the embodiment of the present application, a complete implementation process is provided below with reference to the content provided in the foregoing, and specifically the following is provided:
1) the main equipment end sends an equipment information reading instruction: the master device end receives and analyzes the reply information responded by the slave device end in real time in the process of sending the device information reading instruction, and if the received reply information does not meet the protocol requirement, the device information reading instruction is sequentially sent according to the following sequence:
first device information reading instruction: f803 FE 00001A E180, after receiving the first device information reading instruction, the slave device determines the frame time gap according to the value of the 12 th bit of the device unique serial number, and responds;
second device information reading instruction: f803 FE 20001A E04A, after receiving the second device information reading instruction, the slave device determines the frame time gap according to the value of the 11 th bit of the unique serial number of its device, and responds;
third device information reading instruction: f803 FE 40001A E054, after receiving the third device information reading instruction, the slave device determines the frame time gap according to the value of the 10 th bit of the unique serial number of its device, and responds;
fourth device information reading instruction: f803 FE 60001A E19E, after receiving the fourth device information reading instruction, the slave determines the frame time gap according to the value of the 9 th bit of the unique serial number of its device, and responds;
fifth device information reading instruction: f803 FE 80001A E068, after receiving the fifth device information reading instruction, the slave device determines the frame time gap according to the value of the 8 th bit of the unique serial number of the device, and responds;
sixth device information reading instruction: f803 FE a 0001A E1 a2, after receiving the sixth device information reading instruction, the slave device determines the frame time gap according to the value of the 7 th bit of the unique serial number of the slave device, and responds;
seventh device information reading instruction: f803 FE a 0001A E1 a2, after receiving the seventh device information reading instruction, the slave device determines the frame time gap according to the value of the 6 th bit of the unique serial number of the device, and responds;
eighth device information reading instruction: f803 FE E0001A E076, after receiving the eighth device information reading instruction, the slave device determines the frame time gap according to the value of the 5 th bit of the unique serial number of its device, and responds;
ninth device information reading instruction: f803 FF 00001A E07C, after receiving the ninth device information reading command, the slave determines the frame time gap according to the value of the 4 th bit of the device unique serial number, and responds;
tenth device information reading instruction: f803 FF 20001A E1B 6, after receiving the tenth device information reading instruction, the slave device determines the frame time gap according to the value of the 3 rd bit of the device unique serial number, and responds;
eleventh device information reading instruction: f803 FF 40001A E1 a8, after receiving the eleventh device information reading instruction, the slave device determines the frame time gap according to the value of the 2 nd bit of the unique serial number of its device, and responds;
twelfth device information reading instruction: f803 FF 40001A E1 a8, after receiving the twelfth device information reading instruction, the slave device determines the frame time gap according to the value of the 1 st bit of the unique serial number of the device, and responds;
2) if the main equipment end receives the correct reply information, the communication parameters corresponding to the equipment identification are configured according to the equipment identification analyzed from the reply information.
Specifically, in the above process, it can be seen that the number of the device information reading instructions is the same as the number of bits of the unique serial number of the device, and all the device information reading instructions form a complete frame number reading cycle, and in a complete frame number reading cycle, the master device end can ensure that correct device information of one slave device end is obtained through identification.
In addition, it should be noted that, in the process of configuring the device communication parameters, the configuration of the device communication parameters depends on the cooperation between the master device and the slave device, so that the following description will be further described in conjunction with a device communication parameter configuration method executed by the slave device, and a specific implementation scheme may refer to the following content of fig. 3 and its explanation.
According to the equipment communication parameter configuration method, the frame time gap of the slave equipment end responding to the equipment information reading instruction sent by the master equipment end is related to the equipment identification of the slave equipment end and the equipment information reading instruction sent by the master equipment end, and the equipment identification of each slave equipment is unique, so that the frame time gap is dynamically adjusted through the matching of the equipment information reading instruction sent by the master equipment end and the equipment identification of the slave equipment, the master equipment end can be guaranteed to recognize and obtain correct equipment information of one slave equipment end in one frame number reading period, the whole equipment communication parameter configuration process is realized based on a communication protocol, the workload of equipment communication parameter configuration is effectively reduced, and the configuration accuracy is improved.
As shown in fig. 3, fig. 3 is a flowchart illustrating a procedure of completing communication parameter configuration according to a reply message according to an embodiment of the present application. The details are as follows.
The method for completing communication parameter configuration according to the reply information provided in the embodiment of the present application is mainly executed on the main device 100 in the implementation scenario diagram provided in fig. 1, and specifically, the method includes steps 301 to 303:
301, resolving the target device identification in the reply information.
In the embodiment of the present application, it can be known by combining the foregoing description that, when the reply information received by the master device is correct, the master device may analyze the reply information to obtain a unique target device identifier, where the target device identifier uniquely corresponds to one slave device, and therefore, communication parameter allocation of a target slave device corresponding to a subsequent target device is further achieved based on the target device identifier.
302, determining a target communication parameter corresponding to the target device identifier according to a preset communication parameter distribution rule.
In the embodiment of the present application, it can be known from the foregoing description that, for example, the communication parameters include communication addresses, the preset communication parameter allocation rule may gradually accumulate from a preset starting address to determine a target communication address corresponding to the target device identifier, or sequentially allocate the target communication addresses corresponding to the target device identifiers according to a preset address table. Of course, the specific communication parameter allocation rule may be set based on actual needs, taking the communication address as an example, and only needs to ensure that the communication addresses corresponding to the target device identifiers are different pairwise and correspond to the target device identifiers one to one, which is not described herein again in this embodiment of the present application.
303, combining the target device identifier with the target communication parameter to generate a device configuration instruction.
In the embodiment of the application, after the master device combines the target device identifier and the target communication parameter to generate the device configuration instruction and broadcasts the device configuration instruction, the slave device can judge whether the slave device is a recognized device according to the comparison result of the respective device identifier and the target device identifier. Specifically, if a certain slave device determines that the device identifier of the slave device is the same as the target device identifier in the device configuration instruction, the slave device may determine that the slave device is already identified by the master device, and the slave device may further complete the communication parameter configuration of the slave device by using the target communication parameter carried in the device configuration instruction, and specifically, the implementation scheme for completing the communication parameter configuration by the slave device may refer to the following fig. 5 and the contents explained in the following description.
Furthermore, in order to avoid repeated identification of the slave device by the master device, the identified slave device exits the parameter configuration mode after completing configuration of the communication parameters, so as to no longer respond to the information reading instruction broadcast by the master device.
As shown in fig. 4, fig. 4 is a flowchart illustrating steps of entering and exiting a configuration mode by broadcasting according to an embodiment of the present application. The details are as follows.
The method for entering and exiting the configuration mode in the broadcast provided by the embodiment of the present application is mainly executed on the main device 100 in the implementation scenario diagram provided in fig. 1, and specifically, the method includes steps 401 to 403;
401, an enter configuration mode command is broadcast.
In the embodiment of the present application, it can be known by combining the foregoing related description that the master device end may broadcast the configuration mode entering instruction through the broadcast address, at this time, the slave device end enters the configuration mode and responds after receiving the configuration mode entering instruction, and if the slave device end has entered the configuration mode, the slave device end does not respond to the configuration mode entering instruction. Of course, to ensure that all slave devices have entered the configuration mode, the master device may repeatedly broadcast the instruction to enter the configuration mode.
Specifically, as a feasible scheme, the configuration mode entering command broadcast by the master device is as follows:
F8 10 F8 00 00 01 02 A5 A5 0A E0。
402, generating a device configuration instruction according to the reply information and a preset configuration exit mode, so that the slave device end completes configuration of the communication parameters and exits the configuration mode.
In the embodiment of the application, when the slave device is in the configuration mode, after receiving the device information reading instruction, the slave device determines the frame time gap according to the device information reading instruction and the device identifier, and responds. At this time, the slave device end completes configuration of the communication parameters and exits from the configuration mode, so that repeated response to subsequent device information reading instructions from the slave device end is avoided.
And 403, if the reply message of the slave side response is not received within the preset time interval, broadcasting an instruction of exiting the configuration mode.
In the embodiment of the present application, it can be known from the foregoing related description that, after the slave device finishes the configuration and exits the configuration mode, the slave device no longer responds to the device information reading instruction broadcasted by the master device. Therefore, when the master device does not receive any reply message from the slave device within the preset time interval, it indicates that all the slave devices have been identified, and the configuration mode can be exited.
Specifically, the master device may broadcast the following exit configuration mode command: F810F 8000001021234 BC. And when the slave equipment end is not in the configuration mode, responding to the instruction of exiting the configuration mode and exiting the configuration mode. Therefore, when the master device side does not receive any response data, it can be considered that all the slave device sides have exited the configuration mode. Of course, the master device may repeatedly broadcast the exit configuration mode command multiple times.
As shown in fig. 5, fig. 5 is a schematic flow chart illustrating steps of another method for configuring device communication parameters according to an embodiment of the present disclosure, where the method for configuring device communication parameters according to the embodiment of the present disclosure is mainly executed on the slave device 200 in the implementation scenario diagram illustrated in fig. 1, and specifically, the method includes steps 501 to 504:
and 501, if an equipment information reading instruction is received, setting a frame time gap according to the equipment information reading instruction and a preset equipment identifier.
In the embodiment of the application, after receiving the device information reading instruction broadcast by the master device, the slave device side sets the frame time gap according to the device information reading instruction and the device identifier preset by the slave device side. Specifically, as a possible embodiment of the present application, the frame time gap may be determined based on a value of a position in the device identifier corresponding to the device information reading instruction, and a specific implementation scheme may refer to the content of subsequent fig. 6 and its explanation.
502, sending reply information responding to the device information reading instruction according to the frame time gap.
In the embodiment of the application, after determining that the device information reading instruction broadcasted by the master device is received and setting the corresponding frame time gap, the slave device broadcasts the information carrying the device identifier of the slave device according to the set frame time gap, so as to send the information to the master device for device identification of the master device. The embodiment of the present application is not repeated herein for the implementation scheme of the master device side analyzing the reply information sent by the slave device side.
503, if receiving the device configuration command, analyzing the device configuration command to obtain the target device identifier and the target communication parameter.
In the embodiment of the present application, it can be known by combining the foregoing related description that, after the master device obtains the unique target device identifier by analyzing and identifying the reply information sent by the slave device, the target device identifier and the allocated target communication parameter are combined to form a device configuration instruction and broadcast, and at this time, after receiving the device configuration instruction, the slave device analyzes the device configuration instruction to obtain the target device identifier and the target communication parameter carried therein.
And 504, if the target equipment identifier is matched with a preset equipment identifier, configuring communication parameters according to the target communication parameters.
In the embodiment of the application, after the slave device side obtains the target device identifier and the target communication parameter carried in the device configuration instruction through analysis, the target device identifier and the preset device identifier of the slave device side are compared, and if the target device identifier and the preset device identifier are the same, the slave device side knows that the slave device side is identified by the master device side, so that the configuration of the communication parameter of the slave device side can be directly completed according to the target communication parameter. Otherwise, if the two are different, the device configuration instruction is not the device configuration instruction of the slave device end, and the slave device end directly exits without answering.
In addition, it should be noted that, it is considered that the communication between the master device side and the slave device side includes various instructions, such as a device information reading instruction, a device configuration instruction, and the like, and other instructions unrelated to the device communication parameter configuration. In fact, therefore, the slave needs to first identify the received data frame. Specifically, after receiving the data, the slave device stores the data in a buffer, and then further completes the identification of the received data. Of course, considering that the communication protocol between the master device end and the slave device end is preset, for example, the characters of the different provided instructions, after the communication protocol between the master device end and the slave device end is defined, the slave device end can quickly recognize the received instruction, and the embodiments of the present application are not described herein again.
Further, as an optional embodiment of the present application, the slave device side may determine the mode of the slave device side by updating the state parameter, specifically, when the slave device side is in the configuration mode, the slave device side may respond to the device information reading instruction sent by the master device side, and otherwise, when the slave device side exits the configuration mode, the slave device side does not respond to the device information reading instruction sent by the master device side. The specific implementation scheme can refer to the content of the subsequent figure 7 and the explanation thereof.
Further, as another optional embodiment of the present application, the slave device side further ensures that the subsequent device information reading instruction is responded only on the premise that the previous device information reading instruction is responded by updating the transmission identification parameter, and a specific implementation scheme may refer to content of subsequent fig. 8 and its explanation.
As shown in fig. 6, fig. 6 is a flowchart illustrating a step of setting a frame time gap according to an embodiment of the present application, which is described in detail below.
The method for setting the frame time gap provided in the embodiment of the present application is mainly performed on the slave device 200 in the implementation scenario diagram provided in fig. 1, and the method includes steps 601 to 602:
601, according to the device information reading instruction, determining a numerical value at a position corresponding to the device information reading instruction from a preset device identifier.
In this embodiment, taking the twelve different device information reading instructions provided in the foregoing as examples, at this time, after receiving the character, if the 1 st received byte is 0xF8, the 2 nd received byte is 0x03, the 3 rd received byte is 0xFF, or 0xFE, the slave device may know that the device information reading instruction broadcasted by the master device is received, and further based on the content of the third byte and the fourth byte in the received device information reading instruction, it may be determined that the time gap needs to be determined according to the value at which position in the device identifier is selected. Specifically, the method comprises the following steps:
if the third byte and the fourth byte in the received device information reading instruction are 0xFE00, the master device reads the value of the 12 th bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFE20, the master device reads the value of the 11 th bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFE40, the master device reads the value of the 10 th bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFE60, the master device reads the value of the 9 th bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFE80, the master device reads the value of the 8 th bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFEA0, the master device side reads the value of the 7 th bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFEC0, the master device reads the value of the 6 th bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFEE0, the master device reads the value of the 5 th bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFF00, the master device side reads the value of the 4 th bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFF20, the master device side reads the value of the 3 rd bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFF40, the master device side reads the value of the 2 nd bit in the device identifier;
if the third byte and the fourth byte in the received device information reading instruction are 0xFF60, the master device side reads the value of the 1 st bit in the device identifier;
and 602, setting a frame time gap according to the value.
In this embodiment of the present application, after determining the value L at the corresponding position in the device identifier, the frame time gap may be set according to the following formula:
frame time gap = 200ms + L/3.
Further, in addition to the device information reading instruction, the frame time gap may be set to a short time frame time gap, for example, 100ms, for quick response to the received instruction after the other instruction or information.
Of course, the frame time gap is only a feasible setting manner, and in fact, it is feasible to set the frame time gap in other manners, and it only needs to ensure that the time gap between the normal response from the device end and the data transmission does not exceed 300ms, and the time period of the reply from the device end in the normal mode is less than the frame time gap difference corresponding to two adjacent serial numbers, which is not described herein again in this embodiment of the present application.
As shown in fig. 7, fig. 7 is a flowchart illustrating a step of determining whether to respond to a device information reading command by using a status parameter according to an embodiment of the present application, which is described in detail below.
The method for determining whether to respond to the device information reading instruction by using the state parameter provided by the embodiment of the present application is mainly executed on the slave device 200 in the implementation scenario diagram provided in fig. 1, and the method includes steps 701 to 703:
701, acquiring state parameters.
In the embodiment of the application, the slave device side can update the working mode through the value of the maintenance State parameter State. Specifically, the status parameter includes two values, 0 or 1, where the status parameter State = =1, which indicates that the slave device is in the configuration mode, and conversely, the status parameter State = =0, which indicates that the slave device has exited the configuration mode.
And 702, if the working mode corresponding to the state parameter is the configuration mode, setting a frame time gap according to the received equipment information reading instruction and a preset equipment identifier.
In the embodiment of the present application, it can be known by combining the foregoing related description that if the working mode corresponding to the status parameter is the configuration mode, that is, the status parameter = =1, it indicates that the slave device has not been identified and determined by the master device, and therefore, at this time, the slave device needs to set the frame time gap according to the received device information reading instruction and the preset device identifier, so as to respond to the device information reading instruction sent by the master device. On the contrary, if the working mode corresponding to the state parameter is not the configuration mode, that is, the state parameter = =0, it indicates that the slave device has completed configuration, and it is not necessary to respond to the device information reading instruction sent by the master device.
703, updating the state parameters to exit the configuration mode.
In the embodiment of the application, after the slave device determines that the slave device is identified and determined by the master device and configures the communication parameters of the slave device, the value of the State parameter State of the slave device is set to 0 to indicate that the slave device exits from the configuration mode, so that the slave device does not respond to the device information reading instruction broadcasted by the master device in the subsequent device communication parameter configuration process, and avoids the slave device being repeatedly identified by the master device.
In addition, the slave device updates the state parameters after configuring the communication parameters, and updates the state parameters when the master device broadcasts the command for entering the configuration mode and the command for exiting the configuration mode. Specifically, after receiving the configuration mode entering command broadcast by the master device, the slave device sets the status parameter to 1 if the status parameter = =0, and does not perform any processing if the status parameter = = 1. After receiving the configuration mode exit instruction broadcast by the master device, the slave device sets the status parameter to 0 if the status parameter = =1, and does not perform any processing if the status parameter = = 0.
As shown in fig. 8, fig. 8 is a flowchart illustrating a step of determining whether to respond to a device information reading instruction by using a sending identification parameter according to an embodiment of the present application, which is described in detail below.
The method for determining whether to respond to the device information reading instruction by using the sent identification parameter provided by the embodiment of the present application is mainly executed on the slave device 200 in the implementation scenario diagram provided by fig. 1, and the method includes steps 801 to 803:
801, obtaining a sending identification parameter.
In the embodiment of the application, the slave device side can record the responded device information reading instruction by sending the value of the identification parameter SendFlag through the maintenance system, so that the subsequent device information reading instruction is only responded on the premise of responding to the previous device information reading instruction.
Specifically, unlike the State parameter State, the value of the send identification parameter SendFlag is related to the number of device information read instructions. For example, taking the 12 different device information reading instructions provided above as an example, the value of the sending representation parameter is 1 to 12. Specifically, the send identification parameter SendFlag may set a frame time gap at each time according to the received device information reading instruction and the preset device identification at the slave device, and update the frame time gap in response to the device information reading instruction, if the send identification parameter SendFlag at the slave device is updated, it indicates that the slave device receives and responds to the corresponding device information reading instruction, so as to further respond to the next received device information reading instruction, and otherwise, if the send identification parameter SendFlag at the slave device is not updated, it indicates that the slave device does not respond to the corresponding device information reading instruction, so that it cannot further respond to the next received device information reading instruction.
And 802, if the sending identification parameter is matched with the equipment information reading instruction, setting a frame time gap according to the received equipment information reading instruction and a preset equipment identification.
In this embodiment of the application, if the current sending identification parameter matches the currently received device information reading instruction, it may be determined that the sending identification parameter SendFlag of the slave device has been updated in the process of last receiving the device information reading instruction, that is, the slave device responds to the last received device information reading instruction, and therefore, setting a frame time gap according to the received device information reading instruction and a preset device identifier may be performed to complete the response to the device information reading instruction. On the contrary, if the current sending identification parameter does not match the currently received device information reading instruction, it may be determined that the sending identification parameter SendFlag of the slave device has not been updated in the process of last receiving the device information reading instruction, that is, the slave device has not responded to the last received device information reading instruction, and therefore, the slave device does not need to complete the response to the device information reading instruction.
803, updating the sending identification parameter.
In the embodiment of the present application, after the slave device side sends the reply information responding to the device information reading instruction according to the frame time gap, the slave device side updates the send identification parameter SendFlag to ensure the response to the next received device information reading instruction.
In order to more clearly understand the process of updating the transmission identification parameter provided in the embodiment of the present application, a specific implementation scheme is given below, specifically, the 12 different device information reading instructions provided in the foregoing are also taken as an example, and at this time, the specific implementation scheme is as follows:
if a first device information reading instruction is received, setting SendFlag = =1, and replying;
if receiving a second device information reading instruction, judging whether SendFlag is 1, if so, setting SendFlag to be 2, and replying; if not 1, directly quitting without answering;
if a third device information reading instruction is received: judging whether SendFlag is 2, if so, setting SendFlag to be 3, and replying; if not, directly quitting without answering;
if receiving a fourth device information reading instruction: judging whether SendFlag is 3, if so, setting SendFlag to be 4, and replying; if not 3, directly quitting without answering;
if a fifth device information reading instruction is received: judging whether SendFlag is 4, if so, setting SendFlag to be 5, and replying; if not 4, directly quitting without answering;
if a sixth device information reading instruction is received: judging whether SendFlag is 5, if so, setting SendFlag to be 6, and replying; if not 5, directly quitting without answering;
if receiving the seventh device information reading instruction: judging whether SendFlag is 6, if so, setting SendFlag to be 7, and replying; if not 6, directly quitting without answering;
if an eighth device information reading instruction is received: judging whether SendFlag is 7, if so, setting SendFlag to be 8, and replying; if not 7, directly quitting without answering;
if receiving the ninth device information reading instruction: judging whether SendFlag is 8, if so, setting SendFlag to be 9, and replying; if not 8, directly quitting without answering;
if receiving the tenth device information reading instruction: judging whether SendFlag is 9, if so, setting SendFlag to 10, and replying; if not 9, directly quitting without answering;
if an eleventh device information reading instruction is received: judging whether SendFlag is 10, if so, setting SendFlag to 11, and replying; if not, directly quitting without answering;
if receiving the twelfth device information reading instruction: judging whether SendFlag is 11, if so, setting SendFlag to 12, and replying; if not 11, exit directly, do not reply.
As shown in fig. 9, fig. 9 is a flowchart illustrating a step of receiving a device information reading instruction according to an embodiment of the present application, which is described in detail below.
Considering that in the actual communication process, the slave device side may also receive information replied by other slave device sides, taking the provided sending identification parameter as an example, in general, the sending identification parameters of each slave device should be equal, but due to the existence of an error, the sending identification parameter of a certain slave device may be abnormal, for example, the sending identification parameter is not updated and is smaller than that of other slave devices, at this time, the device may preferentially respond to the device information reading instruction and reply, so that other slave device sides may also receive the reply frame of the device, that is, other devices may receive the reply frame whose number of bytes (far greater than 8 bytes) does not meet the requirement (the requirement is 8 bytes), therefore, the embodiment of the present application provides a way of determining the receiving device information reading instruction, and determines whether the device information reading instruction is received based on the number of bytes, avoiding receiving other abnormal instructions, specifically, the method comprises the following steps of 901-902:
901, receiving a data frame and determining the byte bit number of the received data frame.
In the embodiment of the application, after receiving the data frame, the slave device analyzes the data frame and determines the byte bit number of the data frame.
And 902, if the byte bit number is equal to a preset standard bit number, setting the received data frame as a device information reading instruction.
In the embodiment of the application, in a general case, the device information reading instruction is a byte with a specific bit number, and therefore, whether the byte bit number is equal to a preset standard bit number is determined by comparing the byte bit number with the preset standard bit number, so as to determine whether the received data frame is the device information reading instruction.
Further, when the byte number of the received data frame is equal to the standard number, the data frame received by the slave device end may be regarded as a device information reading instruction, and at this time, the slave device end may continue to execute the subsequent process according to the scheme provided in the foregoing fig. 6 to 8, otherwise, if the byte number of the received data frame is not equal to the standard number, it indicates that the slave device end has not received the device information reading instruction, and in order to avoid data error, the slave device end may not reply to the master device, that is, in the device information reading period of the round, it is equivalent to that the slave device end does not reply to the device information reading instruction again. Only when the first device information reading command is received in the next device information reading cycle, the device information reading cycle is reset, and the subsequent processes are executed again according to the schemes provided in fig. 6 to 8.
The embodiment of the application also provides an equipment communication parameter configuration system, which comprises a master equipment end and a slave equipment end;
the main device end is used for:
a broadcasting equipment information reading instruction;
receiving reply information responded by a slave device side according to a set frame time gap, wherein the frame time gap is determined according to a device identifier of the slave device side and the device information reading instruction;
if the reply information is abnormal, updating the equipment information reading instruction, and broadcasting the updated equipment information reading instruction to re-receive the reply information responded by the slave equipment end according to the set frame time gap;
if the reply information is correct, generating an equipment configuration instruction according to the reply information and broadcasting so that the slave equipment end completes configuration of communication parameters;
the slave device side is used for:
if receiving an equipment information reading instruction, setting a frame time gap according to the received equipment information reading instruction and a preset equipment identifier;
sending reply information responding to the equipment information reading instruction according to the frame time gap, wherein the reply information carries the equipment identification;
if receiving an equipment configuration instruction, analyzing the equipment configuration instruction to obtain a target equipment identifier and a target communication parameter;
and if the target equipment identification is matched with a preset equipment identification, configuring communication parameters according to the target communication parameters.
For an explanation on steps executed by the master device side and the slave device side in the device communication parameter configuration system, reference may be made to the contents of fig. 2 to fig. 9, which is not described herein again in this embodiment of the present application.
An electronic device is further provided in the embodiments of the present application, as shown in fig. 10, fig. 10 is a schematic structural diagram of the electronic device provided in the embodiments of the present application.
The electronic device comprises a memory, a processor and an electronic program stored in the memory and capable of running on the processor, wherein the processor executes the electronic program to realize the steps of the electronic method provided by any embodiment of the application.
Specifically, the method comprises the following steps: the electronic device may include components such as a processor 1001 of one or more processing cores, memory 1002 of one or more storage media, a power supply 1003, and an input unit 1004. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 10 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 1001 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 1002 and calling data stored in the memory 1002, thereby performing overall monitoring of the electronic device. Optionally, processor 1001 may include one or more processing cores; preferably, the processor 1001 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 1001.
The memory 1002 may be used to store software programs and modules, and the processor 1001 executes various functional applications and data processing by operating the software programs and modules stored in the memory 1002. The memory 1002 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 1002 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 1002 may also include a memory controller to provide the processor 1001 access to the memory 1002.
The electronic device further includes a power source 1003 for supplying power to each component, and preferably, the power source 1003 may be logically connected to the processor 1001 through a power management system, so that functions of managing charging, discharging, power consumption, and the like are implemented through the power management system. The power source 1003 may also include any component including one or more of a dc or ac power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The electronic device may further include an input unit 1004, and the input unit 1004 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the electronic device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 1001 in the electronic device loads the executable file corresponding to the process of one or more application programs into the memory 1002 according to the following instructions, and the processor 1001 runs the application programs stored in the memory 1002, thereby implementing the steps in the electronic method provided in any embodiment of the present application.
To this end, an embodiment of the present application provides a computer-readable storage medium, which may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like. The computer readable storage medium has stored thereon an electronic program which, when executed by a processor, implements the steps in the electronic method provided in any of the embodiments of the present application.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and parts that are not described in detail in a certain embodiment may refer to the above detailed descriptions of other embodiments, and are not described herein again.
In a specific implementation, each unit or structure may be implemented as an independent entity, or may be combined arbitrarily to be implemented as one or several entities, and the specific implementation of each unit or structure may refer to the foregoing method embodiment, which is not described herein again.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
The electronic method provided by the embodiment of the present application is described in detail above, and the principle and the implementation of the present invention are explained in the present application by applying a specific example, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (12)

1. A method for configuring communication parameters of devices, which is a master device operating in a master-slave communication system, includes:
a broadcasting equipment information reading instruction;
receiving reply information responded by a slave device side according to a set frame time gap, wherein the frame time gap is determined according to a device identifier of the slave device side and the device information reading instruction;
if the reply information is abnormal, updating the equipment information reading instruction, and broadcasting the updated equipment information reading instruction to re-receive the reply information responded by the slave equipment end according to the set frame time gap;
and if the reply information is correct, generating a device configuration instruction according to the reply information and broadcasting so as to enable the slave device end to complete the configuration of the communication parameters.
2. The method according to claim 1, wherein the frame time slot is determined according to a value at a location corresponding to the device information reading instruction in the device id of the slave device.
3. The method according to claim 1, wherein the generating of the device configuration command according to the reply message comprises:
analyzing the target equipment identification in the reply information;
determining a target communication parameter corresponding to the target equipment identifier according to a preset communication parameter distribution rule;
and combining the target equipment identification with the target communication parameters to generate an equipment configuration instruction.
4. The method of claim 1, wherein prior to the broadcasting of the device information reading command, the method comprises:
broadcasting a configuration mode entering instruction;
generating a device configuration instruction according to the reply information and broadcasting the device configuration instruction so as to enable the slave device end to complete configuration of communication parameters, wherein the method comprises the following steps:
and generating an equipment configuration instruction according to the reply information and a preset configuration quitting mode so that the slave equipment end completes configuration of communication parameters and quits the configuration mode.
5. The method of claim 4, wherein after the device communication parameter reading command, the method further comprises:
and if the reply information responded by the slave equipment end is not received within the preset time interval, broadcasting the configuration mode quitting instruction.
6. A method for configuring communication parameters of a device, operating in a slave device in a master-slave communication system, comprises:
if an equipment information reading instruction is received, setting a frame time gap according to the equipment information reading instruction and a preset equipment identifier;
sending reply information responding to the equipment information reading instruction according to the frame time gap, wherein the reply information carries the equipment identification;
if receiving an equipment configuration instruction, analyzing the equipment configuration instruction to obtain a target equipment identifier and a target communication parameter;
and if the target equipment identification is matched with a preset equipment identification, configuring communication parameters according to the target communication parameters.
7. The method of claim 6, wherein the step of setting the frame time gap according to the device information reading command and the preset device identifier comprises:
determining a numerical value at a position corresponding to the equipment information reading instruction from a preset equipment identifier according to the equipment information reading instruction;
and setting a frame time gap according to the value.
8. The method of claim 6, wherein before setting the frame time gap according to the device information reading command and the preset device identifier, the method comprises:
acquiring a state parameter;
if the working mode corresponding to the state parameter is a configuration mode, executing the step of setting a frame time gap according to the received equipment information reading instruction and a preset equipment identifier;
after configuring the communication parameters according to the target communication parameters, the method includes:
the state parameters are updated to exit the configuration mode.
9. The method of claim 6, wherein before setting the frame time gap according to the received device information reading command and the preset device identifier, the method comprises:
acquiring a sending identification parameter;
if the sending identification parameter is matched with the equipment information reading instruction, executing the step of setting a frame time gap according to the received equipment information reading instruction and a preset equipment identification;
after transmitting reply information in response to the device information reading instruction according to the frame time slot, the method further includes:
and updating the sending identification parameter.
10. The method according to claim 6, wherein if receiving a device information reading command, before setting a frame time gap according to the device information reading command and a preset device identifier, the method comprises:
receiving a data frame and determining the byte bit number of the received data frame;
and if the byte bit number is equal to a preset standard bit number, setting the received data frame as a device information reading instruction.
11. The method for configuring communication parameters of equipment according to any one of claims 1 to 5 or 6 to 10, wherein the equipment identifier is an equipment unique serial number.
12. A device communication parameter configuration system is characterized by comprising a master device end and a slave device end;
the main device end is used for: executing the method according to any of the preceding claims 1-5 for configuring communication parameters of a device;
the slave device side is used for: the steps of the method for configuring communication parameters of a device according to any one of claims 6 to 10 are performed.
CN202210812356.XA 2022-07-12 2022-07-12 Equipment communication parameter configuration method and system Active CN114900429B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210812356.XA CN114900429B (en) 2022-07-12 2022-07-12 Equipment communication parameter configuration method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210812356.XA CN114900429B (en) 2022-07-12 2022-07-12 Equipment communication parameter configuration method and system

Publications (2)

Publication Number Publication Date
CN114900429A true CN114900429A (en) 2022-08-12
CN114900429B CN114900429B (en) 2022-10-21

Family

ID=82729706

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210812356.XA Active CN114900429B (en) 2022-07-12 2022-07-12 Equipment communication parameter configuration method and system

Country Status (1)

Country Link
CN (1) CN114900429B (en)

Citations (12)

* 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
US20140173013A1 (en) * 2012-12-19 2014-06-19 Motech Industries, Inc. Method for setting addresses of slave devices in communication network
CN104994463A (en) * 2015-05-15 2015-10-21 饶品魁 NFC intelligent identification system
CN105072699A (en) * 2015-07-20 2015-11-18 深圳市远望谷信息技术股份有限公司 Method and device for fast distributing access time slots of multiple slave devices in master and slave devices
WO2016107129A1 (en) * 2014-12-31 2016-07-07 华为技术有限公司 Broadcast implementation method, apparatus and device
CN108495371A (en) * 2018-03-28 2018-09-04 广州极飞科技有限公司 Communication means and system, using its main equipment and from equipment and unmanned plane
CN108737590A (en) * 2018-05-15 2018-11-02 浙江正泰电器股份有限公司 A kind of method that address is distributed automatically, system, Modbus main websites, Modbus slave stations
US20200125515A1 (en) * 2018-10-18 2020-04-23 Bender Gmbh & Co. Kg Method for resolving an address conflict for modbus rtu standard protocol
CN111241019A (en) * 2019-12-31 2020-06-05 苏州阿德文斯电子科技有限公司 RS485 bus arbitration and address automatic identification method
CN111510358A (en) * 2019-01-30 2020-08-07 施耐德电气工业公司 Method, device and computer program product for configuring a slave device
CN113543295A (en) * 2021-06-28 2021-10-22 山东省计算中心(国家超级计算济南中心) Data transmission method and system based on sound wave communication
CN114375052A (en) * 2021-07-30 2022-04-19 深圳成谷科技有限公司 Communication method and apparatus

Patent Citations (12)

* 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
US20140173013A1 (en) * 2012-12-19 2014-06-19 Motech Industries, Inc. Method for setting addresses of slave devices in communication network
WO2016107129A1 (en) * 2014-12-31 2016-07-07 华为技术有限公司 Broadcast implementation method, apparatus and device
CN104994463A (en) * 2015-05-15 2015-10-21 饶品魁 NFC intelligent identification system
CN105072699A (en) * 2015-07-20 2015-11-18 深圳市远望谷信息技术股份有限公司 Method and device for fast distributing access time slots of multiple slave devices in master and slave devices
CN108495371A (en) * 2018-03-28 2018-09-04 广州极飞科技有限公司 Communication means and system, using its main equipment and from equipment and unmanned plane
CN108737590A (en) * 2018-05-15 2018-11-02 浙江正泰电器股份有限公司 A kind of method that address is distributed automatically, system, Modbus main websites, Modbus slave stations
US20200125515A1 (en) * 2018-10-18 2020-04-23 Bender Gmbh & Co. Kg Method for resolving an address conflict for modbus rtu standard protocol
CN111510358A (en) * 2019-01-30 2020-08-07 施耐德电气工业公司 Method, device and computer program product for configuring a slave device
CN111241019A (en) * 2019-12-31 2020-06-05 苏州阿德文斯电子科技有限公司 RS485 bus arbitration and address automatic identification method
CN113543295A (en) * 2021-06-28 2021-10-22 山东省计算中心(国家超级计算济南中心) Data transmission method and system based on sound wave communication
CN114375052A (en) * 2021-07-30 2022-04-19 深圳成谷科技有限公司 Communication method and apparatus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
THOMAS MORRIS;RAYFORD VAUGHN;YOGINDER DANDASS: "A Retrofit Network Intrusion Detection System for MODBUS RTU and ASCII Industrial Control Systems", 《2012 45TH HAWAII INTERNATIONAL CONFERENCE ON SYSTEM SCIENCES》 *
方彬浩;罗家祥: "基于随机时隙扫描的RS-485从机地址自动分配方法", 《《IT时代周刊》论文专版(第296期)》 *

Also Published As

Publication number Publication date
CN114900429B (en) 2022-10-21

Similar Documents

Publication Publication Date Title
CN110429708B (en) Method and system for realizing plug and play of power distribution equipment
CN109120477B (en) Dynamic analysis method, device, server and storage medium based on modbus protocol
CN106603735B (en) Method, device and system for distributing communication addresses of intelligent instrument
CN110474896A (en) Data communications method and relevant device based on Modbus consensus standard
CN113765714B (en) Equipment network distribution method and device, storage medium and electronic equipment
CN105141449A (en) Addition method and device for monitoring configuration
US10813032B2 (en) Systems and methods for neighboring node discovery in a network
CN103026661A (en) Device commissioning and replacement
CN115052041A (en) Channel identification distribution method, device, equipment and storage medium
CN114900429B (en) Equipment communication parameter configuration method and system
JP2016031554A (en) Data acquisition device and industrial network system
CN116827801B (en) Network topology construction method, device, computer equipment and readable storage medium
EP4184831A1 (en) Data collection method and apparatus, modbus system, and storage medium
CN112788576A (en) Equipment offline processing method and system, storage medium and electronic device
CN111141015A (en) Remote air conditioner control method
CN115695073A (en) Communication method, device, equipment and storage medium
CN114827967A (en) Software updating method, Bluetooth device and storage medium
CN109767082A (en) A kind of multiplexing industry equipment collaboration operational method and system based on regional location
CN115268951A (en) Installation method, device, equipment and storage medium of operating system
CN115167351A (en) Controller function updating method and system, vehicle and server
CN106028303B (en) Intelligent device discovery method and device
CN105207811B (en) Method and device for replacing non-AllJoyn equipment
CN110109933B (en) Information maintenance method, configuration management database system and storage medium
CN111327465B (en) Intelligent distributed feeder automation terminal node configuration method
CN116436994B (en) Profinet protocol message transmission method, device, equipment and medium

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
CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 325603 Wenzhou Bridge Industrial Park, Beibeixiang Town, Yueqing City, Wenzhou City, Zhejiang Province

Patentee after: Zhejiang Zhengtai IOT Technology Co.,Ltd.

Address before: 325603 Wenzhou Bridge Industrial Park, Beibaixiang Town, Qing City, Wenzhou City, Zhejiang Province

Patentee before: Zhejiang Zhengtai IOT Technology Co.,Ltd.