A communication method and device for multiple machines competing for numbers

By adopting a multi-machine number competition method in the master-slave communication system, the master is used to detect main line fluctuations and the slaves generate low-level signals to compete, and the slaves are automatically numbered, which solves the problems of low efficiency and high error rate in the existing technology. problem, improving communication efficiency.

CN112052214BActive Publication Date: 2024-09-03HUIZHOU TOPBAND ELECTRICAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010862302.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-25
Publication Date
2024-09-03
Estimated Expiration
2040-08-25

AI Technical Summary

Technical Problem

In the existing master-slave communication system, the process of assigning identification numbers by the master to the slaves is inefficient and has a high error rate, making it difficult to apply to large-scale communication systems.

Method used

Using the multi-machine number competition communication method, the host sends broadcast signals within a preset period to detect main line fluctuations. The slaves that are not assigned identification numbers generate low-level signals to compete. The host assigns identification numbers based on the competition results until all slaves Data communication is performed after the machine is numbered.

Benefits of technology

It improves the registration efficiency of the slave and the communication efficiency of the master and slave devices, realizes automatic numbering, and obtains the unique competition code for the slave with the greatest probability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112052214B
    Figure CN112052214B
Patent Text Reader

Abstract

The present invention is applicable to the field of communication technology, and provides a communication method for multiple machines to compete for numbers. The communication system includes a host and a slave, and the host and the slave are both connected to the main line. The method includes the host sending a broadcast signal to each slave in a time slot of a preset period in chronological order, and the host detecting whether the main line fluctuates; if so, the host generates an identification number; the slave that is not assigned an identification number generates a low-level signal in the time slot; the slave sends a low-level signal to the main line in turn to form a competition result; the host assigns an identification number to the corresponding slave according to the competition result; repeats the above steps until the host does not detect that the main line fluctuates; in the next time slot to the last time slot when the main line does not fluctuate, the host sends a data signal to the corresponding slave to achieve communication with the slave. Through the above implementation mode, the present invention realizes the maximum probability of a unique slave obtaining a competition code, thereby improving the registration efficiency of the slave and the communication efficiency of the master-slave device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of communication technology, and in particular relates to a communication method and device for multiple machines competing for numbers. Background Art

[0002] In the computer field, there is often a master-slave communication system with one master and multiple slaves, that is, a communication system with one host device and multiple slave devices.

[0003] In the prior art, the host needs to assign an identification number to the slave, and the slave and the identification number correspond one to one, so that the host can send a corresponding signal to the slave for communication. The existing process of assigning the identification number of the slave by the host is through manual matching. For example, the host is manually operated to add the physical address of the slave to the host so that the slave is assigned an identification number. This method is very inefficient and has a high error rate, and is not suitable for large-scale communication systems. Summary of the invention

[0004] The embodiment of the present invention provides a communication method for multiple machines competing for numbers, aiming to solve the problem of automatic generation of communication addresses of master and slave machines in the existing communication system.

[0005] The embodiment of the present invention is implemented as follows: a communication method for multiple machines competing for numbers is provided, which is applied to a communication system, wherein the communication system includes a host and a slave, and the host and the slave are both connected to a main line. The communication method for multiple machines competing for numbers includes the following steps: Step 1, the host sends a broadcast signal to each of the slaves in a time slot of a preset period in chronological order; Step 2, the host detects whether the main line fluctuates; Step 3, if so, the host generates an identification number; Step 4, the slave that is not assigned an identification number generates a low-level signal in the time slot; Step 5, the slave sends the low-level signal to the main line in turn to form a competition result; Step 6, the host assigns the identification number to the corresponding slave according to the competition result; Step 7, repeating steps 1 to 6 until the host does not detect that the main line fluctuates; Step 8, in the next time slot to the last time slot when the main line does not fluctuate, the host sends a data signal to the corresponding slave to achieve communication with the slave.

[0006] Furthermore, the step of the slave machine that is not assigned an identification number generating a low-level signal in the time slot specifically includes: the slave machine that is not assigned an identification number generates a random number in the time slot; and the slave machine generates a low-level signal according to the random number.

[0007] Furthermore, the slave sends the low level signal to the main line in sequence to form a competition result, which specifically includes: the slave sends the low level signal to the main line in sequence; determines that the slave with the longest low level signal length has successfully competed and forms a competition result.

[0008] Furthermore, after the step of the host generating an identification number, it also includes: the host determines whether the identification number is a repeated identification number; if so, the host generates another new identification number, if not, the host determines that the identification number can be assigned to the corresponding slave.

[0009] Furthermore, the communication method also includes the following steps: when the host sends a data signal to the corresponding slave, if there are multiple slaves that repeatedly respond in the same time slot, the slaves that repeatedly respond stop communicating and compete in the next preset cycle.

[0010] The embodiment of the present invention further provides a communication device for multiple machines to compete for numbers, which is applied to a communication system, wherein the communication system includes a host and a slave, wherein the host and the slave are both connected to a main line, and the multiple machine competition device includes: a broadcast unit, which is used for the host to send a broadcast signal to each of the slaves in a time slot of a preset period in a time sequence; a fluctuation detection unit, which is used for the host to detect whether the main line has fluctuated; an identification number generating unit, which is used for the host to generate an identification number if the host detects that the main line has fluctuated; a low-level signal generating unit, which is used for a slave that has not been assigned an identification number to generate a low-level signal in the time slot; and a competition result forming unit. , used for the slave to send the low-level signal to the main line in sequence to form a competition result; an identification number assigning unit, used for the host to assign the identification number to the corresponding slave according to the competition result; a repeated execution unit, used to repeatedly execute the broadcast unit, the fluctuation detection unit, the identification number generating unit, the low-level signal generating unit, the competition result forming unit and the identification number assigning unit until the host does not detect the fluctuation of the main line; a communication unit, used for the host to send a data signal to the corresponding slave within the next time slot to the last time slot when the main line does not fluctuate, so as to realize communication with the slave.

[0011] Furthermore, the low-level signal generating unit comprises: a random number generating module, which is used for a slave machine which is not assigned an identification number to generate a random number within the time slot; and a low-level signal generating module, which is used for the slave machine to generate a low-level signal according to the random number.

[0012] Furthermore, the competition result forming unit includes: a low level sending module, which is used for the slave to send the low level signal to the main line in sequence; a competition result forming module, which is used to determine that the slave with the longest low level signal length has successfully competed and form a competition result.

[0013] Furthermore, the multi-machine bidding device also includes: a judgment unit, used by the host to judge whether the identification number is a repeated identification number; an operation unit, used by the host to generate another new identification number if the host judges that the identification number is a repeated identification number, and if the host judges that the identification number is a non-duplicate identification number, the host determines that the identification number can be assigned to the corresponding slave.

[0014] Furthermore, the multi-machine bidding device also includes: a repetition unit, which is used to, when the host sends a data signal to the corresponding slave, if there are multiple slaves repeatedly responding in the same time slot, the slaves that repeatedly respond stop communicating and bid in the next preset cycle.

[0015] The beneficial effect achieved by the present invention is that all slaves that are not assigned identification numbers are automatically numbered by multiplexing the communication main line and competing, so that a unique slave can obtain the competition code with the maximum probability, thereby improving the registration efficiency of the slave and the communication efficiency of the master-slave device. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a first flow chart of the communication method of multiple machines competing for numbers according to an embodiment of the present invention;

[0017] Figure 2 is a schematic diagram of the structure of a communication system according to an embodiment of the present invention;

[0018] Figure 3 It is a schematic diagram of a data unit for multiple machines competing for numbers to access the network according to the present invention;

[0019] Figure 4 The present invention Figure 1 Schematic diagram of the process of step 4 in FIG.

[0020] Figure 5 The present invention Figure 1 Schematic diagram of the process of step 5 in FIG.

[0021] Figure 6 It is a schematic diagram of an implementation method of a slave number competition of the present invention;

[0022] Figure 7 It is a second flow chart of the communication method of multiple machines competing for numbers according to an embodiment of the present invention;

[0023] Figure 8It is a structural schematic diagram of an implementation mode of a communication device for multiple machines competing for numbers according to the present invention;

[0024] Fig. 9 It is a schematic block diagram of an embodiment of a communication device for multiple machines competing for numbers provided by the present invention;

[0025] Fig.10 It is a schematic block diagram of an embodiment of a computer storage medium according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0027] The present invention automatically numbers all slaves that are not assigned identification numbers by multiplexing the communication main line and competing, and can achieve the maximum probability of unique slave acquisition competition code, thereby improving the registration efficiency of the slave and the communication efficiency of the master-slave equipment.

[0028] Embodiment 1

