CN109586832B - Wireless synchronization method, wireless slave, wireless master and wireless synchronization system - Google Patents
Wireless synchronization method, wireless slave, wireless master and wireless synchronization system Download PDFInfo
- Publication number
- CN109586832B CN109586832B CN201811533731.7A CN201811533731A CN109586832B CN 109586832 B CN109586832 B CN 109586832B CN 201811533731 A CN201811533731 A CN 201811533731A CN 109586832 B CN109586832 B CN 109586832B
- Authority
- CN
- China
- Prior art keywords
- wireless
- synchronization
- synchronous
- cpu
- state instruction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 61
- 230000001360 synchronised effect Effects 0.000 claims abstract description 185
- 238000012545 processing Methods 0.000 claims abstract description 43
- 230000005540 biological transmission Effects 0.000 abstract description 13
- 238000012937 correction Methods 0.000 abstract description 7
- 230000001960 triggered effect Effects 0.000 description 19
- 238000004891 communication Methods 0.000 description 13
- 238000010586 diagram Methods 0.000 description 9
- 238000005516 engineering process Methods 0.000 description 9
- 238000013480 data collection Methods 0.000 description 8
- 238000012795 verification Methods 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
- H04J3/0635—Clock or time synchronisation in a network
- H04J3/0638—Clock or time synchronisation among nodes; Internode synchronisation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
- H04J3/0635—Clock or time synchronisation in a network
- H04J3/0638—Clock or time synchronisation among nodes; Internode synchronisation
- H04J3/0644—External master-clock
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
- Small-Scale Networks (AREA)
Abstract
The invention discloses a wireless synchronization method, a wireless slave, a wireless host and a wireless synchronization system. According to the wireless synchronization method, the wireless slave and the wireless host establish wireless connection, and the external synchronization interrupt of the CPU is enabled by receiving the synchronization preparation state instruction sent by the wireless host through the wireless connection. And after the CPU is enabled, receiving a synchronous start state instruction to generate an interrupt signal, triggering external synchronous interrupt of the CPU according to the interrupt signal, and starting synchronous operation. The invention realizes the synchronization of a plurality of wireless slaves through the interruption of the hardware layer, can effectively improve the synchronization precision, and does not need to carry out time correction. In addition, the wireless connection mode is adopted, so that the required synchronous equipment is few, the structure is simple, the wireless signal processing time is not required to be estimated, and the routing strategy and the error condition are not required to be considered. Compared with a wired synchronization mode, the cost of a synchronization controller and a high-precision transmission line can be reduced, and the system can be suitable for various different working environments.
Description
Technical Field
The invention relates to the technical field of wireless synchronization, in particular to a wireless synchronization method, a wireless slave, a wireless host and a wireless synchronization system.
Background
The synchronous technology has wide application in the aspects of synchronous data acquisition system, data communication, safe production, product test and the like. The conventional synchronization techniques include a synchronization technique using a common clock line, a GPS synchronization technique, and a master station broadcast time synchronization technique. The synchronous technology adopting the common clock line has higher synchronous precision, but the technology needs wiring, the working environment can influence the wiring work of staff, and when the working environment does not allow the wiring work, the synchronous work cannot be carried out. In addition, the implementation modes of the GPS synchronization technology and the master station broadcasting time synchronization technology can only realize the synchronization of an application layer basically, the synchronization precision is not high enough, and the requirement of special synchronization work cannot be met.
Disclosure of Invention
The present invention has been made in view of the above problems, and has as its object to provide a wireless synchronization method, a wireless slave, a wireless master and a wireless synchronization system which overcome or at least partially solve the above problems.
According to one aspect of the present invention, there is provided a wireless synchronization method applied to a wireless slave, the method comprising:
establishing wireless connection with a wireless host;
receiving a synchronization preparation state instruction sent by the wireless host through the wireless connection, and enabling external synchronization interruption of the CPU;
Receiving a synchronous starting state instruction sent by the wireless host through the wireless connection, and generating an interrupt signal;
and triggering external synchronous interruption of the CPU according to the interruption signal, and starting synchronous operation.
Preferably, the method further comprises:
during the synchronization operation, external synchronization interruption of the CPU is prohibited.
Preferably, the method further comprises:
after the external synchronization interrupt of the CPU is enabled, a synchronization preparation completion instruction is returned to the wireless host, so that the wireless host prepares to send a synchronization start state instruction.
Preferably, the synchronization preparation state instruction is a packet in a message format, and the packet includes a check code;
the receiving, by the wireless connection, a synchronization ready instruction sent by the wireless host, and enabling external synchronization interruption of the CPU includes:
and acquiring a check code in the data packet, and enabling external synchronous interruption of the CPU after the check code is correct.
Preferably, the method further comprises:
starting a first time delay after enabling an external synchronization interrupt of the CPU;
and if the synchronous starting state instruction is not received in the first time delay, prohibiting external synchronous interruption of the CPU after the first time delay is finished.
Preferably, the synchronization start state instruction is a packet in a message format, and the packet includes a synchronization word;
the step of receiving the synchronous start state instruction sent by the wireless host through the wireless connection, and the step of generating the interrupt signal comprises the following steps: and acquiring the synchronous word in the message data packet and outputting an interrupt signal.
Preferably, the synchronizing operation includes: collecting data; and after the second time delay, the acquired data are sent to the wireless host.
According to another aspect of the present invention, there is provided a wireless synchronization method applied to a wireless host, the method including:
establishing wireless connection with at least two wireless slaves;
transmitting a synchronization preparation state instruction to each wireless slave machine through the wireless connection;
after confirming that the synchronization preparation of each wireless slave is completed, a synchronization start state instruction is sent to each wireless slave through the wireless connection.
Preferably, the synchronization preparation state instruction and/or the synchronization start state instruction are data packets in a message format, and the data packets are sent in a broadcast mode; the data packet comprises a check code and a synchronous word.
Preferably, the method further comprises: after a synchronization preparation state instruction is sent to each wireless slave machine through the wireless connection, starting third time delay;
the confirming that the synchronization preparation of each wireless slave machine is completed comprises the following steps: receiving a synchronous preparation completion instruction returned by each wireless slave machine within the third time delay;
and if the synchronization preparation completion instruction returned by any one or more wireless slaves is not received, after the third time delay is finished, sending a synchronization preparation state instruction to each wireless slave through the wireless connection again.
Preferably, the method further comprises: after a synchronous start state instruction is sent to each wireless slave machine through the wireless connection, starting second time delay;
and after the second time delay is finished, receiving the acquired data sent by each wireless slave machine.
According to still another aspect of the present invention, there is provided a wireless slave including a wireless module and a CPU processing module electrically connected to each other;
the wireless module is used for establishing wireless connection with the wireless host; receiving a synchronous preparation state instruction sent by the wireless host through the wireless connection; receiving a synchronous starting state instruction sent by the wireless host through the wireless connection, and generating an interrupt signal;
The CPU processing module is used for enabling external synchronous interruption of the CPU according to the synchronous preparation state instruction; and triggering external synchronous interrupt of the CPU according to the interrupt signal to start synchronous operation.
Preferably, the CPU processing module is further configured to prohibit external synchronization interruption of the CPU during the synchronization operation.
Preferably, the wireless module is further configured to return a synchronization preparation completion instruction to the wireless host after the external synchronization of the CPU is enabled, so that the wireless host prepares to send a synchronization start status instruction.
Preferably, the synchronization preparation state instruction is a packet in a message format, and the packet includes a check code; the CPU processing module is used for acquiring the check code in the data packet and enabling the external synchronous interrupt of the CPU after the check code is correct.
Preferably, the CPU processing module is further configured to start a first time delay after enabling external synchronization of the CPU to be interrupted; and if the synchronous starting state instruction is not received in the first time delay, prohibiting external synchronous interruption of the CPU after the first time delay is finished.
Preferably, the synchronization start state instruction is a packet in a message format, and the packet includes a synchronization word;
The wireless module is used for acquiring the synchronous word in the message data packet and outputting an interrupt signal.
Preferably, the wireless slave further comprises a synchronous operation module, and the synchronous operation module is electrically connected with the CPU processing module;
the synchronous operation module is used for collecting data;
the CPU processing module is also used for sending the acquired data to the wireless host through wireless connection after the second time delay.
According to still another aspect of the present invention, there is provided a wireless host including a wireless module and a CPU processing module electrically connected to each other;
the wireless module is used for establishing wireless connection with at least two wireless slaves;
the CPU processing module is used for sending a synchronous preparation state instruction to each wireless slave machine through the wireless connection; after confirming that the synchronization preparation of each wireless slave is completed, a synchronization start state instruction is sent to each wireless slave through the wireless connection.
Preferably, the synchronization preparation state instruction and/or the synchronization start state instruction are data packets in a message format, and the data packets are sent in a broadcast mode; the data packet comprises a check code and a synchronous word.
Preferably, the CPU processing module is further configured to start a third time delay after sending a synchronization ready state instruction to each of the wireless slaves through the wireless connection; receiving a synchronous preparation completion instruction returned by each wireless slave machine within the third time delay;
and if the synchronization preparation completion instruction returned by any one or more wireless slaves is not received, after the third time delay is finished, sending a synchronization preparation state instruction to each wireless slave through the wireless connection again.
Preferably, the CPU processing module is further configured to start a second time delay after sending a synchronization start status instruction to each of the wireless slaves through the wireless connection; and after the second time delay is finished, receiving the acquired data sent by each wireless slave machine.
According to still another aspect of the present invention, there is provided a wireless synchronization system including:
two or more wireless slaves as in any one of the above, and one wireless master as in any one of the above; the third time of the wireless master is greater than the first time of the wireless slave.
From the above, according to the technical scheme of the present invention, the wireless slave and the wireless host establish wireless connection; receiving a synchronous preparation state instruction sent by a wireless host through wireless connection, and enabling external synchronous interruption of a CPU; receiving a synchronous starting state instruction sent by a wireless host through wireless connection, and generating an interrupt signal; and triggering external synchronous interruption of the CPU according to the interruption signal, and starting synchronous operation. According to the technical scheme, the synchronization of the plurality of wireless slaves is realized through the hardware layer interruption, so that the synchronization precision can be effectively improved, and time correction is not needed. In addition, the wireless connection mode is adopted, so that the required synchronous equipment is few, the structure is simple, the wireless signal processing time is not required to be estimated, and the routing strategy and the error condition are not required to be considered. Compared with a wired synchronization mode, the cost of a synchronization controller and a high-precision transmission line can be reduced, and the system can be suitable for various different working environments.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
fig. 1 shows a schematic flow diagram of a wireless synchronization method according to an embodiment of the invention;
fig. 2 shows a schematic flow chart of a wireless synchronization method according to another embodiment of the invention;
FIG. 3 shows a schematic diagram of a wireless slave according to one embodiment of the present invention;
FIG. 4 shows a schematic diagram of a wireless host according to one embodiment of the invention;
fig. 5 shows a schematic diagram of a wireless synchronization system according to an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 shows a schematic flow diagram of a wireless synchronization method according to an embodiment of the invention. The wireless synchronization method is applied to a wireless slave machine, as shown in fig. 1, and comprises the following steps:
step S110, a wireless connection is established with the wireless host.
The wireless slave is a specific operation object for synchronous operation, and the wireless master controls the wireless slave to realize synchronous operation of a plurality of wireless slaves. For example, in an electric power system, a wireless slave is generally a data acquisition terminal and performs specific data acquisition operation; the wireless host is a data collection terminal and controls a plurality of wireless slaves to synchronously collect data at the same time. The wireless slave and the wireless host realize data communication of the two through wireless connection, for example, the wireless slave receives a control instruction of the wireless host through wireless connection and sends data to the wireless host. The wireless connection can be realized by radio frequency antenna technology, infrared technology and the like, and the data communication between the wireless host and the wireless slave is realized by adopting the wireless connection, so that the wireless connection device has a simple structure and can adapt to different working environments.
Step S120, receiving the synchronization preparation status instruction sent by the wireless host through the wireless connection, and enabling the external synchronization interrupt of the CPU.
According to the invention, the wireless host machine sends the external interrupt request to the wireless slave machines, so that a plurality of wireless slave machines synchronously execute interrupt service programs, and synchronous operation of the wireless slave machines is realized. Therefore, it is necessary to enable the external interrupt of the wireless slave, so as to ensure that the external interrupt of the wireless slave can be triggered, and the wireless slave can respond to the external interrupt request of the wireless host. The synchronization preparation state instruction is an instruction for enabling the external interrupt of the wireless slave, and the wireless slave opens the external interrupt of the CPU according to the synchronization preparation state instruction, so that the external interrupt of the CPU can be triggered. After the external interrupt of the CPU of the wireless slave is enabled, the CPU of the wireless slave receives the external interrupt signal, namely the external interrupt of the wireless slave can be triggered, so that the wireless slave executes an external service program.
Step S130, receiving a synchronous start state instruction sent by a wireless host through wireless connection, and generating an interrupt signal; and triggering external synchronous interruption of the CPU according to the interruption signal, and starting synchronous operation.
The synchronization start state instruction is an external interrupt request sent by the wireless host to the wireless slave. The wireless slave generates an interrupt signal according to the synchronous start state instruction, and the interrupt signal triggers external interrupt of the CPU so that the CPU responds to the external interrupt request to execute an interrupt service routine. When the plurality of wireless slaves simultaneously receive the synchronization start state instruction, the CPU of each wireless slave synchronously responds to the external interrupt request to execute the interrupt service routine, and each wireless slave realizes one-time synchronous operation. The external interrupt synchronization refers to that a plurality of wireless slaves synchronously respond to the same external interrupt and synchronously execute the same external interrupt service routine.
In the specific example of the power system, when a plurality of wireless slaves are required to synchronously complete the data acquisition operation of different departments in the power system, the wireless master simultaneously sends a synchronization start state instruction of data acquisition to the plurality of wireless slaves. And triggering the external interrupt of the CPU by each wireless slave according to the synchronous start state instruction, starting to execute the data acquisition interrupt service program of the corresponding department, and synchronously carrying out data acquisition operation. The wireless slave receives the synchronous start state instruction through the wireless unit, generates an interrupt signal and inputs the interrupt signal to the CPU, and triggers the external synchronous interrupt of the CPU. The receiving of the synchronization start state instruction and the generation of the interrupt signal both occur in the hardware layer of the wireless slave, and the synchronization of a plurality of wireless slaves is realized through the hardware layer interrupt of the wireless slave, so that the synchronization precision can be effectively improved, and the time correction is not needed.
According to the wireless synchronization method of the embodiment, the wireless slave and the wireless host establish wireless connection, and the external synchronization interrupt of the CPU is enabled by receiving a synchronization preparation state instruction sent by the wireless host through the wireless connection. And after the CPU is enabled, receiving a synchronous start state instruction to generate an interrupt signal, triggering external synchronous interrupt of the CPU according to the interrupt signal, and starting synchronous operation. According to the technical scheme, the synchronization of a plurality of wireless slaves is realized through hardware layer interruption, so that the synchronization precision can be effectively improved, and time correction is not needed. In addition, the wireless connection mode is adopted, the needed synchronous equipment is few, the structure is simple, and the wireless signal processing time does not need to be estimated and the routing strategy and error condition are not considered. Compared with a wired synchronization mode, the cost of a synchronization controller and a high-precision transmission line can be reduced, and the system can be suitable for various different working environments.
In one embodiment of the present invention, in the method as shown in fig. 1, the wireless synchronization method further includes: during the synchronization operation, external synchronization interruption of the CPU is prohibited.
The synchronous operation process is a process of executing an interrupt service routine by the CPU of the wireless slave. In this process, external synchronization interruption of the wireless slave CPU is prohibited in order to ensure synchronization of each wireless slave. That is, during the synchronization operation, the external interrupt of the wireless slave CPU is in a disabled state, and no other external interrupt requests are responded.
In the above example, when a plurality of wireless slaves collect data synchronously, if one of the wireless slaves a returns to collect data in response to other external interrupt requests, the data collection of the wireless slaves a and other wireless slaves is not synchronous, so that the result of synchronous data collection is affected. Therefore, by prohibiting external synchronization interruption of the CPU, synchronization operation of the respective wireless slaves is ensured to be consistent.
In one embodiment of the present invention, in the method as shown in fig. 1, the wireless synchronization method further includes: after the external synchronization interrupt of the CPU is enabled, a synchronization preparation completion instruction is returned to the wireless host to prepare the wireless host to transmit a synchronization start state instruction.
And returning a synchronization preparation completion instruction to the wireless host, so that the wireless host confirms that the external interrupt of each wireless slave is opened, the external interrupt of the wireless slave can be triggered, the synchronization operation is accurately executed, and the synchronization accuracy of the synchronization operation is further improved. For example, the synchronous data collection work is performed by three wireless slaves, and the wireless master needs to receive synchronous preparation completion instructions of all three wireless slaves, so that external synchronous interruption of the CPU of each wireless slave can be triggered. The wireless host can then send a synchronization start status instruction. If any wireless slave does not return a synchronization preparation completion instruction, the external interrupt of the wireless slave is possibly not enabled, and the synchronization operation cannot be started. At this time, the wireless host can send the synchronization ready state instruction again, so that the wireless slave can enable the external synchronization interrupt of the CPU again.
In one embodiment of the present invention, as shown in the method of fig. 1, the synchronization ready instruction is a packet in a message format, and the packet includes a check code. Receiving a synchronization preparation state instruction sent by a wireless host through a wireless connection, and enabling external synchronization interruption of a CPU comprises: and acquiring a check code in the data packet, and enabling external synchronous interruption of the CPU after the check code is correct.
Messages are used to exchange data information when requests and responses are made between different systems. The message has a certain format, generally a preamble, a synchronous word, a data field and a check code, wherein the check code is used for checking whether the data in the message data packet is valid. In the synchronize ready state instruction, the wireless slave responds to the check code therein. The wireless slave acquires the check code in the message data packet to check, and if the check code is correct, the wireless slave immediately enables the external synchronous interrupt of the CPU to indicate that the data in the message data packet is effective data. If the verification fails, the data in the message data packet is invalid data, and external synchronous interruption of the CPU cannot be enabled.
In one embodiment of the present invention, in the method as shown in fig. 1, the wireless synchronization method further includes: starting a first time delay after enabling an external synchronization interrupt of the CPU; and if the synchronous starting state instruction is not received in the first time delay, prohibiting external synchronous interruption of the CPU after the first time delay is finished.
The first time delay is set to further ensure that the plurality of wireless slaves can synchronously respond to an external interrupt request, so that the synchronization accuracy among the plurality of wireless slaves is improved. That is, during the first time delay, an external interrupt of the CPU of the wireless slave may be triggered to an enabled state. If the wireless slave does not receive the synchronization start state instruction within the first time delay, after the first time delay is finished, external interrupt of the CPU of the wireless slave is forbidden, and the wireless slave does not respond to the external interrupt request of the wireless master any more. This requires that the wireless master broadcast a synchronization start status instruction to each wireless slave within the first time delay and ensure that each wireless slave receives it, thereby controlling the synchronization error between each wireless slave within the first time delay. The first time may be set according to circumstances, for example, 10ms, 20ms, 50ms, or the like is set.
Taking the power system as an example, the wireless host broadcasts a synchronization start state instruction to the three wireless slaves, and the first wireless slave and the second wireless slave receive the synchronization start state instruction and start synchronous operation within a first time delay of 10 ms. And if the third wireless slave machine does not receive the synchronization start state instruction within the first time delay, and the third wireless slave machine does not inhibit external synchronization interruption and receives the synchronization start state instruction to start the synchronization operation after 20ms, the synchronization operation of the third wireless slave machine is not synchronized with the first wireless slave machine and the second wireless slave machine, and the synchronization precision between the wireless slave machines is affected. Therefore, after the delay of 10ms is finished, the external synchronization of the third wireless slave is forbidden to be interrupted, and the situation can be effectively prevented.
And the wireless host can send an external interrupt request to the wireless slave again according to the synchronous operation result returned by the wireless slave, so that all the wireless slaves execute the external interrupt service routine again. For example, after disabling the external synchronization interrupt of the CPU, the wireless master may send a synchronization ready instruction again, enabling the wireless slave to enable the external synchronization interrupt of the CPU.
In one embodiment of the present invention, as shown in the method of fig. 1, the synchronization start status instruction is a packet in a message format, and the packet includes a synchronization word. In step S130, receiving, through the wireless connection, a synchronization start status instruction sent by the wireless host, and generating the interrupt signal includes: and acquiring the synchronous word in the message data packet and outputting an interrupt signal.
The synchronization start status instruction also adopts a message format which is the same as the format of the synchronization ready status instruction: preamble + sync word + data field + check code. In the sync start status instruction, the wireless slave responds to the sync word therein. The synchronization start state instruction and the synchronization preparation state instruction adopt the same format, and can be convenient for transmission and analysis. When the wireless slave receives the synchronous word, an interrupt signal is generated and input to the CPU, and external interrupt of the CPU is triggered. For example, the wireless module of the wireless slave has an interrupt output pin IRQ, the interrupt input pin IN1 of the CPU processing module is connected with the interrupt output pin IRQ of the wireless module, and the wireless module receives the synchronization start state instruction, acquires the synchronization word therein, and generates an interrupt signal. The interrupt signal is input to the terminal input pin IN1 of the CPU through the interrupt output pin IRQ, thereby triggering the external synchronous interrupt of the CPU.
In one embodiment of the present invention, in the method as shown in fig. 1, the synchronizing operation in step S130 includes: collecting data; and after the second time delay, the acquired data is sent to the wireless host.
The synchronization operation may specifically be a data acquisition operation, for example, in the specific example of the above power system, a plurality of wireless slaves are required to synchronously complete data acquisition operations of different departments in the power system, the wireless master triggers external synchronization interruption of each wireless slave, each wireless slave executes an interruption service program, and the data acquisition operation is synchronously performed. After a second time delay, the wireless slave transmits the data to the wireless master. The second time may be set according to circumstances, for example, 10ms, 20ms, etc.
Fig. 2 shows a schematic flow diagram of a wireless synchronization method according to an embodiment of the invention. The wireless synchronization method is applied to a wireless host, as shown in fig. 2, and comprises the following steps:
step S210, establishing wireless connection with at least two wireless slaves;
the wireless master communicates data with the wireless slave via a wireless connection, for example, by transmitting a control command or the like to the wireless slave via the wireless connection. The wireless connection may be implemented using radio frequency antenna technology, infrared technology, etc.
Step S220, transmitting a synchronous preparation state instruction to each wireless slave machine through wireless connection;
according to the invention, the wireless host machine sends the external interrupt request to the wireless slave machines, so that a plurality of wireless slave machines synchronously execute interrupt service programs, and synchronous operation of the wireless slave machines is realized. Therefore, it is necessary to enable the external interrupt of the wireless slave, so as to ensure that the external interrupt of the wireless slave can be triggered, and the wireless slave can respond to the external interrupt request of the wireless host. The synchronization preparation state instruction is an instruction for enabling the external interrupt of the wireless slave, the wireless host sends the synchronization preparation state instruction to the wireless slave through wireless connection, so that the wireless slave opens the external interrupt of the CPU according to the synchronization preparation state instruction, and the external interrupt of the CPU can be triggered.
In step S230, after confirming that the synchronization preparation of each wireless slave is completed, a synchronization start state command is transmitted to each wireless slave through the wireless connection.
The synchronization preparation completion refers to completing the CPU enabling of the wireless slave, and the wireless master confirms the completion of the synchronization preparation of the wireless slave, which means that the external interrupt of the CPU of the wireless slave can be triggered. At this time, an external interrupt request is sent to the wireless slave, and the wireless slave can respond to and execute a corresponding external interrupt service routine. The synchronization start state instruction is an external interrupt request sent by the wireless host to the wireless slave. The wireless slave generates an interrupt signal according to the synchronous start state instruction, and the interrupt signal triggers external interrupt of the CPU so that the CPU responds to the external interrupt request to execute an interrupt service routine.
In the wireless synchronization method of the present embodiment, a wireless master establishes wireless connection with at least two wireless slaves, and sends a synchronization preparation status instruction to each wireless slave through the wireless connection. After confirming that the synchronization preparation of each wireless slave is completed, a synchronization start state instruction is sent to each wireless slave. The wireless connection can realize the data communication of the wireless host computer and a plurality of wireless slave computers, and compared with the data communication by adopting a communication line, the wireless connection structure is simple, more convenient and efficient, and can effectively improve the synchronization precision. And the cost of the synchronous controller and the high-precision transmission line can be reduced, and the synchronous controller and the high-precision transmission line can adapt to various different working environments.
In one embodiment of the present invention, as shown in the method of fig. 2, the synchronization preparation status instruction and/or the synchronization start status instruction is a packet in a message format, and the packet is sent in a broadcast manner; the data packet contains a check code and a sync word.
Messages are used to exchange data information when requests and responses are made between different systems. The report has a certain format, and the synchronous start state instruction and the synchronous preparation state instruction adopt the same format: the preamble, the synchronous word, the data field and the check code are convenient to transmit and analyze. Of course, the synchronization start status instruction may also be in a different packet format than the synchronization ready status instruction. In the synchronous preparation state instruction, the wireless slave responds to the check code in the synchronous preparation state instruction to check whether the data in the message data packet is valid or not. The wireless slave acquires the check code in the message data packet to check, and if the check code is correct, the wireless slave immediately enables the external synchronous interrupt of the CPU to indicate that the data in the message data packet is effective data. If the verification fails, the data in the message data packet is invalid data, and external synchronous interruption of the CPU cannot be enabled. In the synchronous start state instruction, the wireless slave responds to the synchronous word and outputs an external interrupt signal to the CPU when the synchronous word is detected.
The broadcasting mode can realize that one wireless host machine simultaneously transmits message data packets to all wireless slave machines so as to synchronously trigger external interruption of each wireless slave machine.
In one embodiment of the present invention, in the method as shown in fig. 2, the wireless synchronization method further includes: after transmitting the synchronization ready state instruction to each wireless slave via the wireless connection, a third time delay is started. The step S230 of confirming that the synchronization preparation of each wireless slave is completed includes: receiving a synchronous preparation completion instruction returned by each wireless slave machine in a third time delay; if the synchronization preparation completion instruction returned by any one or more wireless slaves is not received, the synchronization preparation state instruction is sent to each wireless slave again through the wireless connection after the third time delay is finished.
After the wireless host sends the synchronous preparation state instruction, the wireless host enters a waiting state, wherein the waiting time is the delay time of the third time. The third time may be set according to practical details, for example 50ms, 1s, etc. In the waiting state, the wireless host switches to a receiving mode to receive the message returned by each wireless slave and confirm that the synchronous preparation of each wireless slave is completed. And in the time delay of the third time, the wireless host receives a synchronization preparation completion instruction returned by each wireless slave, which indicates that the external interrupt of the CPU of the wireless slave is enabled to be completed, and the wireless host can start broadcasting a synchronization start state instruction. If one or more than one wireless slave machine does not receive a synchronization preparation completion instruction returned by the wireless slave machine, the external interrupt of the CPU of the wireless slave machine is not enabled, and the synchronous operation cannot be started. Therefore, after the delay of the third time is finished, the wireless host switches to a transmission mode, and broadcasts the synchronization preparation state instruction again, so that the wireless slave enables the external synchronization interrupt of the CPU again, and the external synchronization interrupt of each wireless slave CPU is ensured to be in an enabled state. And setting the delay of the third time, limiting the waiting time of the wireless host and improving the working efficiency of the wireless host. The third time of the wireless host is longer than the first time of the wireless slave, so that the wireless host can receive the synchronization preparation completion instruction returned by the wireless slave.
In one embodiment of the present invention, in the method as shown in fig. 2, the wireless synchronization method further includes: after a synchronous start state instruction is sent to each wireless slave machine through wireless connection, starting second time delay; and after the second time delay is finished, receiving the acquired data sent by each wireless slave.
After the wireless host sends the synchronization start state instruction, the wireless host enters a waiting state again, wherein the waiting time is the delay time of the second time, and the second time delay is synchronous with the second time delay of the wireless slave. The delay time of the second time may be specifically set according to practical situations, for example, 10ms, 20ms, etc. After the delay of the second time is finished, the wireless host switches to a receiving mode, opens a receiving program and receives data collected by each wireless slave.
Fig. 3 shows a schematic structural diagram of a wireless slave according to an embodiment of the present invention. As shown in fig. 3, the wireless slave 300 includes a wireless module 310 and a CPU processing module 320 electrically connected to each other;
a wireless module 310, configured to establish a wireless connection with a wireless host; receiving a synchronous preparation state instruction sent by a wireless host through wireless connection; and receiving a synchronous start state instruction sent by the wireless host through wireless connection, and generating an interrupt signal.
A CPU processing module 320, configured to enable external synchronization interrupt of the CPU according to the synchronization preparation status instruction; and triggering external synchronous interrupt of the CPU according to the interrupt signal to start synchronous operation.
The wireless slave is a specific operation object for synchronous operation, and the wireless master controls the wireless slave to realize synchronous operation of a plurality of wireless slaves. For example, in an electric power system, a wireless slave is generally a data acquisition terminal and performs specific data acquisition operation; the wireless host is a data collection terminal and controls a plurality of wireless slaves to synchronously collect data at the same time. The wireless slave and the wireless host realize data communication of the two through wireless connection, for example, the wireless slave receives a control instruction of the wireless host through wireless connection and sends data to the wireless host. The wireless module can adopt a CC1100 system wireless module, an SI443X series wireless module or an SI446X system wireless module and the like to realize wireless connection with the wireless host. The wireless connection is adopted to realize data communication between the wireless host and the wireless slave, the structure is simple, and the wireless slave can adapt to different working environments.
According to the invention, the wireless host machine sends the external interrupt request to the wireless slave machines, so that a plurality of wireless slave machines synchronously execute interrupt service programs, and synchronous operation of the wireless slave machines is realized. Therefore, it is necessary to enable the external interrupt of the wireless slave, so as to ensure that the external interrupt of the wireless slave can be triggered, and the wireless slave can respond to the external interrupt request of the wireless host. The synchronization preparation state instruction is an instruction for enabling the external interrupt of the wireless slave, and the wireless slave opens the external interrupt of the CPU according to the synchronization preparation state instruction, so that the external interrupt of the CPU can be triggered. After the external interrupt of the CPU of the wireless slave is enabled, the CPU of the wireless slave receives the external interrupt signal, namely the external interrupt of the wireless slave can be triggered, so that the wireless slave executes an external service program.
The synchronization start state instruction is an external interrupt request sent by the wireless host to the wireless slave. The wireless module 310 generates an interrupt signal according to the synchronization start state instruction, and the CPU processing module 320 triggers an external interrupt of the CPU according to the interrupt signal, so that the CPU executes an interrupt service routine in response to the external interrupt request. When the plurality of wireless slaves simultaneously receive the synchronization start state instruction, the CPU of each wireless slave synchronously responds to the external interrupt request to execute the interrupt service routine, and each wireless slave realizes one-time synchronous operation. The external interrupt synchronization refers to that a plurality of wireless slaves synchronously respond to the same external interrupt and synchronously execute the same external interrupt service routine.
In the specific example of the power system, when a plurality of wireless slaves are required to synchronously complete the data acquisition operation of different departments in the power system, the wireless master simultaneously sends a synchronization start state instruction of data acquisition to the plurality of wireless slaves. And triggering the external interrupt of the CPU by each wireless slave according to the synchronous start state instruction, starting to execute the data acquisition interrupt service program of the corresponding department, and synchronously carrying out data acquisition operation. The wireless slave receives the synchronous start state instruction through the wireless unit, generates an interrupt signal and inputs the interrupt signal to the CPU, and triggers the external synchronous interrupt of the CPU. The receiving of the synchronization start state instruction and the generation of the interrupt signal both occur in the hardware layer of the wireless slave, and the synchronization of a plurality of wireless slaves is realized through the hardware layer interrupt of the wireless slave, so that the synchronization precision can be effectively improved, and the time correction is not needed.
The wireless slave 300 of the present embodiment establishes a wireless connection with a wireless host through the wireless module 310; the CPU processing unit 320 receives a synchronization ready instruction sent by the wireless host through the wireless connection, and enables external synchronization interrupt of the CPU according to the synchronization ready instruction. After enabling, receiving a synchronous starting state instruction sent by a wireless host through wireless connection, and generating an interrupt signal; the CPU processing unit 320 triggers an external synchronization interrupt of the CPU according to the interrupt signal, and starts a synchronization operation. According to the technical scheme, the synchronization of a plurality of wireless slaves is realized through hardware layer interruption, so that the synchronization precision can be effectively improved, and time correction is not needed. In addition, the wireless connection mode is adopted, the needed synchronous equipment is few, the structure is simple, and the wireless signal processing time does not need to be estimated and the routing strategy and error condition are not considered. Compared with a wired synchronization mode, the cost of a synchronization controller and a high-precision transmission line can be reduced, and the system can be suitable for various different working environments.
In one embodiment of the invention. In the wireless slave 300 shown in fig. 3, the CPU processing module 320 is further configured to prohibit external synchronization interruption of the CPU during the synchronization operation.
The synchronous operation process is a process of executing an interrupt service routine by the CPU of the wireless slave. In this process, the CPU processing module 320 prohibits external synchronization interrupts of the wireless slave CPU in order to ensure synchronization of the wireless slaves. That is, during the synchronization operation, the external interrupt of the wireless slave CPU is in a disabled state, and no other external interrupt requests are responded.
In the above example, when a plurality of wireless slaves collect data synchronously, if one of the wireless slaves a returns to collect data in response to other external interrupt requests, the data collection of the wireless slaves a and other wireless slaves is not synchronous, so that the result of synchronous data collection is affected. Therefore, by prohibiting external synchronization interruption of the CPU, synchronization operation of the respective wireless slaves is ensured to be consistent.
In one embodiment of the invention. In the wireless slave 300 shown in fig. 3, the wireless module 310 is further configured to return a synchronization preparation completion instruction to the wireless host after the external synchronization of the CPU is enabled, so that the wireless host prepares to send a synchronization start status instruction.
And returning a synchronization preparation completion instruction to the wireless host, so that the wireless host confirms that the external interrupt of each wireless slave is opened, the external interrupt of the wireless slave can be triggered, the synchronization operation is accurately executed, and the synchronization accuracy of the synchronization operation is further improved. For example, the synchronous data collection work is performed by three wireless slaves, and the wireless master needs to receive synchronous preparation completion instructions of all three wireless slaves, so that external synchronous interruption of the CPU of each wireless slave can be triggered. The wireless host can then send a synchronization start status instruction. If any wireless slave does not return a synchronization preparation completion instruction, the external interrupt of the wireless slave is possibly not enabled, and the synchronization operation cannot be started. At this time, the wireless host can send the synchronization ready state instruction again, so that the wireless slave can enable the external synchronization interrupt of the CPU again.
In one embodiment of the invention. In the wireless slave 300 shown in fig. 3, the synchronization preparation status instruction is a packet in a message format, and the packet includes a check code; the CPU processing module 320 is configured to obtain a check code in the data packet, and enable external synchronization interrupt of the CPU after the check code is correct.
Messages are used to exchange data information when requests and responses are made between different systems. The message has a certain format, generally a preamble, a synchronous word, a data field and a check code, wherein the check code is arranged at the tail end of the message and is used for checking whether the data in the message data packet is valid or not. In the synchronize ready state instruction, the wireless slave responds to the check code therein. Specifically, the CPU processing module 320 obtains the check code in the packet to check, and if the check is correct, it indicates that the data in the packet is valid data, and the CPU processing module can immediately interrupt external synchronization of the CPU. If the verification fails, the data in the message data packet is invalid data, and external synchronous interruption of the CPU cannot be enabled.
In one embodiment of the invention. In the wireless slave 300 shown in fig. 3, the CPU processing module 320 is further configured to start a first time delay after the external synchronization interrupt of the CPU is enabled; and if the synchronous starting state instruction is not received in the first time delay, prohibiting external synchronous interruption of the CPU after the first time delay is finished.
The first time delay is set to further ensure that the plurality of wireless slaves can synchronously respond to an external interrupt request, so that the synchronization accuracy among the plurality of wireless slaves is improved. That is, during the first time delay, an external interrupt of the CPU of the wireless slave may be triggered to an enabled state. If the wireless slave does not receive the synchronization start state instruction within the first time delay, after the first time delay is finished, external interrupt of the CPU of the wireless slave is forbidden, and the wireless slave does not respond to the external interrupt request of the wireless master any more. This requires that the wireless master broadcast a synchronization start status instruction to each wireless slave within the first time delay and ensure that each wireless slave receives it, thereby controlling the synchronization error between each wireless slave within the first time delay. The first time may be set according to circumstances, for example, 10ms, 20ms, 50ms, or the like is set.
Taking the power system as an example, the wireless host broadcasts a synchronization start state instruction to the three wireless slaves, and the first wireless slave and the second wireless slave receive the synchronization start state instruction and start synchronous operation within a first time delay of 10 ms. And if the third wireless slave machine does not receive the synchronization start state instruction within the first time delay, and the third wireless slave machine does not inhibit external synchronization interruption and receives the synchronization start state instruction to start the synchronization operation after 20ms, the synchronization operation of the third wireless slave machine is not synchronized with the first wireless slave machine and the second wireless slave machine, and the synchronization precision between the wireless slave machines is affected. Therefore, after the delay of 10ms is finished, the external synchronization of the third wireless slave is forbidden to be interrupted, and the situation can be effectively prevented.
And the wireless host can send an external interrupt request to the wireless slave again according to the synchronous operation result returned by the wireless slave, so that all the wireless slaves execute the external interrupt service routine again. For example, after disabling the external synchronization interrupt of the CPU, the wireless master may send a synchronization ready instruction again, enabling the wireless slave to enable the external synchronization interrupt of the CPU.
In one embodiment of the invention. In the wireless slave 300 shown in fig. 3, the synchronization start status instruction is a packet in a message format, and the packet includes a synchronization word. The wireless module 310 is configured to obtain the sync word in the packet and output an interrupt signal.
The synchronization start status instruction also adopts a message format which is the same as the format of the synchronization ready status instruction: the preamble, the synchronous word, the data field and the check code adopt the same format, so that the transmission and the analysis can be facilitated. In the sync start status instruction, the wireless slave corresponds to the sync word therein. Specifically, the wireless module 310 generates an interrupt signal when receiving the sync word, and triggers an external interrupt of the CPU according to the interrupt signal. For example, the wireless module 310 of the wireless slave has an interrupt output pin IRQ, the interrupt input pin IN1 of the CPU processing module 320 is connected to the interrupt output pin IRQ of the wireless module 310, and the wireless module 310 receives the synchronization start state instruction, acquires the synchronization word therein, and generates an interrupt signal. The interrupt signal is input to the interrupt input pin IN1 of the CPU processing module 320 through the interrupt output pin IRQ, thereby triggering an external synchronous interrupt of the CPU.
In one embodiment of the invention. In the wireless slave 300 shown in fig. 3, the wireless slave further includes a synchronous operation module, and the synchronous operation module is electrically connected to the CPU processing module 320. The synchronous operation module is used for collecting data; the CPU processing module 320 is further configured to send the collected data to the wireless host through the wireless connection after the second time delay.
The synchronization operation may specifically be a data acquisition operation, for example, in the specific example of the above power system, a plurality of wireless slaves are required to synchronously complete data acquisition operations of different departments in the power system, the wireless master triggers external synchronization interruption of each wireless slave, each wireless slave executes an interruption service program, and the data acquisition operation is synchronously performed. After a second time delay, the wireless slave transmits the data to the wireless master. The second time may be set according to circumstances, for example, 10ms, 20ms, etc.
Fig. 4 shows a schematic diagram of a wireless host according to an embodiment of the present invention. As shown in fig. 4, the wireless host 400 includes a wireless module 410 and a CPU processing module 420 electrically connected to each other.
A wireless module 410, configured to establish a wireless connection with at least two wireless slaves.
The wireless host establishes a wireless connection with the wireless slave through the wireless module 410 for data communication. For example, a control command or the like is transmitted to the wireless slave via a wireless connection. The wireless module can adopt a CC1100 system wireless module, an SI443X series wireless module or an SI446X system wireless module and the like to realize wireless connection with a plurality of wireless hosts.
The CPU processing module 420 is configured to send a synchronization ready state instruction to each wireless slave through a wireless connection; after confirming that the synchronization preparation of each wireless slave is completed, a synchronization start state instruction is transmitted to each wireless slave through a wireless connection.
According to the invention, the wireless host machine sends the external interrupt request to the wireless slave machines, so that a plurality of wireless slave machines synchronously execute interrupt service programs, and synchronous operation of the wireless slave machines is realized. Therefore, it is necessary to enable the external interrupt of the wireless slave, so as to ensure that the external interrupt of the wireless slave can be triggered, and the wireless slave can respond to the external interrupt request of the wireless host. The synchronization preparation state instruction is an instruction for enabling the external interrupt of the wireless slave, the wireless host sends the synchronization preparation state instruction to the wireless slave through wireless connection, so that the wireless slave opens the external interrupt of the CPU according to the synchronization preparation state instruction, and the external interrupt of the CPU can be triggered.
The synchronization preparation completion refers to completing the CPU enabling of the wireless slave, and the wireless master confirms the completion of the synchronization preparation of the wireless slave, which means that the external interrupt of the CPU of the wireless slave can be triggered. At this time, an external interrupt request is sent to the wireless slave, and the wireless slave can respond to and execute a corresponding external interrupt service routine. The synchronization start state instruction is an external interrupt request sent by the wireless host to the wireless slave. The wireless slave generates an interrupt signal according to the synchronous start state instruction, and the interrupt signal triggers external interrupt of the CPU so that the CPU responds to the external interrupt request to execute an interrupt service routine.
In the wireless host 400 of the present embodiment, a wireless connection is established with at least two wireless slaves through the wireless module 410, and the CPU processing module 420 sends a synchronization preparation status instruction to each wireless slave through the wireless connection. After confirming that the synchronization preparation of each wireless slave is completed, a synchronization start state instruction is sent to each wireless slave through wireless connection. The wireless connection can realize the data communication of the wireless host computer and a plurality of wireless slave computers, and compared with the data communication by adopting a communication line, the wireless connection structure is simple, more convenient and efficient, and can effectively improve the synchronization precision. And the cost of the synchronous controller and the high-precision transmission line can be reduced, and the synchronous controller and the high-precision transmission line can adapt to various different working environments.
In one embodiment of the present invention, in the wireless host shown in fig. 4, the synchronization preparation status instruction and/or the synchronization start status instruction is a packet in a message format, and the packet is sent in a broadcast manner; the data packet contains a check code and a sync word.
Messages are used to exchange data information when requests and responses are made between different systems. The report has a certain format, and the synchronous start state instruction and the synchronous preparation state instruction adopt the same format: the preamble, the synchronous word, the data field and the check code are convenient to transmit and analyze. The wireless slave responds to the check code in the synchronous preparation state instruction to check whether the data in the message data packet is valid or not. The wireless slave acquires the check code in the message data packet to check, and if the check code is correct, the wireless slave immediately enables the external synchronous interrupt of the CPU to indicate that the data in the message data packet is effective data. If the verification fails, the data in the message data packet is invalid data, and external synchronous interruption of the CPU cannot be enabled. In the synchronous start state instruction, the wireless slave responds to the synchronous word and outputs an external interrupt signal to the CPU when the synchronous word is detected.
The broadcasting mode can realize that one wireless host machine simultaneously transmits message data packets to all wireless slave machines so as to synchronously trigger external interruption of each wireless slave machine.
In one embodiment of the present invention, as in the wireless host shown in fig. 4, the CPU processing module 420 is further configured to start a third time delay after sending a synchronization ready instruction to each wireless slave through the wireless connection; receiving a synchronous preparation completion instruction returned by each wireless slave machine in a third time delay; if the synchronization preparation completion instruction returned by any one or more wireless slaves is not received, the synchronization preparation state instruction is sent to each wireless slave again through the wireless connection after the third time delay is finished.
After the wireless host sends the synchronous preparation state instruction, the wireless host enters a waiting state, wherein the waiting time is the delay time of the third time. The third time may be set according to practical details, for example 50ms, 1s, etc. In the waiting state, the wireless host switches to a receiving mode to receive the message returned by each wireless slave and confirm that the synchronous preparation of each wireless slave is completed. And in the time delay of the third time, the wireless host receives a synchronization preparation completion instruction returned by each wireless slave, which indicates that the external interrupt of the CPU of the wireless slave is enabled to be completed, and the wireless host can start broadcasting a synchronization start state instruction. If one or more than one wireless slave machine does not receive a synchronization preparation completion instruction returned by the wireless slave machine, the external interrupt of the CPU of the wireless slave machine is not enabled, and the synchronous operation cannot be started. Therefore, after the delay of the third time is finished, the wireless host switches to a transmission mode, and broadcasts the synchronization preparation state instruction again, so that the wireless slave enables the external synchronization interrupt of the CPU again, and the external synchronization interrupt of each wireless slave CPU is ensured to be in an enabled state. And setting the delay of the third time, limiting the waiting time of the wireless host and improving the working efficiency of the wireless host. The third time of the wireless host is longer than the first time of the wireless slave, so that the wireless host can receive the synchronization preparation completion instruction returned by the wireless slave.
In one embodiment of the present invention, as in the wireless host shown in fig. 4, the CPU processing module 420 is further configured to start a second time delay after sending a synchronization start status instruction to each wireless slave through the wireless connection; and after the second time delay is finished, receiving the acquired data sent by each wireless slave.
After the wireless host sends the synchronization start state instruction, the wireless host enters a waiting state again, wherein the waiting time is the delay time of the second time, and the second time delay is synchronous with the second time delay of the wireless slave. The delay time of the second time may be specifically set according to practical situations, for example, 10ms, 20ms, etc. After the delay of the second time is finished, the wireless host switches to a receiving mode, opens a receiving program and receives data collected by each wireless slave.
Fig. 5 shows a schematic diagram of a wireless synchronization system according to an embodiment of the invention. As shown in fig. 5, the wireless synchronization system 500 includes: two or more wireless slaves 300 as described in any one of the above, and a wireless master 400 as described in any one of the above; the third time of the wireless master is greater than the first time of the wireless slave.
In the wireless synchronization system 500, each wireless slave 300 communicates data with the wireless master 400, thereby realizing a wireless synchronization method. The specific structure, function and data communication manner of the wireless slave 300 and the wireless master 400 are referred to the above embodiments, and are not described herein.
In summary, in the wireless synchronization method of the present invention, the wireless slave establishes a wireless connection with the wireless host, and receives the synchronization ready command sent by the wireless host through the wireless connection to enable the external synchronization interrupt of the CPU. And after the wireless host computer is enabled, receiving a synchronous starting state instruction sent by the wireless host computer to generate an interrupt signal, triggering external synchronous interrupt of the CPU according to the interrupt signal, and starting synchronous operation. According to the technical scheme, the synchronization of a plurality of wireless slaves is realized through hardware layer interruption, so that the synchronization precision can be effectively improved, and time correction is not needed. In addition, the wireless connection mode is adopted, the needed synchronous equipment is few, the structure is simple, and the wireless signal processing time does not need to be estimated and the routing strategy and error condition are not considered. Compared with a wired synchronization mode, the cost of a synchronization controller and a high-precision transmission line can be reduced, and the system can be suitable for various different working environments.
The foregoing is merely a specific embodiment of the invention and other modifications and variations can be made by those skilled in the art in light of the above teachings. It is to be understood by persons skilled in the art that the foregoing detailed description is provided for the purpose of illustrating the invention more fully, and that the scope of the invention is defined by the appended claims.
Claims (9)
1. A wireless synchronization method applied to a wireless slave, the method comprising:
establishing wireless connection with a wireless host;
receiving a synchronization preparation state instruction sent by the wireless host through the wireless connection, and enabling external synchronization interruption of a CPU, wherein the synchronization preparation state instruction is an instruction for enabling external interruption of a wireless slave;
receiving a synchronous starting state instruction sent by the wireless host through the wireless connection, and generating an interrupt signal, wherein the synchronous starting state instruction is an external interrupt request sent by the wireless host to the wireless slave;
triggering external synchronous interrupt of the CPU according to the interrupt signal, and starting synchronous operation, wherein the synchronous operation comprises the following steps: collecting data; when a plurality of wireless slaves are required to synchronously complete data acquisition operations of different departments in the power system, the wireless master simultaneously sends a synchronous start state instruction of data acquisition to the plurality of wireless slaves, and each wireless slave triggers external interrupt of a CPU according to the synchronous start state instruction to start executing a data acquisition interrupt service program of the corresponding department and synchronously acquire data operation;
the method further comprises the steps of:
After the wireless host sends a synchronous preparation state instruction to each wireless slave machine through the wireless connection, starting third time delay;
the step of confirming that the synchronization preparation of each wireless slave machine is completed comprises the following steps: receiving a synchronization preparation completion instruction returned by each wireless slave machine within the third time delay by the wireless host machine;
if the synchronization preparation completion instruction returned by any one or more than one wireless slave machine is not received, after the third time delay is finished, sending a synchronization preparation state instruction to each wireless slave machine through the wireless connection again;
starting a first time delay after enabling an external synchronization interrupt of the CPU;
if the synchronous starting state instruction is not received in the first time delay, prohibiting external synchronous interruption of the CPU after the first time delay is finished;
and after the second time delay, the acquired data are sent to the wireless host.
2. The method according to claim 1, wherein the method further comprises:
during the synchronization operation, external synchronization interruption of the CPU is prohibited.
3. The method according to claim 1, characterized in that the method further comprises:
After the external synchronization interrupt of the CPU is enabled, a synchronization preparation completion instruction is returned to the wireless host, so that the wireless host prepares to send a synchronization start state instruction.
4. The method of claim 1, wherein the synchronization readiness instruction is a packet in a message format, the packet including a check code;
the receiving, by the wireless connection, a synchronization ready instruction sent by the wireless host, and enabling external synchronization interruption of the CPU includes:
and acquiring a check code in the data packet, and enabling external synchronous interruption of the CPU after the check code is correct.
5. A wireless synchronization method applied to a wireless host, the method comprising:
establishing wireless connection with at least two wireless slaves;
transmitting a synchronization preparation state instruction to each wireless slave machine through the wireless connection, wherein the synchronization preparation state instruction is an instruction for enabling external interruption of the wireless slave machine;
after confirming that the synchronization preparation of each wireless slave machine is completed, transmitting a synchronization start state instruction to each wireless slave machine through the wireless connection, wherein the synchronization start state instruction is an external interrupt request transmitted by a wireless host machine to the wireless slave machine;
When a plurality of wireless slaves are required to synchronously complete data acquisition operations of different departments in the power system, the wireless master simultaneously sends a synchronous start state instruction of data acquisition to the plurality of wireless slaves, and each wireless slave triggers external interrupt of a CPU according to the synchronous start state instruction to start executing a data acquisition interrupt service program of the corresponding department and synchronously acquire data operation;
the method further comprises the steps of:
after a synchronization preparation state instruction is sent to each wireless slave machine through the wireless connection, starting third time delay;
the step of confirming that the synchronization preparation of each wireless slave machine is completed comprises the following steps: receiving a synchronous preparation completion instruction returned by each wireless slave machine within the third time delay;
if the synchronization preparation completion instruction returned by any one or more than one wireless slave machine is not received, after the third time delay is finished, sending a synchronization preparation state instruction to each wireless slave machine through the wireless connection again;
starting a first time delay after enabling an external synchronization interrupt of the CPU;
if the synchronous starting state instruction is not received in the first time delay, prohibiting external synchronous interruption of the CPU after the first time delay is finished;
After a synchronous start state instruction is sent to each wireless slave machine through the wireless connection, starting second time delay;
and after the second time delay is finished, receiving the acquired data sent by each wireless slave machine.
6. The method according to claim 5, wherein the synchronization preparation status instruction and/or the synchronization start status instruction is a packet in a message format, and the packet is sent in a broadcast manner;
the data packet comprises a check code and a synchronous word.
7. The wireless slave machine is characterized by comprising a wireless module and a CPU processing module which are mutually and electrically connected;
the wireless module is used for establishing wireless connection with the wireless host; receiving a synchronization preparation state instruction sent by the wireless host through the wireless connection, wherein the synchronization preparation state instruction is an instruction for enabling external interruption of the wireless slave; receiving a synchronous starting state instruction sent by the wireless host through the wireless connection, and generating an interrupt signal, wherein the synchronous starting state instruction is an external interrupt request sent by the wireless host to the wireless slave;
the CPU processing module is used for enabling external synchronous interruption of the CPU according to the synchronous preparation state instruction; and triggering external synchronous interrupt of the CPU according to the interrupt signal to start synchronous operation, wherein the synchronous operation comprises the following steps: collecting data; when a plurality of wireless slaves are required to synchronously complete data acquisition operations of different departments in the power system, the wireless master simultaneously sends a synchronous start state instruction of data acquisition to the plurality of wireless slaves, and each wireless slave triggers external interrupt of a CPU according to the synchronous start state instruction to start executing a data acquisition interrupt service program of the corresponding department and synchronously acquire data operation;
The CPU processing module is also used for starting a first time delay after external synchronization interrupt of the CPU is enabled; if the synchronous starting state instruction is not received in the first time delay, prohibiting external synchronous interruption of the CPU after the first time delay is finished;
and after the second time delay, the acquired data is sent to the wireless host through wireless connection.
8. The wireless host is characterized by comprising a wireless module and a CPU processing module which are mutually and electrically connected;
the wireless module is used for establishing wireless connection with at least two wireless slaves;
the CPU processing module is used for sending a synchronous preparation state instruction to each wireless slave machine through the wireless connection, wherein the synchronous preparation state instruction is an instruction for enabling external interrupt of the wireless slave machine; after confirming that the synchronization preparation of each wireless slave machine is completed, transmitting a synchronization start state instruction to each wireless slave machine through the wireless connection, wherein the synchronization start state instruction is an external interrupt request transmitted by a wireless host machine to the wireless slave machine; when a plurality of wireless slaves are required to synchronously complete data acquisition operations of different departments in the power system, the wireless master simultaneously sends a synchronous start state instruction of data acquisition to the plurality of wireless slaves, and each wireless slave triggers external interrupt of a CPU according to the synchronous start state instruction to start executing a data acquisition interrupt service program of the corresponding department and synchronously acquire data operation;
The CPU processing module is also used for starting third time delay after sending a synchronous preparation state instruction to each wireless slave machine through the wireless connection; receiving a synchronous preparation completion instruction returned by each wireless slave machine within the third time delay;
if the synchronization preparation completion instruction returned by any one or more than one wireless slave machine is not received, after the third time delay is finished, sending a synchronization preparation state instruction to each wireless slave machine through the wireless connection again;
after a synchronous start state instruction is sent to each wireless slave machine through the wireless connection, starting second time delay; and after the second time delay is finished, receiving the acquired data sent by each wireless slave machine.
9. A wireless synchronization system, the system comprising:
two or more wireless slaves as recited in claim 7, and one wireless master as recited in claim 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811533731.7A CN109586832B (en) | 2018-12-14 | 2018-12-14 | Wireless synchronization method, wireless slave, wireless master and wireless synchronization system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811533731.7A CN109586832B (en) | 2018-12-14 | 2018-12-14 | Wireless synchronization method, wireless slave, wireless master and wireless synchronization system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109586832A CN109586832A (en) | 2019-04-05 |
CN109586832B true CN109586832B (en) | 2023-11-14 |
Family
ID=65928073
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811533731.7A Active CN109586832B (en) | 2018-12-14 | 2018-12-14 | Wireless synchronization method, wireless slave, wireless master and wireless synchronization system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109586832B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113110140B (en) * | 2021-03-26 | 2022-09-23 | 苏州振畅智能科技有限公司 | Execution method of instruction synchronization system based on 5G and satellite time service |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101610145A (en) * | 2009-07-03 | 2009-12-23 | 中兴通讯股份有限公司 | A kind of method and system of realizing the Synchronization Control of distributed system |
CN103326802A (en) * | 2013-05-31 | 2013-09-25 | 燕山大学 | Wireless network system for achieving synchronous acquisition, synchronous acquisition device and method |
CN103810828A (en) * | 2012-11-09 | 2014-05-21 | 中国科学院沈阳计算技术研究所有限公司 | Wireless communication system and method for Internet-of-Things aggregation node of machine tool |
CN105024892A (en) * | 2015-06-09 | 2015-11-04 | 上海冉能自动化科技有限公司 | A method and system realizing wireless communication between an instrument and a host computer |
CN105578383A (en) * | 2015-05-25 | 2016-05-11 | 上海归墟电子科技有限公司 | 2.4G-based networking communication system and communication method |
CN209072511U (en) * | 2018-12-14 | 2019-07-05 | 广州智光自动化有限公司 | A kind of wireless slave, wireless host and wireless synchronization master |
-
2018
- 2018-12-14 CN CN201811533731.7A patent/CN109586832B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101610145A (en) * | 2009-07-03 | 2009-12-23 | 中兴通讯股份有限公司 | A kind of method and system of realizing the Synchronization Control of distributed system |
CN103810828A (en) * | 2012-11-09 | 2014-05-21 | 中国科学院沈阳计算技术研究所有限公司 | Wireless communication system and method for Internet-of-Things aggregation node of machine tool |
CN103326802A (en) * | 2013-05-31 | 2013-09-25 | 燕山大学 | Wireless network system for achieving synchronous acquisition, synchronous acquisition device and method |
CN105578383A (en) * | 2015-05-25 | 2016-05-11 | 上海归墟电子科技有限公司 | 2.4G-based networking communication system and communication method |
CN105024892A (en) * | 2015-06-09 | 2015-11-04 | 上海冉能自动化科技有限公司 | A method and system realizing wireless communication between an instrument and a host computer |
CN209072511U (en) * | 2018-12-14 | 2019-07-05 | 广州智光自动化有限公司 | A kind of wireless slave, wireless host and wireless synchronization master |
Also Published As
Publication number | Publication date |
---|---|
CN109586832A (en) | 2019-04-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP2822228B1 (en) | Industrial network apparatus and data communication method | |
CN110149260B (en) | Time-triggered bus cluster starting and restarting method and device | |
CN113490218B (en) | Pairing method, pairing device, bluetooth remote controller, intelligent device and storage medium | |
JPH10145276A (en) | Ad hoc network system and its connecting method | |
CN109996325B (en) | Clock synchronization system and method of wireless sensor network | |
CN111107528A (en) | Bluetooth test method and test machine | |
WO2017118002A1 (en) | Method and system for synchronization between robot and server | |
CN111708296A (en) | Synchronous control and data voting method based on two-channel safety PLC | |
CN109586832B (en) | Wireless synchronization method, wireless slave, wireless master and wireless synchronization system | |
CN209072511U (en) | A kind of wireless slave, wireless host and wireless synchronization master | |
CN109768850B (en) | Vehicle-mounted communication method and system | |
CN112817886B (en) | Master-slave communication method and device based on SPI | |
CN114826812A (en) | Method and system for realizing RS485 communication multiple master stations | |
EP3796693B1 (en) | Method, apparatus, terminal and storage medium for sending measurement report | |
CN116506096B (en) | Clock synchronization method, system, component and equipment | |
CN109274763B (en) | Information synchronization method and dual-computer hot standby equipment | |
JP2011034559A (en) | Image forming apparatus, energy saving transition return control method, and energy saving transition return control program | |
CN113821074A (en) | Time synchronization method and device, electronic equipment and storage medium | |
CN102013918B (en) | Method, system and device for transmitting data | |
CN105208070A (en) | Automotive remote information processing system and method thereof | |
CN112363962B (en) | Data communication method, system, electronic device and computer storage medium | |
CN103338101B (en) | Data synchronization implementing method | |
CN115208711A (en) | Ad-hoc network method of intelligent equipment | |
JPH086615A (en) | Data linking method | |
CN118316562A (en) | Clock synchronization method of dual-mode communication module |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |