Address coding method, device and system

Through the automated address encoding method, the number of devices to be encoded and the preset encoding address is sent, which solves the problem of manual intervention in the encoding configuration of master and slave devices in the prior art, and improves the encoding efficiency and degree of automation.

CN119109903APending Publication Date: 2024-12-10TIMES TIANYUAN (SUZHOU) TECHNOLOGY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411180795.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The address encoding configuration between the master and slave devices in existing industrial control systems requires manual intervention, with low automation and low encoding efficiency.

Method used

By obtaining the number of slave devices to be encoded, sending a start encoding instruction to the slave device, and performing statistics and verification based on the received request encoding instruction and storage encoding address, automatically sending a preset encoding address to complete the address encoding, realizing the slave Automatic encoding of the device.

Benefits of technology

The encoding efficiency between the host device and the slave device is improved, and the automated address encoding process is realized without manual intervention, which improves the automation level of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119109903A_ABST
    Figure CN119109903A_ABST
Patent Text Reader

Abstract

The invention discloses an address coding method, device and system, and relates to the technical field of coded address communication, and the method comprises the steps: obtaining the number of to-be-coded slave devices; sending a start coding instruction to the slave equipment, wherein the start coding instruction indicates that the slave equipment enters an address coding mode; receiving a request coding instruction and a first storage coding address sent by the slave equipment; counting a first number of the received request coding instructions; and under the condition that the first number is equal to the number of the to-be-coded slave devices and the received first storage coded address of at least one slave device is inconsistent with the preset coded address of the corresponding slave device, sending the preset coded address to the slave device, so that the slave device performs address coding, and obtaining a coding result. According to the embodiment of the invention, the master device and the slave device can be automatically coded, address coding is quickly completed, and the coding efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of coded address communication, and in particular, relates to an address coding method, device and system. Background Art

[0002] In some industrial control systems, there are usually multiple devices that cooperate to achieve system linkage. During the operation of the system, master devices and slave devices are generally set up, and the master device is used to control the remaining types of slave devices. Setting up networking communication and coding address allocation between the master and slave devices is the key to system control and management.

[0003] In the related art, the address is generally configured through a hardware coding switch. Although the coding between the master device and the slave device can be achieved through the hardware coding switch, it requires technical personnel to go to the site for configuration, which is not highly automated and has low coding efficiency. Summary of the invention

[0004] The embodiments of the present application provide an address coding method, device and system, which can automatically encode master and slave devices, quickly complete address coding, and improve coding efficiency.

[0005] On the one hand, an embodiment of the present application provides an address encoding method, the method comprising:

[0006] Get the number of slave devices to be encoded;

[0007] Sending a start encoding instruction to the slave device, wherein the start encoding instruction indicates that the slave device enters an address encoding mode;

[0008] Receiving a request encoding instruction and a first storage encoding address sent by the slave device;

[0009] Counting a first number of received request encoding instructions;

[0010] When the first number is equal to the number of slave devices to be encoded and the first stored encoding address of at least one received slave device is inconsistent with the preset encoding address of the corresponding slave device, the preset encoding address is sent to the slave device so that the slave device performs address encoding to obtain an encoding result.

[0011] Optionally, when the number of the slave devices is determined to be multiple and the multiple slave devices are cascaded through a communication interface, sending a start encoding instruction to the slave device includes:

[0012] Acquire a coding order of the slave device, where the coding order is determined based on a cascade relationship of a plurality of the slave devices;

[0013] A start encoding instruction is sent to the slave device according to the encoding sequence.

[0014] Optionally, the encoding result includes a first encoding address of the slave device. After sending a preset encoding address to the slave device so that the slave device performs address encoding and obtains the encoding result, the method further includes:

[0015] Within a first preset time period, when receiving the encoding result returned by the slave device, verifying the first encoding address to obtain a verification result;

[0016] Counting a second number of the slave devices that have successfully been encoded in the verification result;

[0017] When the second number is equal to the number of slave devices to be encoded, an exit encoding instruction is sent to the slave device.

[0018] Optionally, when the encoding result returned by the slave device is not received within a first preset time period or the verification result determines that the first encoding address is inconsistent with the preset encoding address, the method further includes:

[0019] Generate encoding failure information;

[0020] Fault information is determined based on the encoding failure information, where the fault information includes a slave device number and a fault type corresponding to the encoding failure.

[0021] Optionally, when the verification result determines that the first coding address is inconsistent with the preset coding address, the method further includes:

[0022] Counting the number of times a preset encoding address is sent to the current slave device;

[0023] When the sending number is less than the preset number, returning to the step of sending the preset coded address to the slave device;

[0024] When the number of transmissions is equal to the preset number of times, the step of generating encoding failure information is performed.

[0025] Optionally, sending an exit code instruction to the slave device includes:

[0026] Sending a confirmation coding instruction to the slave device;

[0027] When receiving a coding success instruction sent by at least one of the slave devices within the second preset time period, an exit coding instruction is sent.

[0028] On the other hand, an embodiment of the present application provides an address encoding method, which is applied to a slave device, and the method includes:

[0029] In response to a start encoding instruction sent by a host device, sending a request encoding instruction and a first storage encoding address to the host device, wherein the start encoding instruction identifies that the slave device enters an address encoding mode;

[0030] Receiving a preset coded address sent by the host device;

[0031] Modify the first stored coding address based on the preset coding address to obtain a first coding address;

[0032] Determining the first encoding address as an encoding result;

[0033] The encoding result is sent to the host device.

[0034] Optionally, after sending the encoding result to the host device, the method further includes:

[0035] Within a second preset time period, in response to the encoding confirmation instruction sent by the host device, sending an encoding success instruction to the host device;

[0036] Within a third preset time period, receiving an exit coding instruction;

[0037] An address encoding mode is exited based on the exit encoding instruction.

[0038] Optionally, after sending the encoding success instruction to the host device, the method further includes:

[0039] Get the first moment of sending the encoding success instruction;

[0040] Determine a fourth preset duration based on the first moment and the preset delay;

[0041] When the fourth preset time period has elapsed and no exit coding instruction is received, the address coding mode is exited, wherein the fourth preset time period is greater than the third preset time period.

[0042] On the other hand, an embodiment of the present application provides an address encoding device, applied to a host device, the device comprising:

[0043] An acquisition module is used to obtain the number of slave devices to be encoded;

[0044] A sending module, used for sending a start coding instruction to the slave device, wherein the start coding instruction indicates that the slave device enters an address coding mode;

[0045] A receiving module, used for receiving a request encoding instruction and a first storage encoding address sent by the slave device;

[0046] A statistics module, used for counting a first number of received request encoding instructions;

[0047] The sending module is also used to send a preset coding address to the slave device when the first number is equal to the number of slave devices to be encoded and the first stored coding address received of at least one slave device is inconsistent with the preset coding address of the corresponding slave device, so that the slave device performs address encoding to obtain a coding result.

[0048] On the other hand, an embodiment of the present application provides an address encoding device, which is applied to a slave device, and the device includes:

[0049] A sending module, configured to send a request encoding instruction and a first storage encoding address to the host device in response to a start encoding instruction sent by the host device, wherein the start encoding instruction indicates that the slave device enters an address encoding mode;

[0050] A receiving module, used for receiving a preset coded address sent by the host device;

[0051] A modification module, configured to modify the first stored coding address based on the preset coding address to obtain a first coding address;

[0052] A determination module, configured to determine the first encoding address as an encoding result;

[0053] The sending module is also used to send the encoding result to the host device.

[0054] On the other hand, an embodiment of the present application provides an address encoding system, the system comprising a host device and at least one slave device group, the host device is used to execute the address encoding method as described in the first aspect, the slave device group comprises at least one slave device, and the slave device executes the address encoding method as described in the first aspect;

[0055] The host device includes at least one first communication interface and its corresponding first data transmission interface, the at least one first communication interface is connected one-to-one with the second communication interface of the at least one slave device group, and the first data transmission interface is communicatively connected with the data input interface of the slave device group.

[0056] Optionally, when the slave device group includes multiple slave devices, the multiple slave devices are cascaded via the second communication interface.

[0057] In another aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor and a memory storing computer program instructions;

[0058] When the processor executes the computer program instructions, the address encoding method as described in the first aspect is implemented.

[0059] On the other hand, an embodiment of the present application provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the address encoding method described in the first aspect is implemented.

[0060] On the other hand, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the address encoding method as described in the first aspect.

[0061] The address coding method, device and system of the embodiments of the present application, in the embodiments of the present application, when performing address coding, the number of slave devices that the host device needs to encode this time is specified by the number of slave devices to be encoded, and then the request encoding instruction fed back by the slave device and the first stored encoding address are used to determine whether the first number of slave devices meets the number of devices to be encoded. When the first number is equal to the number of slave devices to be encoded and the first stored encoding address received from at least one slave device is inconsistent with the preset encoding address of the slave device corresponding to it, the preset encoding address is sent, so that the slave device is encoded based on the preset encoding address, and the encoding result is obtained, and the address coding is completed. The entire process does not require manual intervention, and the slave device is automatically encoded, which effectively improves the encoding efficiency of the host device and the slave device. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0063] Figure 1 It is a flowchart of an address coding system provided by an embodiment of the present application;

[0064] Figure 2 It is a flowchart of an address coding interaction method provided by an embodiment of the present application;

[0065] Figure 3 It is a flowchart of an address encoding method provided by an embodiment of the present application;

[0066] Figure 4It is a flowchart of an address encoding method provided by an embodiment of the present application;

[0067] Figure 5 is a schematic diagram of the structure of an address encoding device provided by another embodiment of the present application;

[0068] Figure 6 is a schematic diagram of the structure of an address encoding device provided by another embodiment of the present application;

[0069] Figure 7 It is a structural schematic diagram of an electronic device provided in yet another embodiment of the present application. DETAILED DESCRIPTION

[0070] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0071] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0072] In order to solve the problems in the prior art, the embodiments of the present application provide an address encoding method, device and system.

[0073] In an embodiment of the present application, when performing address coding, the number of slave devices that the host device needs to encode this time is specified by the number of slave devices to be encoded, and then the request coding instruction fed back by the slave device and the first stored coding address are used to determine whether the first number of slave devices meets the number of devices to be encoded. When the first number is equal to the number of slave devices to be encoded and the first stored coding address of at least one received slave device is inconsistent with the preset coding address of the slave device corresponding to it, the preset coding address is sent, so that the slave device is encoded based on the preset coding address, and the coding result is obtained, and the address coding is completed. The entire process does not require manual intervention, and the slave device is automatically encoded, which effectively improves the coding efficiency of the host device and the slave device.

[0074] The following first introduces the address coding system provided in the embodiment of the present application.

[0075] Reference Figure 1 , Figure 1 A system structure diagram of an address coding system is shown, wherein the address coding system includes a host device and multiple slave device groups, wherein the host device includes at least one first communication interface and its corresponding first data transmission interface, the at least one first communication interface is connected one-to-one with the second communication interface of at least one slave device group, and the first data transmission interface is communicatively connected with the data input interface of the slave device group.

[0076] In one embodiment, each slave device group may include multiple slave devices, wherein the slave devices may be slave devices of the same type, for example, a slave device group may all be slave devices for signal acquisition, or they may be slave devices of different types, such as slave devices responsible for data acquisition and slave devices responsible for controlling actuators.

[0077] It is worth noting that, in the address encoding system, when there are multiple slave devices of different types, each type of slave device will be communicatively connected to a first communication interface in the host device.

[0078] In another embodiment, when the slave device group includes multiple slave devices, the data input interface of the first slave device in the slave device group is communicatively connected to the first data transmission interface of the host device, and the data output interface of the first slave device is communicatively connected to the data input interface of the second slave device, that is, the multiple slave devices are cascaded through the second communication interface.

[0079] Reference Figure 2 Based on the above-mentioned address coding system, an embodiment of the present application provides an address coding method. The address coding method may include the following S101-S1010:

[0080] S101, the host device obtains the number of slave devices to be encoded.

[0081] S102, the host device sends a start encoding instruction to the slave device.

[0082] S103, the slave device sends a request encoding instruction and a first storage encoding address to the host device in response to the start encoding instruction sent by the host device.

[0083] S104, the host device receives a request encoding instruction and a first storage encoding address.

[0084] S105: The host device counts a first number of received request encoding instructions.

[0085] S106, when the first number is equal to the number of slave devices to be encoded and the first stored encoding address of at least one received slave device is inconsistent with the preset encoding address of its corresponding slave device, the host device sends a preset encoding address to the slave device, so that the slave device performs address encoding to obtain an encoding result.

[0086] S107, the slave device receives the preset coded address sent by the host device.

[0087] S108: The slave device modifies the first stored coding address based on the preset coding address to obtain a first coding address.

[0088] S109: The slave device determines the first encoding address as the encoding result.

[0089] S1010, the slave device sends the encoding result to the host device.

[0090] In some embodiments, in S101, when the host device and the slave device need to communicate, the staff first needs to input the number of slave devices to be encoded in the host device, and the host device encodes the address of the slave device according to the input number of slave devices to be encoded to realize communication between the host device and the slave device.

[0091] It is worth noting that for the address coding system, since the number of slave devices in the address coding system can be added at will, it is necessary to determine the number of slave devices to be encoded in the address coding system to ensure that the host device and the slave device are correctly connected during automatic encoding.

[0092] In some embodiments, in S102, by starting the encoding instruction, the host device sends a high level signal to the data input interface of the slave device. When the data input interface of the first slave device has a high level signal, it indicates that the slave device enters the address encoding state.

[0093] In some embodiments, in S103, when the level of the data input interface of the slave device is high, the slave device sends a request encoding instruction and sends the first stored encoding address stored in the memory of the slave device to the host device to verify whether the preset encoding address stored in the host device is consistent with the first stored encoding address sent by the slave device.

[0094] In some embodiments, in S104, the host device receives the request encoding instructions sent by the slave devices one by one in the order of the cascade of the slave devices, and counts a first number in the host device to verify whether each slave device communicates with the host device.

[0095] In some embodiments, in S105 and S106, when the first number is equal to the number of slave devices to be encoded, it indicates that there is no problem with the connection signals between all slave devices and the host device at this time. When the first stored coding address of each slave device is consistent with its corresponding preset coding address, it indicates that the host device and the slave device are communicating normally and can transmit data normally. However, when the first stored coding address of each slave device is inconsistent with its corresponding preset coding address, it indicates that the host device and the slave device need to perform address encoding at this time so that they can communicate and transmit data normally. That is, the host device sends the preset coding address to the slave device at this time, so that the slave device encodes and obtains the coding result.