[0029] Please refer to this Figure 1 , Figure 1 FIG. 1 is a schematic diagram of a first flow chart of a communication method for multiple machines competing for numbers according to an embodiment of the present invention. Figure 1 The communication method for multiple machines competing for numbers provided by the present invention is applied to a communication system. Please further combine Figure 2 , Figure 2 Schematic diagram of a communication system according to an embodiment of the present invention. Figure 2 The communication system 100 provided by the present invention includes a host (MCU) 110 and multiple slaves (MCU) 120, wherein the host 110 is connected to the multiple slaves 120 respectively through a main line 130. Optionally, in a specific application scenario of the present invention, the communication system 100 can be applied to a power supply system, wherein the host 110 is provided with a concentrator (not shown in the figure), and the slave 120 is provided with a collector (not shown in the figure), and the slave 120 corresponds to each household user, and the collector can collect the user's water and electricity, and report it to the concentrator of the host 110. Of course, the communication system 100 of the present invention can also be applied to other application scenarios, which are not specifically limited here.

[0030] Furthermore, the communication method for multiple machines competing for numbers provided in the first embodiment of the present invention includes the following steps:

[0031] Step 1: The host sends a broadcast signal to each slave in a time slot of a preset period in chronological order.

[0032] Among them, the preset time period in the embodiment of the present invention can be 1 second, and in other implementations it can also be 2 seconds, 3 seconds, etc., which are not specifically limited here. Specifically, the host can send broadcast signals to each slave in the preset time period of 1 second in the time sequence of the first time slot (first millisecond), the second time slot (second millisecond), the third time slot (third millisecond)...the nth time slot (nth millisecond). After judging that the slaves all have identification numbers in the nth time slot, the host sends data signals to each slave from the next time slot of the nth time slot to the last time slot. Further combined Figure 3 , Figure 3 Schematic diagram of a data unit for multiple machines competing for numbers to access the network according to the present invention, as shown in Figure 3 In the present invention, the competition number network access data unit consists of 10 bits, and the slave in step 1 includes the following situations:

[0033] 1. The slave has an identification number;

[0034] 2. The slaves have no identification numbers;

[0035] 3. The inserted new slave has no identification number;

[0036] In the embodiment of the present invention, the host sends a broadcast signal to all slaves in a time slot of a preset period of 1 second in chronological order.

[0037] Step 2: The host detects whether the main line fluctuates.

[0038] Specifically, in step S200, the host needs to detect whether the main line fluctuates. The host sends a broadcast signal to all slaves within a preset period of 1 second. For the case where all slaves have identification numbers, the host detects that the main line does not fluctuate within the first time slot (the first millisecond), and the host determines that the slave has an identification number. At this time, the host does not need to send a broadcast in the second time slot, that is, the host communicates with the slave from the second time slot (the second millisecond) to the 1000th millisecond, and the above process is repeated in the next preset time period.

[0039] For the case where none of the slaves have identification numbers and the newly inserted slaves do not have identification numbers, the master sends a broadcast to all the slaves in a time slot of a preset period of 1 second in chronological order. Further, if the master detects that the main line fluctuates in the first time slot (the first millisecond), none of the slaves have identification numbers and the newly inserted slaves do not have identification numbers start to compete for numbers, then the process goes to step S300.

[0040] Step 3: The host generates an identification number.

[0041] Optionally, for the case where all slaves have no identification numbers and newly inserted slaves have no identification numbers, if the host detects fluctuations in the main line in the first time slot (first millisecond), the host generates an identification number, and the slaves that have not been assigned identification numbers begin to compete in the first time slot.

[0042] Step 4: The slaves that are not assigned identification numbers generate low-level signals in the time slot.

[0043] Optionally, slaves that are not assigned identification numbers (including slaves that have no identification numbers and newly inserted slaves that have no identification numbers) generate low-level signals in the first time slot.

[0044] Step 5: The slaves send low-level signals to the master line in turn to form a competition result.

[0045] Further, the slaves generating the low level signals in step 4 send their respective low level signals to the master line in turn to form a competition result.

[0046] Step 6: The host assigns an identification number to the corresponding slave according to the competition result.

[0047] Optionally, the identification number generated by the host is assigned to the corresponding slave according to the competition result in step 5, and the remaining slaves that have not been assigned identification numbers wait for the second round of bidding. Among them, the slaves that have been assigned identification numbers will no longer participate in subsequent bidding.

[0048] Step 7: Repeat steps 1 to 6 until the host detects no fluctuation in the main line.

[0049] Optionally, steps 1 to 6 are repeated until the host detects no fluctuations in the main line, that is, the above steps are repeated until all slaves are assigned identification numbers. For example, after the slave competition in the first time slot ends, the host sends a broadcast signal to the remaining slaves that have not been assigned identification numbers in the second time slot of a preset period of 1 second in chronological order, and the host detects whether fluctuations occur in the second time slot (the second millisecond). If fluctuations are detected in the second time slot, the host generates an identification number, and the remaining slaves that have not been assigned identification numbers start the second round of competition. That is, the slaves that have not been assigned identification numbers generate low-level signals in the second time slot respectively, and send low-level signals to the main line in turn to form a competition result, and the host assigns identification numbers to the corresponding slaves according to the competition result.

[0050] Similarly, the bidding process for the slaves in the remaining time slots within the preset time period is the same and will not be repeated here. Thus, it is only necessary to repeat the above steps 1 to 6 until all the slaves are assigned identification numbers.

[0051] Step 8: From the next time slot to the last time slot when the main line does not fluctuate, the host sends a data signal to the corresponding slave to achieve communication with the slave.

[0052] Specifically, for the above-mentioned situation where the slaves already have identification numbers, if all the slaves already have identification numbers, the host detects that there is no fluctuation in the main line within the first time slot (the first millisecond), and the host determines that all the slaves already have identification numbers, then from the second time slot to the last time slot (the 1000th millisecond), the host sends a data signal to the corresponding slave for communication.

[0053] It is worth mentioning that when the host sends a data signal to the bus, no slave responds (that is, no slave communicates with the host). The host determines that the identification number at this time is a invalid number, that is, the identification number is broken or does not exist. The host recycles the identification number to avoid the situation where the invalid number affects the communication efficiency.

[0054] For the slaves without identification numbers and the newly inserted slaves without identification numbers, if the host detects that the main line has no fluctuations in the nth time slot (nth millisecond), the host sends a data signal to the corresponding slave for communication from the next time slot of the nth time slot to the last time slot (1000th millisecond). For example, if the host detects that the main line has no fluctuations in the 5th time slot (5th millisecond), the host sends a data signal to the corresponding slave for communication from the 6th time slot (6th millisecond) to the last time slot (1000th millisecond).

[0055] In the above implementation, all slaves are automatically numbered by multiplexing the communication main line and competing, which can maximize the probability of achieving unique slave acquisition competition code, thereby improving the registration efficiency of the slaves and the communication efficiency of the master-slave devices.

[0056] Embodiment 2

[0057] Further integration Figure 4 , Figure 4 4 is a flow chart of step 4 of the present invention. It can be understood that embodiment 2 of the present invention is a further extension of embodiment 1, and step 4 further includes the following sub-steps:

[0058] Step 41: A slave that is not assigned an identification number generates a random number within a time slot.

[0059] Optionally, the slaves that are not assigned an identification number generate random numbers in the same time slot. For example, if the host detects that the main line fluctuates in the first time slot, the slaves that are not assigned an identification number generate random numbers in the first time slot.

[0060] Step 42: The slave generates a low level signal according to the random number.

[0061] Each slave that is not assigned an identification number generates a low-level signal according to a random number generated by itself.

[0062] Similarly, for the slaves entering the second, third, and final rounds of bidding, the generation of their low-level signals is the same, that is, random numbers are generated and low-level signals are generated according to the random numbers.

[0063] In the above implementation, by adopting multiple rounds of competition for slaves that are not assigned identification numbers, it is possible to achieve a maximum probability of unique slave acquisition of competition codes.

[0064] Embodiment 3

[0065] Further integration Figure 5 , Figure 5 is a flow chart of step 5 of the present invention. It can be understood that embodiment 3 of the present invention is a further extension of embodiment 1, and step 5 further includes the following sub-steps:

[0066] Step 51, the slaves send low level signals to the master line in sequence.

[0067] Optionally, the slaves send the low-level signals generated by each of them to the master line in turn.

[0068] Step 52, determining whether the slave with the longest low-level signal length has successfully competed and forming a competition result.

