Address allocation method, intelligent cabinet, slave control unit and master control unit
Patent Information
- Application Number
- CN202210085146.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2042-01-25
AI Technical Summary
[0003]但是,目前的智能柜中,一般是需要用户对每个柜格分别配置节点地址,逐一配置每个柜格的节点地址,费时费力,效率低下
[0058]According to the address allocation method, smart cabinet, slave control unit, and master control unit of the embodiments of this application, the first slave control unit receives the first node address; if the first slave control unit is connected to a second slave control unit, the first slave control unit forwards the local node address of the first slave control unit to the second slave control unit, so that the second slave control unit updates the local node address of the second slave control unit, and then updates the local node address of the first slave control unit to the first node address. When a node receives a new node address, it triggers the forwarding of the local node address to the next node, and then passes it sequentially, thereby realizing the automatic allocation of node addresses of multiple cabinet compartments in the smart cabinet and improving the efficiency of node address allocation of the slave control unit.
Smart Images

Figure CN114443509B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical fields of next-generation information technology and biomedicine industry, and in particular to an address allocation method, intelligent cabinet, slave control unit and master control unit. Background Technology
[0002] With the development of technology, smart lockers such as express delivery lockers, food pickup lockers, vending machines, and smart medicine cabinets are being used more and more widely. A smart locker consists of multiple compartments, each of which is configured with an independent node address to facilitate the control and management of the smart locker.
[0003] However, in current smart lockers, users generally need to configure the node address for each compartment separately. Configuring the node address for each compartment one by one is time-consuming, labor-intensive, and inefficient. Summary of the Invention
[0004] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes an address allocation method, an intelligent cabinet, a slave control unit, and a master control unit, which can realize the automatic allocation of addresses for multiple cabinet node nodes in the intelligent cabinet.
[0005] An address allocation method includes a first slave control unit and a second slave control unit, the method comprising:
[0006] The step of allocating an address to the second slave control unit includes:
[0007] Receive the address of the first node;
[0008] If the first slave control unit is connected to the second slave control unit, the local node address of the first slave control unit is forwarded to the second slave control unit so that the second slave control unit can update the local node address of the second slave control unit.
[0009] Update the local node address of the first slave control unit to the address of the first node.
[0010] In this embodiment, the first slave control unit includes several units, and after updating the local node address of the first slave control unit to the first node address, it further includes:
[0011] If the local node address of the second slave control unit is the first preset address, then the address is allocated to the second slave control unit connected to other first slave control units.
[0012] In this embodiment, a master control unit is also included, which is communicatively connected to the plurality of first slave control units. The plurality of first slave control units are connected sequentially, and each first slave control unit is connected to a plurality of second slave control units. The step of allocating addresses to the second slave control units includes the following prior steps:
[0013] The step of allocating an address to the first slave control unit includes:
[0014] The first slave control unit is determined from the plurality of first slave control units;
[0015] The first node address is sent to the first slave control unit so that the first slave control unit forwards its local node address to other first slave control units;
[0016] Update the local node address of the first slave control unit to the first node address.
[0017] In this embodiment, after updating the local node address of the first slave control unit to the first node address, the method further includes:
[0018] If the local node address of the first slave control unit is the second preset address, then proceed to the step of allocating an address to the second slave control unit;
[0019] If the local node address of the first slave control unit is the third preset address, then address allocation will stop.
[0020] In this embodiment, the step of allocating an address to the first slave control unit further includes:
[0021] Several node addresses AnBn are preset to be assigned;
[0022] Correspondingly, in the step of allocating an address to the first slave control unit, sending the first node address to the first slave control unit includes:
[0023] The node address AnBn is sent to the first slave control unit in the order of AnBn, A(n-1)Bn...A1Bn, A1B(n-1), A1B(n-2), A1B0, A2Bn, A2B(n-1)...A2B0, A3Bn...A(n-1)B0, AnBn, AnB(n-1)...AnB0;
[0024] Correspondingly, in the step of allocating an address to the first slave control unit, the step of jumping to allocate an address to the second slave control unit if the local node address of the first slave control unit is a second preset address includes:
[0025] If the local node address of the first slave control unit is A1B0, then proceed to the step of allocating an address to the second slave control unit;
[0026] Correspondingly, the step of stopping address allocation if the local node address of the first slave control unit is a third preset address includes:
[0027] If the local node address of the first slave control unit is AnB0, then address allocation is stopped.
[0028] In this embodiment, the step of allocating an address to the first slave control unit further includes:
[0029] Several node addresses AnBn are preset to be assigned;
[0030] Correspondingly, in the step of allocating an address to the first slave control unit, sending the first node address to the first slave control unit includes:
[0031] The node address AnBn is sent to the first slave control unit in the order of AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn;
[0032] Correspondingly, in the step of allocating an address to the first slave control unit, the step of jumping to allocate an address to the second slave control unit if the local node address of the first slave control unit is a second preset address includes:
[0033] If the local node address of the first slave control unit is A1Bn, then proceed to the step of allocating an address to the second slave control unit.
[0034] In this embodiment, the step of allocating an address to the second slave control unit, including receiving the first node address, comprises:
[0035] The first node address AnBn is received in the order of AnBn, AnB(n-1), AnB(n-2)...AnB1, AnB0, A(n-1)Bn...A(n-1)B1...A1Bn...A1B0;
[0036] If the local node address of the first slave control unit matches the received first node address AnBn, then an address is allocated to the corresponding connected second slave control unit;
[0037] Correspondingly, in the step of allocating an address to the second slave control unit, the step of allocating an address to the second slave control unit connected to other first slave control units if the local node address of the second slave control unit is a first preset address includes:
[0038] If the local node address of the first slave control unit is AnB0, the addresses are allocated to the second slave control units connected to other first slave control units with local node addresses AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn in the order of AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn;
[0039] Correspondingly, the step of stopping address allocation if the first node address received by the first slave control unit is a third preset address includes:
[0040] If the first node address received by the first slave control unit is A1B0, then the address allocation is stopped.
[0041] A smart cabinet includes a main control unit and at least one cabinet layer. Each cabinet layer is provided with a first slave control unit. If the number of cabinet layers is greater than or equal to 2, the first slave control units between the at least one cabinet layer are connected sequentially. Each first slave control unit is connected to a plurality of second slave control units.
[0042] The first slave control unit is used for:
[0043] The address allocation method described above is executed to allocate addresses to each of the second slave control units in each of the cabinet layers;
[0044] Or the main control unit is used for:
[0045] The address allocation method described above is executed to allocate addresses to each of the first slave control units in each of the cabinet layers.
[0046] A slave control unit, comprising:
[0047] At least one first memory;
[0048] At least one first processor;
[0049] At least one first procedure;
[0050] The first program is stored in the first memory, and the first processor executes at least one of the first programs to achieve:
[0051] The address allocation method described above.
[0052] A main control unit, comprising:
[0053] At least one second memory;
[0054] At least one second processor;
[0055] At least one second procedure;
[0056] The second program is stored in the second memory, and the second processor executes at least one of the second programs to achieve:
[0057] The address allocation method described above.
[0058] According to the address allocation method, smart cabinet, slave control unit, and master control unit of the embodiments of this application, the first slave control unit receives the first node address; if the first slave control unit is connected to a second slave control unit, the first slave control unit forwards the local node address of the first slave control unit to the second slave control unit, so that the second slave control unit updates the local node address of the second slave control unit, and then updates the local node address of the first slave control unit to the first node address. When a node receives a new node address, it triggers the forwarding of the local node address to the next node, and then passes it sequentially, thereby realizing the automatic allocation of node addresses of multiple cabinet compartments in the smart cabinet and improving the efficiency of node address allocation of the slave control unit. Attached Figure Description
[0059] Additional aspects and advantages of this application will become apparent and readily understood in conjunction with the following description of the embodiments, in which:
[0060] Figure 1 This is a schematic diagram of the framework of the first slave control unit and the second slave control unit for executing the address allocation method in Embodiment 1 of this application;
[0061] Figure 2 This is a schematic diagram of the framework of the master control unit and the first slave control unit for executing the address allocation method according to Embodiment 1 of this application;
[0062] Figure 3 This is a schematic diagram of the system framework of the master control unit and the first slave control unit for executing the address allocation method in Embodiment 1 of this application;
[0063] Figure 4 A flowchart illustrating the steps of the address allocation method provided in Embodiment 1 of this application for allocating an address to the second slave control unit;
[0064] Figure 5 A flowchart illustrating the steps of the address allocation method provided in Embodiment 1 of this application for allocating an address to the first slave control unit;
[0065] Figure 6 This is a flowchart illustrating the steps before allocating an address to the first slave control unit in the address allocation method provided in Embodiment 1 of this application;
[0066] Figure 7 This is a schematic diagram of the framework of the address allocation method for the smart cabinet in Embodiment 1 of this application;
[0067] Figure 8 This is a schematic diagram of the process of allocating addresses to the first slave control unit according to a preset address and a preset order in Embodiment 1 of this application;
[0068] Figure 9 This is a flowchart illustrating the process of allocating addresses to the second slave control unit according to a preset address and a preset order in Embodiment 1 of this application.
[0069] Figure 10 This is a flowchart illustrating the process of allocating addresses to the first slave control unit according to a preset address and a preset order in another embodiment of this application.
[0070] Figure 11 This is a flowchart illustrating the process of allocating addresses to the second slave control unit according to a preset address and a preset order in another embodiment of this application.
[0071] Figure 12 This is a schematic diagram of the structure of the smart cabinet according to Embodiment 2 of this application;
[0072] Figure 13 This is a schematic diagram of the structural modules of the slave control unit in Embodiment 3 of this application;
[0073] Figure 14 This is a schematic diagram of the structural modules of the main control unit in Embodiment 4 of this application. Detailed Implementation
[0074] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0075] It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown in the flowchart. The terminology in the specification, claims, and the foregoing drawings is used to distinguish similar objects and is not necessarily used to describe a specific order or sequence.
[0076] In the description of this application, the use of "first" and "second" is for the purpose of distinguishing technical features only, and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or the order of the technical features indicated.
[0077] In the description of this application, unless otherwise expressly defined, terms such as "setup," "installation," and "connection" should be interpreted broadly, and those skilled in the art can reasonably determine the specific meaning of the above terms in this application in conjunction with the specific content of the technical solution.
[0078] To manage and control each compartment of the smart cabinet, this embodiment of the application provides a slave control unit in each compartment, and the smart cabinet also includes a master control unit. The slave control units and the master control unit can be embedded motherboards or other devices. The master control unit controls the operation of the slave control units. To ensure normal communication between the slave control units and the master control unit, each slave control unit needs to be configured with a node address, and each slave control unit has a unique node address.
[0079] In existing technologies, when assembling smart cabinets, workers typically configure the node address of each slave control unit individually before installing them into the cabinet compartments. This process is time-consuming, labor-intensive, and inefficient. Furthermore, when there are a large number of slave control units, configuration errors are prone to occur, leading to communication conflicts and rendering the smart cabinet unusable. This necessitates disassembling each slave control unit in the cabinet compartment for individual verification and reconfiguration of the incorrectly configured units, followed by reinstallation of all slave control units back into the cabinet compartments – a complex process.
[0080] Based on this, this application proposes an address allocation method, a smart cabinet, a slave control unit, and a master control unit. By triggering the forwarding of the local node address to the next node when a node receives a new node address, and then transmitting them sequentially, the automatic allocation of node addresses for multiple cabinet compartments in the smart cabinet is realized. This enables automatic allocation of node addresses for the slave control unit, thereby improving the efficiency of node address allocation for the slave control unit.
[0081] Please refer to the following for details. Figure 1 , Figure 1 This is a system architecture diagram for executing an address allocation method according to an embodiment of this application. The system architecture includes one first slave control unit and several second slave control units. Each second slave control unit is provided with an input terminal, an output terminal, and a communication terminal. The first slave control unit is connected to the input terminal of one of the second slave control units, and the various second slave control units are connected in a daisy chain.
[0082] Specifically, excluding the first and last second slave control units, the input terminals of the other second slave control units are connected to the output terminals of the adjacent second slave control units. For example, the input terminal of the first second slave control unit is connected to the first slave control unit, the output terminal of the first second slave control unit is connected to the input terminal of the second second slave control unit, the output terminal of the second second slave control unit is connected to the input terminal of the third second slave control unit, and so on. The output terminal of the last second slave control unit is not connected to the input terminals of the other second slave control units.
[0083] In this embodiment, the first slave control unit is the hierarchical board of the smart cabinet, and the second slave control unit is the medicine box board of the smart cabinet. The main control board assigns addresses to the medicine box board through the hierarchical board. In another embodiment, please refer to... Figure 2 and Figure 3The first slave control unit can be the main control board of the intelligent cabinet, and the second slave control unit can be a hierarchical board of the intelligent cabinet. When the first slave control unit is a hierarchical board, the communication terminals of each first slave control unit are connected to the main control board through a bus. After the node address is assigned, the main control board communicates with each first slave control unit through the bus to control the operation of each second slave control unit, i.e., the medicine box board. The bus can be a CAN (Controller Area Network) bus or a bus wiring method based on the RS485 standard.
[0084] Among them, such as Figure 1 When the system architecture shown executes the address allocation method of this application embodiment, the first slave control unit sequentially sends several different node addresses to the first second slave control unit. The number of node addresses is greater than or equal to the number of second slave control units. For example, the first slave control unit sequentially sends the first node address, the second node address, and the third node address to the input terminal of the first second slave control unit. After receiving the first node address, the first second slave control unit sends its original local node address to the input terminal of the second second slave control unit through its output terminal, and updates the local node address of the first second slave control unit to the first node address; the second second slave control unit... After receiving the original local node address of the first slave control unit, the second slave control unit sends the original local node address of the second slave control unit to the input of the third slave control unit through its output terminal, and updates the local node address of the second slave control unit to the original local node address of the first slave control unit. Similarly, after receiving the original local node address of the second slave control unit, the third slave control unit sends its own original local node address to the input of the fourth slave control unit through its output terminal, and updates its local node address to the original local node address of the second slave control unit, and so on. Thus, at this point, the local node address of the third slave control unit is the address of the first slave control unit, the local node address of the second slave control unit is the address of the second slave control unit, and the local node address of the first slave control unit is the address of the third slave control unit. This achieves automatic allocation of node addresses for the slave control units, improving the efficiency of node address allocation.
[0085] Understandably, before configuring the node address, the local node address of the second slave control unit is 00 or 0000 by default.
[0086] It should be noted that the system architecture and application scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. Those skilled in the art will know that with the evolution of system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0087] It will be understood by those skilled in the art that Figure 1 The system architecture shown does not constitute a limitation on the embodiments of this application. It may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0088] exist Figure 1 The system architecture shown also includes a processor (not shown in the figure) and a memory (not shown in the figure). The memory stores instructions, and the processor can call the instructions stored in the memory to execute the address allocation method. Figure 1 The system architecture shown can be an intelligent cabinet system or other systems, and this application does not impose any restrictions on it.
[0089] Based on the above system architecture, various embodiments of the address allocation method of this application are proposed below.
[0090] Example 1
[0091] Reference Figure 4 The address allocation method in this embodiment is applied to the first slave control unit, including:
[0092] Step S300: Assign an address to the second slave control unit, wherein step S300 includes:
[0093] Step S310: Receive the address of the first node;
[0094] Step S320: If the first slave control unit is connected to the second slave control unit, forward the local node address of the first slave control unit to the second slave control unit so that the second slave control unit can update the local node address of the second slave control unit.
[0095] Step S330: Update the local node address of the first slave control unit to the first node address.
[0096] Specifically, the second slave control unit is a slave control unit connected to the first slave control unit. For example, the address allocation method of Embodiment 1 of this application can be applied to... Figure 1 For each second slave control unit in the system architecture shown, please refer to... Figure 1 ,exist Figure 1In this context, if the second slave control unit comprises several units connected sequentially, the local node address of the first slave control unit can be forwarded to the second slave control unit.
[0097] The specific process of forwarding and updating is as follows: When the first slave control unit receives the first node address, if it determines that the output of the first slave control unit is connected to a second slave control unit, it forwards the local node address of the first slave control unit to the first second slave control unit, and then updates the local node address of the first slave control unit to the received first node address. When the first slave control unit receives the second node address, if it determines that the output of the first slave control unit is connected to a second slave control unit, the first slave control unit continues to forward the updated first node address to the first second slave control unit. Each time the first second slave control unit receives a node address forwarded by the first slave control unit, if it determines that the output of the first second slave control unit is connected to another second slave control unit, it forwards the local node address to the second second slave control unit in sequence. After forwarding the local node address, the local node address of the first slave control unit is updated to the new node address received before forwarding, and the local node address of the first second slave control unit is updated to the new first node address forwarded by the first slave control unit before forwarding the local address, and so on.
[0098] If it is determined that the output of the first slave control unit is not connected to a second slave control unit, or the output of the second slave control unit is not connected to another second slave control unit, then the local node address is not forwarded to the next node, and the first slave control unit updates the local node address to the received first node address.
[0099] It is understood that the first slave control unit and the second slave control unit of Embodiment 1 of this application have been described above and below. However, this application is not limited to the literal interpretation of the slave control unit in the above embodiments, but should be understood in a general sense. The master control unit, slave control unit, first slave control unit, and second slave control unit are defined only to distinguish different unit nodes, and cannot be limited according to their literal meaning. For example, refer to Figure 2 and Figure 3 The address allocation method in Embodiment 1 can also be applied to the master control board or the second slave control unit, where the master control board or the second slave control unit is equivalent to the first slave control unit. The master control board or the second slave control unit receives the first node address. If the master control board or the second slave control unit is connected to other units, it forwards the local node address of the master control board or the second slave control unit to those other units, enabling them to update the local node address of the master control board or the second slave control unit. For example, if multiple different units share the same bus, after the master control board or the second slave control unit forwards its local node address to other units, it updates the local node address of the master control board or the second slave control unit to the first node address. Such schemes are also included within the scope of protection of this application.
[0100] In this embodiment, when the address allocation method of this application is executed, not only can the node address of the second slave control unit be automatically allocated, but also the specified node address can be set as the local node address of the specified second slave control unit by setting the order of the node addresses sent by the first slave control unit. For example, a system implementing the address allocation method of this application includes a first slave control unit and N second slave control units, the N second slave control units being connected sequentially, the first slave control unit being connected to the first second slave control unit, and N being a positive integer greater than or equal to 2; the first slave control unit sequentially sends S node addresses to the first second slave control unit, where S is a positive integer greater than or equal to N; the j-th second slave control unit receives the i-th node address, where i = 1, 2, ..., S; j = 1, 2, ..., N; if j+1≤N, the j-th second slave control unit sends the local node address of the j-th second slave control unit to the (j+1)-th second slave control unit, so that the (j+1)-th second slave control unit updates its local node address to the local node address of the j-th second slave control unit; the local node address of the j-th second slave control unit is updated to the i-th node address; until the local node address of the N-th second slave control unit is updated to the (S-N+1)-th node address. After address allocation, the local node address of the Nth second slave control unit is the (S-N+1)th node address, the local node address of the (N-1)th second slave control unit is the SNth node address, and the local node address of the 1st second slave control unit is the Sth node address. In other words, the local node address of the jth second slave control unit is the (S-j+1)th node address. This achieves automatic address allocation for the second slave control units and allows a specified node address to be set as the local node address of a specified second slave control unit.
[0101] For details, please refer to Figure 1 , Figure 2 and Figure 3 For example, the first slave control unit and the second slave control unit can be the embedded motherboard or other devices of the smart cabinet. When the first slave control unit is the main control board of the smart cabinet, the second slave control unit can be the hierarchical control board of the smart cabinet, the second slave control unit can be the hierarchical board of the smart cabinet. When the first slave control unit is the hierarchical control board of the smart cabinet, the second slave control unit can be the medicine box control board of the smart cabinet, the medicine box board.
[0102] Specifically, the first slave control unit sequentially sends the first node address, the second node address, and the third node address to the input terminal of the first second slave control unit. The first, second, and third node addresses can be node addresses in a predetermined order. By executing the address allocation method of this application embodiment, the local node address of the third second slave control unit becomes the first node address. At this time, the local node address of the second second slave control unit becomes the second node address, and the local node address of the first second slave control unit becomes the third node address. Thus, the address allocation method of this application embodiment can improve the efficiency of node address allocation for the second slave control units of the smart cabinet and improve the production process of the smart cabinet. It eliminates the need to configure the node address of each second slave control unit individually before installing each slave control unit in the smart cabinet. Instead, each second slave control unit can be directly installed in the smart cabinet, and then the address allocation method of this application embodiment can be executed to automatically complete the node address configuration for each second slave control unit, thereby improving the production efficiency of the smart cabinet.
[0103] In summary, this embodiment achieves automatic allocation of node addresses for multiple cabinet compartments in a smart cabinet by triggering the forwarding of the local node address to the next node when a node receives a new node address, and then passing the addresses sequentially.
[0104] Please refer to Figure 4 In this embodiment, after step S330, step S340 is also included.
[0105] Step S340: If the local node address of the second slave control unit is the first preset address, then the address is allocated to the second slave control units connected to other first slave control units.
[0106] For example, first, the range of node addresses to be sent is preset and obtained, and then the node addresses within the range of node addresses are sent to the first slave control unit in a preset order. The number of node addresses within the range of node addresses is greater than or equal to the number of the second slave control units.
[0107] The order of the preset node addresses can be from largest to smallest or from smallest to largest. The determination of the first preset address is related to the sending order of the node addresses. The first preset address is generally the end address of the node address being sent this time. It can also be set as a special address with an end code mark. The node address being sent can be determined by this address.
[0108] When the local node address of the second slave control unit is determined to be the first preset address, it is determined that the node addresses for that sequence have been fully allocated. That is, all the second slave control units have been allocated their corresponding node addresses, and at the same time, the allocation of node addresses to the other second slave control units connected to the first slave control unit is triggered. Specifically, if the first slave control unit is a level board of the smart cabinet, and the second slave control units are several medicine box boards corresponding to that level board, it is determined that the addresses of all medicine box boards corresponding to that level have been fully allocated, and then node addresses are allocated to the medicine box boards corresponding to other level boards.
[0109] It is understood that each second slave control unit has an input terminal and an output terminal, the output terminal of the first slave control unit is connected to the input terminal of the first second slave control unit, and the output terminal of the first second slave control unit is connected to the input terminal of the second second slave control unit. When the first slave control unit receives the first node address through its input terminal, its local node address is sent to the first second slave control unit through its output terminal; the local node address of the first slave control unit is updated to the first node address. When the first slave control unit receives the second node address through its input terminal, its first node address is sent to the first second slave control unit through its output terminal, and the local node address of the first second slave control unit is sent to the second second slave control unit through its output terminal; the local node address of the first second slave control unit is updated to the first node address, and the local node address of the first slave control unit is updated to the second node address. When it is detected that the local node address of the first slave control unit is updated to the Nth node address, or when it is detected that the first slave control unit receives the N+1th node address, and the Nth node address matches the first preset address, then the sending of new node addresses to the current first slave control unit stops, and addresses are assigned to the second slave control units connected to other first slave control units. This process continues, thereby enabling the allocation of node addresses to a smart cabinet that includes multiple first slave control units and multiple second slave control units.
[0110] Reference Figure 5 In this embodiment, the method further includes a master control unit, which is communicatively connected to a plurality of first slave control units. The plurality of first slave control units are connected end-to-end sequentially, and each first slave control unit is connected to a plurality of second slave control units connected end-to-end. Step S300, before allocating addresses to the second slave control units, includes:
[0111] Step S200: Assign an address to the first slave control unit; wherein step S200 includes:
[0112] Step S210: Determine the first slave control unit from a plurality of first slave control units;
[0113] Step S220: Send the first node address to the first slave control unit so that the first slave control unit forwards the local node address of the first slave control unit to other first slave control units;
[0114] Step S230: Update the local node address of the first slave control unit to the first node address.
[0115] Specifically, in this embodiment, the first slave control unit is the first head slave control unit directly connected to the master control unit. In other embodiments of this embodiment, the first slave control unit may also be other intermediate or terminal slave control units connected via a bus or other dedicated control lines. For example, in this embodiment, the master control unit is such as... Figure 7 The master control unit shown has a first slave control unit (the first slave unit). The master control unit sequentially sends three node addresses to the input of the first slave control unit: the first node address, the second node address, and the third node address. After receiving the first node address, the first slave control unit sends its original local node address to the input of the second slave control unit through its output, and updates its local node address to the first node address. The second slave control unit receives the original node address from the first slave control unit. After receiving the local node address, the original local node address of the second first slave control unit is sent to the input of the third first slave control unit through the output terminal, and the local node address of the second first slave control unit is updated to the original local node address of the first first slave control unit. Upon receiving the original local node address of the second first slave control unit, the third first slave control unit sends its own original local node address to the input of the fourth first slave control unit through the output terminal, and updates its local node address to the original local node address of the second first slave control unit. Thus, the local node address of the third first slave control unit is the address of the first node, the local node address of the second first slave control unit is the address of the second node, and the local node address of the first first slave control unit is the address of the third node. This not only enables automatic allocation of slave control unit node addresses but also allows setting the order of node addresses sent by the master control unit to set a specified node address as the local node address of a specified slave control unit.
[0116] refer to Figure 5 In this embodiment, after step S230, the following step is also included:
[0117] Step S240: If the local node address of the first slave control unit is the second preset address, then proceed to the step of allocating an address to the second slave control unit.
[0118] Step S250: If the local node address of the first slave control unit is the third preset address, then stop the address allocation.
[0119] Specifically, the range of node addresses to be sent is first preset and obtained, and then node addresses within the range of node addresses are sent to the first slave control unit in a preset order. The number of node addresses within the range of node addresses is greater than or equal to the number of slave control units.
[0120] The order of the preset node addresses can be from largest to smallest or from smallest to largest. The second preset address is related to the sending order of the node addresses. The second preset address is generally the end address of the node address being sent this time. It can also be set as a special address with a corresponding end code mark. The node address of the first slave control unit has been sent through this address.
[0121] Specifically, by determining whether the local node address of the first slave control unit is the second preset address, when it is determined that the local node address of the first slave control unit is the second preset address, it is determined that all node addresses have been issued, that is, all the first slave control units connected end to end have corresponding node addresses, and then the step of allocating addresses to the second slave control unit is triggered.
[0122] The third preset address is set to the last address among all addresses to be issued, or it can be set to a special address with a corresponding end code. This address is used to determine whether the node addresses of all slave control units have been sent. When the local node address of the first slave control unit or the local node address of another first slave control unit is the third preset address, it means that all addresses have been issued and the address allocation stops.
[0123] If it is determined that the output of the first slave control unit is not connected to any other first slave control unit, or the output of the first slave control unit is not connected to any second slave control unit, then the local node address is not forwarded to the next node, and the first slave control unit updates the local node address to the new node address received.
[0124] When the local node address of the first slave control unit is updated to the Mth node address, or when the first slave control unit receives the (M+1)th node address and the Mth node address matches the second or third preset address, then the sending of new node addresses to the current first slave control unit is stopped, and addresses are assigned to or stopped from being assigned to other second slave control units connected to the first slave control unit. This process is repeated to achieve the allocation of node addresses to the smart cabinet, which includes multiple first slave control units and multiple second slave control units.
[0125] Specifically, refer to Figure 7The intelligent cabinet includes a main control unit and several cabinet layers. Each cabinet layer includes one first slave control unit, and the first slave control units are connected sequentially end to end. Each first slave control unit is connected to several second slave control units, and the main control unit is connected to the first slave control units of the first cabinet layer. The main control unit, each first slave control unit, and each second slave control unit are all connected to a bus. In this configuration, the main control unit is the main control board of the intelligent cabinet, the first slave control units are the hierarchical control boards of the intelligent cabinet, and the second slave control units are the medicine box boards of the intelligent cabinet.
[0126] In this embodiment, the preset node address is 4 bits of data, such as AABB, where the first two bits AA correspond to the address of the first slave control unit and the last two bits BB correspond to the address of the second slave control unit.
[0127] When executing the address allocation method in this embodiment, the node addresses A are set according to a specific rule order. n A n B n B n When a specific address is triggered, an address is assigned to the first slave control unit or the second slave control unit, which can realize the assignment of addresses to multiple first slave control units and second slave control units.
[0128] For example, in one embodiment, when the preset node address is 4 bits of data, the master control unit can first send n node addresses with different first two bits and the same last two bits to the first slave control unit in sequence, so that the first slave control unit forwards the local node address to other first slave control units, until it is determined that the local node address Am of the first slave control unit is the second preset address, indicating that the address allocation of each first slave control unit has been completed.
[0129] After allocating the address of each first slave control unit, the process jumps to allocating the address of the second slave control unit at each level. That is, each first slave control unit is assigned a node address with the first two bits of the four-bit data being the same and the last two bits being different. This allows each first slave control unit to forward the received local node address to the corresponding second slave control unit. This process continues until the local node address of the second slave control unit is determined to be the first preset address, indicating that the address allocation of the second slave control unit at each level has been completed. After allocating the address of each second slave control unit, it is determined whether the local node address of the corresponding first slave control unit is the third preset address. If it is, it indicates that the address allocation of the entire smart cabinet has been completed, and the address allocation operation stops.
[0130] In another embodiment, the preset node address is 6 bits of data, such as AABBCC, where the first 2 bits AA corresponds to the address of the master control unit, the middle 2 bits BB corresponds to the address of the first slave control unit, and the last 2 bits CC corresponds to the address of the second slave control unit.
[0131] Specifically, when executing the address allocation method of the corresponding embodiment, the master control unit can first send multiple node addresses to the first slave control unit in sequence, where the first two bits are the same, the middle two bits are different, and the last two bits are the same. This allows the first slave control unit to forward its local node address to other slave control units until the local node address of the first slave control unit is determined to be the second preset address, indicating that the address allocation for each slave control unit has been completed. After the address allocation for each slave control unit is completed, the process jumps to allocating addresses to the second slave control units at each level. That is, each slave control unit is allocated a node address with the first two bits being the same, the middle two bits being the same, and the last two bits being different in a 6-bit data structure. This allows each slave control unit to forward the received local node address to the corresponding second slave control unit until the local node address of the second slave control unit is determined to be the first preset address, indicating that the address allocation for each level of the second slave control unit has been completed. After the address allocation for each second slave control unit is completed, it is determined whether the local node address of the first slave control unit is the third preset address. If it is, the address allocation for the entire smart cabinet has been completed, and the address allocation operation is stopped.
[0132] In summary, by sending node addresses in a pre-set order to the first slave control unit in one or more batches, it is possible to allocate addresses to multiple first slave control units and second slave control units.
[0133] In another embodiment, after allocating the address of each first slave control unit, the master control unit can also interact with the first slave control units of a specified layer via a bus. The master control unit can send multiple node addresses with the same first two bits, the same middle two bits, and different last two bits to the first slave control units of the specified layer via the bus. This allows the first slave control unit to sequentially send multiple node addresses with the same first two bits, the same middle two bits, and different last two bits to the second slave control units directly connected to it, thereby completing the address allocation for each second slave control unit of that layer. When a second slave control unit of a certain layer needs to be replaced or an address error occurs, only the address of the second slave control unit of that layer needs to be reconfigured, without needing to reconfigure all the second slave control units of the smart cabinet, thus improving address allocation efficiency and facilitating the replacement of second slave control units.
[0134] refer to Figure 6 In this embodiment, before step S200: allocating an address to the first slave control unit, step S100 is also included: pre-setting several node addresses AnBn with 4-digit values to be allocated.
[0135] Among them, reference Figure 8 and Figure 9Taking n=20 as an example, the value of n is greater than the number of levels of the smart cabinet and greater than the number of medicine boxes on any level of the smart cabinet. For example, in this embodiment, the smart cabinet includes 11 first slave control units, and each level of the smart cabinet includes 10 second slave control units. Each of the 10 first slave control units is connected to 10 second slave control units, and 1 first slave control unit is not connected to a second slave control unit.
[0136] The default node address of the smart cabinet is a 4-digit number AnBn. An represents the first two digits of the layer address code, and Bn represents the last two digits of the box address code. In the layer address code An, n takes a value greater than or equal to 1 and less than or equal to 20. In the box address code Bn, n takes a value greater than or equal to 0 and less than or equal to 20. That is, the layer address codes A1, A2...A20 correspond to addresses 01, 02...20 respectively; and the box address codes B0, B1, B2...B0 correspond to addresses 00, 01, 02...20 respectively.
[0137] For the corresponding information, please refer to [link / reference]. Figure 6 In the step of allocating an address to the first slave control unit, step S220, sending the first node address to the first slave control unit specifically includes:
[0138] Step S221: Send the node address AnBn to the first slave control unit in the order of AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn;
[0139] Specifically, the initial distribution order of the preset node addresses follows the rule that address values An decrease sequentially from largest to smallest, while address Bn retains its maximum value. At this point, the master control unit is the main control board of the smart cabinet, the first slave control unit is the cabinet's hierarchical board, and the second slave control unit is one of the corresponding medicine box boards. The master control board sends 20 node addresses to the first slave control unit in the order A20B20, A19B20...A9B20, A8B20...A1B20, which corresponds to the node addresses 2020, 1920...1020, 0920, 0820...0120. Correspondingly, based on this order, the second preset address is preset to A1Bn, which corresponds to address 0120.
[0140] Correspondingly, in the step of allocating an address to the first slave control unit, step S240, if the local node address of the first slave control unit is the second preset address, then jumps to the step of allocating an address to the second slave control unit, specifically including:
[0141] Step S241: If the local node address of the first slave control unit is A1Bn, then proceed to the step of allocating an address to the second slave control unit.
[0142] Specifically, when the first slave control unit receives 2020, it forwards its local node address to the second slave control unit and saves 2020 as its local node address. When the first slave control unit receives 1920, it forwards 2020 to the second slave control unit, which then forwards its local node address to the third slave control unit. At this point, 2020 is saved as the local node address of the second slave control unit, and 1920 is saved as the local node address of the first slave control unit. This process continues until the local node address of the first slave control unit is determined to be 0120, which is the second preset address. This indicates that the allocation of addresses for the smart cabinet's hierarchical boards has been completed. At this point, the hierarchical boards, from top to bottom, are 0120, 0220, 0320...1020, 1120. The process then proceeds to the step of allocating addresses to the second slave control unit. Please refer to [the relevant documentation / reference]. Figure 6 In step S300, which assigns an address to the second slave control unit, step S310, receiving the address of the first node, specifically includes:
[0143] Step S311: Receive node address AnBn in the order of AnBn, AnB(n-1), AnB(n-2)...AnB1, AnB0, A(n-1)Bn...A(n-1)B1...A1Bn...A1B0.
[0144] Specifically, the second distribution order rule for the preset node address is as follows: the Bn address value is sent from largest to smallest, the An address value remains at its maximum value, and when the Bn address value is the minimum value B0, the An address value is reduced by one and remains unchanged. The Bn address value is then sent from largest to smallest again, and this cycle is repeated until the node address AnBn reaches the minimum value A1B0.
[0145] Step S312: If the local node address of the first slave control unit matches the received first node address AnBn, then an address is allocated to the corresponding connected second slave control unit; otherwise, the first node address AnBn is discarded.
[0146] For details, please refer to Figure 8 and Figure 9The main control board receives the first node address AnBn and sends it to the first slave control unit. The main control board then sends the node address to the first slave control unit in the order of A20B20, A20B19...A20B0…A10B09, A10B08...A10B1, A10B0...A1B0, i.e., in the order of 2020, 2019, 2018...2000…1009, 1008…1001, 1000...0100. If the local node of the first slave control unit... If the address matches the received first node address AnBn, then an address is allocated to the corresponding connected second slave control unit. If there is no match, the first node address AnBn is discarded. For example, if the local node address of the 11th first slave control unit matches the received first node address 1120, then an address is allocated to the 11th first slave control node with local node address 1120 and the corresponding connected second slave control unit. All node addresses before 1120 in node address AnBn are discarded because they do not match the local address of the corresponding first slave control unit.
[0147] Specifically, if the output of the 11th first slave control node is connected to a second slave control unit, then an address with a node address value after 1120 is assigned to the second slave control unit. In this embodiment, if the output of the 11th first slave control unit is not connected to a second slave control unit, then the 11th first slave control unit does not forward local node addresses, but only receives new node addresses and updates and overwrites the old local node addresses until the next jump step is triggered. That is, after the corresponding node address Bn reaches the minimum value B0, the node address AnBn is matched again to see if it matches the local node address assigned by the first slave control unit. If it does not match, the node address is discarded. If it matches the local node address of the corresponding first slave control unit, and the corresponding first slave control unit is connected to a second slave control unit, then an address is assigned to the second slave control unit connected to the corresponding first slave control unit. When the corresponding first slave control unit triggers the second preset address, it means that the second slave control unit of this layer has completed the assignment, and the process jumps to the next first slave control unit.
[0148] For example, when the node address received by the first slave control unit is 1120, and the local address of the 13th first slave control unit is matched with 1120, an address is allocated to the first slave control unit connected to the 13th first slave control unit. Since the 13th first slave control unit is not connected to a second slave control unit at this time, the node address AnBn is updated to 1100 in the local address of the 13th first slave control unit. At this time, Bn reaches the minimum value of 00, triggering the allocation of an address to the 10th first slave control unit. At the same time, the local node address of the 10th first slave control unit is checked and found to be 1020, which matches the node address 1020 after the sent node address 1100. At this time, the 10th first slave control unit is connected to a second slave control unit, so 1020 is forwarded to the first second slave control unit at the corresponding level of the 10th first slave control unit. The local node address of the first second slave control unit connected to the 0th first slave control unit is forwarded to the corresponding second second slave control unit. At this time, 1020 is saved as the local node address of the corresponding first second slave control unit. When the 10th first slave control unit receives 1019, it forwards 1019 to the corresponding first second slave control unit. The 1020 of the first second slave control unit is forwarded to the corresponding second second slave control unit. At this time, 1020 is saved as the local node address of the corresponding second second slave control unit, and 1019 is saved as the local node address of the corresponding first second slave control unit. This process continues until 1001 is assigned to the first second slave control unit connected to the 10th first slave control unit, and 1000 is assigned to the 10th first slave control unit and updated locally. When the local node address of the 10th first slave control unit is determined to be 1000, or the local node address of the corresponding first second slave control unit is 1001, it indicates that the address allocation for the medicine box panels on the 10th layer of the smart cabinet has been completed. When Bn reaches its minimum value, the system jumps to A9B20, which corresponds to the 9th first slave control unit. Addresses are then allocated from largest to smallest Bn until the minimum value B0 is reached, at which point the system jumps again, repeating this cycle. At this point, the medicine box panels on the 10th layer are numbered 1001, 1002, 1003…1010 from left to right.
[0149] Correspondingly, in step S300: allocating addresses to the second slave control unit, step S340: if the local node address of the second slave control unit is the first preset address, then allocating addresses to the second slave control units connected to other first slave control units includes:
[0150] Step S341: If the local node address of the first slave control unit is AnB0, allocate addresses to the second slave control unit connected to the first slave control unit with local node addresses AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn in the order of AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn.
[0151] Specifically, in this embodiment, the first preset address is AnB0. That is, when Bn in the node address AnBn reaches the minimum value B0, i.e., 00, a jump to the next first slave control unit is triggered. For example, AnB0 is 1000, where 1000 is the end node address of the smart cabinet layer node, corresponding to the layer board address of that layer. When the first slave control unit receives the end node address 1000 and updates it to the local node address, it indicates that the previous node address 1001 of the end node address 1000 has been forwarded to the corresponding connected first second slave control unit. It can be known that the local node address of the corresponding connected second slave control unit is 1001. At this time, it can be determined that the allocation of all medicine box board addresses of that layer has been completed, i.e., the allocation of the medicine box board addresses of the 10th layer has been completed. Then, the address is assigned to the second slave control unit connected to the first slave control unit with local node addresses A(n-1)Bn, A(n-2)Bn...A1Bn. That is, the address is assigned to the second slave control unit connected to the first slave control unit with addresses 0910, 0810...0110 in sequence until the third preset address is triggered to end the assignment, thereby realizing the address assignment of all medicine box plates of the smart cabinet.
[0152] refer to Figure 6 In this embodiment, step S250, if the local node address of the first slave control unit is the third preset address, then stopping address allocation specifically includes:
[0153] Step S251: If the node address of the first slave control unit is A1B0, then stop allocating addresses.
[0154] Specifically, during the process of allocating addresses to the second slave control unit connected to the first slave control unit in the order of A(n-1)Bn, A(n-2)Bn...A1Bn, the third preset address is A1B0, i.e. 0100. When the node address received by the first slave control unit is 0100, it indicates that the node address has been allocated from the medicine box board of the 10th layer to the medicine box board of the 1st layer, and the address allocation of the first medicine box board of the 1st layer has been completed. This indicates that all the layer boards and medicine box boards in the smart cabinet have completed the address allocation, and the address allocation process stops.
[0155] The address allocation method in this embodiment includes a first slave control unit and a second slave control unit. The first slave control unit receives a first node address. If the first slave control unit is connected to a second slave control unit, the first slave control unit forwards its local node address to the second slave control unit, so that the second slave control unit updates its local node address. The local node address of the first slave control unit is then updated to the first node address. Thus, by transmitting the received node address from one end to the other, automatic allocation of node addresses for the first and second slave control units is achieved. Furthermore, by pre-setting the corresponding node address order, only two triggers are needed to send address data to complete the allocation of all cabinet addresses, eliminating the need for manual address allocation by floor or box, thereby improving the efficiency of node address allocation.
[0156] Furthermore, this embodiment pre-defines several first node addresses to be assigned as AnBn, and then allocates addresses according to the address value range from largest to smallest. Compared to setting several first node addresses to be assigned as AmBn, or allocating addresses from smallest to largest, this method has a higher degree of automation, less computation, and higher efficiency. Pre-defines several first node addresses to be assigned as AnBn, and then allocates addresses according to the address value range from largest to smallest. Allocating addresses from largest to smallest only requires setting one parameter upper limit value n based on the cabinet model. For example, n=10 means that a maximum of 100 cabinets can be assigned addresses, n=20 means that a maximum of... To assign addresses to 400 cabinets, by setting a parameter reserve (e.g., for a known cabinet model with 90 cabinets, setting the upper limit n=20, meaning reserving 400 addresses to be assigned), addresses are assigned from largest to smallest, starting with 20, until the minimum value 01 or 00 is detected, at which point the address allocation for a certain level is considered complete. Compared to assigning addresses from smallest to largest, which requires a longer time to trigger a stop judgment after address allocation due to the lack of a trigger stop condition or the large number of addresses at the last trigger stop, assigning addresses from largest to smallest can automatically trigger a stop judgment after allocation when there are many addresses to be assigned, making it more efficient.
[0157] Please refer to Figure 10 and Figure 11 In another embodiment, before step S200: allocating an address to the first slave control unit, the method further includes: presetting a number of node addresses AnBn with 4-digit values to be allocated.
[0158] Correspondingly, in step S200 of allocating an address to the first slave control unit, sending the first node address to the first slave control unit includes:
[0159] The node address AnBn is sent to the first slave control unit in the order of AnBn, A(n-1)Bn...A1Bn, A1B(n-1), A1B(n-2), A1B0, A2Bn, A2B(n-1)...A2B0, A3Bn...A(n-1)B0, AnBn, AnB(n-1)...AnB0;
[0160] Correspondingly, in the step of allocating an address to the first slave control unit, if the local node address of the first slave control unit is the second preset address, then the step of allocating an address to the second slave control unit includes:
[0161] If the local node address of the first slave control unit is A1B0, then jump to the step of allocating an address to the second slave control unit;
[0162] Correspondingly, if the local node address of the first slave control unit is the third preset address, then the address allocation will stop, including:
[0163] If the local node address of the first slave control unit is AnB0, then address allocation stops.
[0164] In this embodiment, the node address AnBn is sent to the first slave control unit in the order of AnBn, A(n-1)Bn...A1Bn, A1B(n-1), A1B(n-2), A1B0, A2Bn, A2B(n-1)...A2B0, A3Bn...A(n-1)B0, AnBn, AnB(n-1)...AnB0. This is different from the embodiment in which the node address AnBn is first sent to the first slave control unit in the order of AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn, and then the node address AnBn is sent to the first slave control unit in the order of AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn. The node addresses AnBn are sent in different orders from nB(n-1), AnB(n-2)...AnB1, AnB0, A(n-1)Bn...A(n-1)B1...A1Bn...A1B0. In this embodiment, after allocating the node addresses of the first slave control unit, the address is directly allocated to the second slave control unit connected to the last allocated first slave control unit. Then, the address is allocated to the second slave control unit connected to the unit according to the local node address of the allocated first slave control unit from smallest to largest. All address allocations can be completed by triggering the sending of the preset node address only once.
[0165] In this embodiment, the third preset address that triggers the stop address allocation is AnB0. That is, the last address AnB0 is triggered to stop only after all preset addresses have been allocated. However, in reality, after the second slave control unit corresponding to the 10th first slave control unit has completed the address allocation, all second slave control unit addresses have been allocated. At this time, the 11th first slave control unit, which is not connected to the second slave control unit, receives the subsequent unallocated node addresses and updates them to the local node addresses before triggering the stop at the last address AnB0.
[0166] In contrast, this embodiment does not require matching the first slave control unit corresponding to the local node address when triggering the second transmission of the preset address as in Embodiment 1, in order to complete the address allocation. It can complete the allocation of all preset addresses in one trigger, which is more efficient when there are fewer cabinets in the smart cabinet, i.e., fewer addresses need to be allocated.
[0167] Example 2
[0168] Reference Figure 12 This application provides an intelligent cabinet, including a main control unit 500 and at least one cabinet layer. Each cabinet layer is provided with a first slave control unit 600. If the number of cabinet layers is greater than or equal to two, the first slave control units 600 between at least one cabinet layer are connected sequentially. Each first slave control unit 600 is connected to a second slave control unit 700. The first slave control unit 600 is used for:
[0169] The address allocation method as described in Embodiment 1 of this application is executed to allocate addresses to each second slave control unit 700 of each cabinet layer;
[0170] The main control unit is used for:
[0171] The address allocation method as described in Embodiment 1 of this application is executed to allocate addresses to each first slave control unit 600 of each cabinet layer.
[0172] Reference Figure 12 The illustrated intelligent cabinet includes a main control unit 500 and several cabinet layers. Each cabinet layer includes a first slave control unit 600, and the first slave control units 600 are connected sequentially. Each first slave control unit 600 is connected to several second slave control units 700. The main control unit 500 is connected to the first slave control units 600 of the first cabinet layer, and the main control unit 500, each first slave control unit 600, and each second slave control unit 700 are all connected to a bus. Figure 5In this process, the master control unit 500 first executes the address allocation method as described in Embodiment 1 of this application. Then, the first slave control unit 600 of each cabinet layer executes the address allocation method as described in Embodiment 1 of this application to perform forwarding and updating of the first node address, thereby completing the allocation of the node address for the first slave control unit 600 of each cabinet layer. After completing the allocation of the node address for the first slave control unit 600 of each cabinet layer, the first slave control unit 600 of each cabinet layer executes the address allocation method as described in Embodiment 1 of this application, and several second slave control units 700 corresponding to each cabinet layer execute the address allocation method as described in Embodiment 1 of this application to complete the allocation of the node address for the second slave control unit 700 corresponding to each cabinet layer, which can improve the efficiency of node address allocation. In this way, the allocation of the node address for each first slave control unit 600 and second slave control unit 700 of the smart cabinet is completed, enabling the smart cabinet to communicate normally.
[0173] Figure 12 The illustrated smart cabinet can be a smart medicine cabinet. The main control unit 500 is the main control board of the smart cabinet, the first slave control unit 600 is the hierarchical control board of the smart cabinet, and the second slave control unit 700 is the medicine box board of the smart cabinet. If the node address is 6 bits, the first 2 bits represent the address of the main control unit 500, the middle 2 bits represent the address of the first slave control unit 600, and the last 2 bits represent the address of the second slave control unit 700.
[0174] When executing the address allocation method of Embodiment 1, the master control unit 500 first sends multiple preset node addresses to the first slave control unit 600 in sequence, so that the first slave control unit 600 forwards its local node address to other slave control units 600, thereby completing the address allocation for each slave control unit 600. After completing the address allocation for each slave control unit 600, the master control unit 500 can interact with the first slave control unit 600 of the specified layer via the bus. The master control unit 500 can send multiple preset node addresses to the first slave control unit 600 of the specified layer via the bus, so that the first slave control unit 600 can send multiple preset node addresses to the second slave control unit 700 directly connected to the first slave control unit 600 in sequence, thereby completing the address allocation for each second slave control unit 700 of the specified layer. When the second slave control unit 700 of a certain layer needs to be replaced or the address is incorrect, it is only necessary to reconfigure the address of the second slave control unit 700 of that layer. There is no need to reconfigure all the second slave control units 700 of the smart cabinet, which improves the address allocation efficiency and facilitates the replacement of the second slave control unit 700.
[0175] In this embodiment, the preset node address is a 4-bit data. The first two bits represent the address of the first slave control unit 600, and the last two bits represent the address of the second slave control unit 700. The main control board, as the issuer of address allocation, forwards the first node address to complete the address allocation for the hierarchical boards and medicine box boards in the intelligent cabinet. In this embodiment, decimal is used as the basis for data storage. In other embodiments, binary, octal, hexadecimal, etc., can also be used as the basis for data storage.
[0176] It should be noted that, Figure 12 The smart cabinet shown is merely an example of this application and should not be construed as a limitation on the embodiments of this application. The embodiments of this application do not make specific limitations on the number of cabinet layers, i.e., the number of first slave control units, and the number of second slave control units in each cabinet layer.
[0177] This embodiment achieves automatic allocation of node addresses for multiple cabinet compartments in a smart cabinet by triggering the forwarding of the local node address to the next node when a node receives a new node address, and then passing it sequentially.
[0178] Example 3
[0179] Reference Figure 13 , Figure 13 This is a schematic diagram of the framework of a slave control unit according to an embodiment of this application. An embodiment of this application provides a slave control unit, including:
[0180] At least one first memory 200;
[0181] At least one first processor 100;
[0182] At least one first procedure;
[0183] The first program is stored in the first memory 200, and the first processor 100 executes at least one of the first programs to achieve the following:
[0184] The address allocation method as described in Example 1.
[0185] The first processor 100 and the first memory 200 can be connected by a bus or other means.
[0186] The first memory 200 serves as a readable storage medium and can be used to store non-transitory software instructions and non-transitory instructibles. Furthermore, the first memory 200 may include a high-speed random access first memory 200, and may also include non-transitory first memories 200, such as at least one disk first memory 200, a flash memory device, or other non-transitory solid-state first memories 200. It is understood that the first memory 200 may optionally include first memories 200 remotely located relative to the first processor 100, and these remote first memories 200 can be connected to the first processor 100 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0187] The first processor 100 executes non-transitory software instructions, commands, and signals stored in the first memory 200 to perform various functional applications and data processing, thereby implementing the address allocation method of Embodiment 1 above.
[0188] The non-transient software instructions required to implement the address allocation method of Embodiment 1 are stored in the first memory 200. When executed by the first processor 100, the address allocation method of Embodiment 1 of this application is executed.
[0189] This embodiment achieves automatic allocation of node addresses for multiple cabinet compartments in a smart cabinet by triggering the forwarding of the local node address to the next node when a node receives a new node address, and then passing it sequentially.
[0190] Example 4
[0191] Reference Figure 14 , Figure 14 This is a schematic diagram of the main control unit in an embodiment of this application; an embodiment of this application provides a main control unit, including:
[0192] At least one secondary memory 400;
[0193] At least one secondary processor 300;
[0194] At least one second procedure;
[0195] The second program is stored in the second memory 400, and the second processor 300 executes at least one of the second programs to achieve the following:
[0196] The address allocation method is as described in Example 1.
[0197] The second processor 300 and the second memory 400 can be connected via a bus or other means.
[0198] The second memory 400 serves as a readable storage medium and can be used to store non-transitory software instructions and non-transitory instructions. Furthermore, the second memory 400 may include a high-speed random access second memory 400, and may also include a non-transitory second memory 400, such as at least one disk second memory 400, a flash memory device, or other non-transitory solid-state second memory 400. It is understood that the second memory 400 may optionally include second memories 400 remotely located relative to the second processor 300, and these remote second memories 400 can be connected to the second processor 300 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0199] The second processor 300 executes non-transitory software instructions, commands, and signals stored in the second memory 400 to perform various functional applications and data processing, thereby implementing the address allocation method of Embodiment 1 above.
[0200] The non-transient software instructions required to implement the address allocation method of Embodiment 1 are stored in the second memory 400. When executed by the second processor 300, the address allocation method of Embodiment 1 is executed.
[0201] This embodiment achieves automatic allocation of node addresses for multiple cabinet compartments in a smart cabinet by triggering the forwarding of the local node address to the next node when a node receives a new node address, and then passing it sequentially.
[0202] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0203] Based on the above description of the embodiments, those skilled in the art will understand that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable signals, data structures, instruction modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible by a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable signals, data structures, instruction modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0204] The embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of this application.
Claims
1. An address allocation method, characterized in that, The system includes a first slave control unit and a second slave control unit, and a master control unit. The first slave control units comprise a plurality of units, and the master control unit is communicatively connected to the plurality of first slave control units. The plurality of first slave control units are connected sequentially, and each first slave control unit is connected to a plurality of second slave control units. The master control unit is the master control board of the smart cabinet, the first slave units are the hierarchical boards of the smart cabinet, and the second slave units are the plurality of medicine box boards corresponding to the hierarchical boards. The method includes: The step of allocating an address to the first slave control unit includes: determining a first slave control unit from the plurality of first slave control units; sending a first node address to the first slave control unit so that the first slave control unit forwards its local node address to other first slave control units; updating the local node address of the first slave control unit to the first node address; if the local node address of the first slave control unit is a second preset address, then proceeding to the step of allocating an address to the second slave control unit; if the local node address of the first slave control unit is a third preset address, then stopping the address allocation. The step of allocating an address to the second slave control unit includes: Receive the address of the first node; if the first slave control unit is connected to the second slave control unit, forward the local node address of the first slave control unit to the second slave control unit so that the second slave control unit can update the local node address of the second slave control unit; update the local node address of the first slave control unit to the first node address; if the local node address of the second slave control unit is a first preset address, allocate an address to the second slave control unit connected to other first slave control units; The step of allocating an address to the first slave control unit includes the following prior steps: Several node addresses AnBn to be assigned are preset; the value of n is greater than the number of levels of the smart cabinet and greater than the number of medicine boxes on any level of the smart cabinet. An represents the first two digits of the level address code and Bn represents the last two digits of the box address code. Correspondingly, the first distribution order rule for the preset node address is that the An address value is sequentially from largest to smallest, and the Bn address data remains unchanged at its maximum value. In the step of allocating the address to the first slave control unit, the step of sending the first node address to the first slave control unit includes: sending the node address AnBn to the first slave control unit in the order of AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn. Correspondingly, in the step of allocating an address to the first slave control unit, the step of jumping to allocating an address to the second slave control unit if the local node address of the first slave control unit is the second preset address includes: if the local node address of the first slave control unit is A1Bn, then jumping to the step of allocating an address to the second slave control unit; Correspondingly, the second distribution order rule for the preset node address is as follows: the Bn address value is sequentially from largest to smallest, the An address value remains at its maximum value, and when the Bn address value is the minimum value B0, the An address value is reduced by one and remains unchanged. In the step of allocating the address to the second slave control unit, receiving the first node address includes: receiving the first node address AnBn in the order of AnBn, AnB(n-1), AnB(n-2)...AnB1, AnB0, A(n-1)Bn...A(n-1)B1...A1Bn...A1B0; if the local node address of the first slave control unit matches the received first node address AnBn, then the address is allocated to the corresponding connected second slave control unit; if they do not match, the first node address AnBn is discarded. Correspondingly, in the step of allocating an address to the second slave control unit, the step of allocating an address to the second slave control unit connected to other first slave control units if the local node address of the second slave control unit is a first preset address includes: if the local node address of the first slave control unit is AnB0, allocating addresses to the second slave control units connected to other first slave control units with local node addresses AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn in the order of AnBn, A(n-1)Bn, A(n-2)Bn...A1Bn; Correspondingly, the step of stopping address allocation if the first node address received by the first slave control unit is a third preset address includes: stopping address allocation if the first node address received by the first slave control unit is A1B0.
2. A smart cabinet, characterized in that, It includes a main control unit and at least one cabinet layer. Each cabinet layer is provided with a first slave control unit. If the number of cabinet layers is greater than or equal to 2, the first slave control units between the at least one cabinet layer are connected in sequence. Each first slave control unit is connected to a plurality of second slave control units. The first slave control unit is used for: The address allocation method as described in claim 1 is executed to allocate addresses to each of the second slave control units in each of the cabinet layers; Or the main control unit is used for: The address allocation method as described in claim 1 is executed to allocate addresses to each of the first slave control units in each of the cabinet layers.
3. A slave control unit, characterized in that, include: At least one first memory; At least one first processor; At least one first procedure; The first program is stored in the first memory, and the first processor executes at least one of the first programs to achieve: The address allocation method as described in claim 1.
4. A main control unit, characterized in that, include: At least one second memory; At least one second processor; At least one second procedure; The second program is stored in the second memory, and the second processor executes at least one of the second programs to achieve: The address allocation method as described in claim 1.
Citation Information
Patent Citations
Slave control unit address allocation method and system of battery management system
CN112702448A