[0096] In some other embodiments, in S107, the slave device modifies the first stored coded address according to the preset coded address to obtain the first coded address to complete the address coding, and realizes normal communication between the host device and the slave device through the preset coded address.

[0097] In an embodiment of the present application, when performing address coding, the number of slave devices that the host device needs to encode this time is specified by the number of slave devices to be encoded, and then the request coding instruction fed back by the slave device and the first stored coding address are used to determine whether the first number of slave devices meets the number of devices to be encoded. When the first number is equal to the number of slave devices to be encoded and the first stored coding address of at least one received slave device is inconsistent with the preset coding address of the slave device corresponding to it, the preset coding address is sent, so that the slave device is encoded based on the preset coding address, and the coding result is obtained, and the address coding is completed. The entire process does not require manual intervention, and the slave device is automatically encoded, which effectively improves the coding efficiency of the host device and the slave device.

[0098] To facilitate understanding of the embodiments of the present application, an address encoding method applied to a host device is explained below.

[0099] Reference Figure 3 , an address encoding method includes the following S301-S305:

[0100] S301, obtaining the number of slave devices to be encoded.

[0101] In this embodiment, during the process of address coding between the host device and the slave device, the number of slave devices can be increased in the address coding system according to actual conditions. Therefore, before address coding, a technician is required to input the corresponding number of slave devices to be encoded to ensure that the host device can communicate with each slave device through the encoded address.

[0102] In some other embodiments, when the host device and the slave device have been communicating based on the encoding address and no new slave device has been added, the host device can directly retrieve the number of slave devices to be encoded from the memory.

[0103] S302, sending a start encoding instruction to the slave device.

[0104] In some embodiments, in order to quickly perform address encoding on the slave device, the new host device can send a start encoding instruction to the slave device, where the start encoding instruction indicates that the slave device enters the address encoding mode, that is, the start encoding instruction can raise the level of the data input interface of the slave device so that the slave device can enter the address encoding mode and prepare for address encoding.

[0105] For ease of explanation, the following explanation is given by assuming that the number of slave devices is determined to be multiple and the multiple slave devices are cascaded through a communication interface.

[0106] In some other embodiments, before S302, the method may further include:

[0107] Get the encoding sequence of the slave device;

[0108] Send a start encoding command to the slave device according to the encoding sequence.

[0109] In this embodiment, based on the aforementioned address coding system, each slave device is connected in a cascade form. After the host device sends a start coding instruction to the slave device, the host device pulls up the data output interface of the slave device in sequence according to the coding order, so that address coding is performed when the level of the data input interface of the pulled-up slave device is a high level.

[0110] Specifically, when the host device sends a start encoding instruction to the slave device, the slave device receives the start encoding instruction, and the slave device can only receive message data. When the data output interface of the host device is pulled high, the level of the data input interface of the first slave device connected to the host device is high, and the first slave device can receive and send message data, and perform the address encoding process with the host device; when the first slave device and the host device complete address encoding, the data output interface of the first slave device is pulled high, so that the level of the data input interface of the second slave device connected to the first slave device is high, the second slave device can receive and send message data, and perform the address encoding process with the host device, and so on, the address encoding is performed on the remaining slave devices.

[0111] In some other embodiments, when the host device performs address encoding with multiple slave devices, the slave device address encoding is also encoded according to the above encoding order.

[0112] In some other embodiments, when the slave device receives a start encoding instruction, the slave device enters an address encoding mode, which means that the slave device can only receive or send encoded addresses and cannot receive other message data.

[0113] S303, receiving a request encoding instruction and a first storage encoding address sent by a slave device.

[0114] In this embodiment, the slave device sends a request coding instruction and a first stored coding address to the host device in sequence according to the coding order. When the current slave device is unable to send a request coding instruction to the host device, it indicates that the slave device and the host device have not established a communication connection through the communication interface. At this time, an alarm signal needs to be output and an alarm message needs to be sent to the technician.

[0115] In other embodiments, with respect to the first stored coded address sent by the slave device, it is worth noting that, as an example, when the slave device is first incorporated into the address coding system, the first stored coded address of the slave device is 0000, and when the address coding system incorporates a new slave device and the coding sequence is modified, the slave device may send the first stored coded address through which communication has been established with the host device.

[0116] In some embodiments, the host device may determine the encoding order by following the order in which the request encoding instructions are received.

[0117] S304: Count the first number of received request encoding instructions.

[0118] In some embodiments, since multiple slave devices are connected in a cascade form, as long as there is an error in the communication between one slave device and the host device, the slave devices after this slave device will not be able to send request coding instructions. Correspondingly, the first number of request codes received by the host device will also be reduced, and it can be determined whether the address coding requirements are met based on the first number and the number of slave devices to be stored.

[0119] S305, when the first number is equal to the number of slave devices to be encoded and the first stored encoding address of at least one received slave device is inconsistent with the preset encoding address of its corresponding slave device, send the preset encoding address to the slave device so that the slave device performs address encoding to obtain the encoding result.