[0069] It is understandable that the slave with a shorter low level length sends a high level signal to the main line earlier, but the main line is still in a low level state at this time, and the slave with a shorter low level length fails in the competition. On the contrary, the slave with the longest low level length sends a high level signal to the main line the latest. At this time, the main line can be converted from a low level state to a high level state, and the slave with the longest low level length succeeds in the competition and forms a competition result. Among them, the competition result means that the slave with the longest low level length can obtain the identification number assigned by the host, and the identification number can be any number of 1, 2 or 3, which is not specifically limited here. Please further combine Figure 6 , Figure 6 This is a schematic diagram of an implementation method of the slave number competition of the present invention, specifically Figure 6 For example, if the low level length of slave 1 is less than that of slave 2, slave 2 succeeds in the bidding and can obtain the identification number assigned by the host.

[0070] Embodiment 4

[0071] Please further combine 7, Figure 71 is a second flow chart of a communication method for multiple machines competing for numbers according to an embodiment of the present invention, and the fourth embodiment of the present invention is a further extension of the first embodiment, except that in the fourth embodiment, it is necessary to further determine whether the identification number generated by the host is a repeated identification number, and the similarities are not repeated here, and the fourth embodiment further includes the following steps:

[0072] S100: The host sends a broadcast signal to each slave in a time slot of a preset period in chronological order.

[0073] S110, the host detects whether the main line fluctuates.

[0074] S120: If yes, the host generates an identification number.

[0075] S130: The host determines whether the identification number is a repeated identification number.

[0076] Furthermore, in order to avoid duplicate identification numbers being generated during the slave number competition process, the fourth embodiment of the present invention needs to deduplicate the identification numbers generated by the host, that is, determine whether the identification number generated by the host in the current time slot is the same as the identification number generated in the time slot before the current time slot.

[0077] S140: If yes, the host generates another new identification number; if no, the host determines that the identification number can be assigned to the corresponding slave.

[0078] Specifically, if the identification number generated by the host in the current time slot in the determination step S130 is repeated with the identification number generated in the previous time slot, the host regenerates another new identification number. Conversely, if the identification number generated by the host in the current time slot in the determination step 4 is not repeated with the identification number generated in the previous time slot, the identification number can be assigned to the corresponding slave.

[0079] In this embodiment, by pre-detecting whether the identification number generated by the host is repeated, the phenomenon of duplicate numbers occurring during the slave number competition process can be detected, thereby improving the efficiency of slave registration and the efficiency of master-slave communication.

[0080] S150: A slave that is not assigned an identification number generates a low level signal in the time slot.

[0081] S160, the slaves send the low level signals to the master line in sequence to form a competition result.

[0082] S170: The host assigns the identification number to the corresponding slave according to the competition result.

[0083] S180, repeatedly executing S100 to S170 until the host does not detect fluctuations in the main line.

[0084] S190. From the next time slot to the last time slot when the main line does not fluctuate, the host sends a data signal to the corresponding slave to achieve communication with the slave.

[0085] In the above implementation, all slaves are automatically numbered by multiplexing the communication main line and competing, which can maximize the probability of achieving unique slave acquisition competition code, thereby improving the registration efficiency of the slaves and the communication efficiency of the master-slave devices.

[0086] Embodiment 5

[0087] Embodiment 5 of the present invention is a further extension of Embodiment 1, except that in Embodiment 5, it is necessary to further determine whether the identification number is a repeated identification number, and the remaining steps are the same, and the similarities are not repeated here, and Embodiment 5 further includes the following steps:

[0088] When the host sends a data signal to the corresponding slave, if multiple slaves respond repeatedly in the same time slot, the slaves that respond repeatedly stop communicating and compete for numbers in the next preset cycle.

[0089] Among them, in the next time slot to the last time slot when the main line does not fluctuate, the host sends a data signal to the corresponding slave. In this process, if there are multiple slaves that respond repeatedly in the same time slot, it is determined that there is a duplicate number at this time, and the slave that responds repeatedly stops communicating and re-participates in the bidding in the next preset cycle, waiting for the host to assign a new identification number. The addressed slave responds after a random delay, which can prevent the existence of duplicate identification numbers in the slave. If there is no duplicate identification number in the slave, normal communication can be carried out. If there is a duplicate identification number in the slave, the duplicate slave re-participates in the bidding, improving the registration efficiency of the slave and the communication efficiency of the master and slave.

[0090] For example, in the second time slot, the host sends a data signal to the corresponding slave. If slave A and slave B have duplicate identification numbers, slave A responds first and slave B responds later. When slave B responds, it finds that the bus is occupied. Then slave B determines that there is a duplicate identification number, and slave B does not communicate data with the host. When there is a broadcast signal next time (that is, the next preset cycle), slave B participates in the bidding and is reassigned a new identification number.