[0120] In some embodiments, when all slave devices in the address coding system are normally connected to the host device, if the host device has already communicated normally with the slave device through the first stored address, and the host device again establishes communication with the slave device according to the first stored coding address, it can be proved that the host device and the slave device can communicate normally.

[0121] When the first storage address is inconsistent with its corresponding preset coding address, the host device sends the preset coding address to the slave device, so that the slave device performs address coding according to the preset coding address to obtain a coding result. As an example, the coding result includes the first coding address of the slave device.

[0122] In some other embodiments, when the first number is not equal to the number of slave devices to be encoded, the slave devices do not meet the encoding requirements and the host device needs to feedback an exception.

[0123] In an embodiment of the present application, when performing address coding, the number of slave devices that the host device needs to encode this time is specified by the number of slave devices to be encoded, and then the request coding instruction fed back by the slave device and the first stored coding address are used to determine whether the first number of slave devices meets the number of devices to be encoded. When the first number is equal to the number of slave devices to be encoded and the first stored coding address of at least one received slave device is inconsistent with the preset coding address of the slave device corresponding to it, the preset coding address is sent, so that the slave device is encoded based on the preset coding address, and the coding result is obtained, and the address coding is completed. The entire process does not require manual intervention, and the slave device is automatically encoded, which effectively improves the coding efficiency of the host device and the slave device.

[0124] In order to ensure normal communication between the host device and the slave device and improve the accuracy of address coding, after S305, the method may further include:

[0125] Within a first preset time period, when receiving the encoding result returned by the slave device, verifying the first encoding address to obtain a verification result;

[0126] A second number of successful encodings of slave devices in the statistical verification results;

[0127] When the second number is equal to the number of slave devices to be encoded, an exit encoding instruction is sent to the slave device.

[0128] In this embodiment, within the first preset time length when the host device waits to receive the coding structure returned by the slave device, it is necessary to verify the first coding address according to the preset coding address to determine whether the first stored coding address for address encoding of the slave device is the preset coding address, and whether the host device can communicate and transmit data with the slave device through the first coding address.

[0129] Then, the second number of successfully encoded slave devices in the verification result is counted, that is, the number of slave devices with the same first encoding address and the preset encoding address is counted, so that the host device determines whether to continue sending the preset encoding address to the next slave device.

[0130] In some other embodiments, when the verification result determines that the encoding of the slave device is successful, the host device sends the preset encoding address corresponding to the next slave device in the encoding order, so that the next slave device performs address encoding according to the preset encoding address, until multiple slave devices have completed address encoding and have all been encoded successfully.

[0131] When multiple slave devices are encoded successfully, it means that the second number of slave devices equal to the number of slaves to be encoded can be encoded successfully. At this time, the host device can send an exit encoding instruction to the slave device, and the slave device can exit the address encoding mode through the exit encoding instruction and receive other message information or data.

[0132] In some other embodiments, when the encoding result returned by the slave device is not received within the first preset time period or the verification result determines that the first encoding address is inconsistent with the preset encoding address, the method further includes:

[0133] Generate encoding failure information;

[0134] Fault information is determined based on the encoding failure information.

[0135] In this embodiment, when the verification result determines that the first coding address is inconsistent with the preset coding address or the coding result returned by the slave device is not received within the first preset time period, it indicates that the slave device cannot establish communication with the host device through the preset coding address. It may be because the preset coding address sent by the host device is wrong, or it may be damaged by the slave device, etc. In either case, the host device generates coding failure information and determines fault information through the coding failure information. As an example, the fault information may include the slave device number and fault type corresponding to the coding failure.

[0136] In some embodiments, the fault information may be determined based on an encoding result of a slave device that is not received by the host device or a slave device that fails verification, and the fault type may be verification failure or failure to receive an encoding result.

[0137] In some other embodiments, in order to reduce the possibility of misjudging the failure of the slave device, when the verification result determines that the first coding address is inconsistent with the preset coding address, the method may further include:

[0138] Count the number of times the preset encoding address is sent to the current slave device;

[0139] When the number of transmissions is less than the preset number, returning to the step of transmitting the preset coding address to the slave device;

[0140] When the number of transmissions is equal to the preset number of times, the step of generating encoding failure information is executed.

[0141] In this embodiment, since the data packet may be lost or interfered due to the communication connection or environmental factors, resulting in the inconsistency between the first coding address and the preset coding address, a preset number of times can be set in the host device. When the number of sending times is less than the preset number of times, return to step S305. When the number of sending times is greater than or equal to the preset number of times, execute the step of generating coding failure information. That is, when the preset coding address is repeatedly sent, it indicates that the slave device has failed at this time, and the host device needs to generate coding failure information to remind the technician.

[0142] In some other embodiments, in order to quickly complete the address encoding of all slave devices, sending an exit encoding instruction to the slave device includes:

[0143] Send a confirmation code instruction to the slave device;

[0144] In the case where a coding success instruction is received from at least one slave device within the second preset time period, an exit coding instruction is sent.

[0145] In some embodiments, when each slave device completes encoding and the encoding is successful, the host device sends a confirmation encoding instruction to the successfully encoded slave device, so that the slave device sends a successful encoding instruction. At the same time, the host device detects whether the successful encoding instruction received from the slave device is successful. If the successful encoding instruction is not received, it means that although the slave device is encoded successfully, a fault has occurred. At this time, the host device needs to generate an encoding failure instruction; if the successful encoding instruction is received, it indicates that there is no abnormality in the slave device during the entire process of address encoding.

[0146] In some embodiments, for each successfully encoded slave device, the host device may immediately send an encoding confirmation encoding instruction to the successfully encoded slave device.

[0147] Reference Figure 4 The embodiment of the present application further provides an address encoding method, which is applied to a slave device. The address encoding method may include S401-S405:

[0148] S401, in response to a start encoding instruction sent by a host device, sending a request encoding instruction and a first storage encoding address to the host device;

[0149] S402, receiving a preset coded address sent by a host device;

[0150] S403, modifying the first stored coding address based on the preset coding address to obtain a first coding address;

[0151] S404, determining the first encoding address as the encoding result;

[0152] S405, sending the encoding result to the host device.

[0153] In this embodiment, when the slave device receives the start encoding instruction, the slave device enters the address encoding mode and starts address encoding.

[0154] After the slave device receives the preset coding address sent by the host device, the slave device modifies the first stored coding address by the preset coding address to obtain the first coding address, that is, the slave device stores the preset coding address to the corresponding position of the memory, and then communicates with the host device according to the preset coding address.

[0155] After obtaining the first coded address, the slave device sends the first coded address to the host device, so that the host device can communicate according to the first coded address.

[0156] In an embodiment of the present application, when performing address coding, the number of slave devices that the host device needs to encode this time is specified by the number of slave devices to be encoded, and then the request coding instruction fed back by the slave device and the first stored coding address are used to determine whether the first number of slave devices meets the number of devices to be encoded. When the first number is equal to the number of slave devices to be encoded and the first stored coding address of at least one received slave device is inconsistent with the preset coding address of the slave device corresponding to it, the preset coding address is sent, so that the slave device is encoded based on the preset coding address, and the coding result is obtained, and the address coding is completed. The entire process does not require manual intervention, and the slave device is automatically encoded, which effectively improves the coding efficiency of the host device and the slave device.

[0157] In some other embodiments, after S405, the method may further include:

[0158] Within a second preset time period, in response to a confirmation encoding instruction sent by the host device, sending an encoding success instruction to the host device;

[0159] Within a third preset time period, receiving an exit coding instruction;

[0160] Exit address encoding mode based on the exit encoding instruction.

[0161] In this embodiment, after the slave device completes encoding and the encoding is successful, it receives an exit encoding instruction within a third preset time period, and the slave device exits the address encoding mode according to the exit encoding instruction.

[0162] In some other embodiments, after sending the encoding success instruction to the host device, the method may further include:

[0163] Get the first moment of sending the encoding success instruction;

[0164] Determine a fourth preset duration based on the first moment and the preset delay;

[0165] At a fourth preset time length and when no exit coding instruction is received, the address coding mode is exited, wherein the fourth preset time length is greater than the third preset time length.

[0166] In this embodiment, due to the delay, the slave device may not receive the exit coding instruction. The first moment of sending the encoding success instruction is taken as the revelation moment. After the preset delay, that is, after the fourth preset time length, the slave device automatically exits the address coding mode. Correspondingly, the exit coding instruction represents that the level of the data input interface of the slave device is pulled low, and the encoding is ended at this time.

[0167] Reference Figure 5 The embodiment of the present application further provides an address encoding device 500, which is applied to a host device and may include:

[0168] An acquisition module 501 is used to acquire the number of slave devices to be encoded;

[0169] The sending module 502 is used to send a start encoding instruction to the slave device, where the start encoding instruction indicates that the slave device enters an address encoding mode;

[0170] The receiving module 503 is used to receive the request encoding instruction and the first storage encoding address sent by the slave device;

[0171] A statistics module 504, configured to count a first number of received request encoding instructions;

[0172] The sending module 502 is also used to send a preset coding address to the slave device when the first number is equal to the number of slave devices to be encoded and the first stored coding address received of at least one slave device is inconsistent with the preset coding address of its corresponding slave device, so that the slave device performs address encoding to obtain a coding result.

[0173] As an optional implementation, when the number of slave devices is determined to be multiple and the multiple slave devices are cascaded through a communication interface, the sending module 502 may also be used to:

[0174] Obtaining a coding order of slave devices, where the coding order is determined based on a cascade relationship of multiple slave devices;

[0175] Send a start encoding command to the slave device according to the encoding sequence.