[0091] In the above implementation, all slaves are automatically numbered by multiplexing the communication main line and competing, which can maximize the probability of achieving unique slave acquisition competition code, thereby improving the registration efficiency of the slaves and the communication efficiency of the master-slave devices.

[0092] Embodiment 6

[0093] See also Figure 8 , Figure 8 FIG. 1 is a schematic diagram of a structure of an embodiment of a communication device for multiple machines competing for numbers according to the present invention. Figure 8 The communication device 200 for multiple machines competing for numbers provided by the present invention includes a broadcast unit 210, a fluctuation detection unit 220, an identification number generating unit 230, a low-level signal generating unit 240, a competition result forming unit 250, an identification number assigning unit 260, a repetition executing unit 270 and a communication unit 280. The multiple machines competing for numbers device 200 is applied to a communication system, and the communication system includes a master and a slave, and the master and the slave are both connected to a main line.

[0094] The broadcast unit 210 is used by the host to send a broadcast signal to each slave in a time slot of a preset period in a time sequence.

[0095] The fluctuation detection unit 220 is used by the host to detect whether the main line has fluctuations.

[0096] The identification number generating unit 230 is used for generating an identification number when the host detects that the main line has fluctuated.

[0097] The low-level signal generating unit 240 is used for the slave machine that is not assigned with an identification number to generate a low-level signal in a time slot, and the low-level signal generating unit 240 further includes a random number generating module 241 and a low-level signal generating module 242. Among them, the random number generating module 241 is used for the slave machine that is not assigned with an identification number to generate a random number in the time slot. The low-level signal generating module 242 is used for the slave machine to generate a low-level signal according to the random number.

[0098] The competition result forming unit 250 is used for the slave to sequentially send low-level signals to the main line to form a competition result, and the competition result forming unit 250 further includes a low-level sending module 251 and a competition result forming module 252. Among them, the low-level sending module 251 is used for the slave to sequentially send the low-level signal to the main line. The competition result forming module 252 is used to determine that the slave with the longest low-level signal length successfully competes and forms a competition result.

[0099] The identification number assigning unit 260 is used by the host to assign the identification number to the corresponding slave according to the competition result.

[0100] The repetitive execution unit 270 is used to repeatedly execute the broadcast unit 210, the fluctuation detection unit 220, the identification number generating unit 230, the low level signal generating unit 240, the competition result forming unit 250 and the identification number assigning unit 260 until the host does not detect fluctuations in the main line.

[0101] The communication unit 280 is used for the host to send a data signal to the corresponding slave within the next time slot to the last time slot when the main line does not fluctuate, so as to realize communication with the slave.

[0102] In addition, the multi-machine bidding device 200 in the embodiment of the present invention further includes:

[0103] A judging unit (not shown) is used by the host to judge whether the identification number is a repeated identification number. An operating unit (not shown) is used to generate another new identification number if the host judges that the identification number is a repeated identification number, and to assign the identification number to the corresponding slave if the host judges that the identification number is a non-duplicate identification number.

[0104] The repeating unit is used for, when the host sends a data signal to the corresponding slave, if there are multiple slaves that repeatedly respond in the same time slot, the slaves that repeatedly respond stop communicating and compete for numbers in the next preset cycle.

[0105] Each functional module in the above implementation mode can implement each step of the communication method of multiple machines competing for numbers in the above embodiments 1 to 5, which will not be repeated here.

[0106] In the above implementation, all slaves are automatically numbered by multiplexing the communication main line and competing, which can maximize the probability of achieving unique slave acquisition competition code, thereby improving the registration efficiency of the slaves and the communication efficiency of the master-slave devices.

[0107] Embodiment 7

[0108] See also Fig. 9 , Fig. 9 It is a schematic block diagram of an embodiment of a communication device for multiple machines competing for numbers provided by the present invention. The device for multiple machines competing for numbers in this embodiment includes a processor 51, a memory 52 coupled to the processor 51, and a computer program stored in the memory 52 and executable on the processor 51. The memory 52 stores computer instructions. The processor 51 executes the computer instructions when working to implement the communication method for multiple machines competing for numbers in any of the above embodiments.

[0109] The processor 51 may also be referred to as a CPU (Central Processing Unit). The processor 51 may be an integrated circuit chip having signal processing capabilities. The processor 51 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, but is not limited thereto.

[0110] Embodiment 8

[0111] See also Fig.10 , Fig.10 It is a schematic block diagram of an embodiment of a computer storage medium provided by the present invention. The computer-readable storage medium in this embodiment stores a computer program 61, which can be executed by a processor to implement the multi-machine communication method in any of the above embodiments.

[0112] Optionally, the readable storage medium can be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes, or a terminal device such as a computer, a server, a mobile phone, or a tablet.

[0113] In summary, those skilled in the art can easily understand that the present invention provides a communication method and device for multi-machine competition. In the above implementation, all slaves are automatically numbered by multiplexing the communication main line and competing, which can achieve the maximum probability of a unique slave obtaining the competition code, thereby improving the registration efficiency of the slave and the communication efficiency of the master-slave devices.

[0114] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A communication method for multiple machines competing for numbers, characterized in that: Applied to a communication system, the communication system includes a host and a slave, the host and the slave are both connected to a main line, and the communication method includes the following steps: Step 1, the host sends a broadcast signal to each of the slaves in a time slot of a preset period in chronological order; Step 2, the host detects whether the main line fluctuates; Step 3: If yes, the host generates an identification number; Step 4, the slave that is not assigned an identification number generates a random number within the time slot, and generates a low-level signal according to the random number; Step 5, the slave sends the low level signal to the master line in sequence, determines that the slave with the longest low level signal length has successfully competed, and forms a competition result; Step 6, the host assigns the identification number to the corresponding slave according to the competition result; Step 7, repeating steps 1 to 6 until the host detects no fluctuation in the main line; Step 8: From the next time slot to the last time slot when the main line does not fluctuate, the host sends a data signal to the corresponding slave to achieve communication with the slave.

2. The communication method according to claim 1, characterized in that: After the host generates an identification number, the process further includes: The host determines whether the identification number is a repeated identification number; If yes, the host generates another new identification number, if no, the host determines that the identification number can be assigned to the corresponding slave.

3. The communication method according to claim 1, characterized in that: The communication method further comprises the following steps: When the host sends a data signal to the corresponding slave, if multiple slaves respond repeatedly in the same time slot, the slaves that respond repeatedly stop communicating and compete for numbers in the next preset cycle.

4. A multi-machine bidding device, characterized in that: Applied to a communication system, the communication system includes a host and a slave, the host and the slave are both connected to a main line, and the multi-machine bidding device includes: A broadcast unit, used for the host to send a broadcast signal to each of the slaves in a time slot of a preset period in a time sequence; A fluctuation detection unit, used by the host to detect whether the main line generates fluctuations; An identification number generating unit, configured to generate an identification number if the host detects that the main line generates fluctuations; A low-level signal generating unit, comprising a random number generating module and a low-level signal generating module, wherein the random number generating module is used for a slave machine that is not assigned an identification number to generate a random number within the time slot, and the low-level signal generating module is used for generating a low-level signal according to the random number; A competition result forming unit, comprising a low level signal sending module and a competition result forming module, wherein the low level signal sending module is used for the slave to sequentially send the low level signal to the master line, and the competition result forming module is used to determine whether the slave with the longest low level signal length has successfully competed and form a competition result; An identification number assigning unit, used for the host to assign the identification number to the corresponding slave according to the competition result; a repeating execution unit, configured to repeatedly execute the broadcasting unit, the fluctuation detection unit, the identification number generating unit, the low-level signal generating unit, the competition result forming unit, and the identification number assigning unit until the host fails to detect fluctuations in the main line; The communication unit is used for the host to send a data signal to the corresponding slave within the next time slot to the last time slot when the main line does not generate fluctuations, so as to realize communication with the slave.

5. The multi-machine bidding device according to claim 4, characterized in that: The multi-machine bidding device also includes: A judging unit, used by the host to judge whether the identification number is a repeated identification number; The operating unit is used for generating another new identification number if the host determines that the identification number is a repeated identification number, and for assigning the identification number to the corresponding slave if the host determines that the identification number is a non-duplicate identification number.

6. The multi-machine bidding device according to claim 4, characterized in that: The multi-machine bidding device also includes: The repeating unit is used for, when the host sends a data signal to the corresponding slave, if there are multiple slaves that repeatedly respond in the same time slot, the slaves that repeatedly respond stop communicating and compete for numbers in the next preset cycle.