[0176] As an optional implementation, the encoding result includes the first encoded address of the slave device, and the sending module 502 can also be used for:

[0177] Within a first preset time period, when receiving the encoding result returned by the slave device, verifying the first encoding address to obtain a verification result;

[0178] A second number of successful encodings of slave devices in the statistical verification results;

[0179] When the second number is equal to the number of slave devices to be encoded, an exit encoding instruction is sent to the slave device.

[0180] As an optional implementation manner, when the encoding result returned by the slave device is not received within the first preset time period or the verification result determines that the first encoding address is inconsistent with the preset encoding address, the sending module 502 can also be used to:

[0181] Generate encoding failure information;

[0182] Fault information is determined based on the encoding failure information, where the fault information includes a slave device number and a fault type corresponding to the encoding failure.

[0183] As an optional implementation manner, when the verification result determines that the first encoding address is inconsistent with the preset encoding address, the sending module 502 may also be used to:

[0184] Count the number of times the preset encoding address is sent to the current slave device;

[0185] When the number of transmissions is less than the preset number, returning to the step of transmitting the preset coding address to the slave device;

[0186] When the number of transmissions is equal to the preset number of times, the step of generating encoding failure information is executed.

[0187] As an optional implementation manner, the sending module 502 may also be used for:

[0188] Send a confirmation code instruction to the slave device;

[0189] In the case where a coding success instruction is received from at least one slave device within the second preset time period, an exit coding instruction is sent.

[0190] Reference Figure 6 The embodiment of the present application further provides an address encoding device 600, which is applied to a slave device. The address encoding device 600 may include:

[0191] The sending module 601 is used to send a request encoding instruction and a first storage encoding address to the host device in response to a start encoding instruction sent by the host device, wherein the start encoding instruction indicates that the slave device enters an address encoding mode;

[0192] The receiving module 602 is used to receive a preset coded address sent by a host device;

[0193] A modification module 603, configured to modify the first stored coding address based on a preset coding address to obtain a first coding address;

[0194] A determination module 604, configured to determine the first encoding address as an encoding result;

[0195] The sending module 601 is also used to send the encoding result to the host device.

[0196] As an optional implementation manner, the sending module 601 may also be used for:

[0197] Within a second preset time period, in response to a confirmation encoding instruction sent by the host device, sending an encoding success instruction to the host device;

[0198] Within a third preset time period, receiving an exit coding instruction;

[0199] Exit address encoding mode based on the exit encoding instruction.

[0200] As an optional implementation manner, the sending module 601 may also be used for:

[0201] Get the first moment of sending the encoding success instruction;

[0202] Determine a fourth preset duration based on the first moment and the preset delay;

[0203] At a fourth preset time length and when no exit coding instruction is received, the address coding mode is exited, wherein the fourth preset time length is greater than the third preset time length.

[0204] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.

[0205] The electronic device may include a processor 701 and a memory 702 storing computer program instructions.

[0206] Specifically, the processor 701 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0207] The memory 702 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 702 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In one example, the memory 702 may include a removable or non-removable (or fixed) medium, or the memory 702 is a non-volatile solid-state memory. The memory 702 may be inside or outside the integrated gateway disaster recovery device.

[0208] In one example, the memory 702 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or a flash memory, or a combination of two or more of these.

[0209] The memory 702 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the video query method according to the first aspect of the present disclosure.

[0210] The processor 701 reads and executes the computer program instructions stored in the memory 702 to implement Figure 3 and Figure 4 An address encoding method in the illustrated embodiment.

[0211] In one example, the electronic device may further include a communication interface 703 and a bus 704. Figure 7 As shown, the processor 701, the memory 702, and the communication interface 703 are connected via a bus 704 and communicate with each other.

[0212] The communication interface 703 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0213] Bus 704 includes hardware, software or both, and the parts of electronic equipment are coupled to each other.For example, but not limitation, bus may include accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, front side bus (Front Side Bus, FSB), hypertransmission (Hyper Transport, HT) interconnection, industry standard architecture (IndustryStandard Architecture, ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 704 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.

[0214] The electronic device can execute the address encoding method in the embodiment of the present application, thereby realizing the address encoding method and device.

[0215] In addition, in combination with the address encoding method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the address encoding methods in the above embodiment is implemented.

[0216] In an optional embodiment, in combination with the address encoding method in the above embodiment, the embodiment of the present application can provide a computer program product for implementation, and the instructions in the computer program product are executed by a processor of an electronic device, so that the electronic device can implement any one of the address encoding methods in the above embodiment.

[0217] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0218] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0219] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0220] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0221] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. An address encoding method, characterized in that: Applied to a host device, the method includes: Get the number of slave devices to be encoded; Sending a start encoding instruction to the slave device, wherein the start encoding instruction indicates that the slave device enters an address encoding mode; Receiving a request encoding instruction and a first storage encoding address sent by the slave device; Counting a first number of received request encoding instructions; When the first number is equal to the number of slave devices to be encoded and the first stored encoding address of at least one received slave device is inconsistent with the preset encoding address of the corresponding slave device, the preset encoding address is sent to the slave device so that the slave device performs address encoding to obtain an encoding result.

2. The method according to claim 1, characterized in that: In the case that the number of the slave devices is determined to be multiple and the multiple slave devices are cascaded through a communication interface, sending a start encoding instruction to the slave device includes: Acquire a coding order of the slave device, where the coding order is determined based on a cascade relationship of a plurality of the slave devices; A start encoding instruction is sent to the slave device according to the encoding sequence.

3. The method according to claim 1, characterized in that The encoding result includes a first encoding address of the slave device. After sending a preset encoding address to the slave device so that the slave device performs address encoding and obtains the encoding result, the method further includes: Within a first preset time period, when receiving the encoding result returned by the slave device, verifying the first encoding address to obtain a verification result; Counting a second number of the slave devices that have successfully been encoded in the verification result; When the second number is equal to the number of slave devices to be encoded, an exit encoding instruction is sent to the slave device.

4. The method according to claim 3, characterized in that In the case where the encoding result returned by the slave device is not received within the first preset time period or the verification result determines that the first encoding address is inconsistent with the preset encoding address, the method further includes: Generate encoding failure information; Fault information is determined based on the encoding failure information, where the fault information includes a slave device number and a fault type corresponding to the encoding failure.

5. The method according to claim 4, characterized in that When the verification result determines that the first coding address is inconsistent with the preset coding address, the method further includes: Counting the number of times a preset encoding address is sent to the current slave device; When the sending number is less than the preset number, returning to the step of sending the preset coded address to the slave device; When the number of transmissions is equal to the preset number of times, the step of generating encoding failure information is performed.

6. The method according to claim 3, characterized in that The step of sending an exit code instruction to the slave device includes: Sending a confirmation coding instruction to the slave device; When receiving a coding success instruction sent by at least one of the slave devices within the second preset time period, an exit coding instruction is sent.

7. An address encoding method, characterized in that: Applied to slave devices, the method includes: In response to a start encoding instruction sent by a host device, sending a request encoding instruction and a first storage encoding address to the host device, wherein the start encoding instruction identifies that the slave device enters an address encoding mode; Receiving a preset coded address sent by the host device; Modify the first stored coding address based on the preset coding address to obtain a first coding address; Determining the first encoding address as an encoding result; The encoding result is sent to the host device.

8. The method according to claim 7, characterized in that After sending the encoding result to the host device, the method further includes: Within a second preset time period, in response to the encoding confirmation instruction sent by the host device, sending an encoding success instruction to the host device; Within a third preset time period, receiving an exit coding instruction; An address encoding mode is exited based on the exit encoding instruction.

9. The method according to claim 8, characterized in that After sending the encoding success instruction to the host device, the method further includes: Get the first moment of sending the encoding success instruction; Determine a fourth preset duration based on the first moment and the preset delay; When the fourth preset time period has elapsed and no exit coding instruction is received, the address coding mode is exited, wherein the fourth preset time period is greater than the third preset time period.

10. An address encoding device, characterized in that: Applied to a host device, the device comprises: An acquisition module is used to obtain the number of slave devices to be encoded; A sending module, used for sending a start coding instruction to the slave device, wherein the start coding instruction indicates that the slave device enters an address coding mode; A receiving module, used for receiving a request encoding instruction and a first storage encoding address sent by the slave device; A statistics module, used for counting a first number of received request encoding instructions; The sending module is also used to send a preset coding address to the slave device when the first number is equal to the number of slave devices to be encoded and the first stored coding address received of at least one slave device is inconsistent with the preset coding address of the corresponding slave device, so that the slave device performs address encoding to obtain a coding result.

11. An address encoding device, characterized in that: Applied to a slave device, the device comprises: A sending module, configured to send a request encoding instruction and a first storage encoding address to the host device in response to a start encoding instruction sent by the host device, wherein the start encoding instruction indicates that the slave device enters an address encoding mode; A receiving module, used for receiving a preset coded address sent by the host device; A modification module, configured to modify the first stored coding address based on the preset coding address to obtain a first coding address; A determination module, configured to determine the first encoding address as an encoding result; The sending module is also used to send the encoding result to the host device.

12. An address coding system, characterized in that: The method comprises a host device and at least one slave device group, wherein the host device is used to execute the address encoding method according to any one of claims 1 to 6, and the slave device group comprises at least one slave device, and the slave device executes the address encoding method according to any one of claims 7 to 9; The host device includes at least one first communication interface and its corresponding first data transmission interface, the at least one first communication interface is connected one-to-one with the second communication interface of the at least one slave device group, and the first data transmission interface is communicatively connected with the data input interface of the slave device group.

13. The system according to claim 12, characterized in that When the slave device group includes a plurality of slave devices, the plurality of slave devices are cascaded via the second communication interface.

Citation Information

Cited By

  • IP address dynamic allocation method and system and storage medium

    CN119383166A