Instruction execution method and device, electronic equipment and storage medium

By adjusting the system timer count value of the master and slave devices in the group control system, we ensure that the instructions are sent and executed when synchronization is reached, solving the synchronization problem caused by network delay and achieving simultaneous execution of the master and slave devices.

CN119225818APending Publication Date: 2024-12-31GUANGDONG LEHUA HOME FURNISHING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411129646.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In the group control system, due to network transmission time consumption and other reasons, the master and slave devices cannot guarantee execution of instructions at the same time.

Method used

By setting the system timer on the master and slave devices, adjusting the count value of the timer, synchronizing it, obtaining the target send count value and the target delay count value, determining the device execution count value, and sending it when the timer reaches the value Instructions, causing the slave to execute the instructions at the same time.

Benefits of technology

The master and slave devices execute instructions at the same time are implemented, solving the synchronization problem caused by network delay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225818A_ABST
    Figure CN119225818A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an instruction execution method and device, electronic equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: acquiring a first count value of a first system timer, and acquiring at least one second count value of each second system timer; and adjusting the first system timer and the second system timer according to the first count value and the second count value, so that the adjusted count values are the same. And determining a target sending count value according to the instruction sending mode information, and obtaining a target delay count value. And determining an equipment execution count value according to the target sending count value, the target delay count value and a pre-design value. A target instruction is generated, when the count value of the first system timer reaches a preset value, the target instruction and the device execution count value are sent to each slave device, and when the system timers of the master device and the slave devices reach the device execution count value, the target instruction is executed at the same time. The problem that master equipment and slave equipment cannot execute instructions at the same time point is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an instruction execution method, device, electronic device and storage medium. Background Art

[0002] The group control system includes a master device and at least one slave device. In the group control system, the master device needs to send instructions to at least one slave device and execute the instructions simultaneously with the slave device. For example, the group control system is a video playback system, and the master device and at least one slave device are spliced ​​into an integral screen for playing videos. When the master device plays the first frame of the image, the instruction to play the first frame of the image is synchronized to multiple slave devices, so that the slave devices and the master device execute the instruction simultaneously. However, due to reasons such as time-consuming network transmission, the instructions of the master device and at least one slave device cannot be guaranteed to be executed at the same time. Therefore, how to achieve the simultaneous execution of the instructions of the master device and at least one slave device has become a technical problem that needs to be solved urgently. Summary of the invention

[0003] The main purpose of the embodiments of the present application is to propose an instruction execution method, apparatus, electronic device and storage medium, aiming to enable the simultaneous execution of instructions of a master device and at least one slave device.

[0004] To achieve the above-mentioned object, a first aspect of an embodiment of the present application provides an instruction execution method, which is applied to a master device, wherein the master device is communicatively connected to at least one slave device, a first system timer is set on the master device, and a second system timer is set on the slave device, wherein the method comprises:

[0005] Obtaining a current count value of the first system timer to obtain a first count value, and obtaining a current count value of each of the second system timers to obtain at least one second count value;

[0006] Adjusting the count values ​​of the first system timer and the second system timer respectively according to the first count value and the second count value; wherein the count values ​​of the first system timer and the second system timer after adjustment are the same;

[0007] Acquire instruction sending mode information, and determine a target sending count value according to the instruction sending mode information; wherein the target sending count value is a count value required for the master device to send instructions to all the slave devices;

[0008] Obtaining a target delay count value; wherein the target delay count value is a maximum delay count value required for the master device to send an instruction to each of the slave devices;

[0009] Determine the device execution count value according to the target sending count value, the target delay count value and the pre-designed value; wherein the preset count value is the count value of the first system timer when sending the target instruction;

[0010] Generate a target instruction, and when the count value of the first system timer reaches the pre-designed value, send the target instruction and the device execution count value to each of the slave devices, so that the slave device executes the target instruction when the count value of the second system timer reaches the device execution count value;

[0011] The target instruction is executed when the count value of the first system timer reaches the device execution count value.

[0012] In some embodiments, adjusting the count values ​​of the first system timer and the second system timer according to the first count value and the second count value respectively includes:

[0013] Selecting a count value according to the first count value and at least one of the second count values ​​to obtain a target count value;

[0014] The count values ​​of the first system timer and the second system timer are adjusted respectively according to the target count value.

[0015] In some embodiments, adjusting the count values ​​of the first system timer and the second system timer respectively according to the target count value includes:

[0016] Obtaining a difference between the target count value and the first count value to obtain a first difference;

[0017] Obtaining a difference between the target count value and the second count value to obtain a second difference value;

[0018] The count value of the first system timer is adjusted according to the first difference, and the count value of the second system timer is adjusted according to the second difference.

[0019] In some embodiments, obtaining the current count value of the first system timer to obtain the first count value, and obtaining the current count value of each of the second system timers to obtain at least one second count value includes:

[0020] Sending a query instruction to the slave device, and recording a count value of the first system timer when sending the query instruction, to obtain the first count value;

[0021] receiving a first message returned by the slave device according to the query instruction; wherein the first message includes a third count value, and the third count value is the count value of the second system timer when the slave device receives the query instruction;

[0022] Acquire a count value of the first system timer when the first message is received to obtain a fourth count value;

[0023] The second count value is determined according to the first count value, the third count value and the fourth count value.

[0024] In some embodiments, the instruction sending mode information includes polling sending mode information or broadcast sending mode information, and obtaining the instruction sending mode information and determining the target sending count value according to the instruction sending mode information includes:

[0025] If the instruction sending mode information is the polling sending mode information, obtaining a sending interval count value of sending instructions to each of the slave devices, and determining the target sending count value according to each of the sending interval count values;

[0026] If the instruction sending mode information is the broadcast sending mode information, the target sending count value is zero.

[0027] In some embodiments, obtaining the target delay count value includes:

[0028] Sending a test instruction to each of the slave devices, and recording the count value of the first system timer when sending the test instruction, to obtain a fifth count value;

[0029] receiving a second message returned by the slave device according to the test instruction, and recording a count value of the first system timer when the second message is received to obtain a sixth count value;

[0030] Determine the delay count value of the slave device according to the fifth count value and the sixth count value to obtain a candidate delay count value;

[0031] Each of the candidate delay count values ​​is sorted, and the largest candidate delay count value is used as the target delay count value.

[0032] In some embodiments, determining the device execution count value according to the target sending count value, the target delay count value and the pre-designed value includes:

[0033] Obtaining a sum of the target sending count value, the target delay count value and the pre-designed value to obtain an expected execution count value;

[0034] The device execution count value is determined according to the expected execution count value; wherein the device execution count value is greater than or equal to the expected execution count value.

[0035] To achieve the above-mentioned object, a second aspect of an embodiment of the present application provides an instruction execution device, which is applied to a master device, wherein the master device is communicatively connected to at least one slave device, a first system timer is set on the master device, and a second system timer is set on the slave device, wherein the device comprises:

[0036] A first acquisition module, configured to acquire a current count value of the first system timer to obtain a first count value, and acquire a current count value of each of the second system timers to obtain at least one second count value;

[0037] an adjustment module, configured to adjust the count values ​​of the first system timer and the second system timer respectively according to the first count value and the second count value; wherein the count values ​​of the first system timer and the second system timer after adjustment are the same;

[0038] A second acquisition module is used to acquire instruction sending mode information, and determine a target sending count value according to the instruction sending mode information; wherein the target sending count value is a count value required for the master device to send instructions to all the slave devices;

[0039] A third acquisition module is used to acquire a target delay count value; wherein the target delay count value is a maximum delay count value required for the master device to send an instruction to each of the slave devices;

[0040] A determination module, configured to determine a device execution count value according to the target sending count value, the target delay count value and a pre-designed value; wherein the preset count value is a count value of the first system timer when sending a target instruction;

[0041] a generating module, configured to generate a target instruction, and when the count value of the first system timer reaches the pre-designed value, send the target instruction and the device execution count value to each of the slave devices, so that the slave device executes the target instruction when the count value of the second system timer reaches the device execution count value;

[0042] An execution module is used to execute the target instruction when the count value of the first system timer reaches the device execution count value.

[0043] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.

[0044] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.

[0045] The instruction execution method, device, electronic device and storage medium proposed in the present application obtain the current count value of the first system timer to obtain the first count value, and obtain the current count value of each second system timer to obtain at least one second count value. The count values ​​of the first system timer and the second system timer are adjusted according to the first count value and the second count value, wherein the count values ​​of the first system timer and the second system timer after adjustment are the same. The target sending count value is determined according to the instruction sending mode information; wherein the target sending count value is the count value required for the master device to send the instruction to all slave devices. The target delay count value is obtained; wherein the target delay count value is the maximum delay count value required for the master device to send the instruction to each slave device. The device execution count value is determined according to the target sending count value, the target delay count value and the pre-designed value. The target instruction is generated, and when the count value of the first system timer reaches the pre-designed value, the target instruction and the device execution count value are sent to each slave device, and the slave device executes the target instruction when the count value of the second system timer reaches the device execution count value. The master device executes the target instruction when the count value of the first system timer reaches the device execution count value. In this embodiment, the system timers of the master device and the slave device can reach the device execution count value at the same time, and execute the target instruction at the same time when the count value of the system timer reaches the device execution count value, thereby solving the problem that the master device and the slave device cannot guarantee the execution of instructions at the same time point. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 is an optional flowchart of the instruction execution method provided in an embodiment of the present application;

[0047] Figure 2 yes Figure 1 Flow chart of step S102 in FIG.

[0048] Figure 3 yes Figure 2 Flow chart of step S202 in FIG.

[0049] Figure 4 yes Figure 1 Flow chart of step S101 in FIG.

[0050] Figure 5 yes Figure 1 Flow chart of step S103 in FIG.

[0051] Figure 6 yes Figure 1 Flow chart of step S104 in FIG.

[0052] Figure 7 yes Figure 1 Flow chart of step S105 in FIG.

[0053] Figure 8 is a schematic diagram of the structure of the instruction execution device provided in an embodiment of the present application;

[0054] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application 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 application and are not used to limit the present application.

[0056] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0058] In a group control system, the master device needs to send a command to at least one slave device and execute the command simultaneously with the slave device. However, due to network transmission time-consuming reasons, there will be a delay in the time when the slave device receives the command, resulting in the master device and the slave device being unable to execute the command at the same time. In related technologies, the master device and the slave device can execute the command at the same time at a certain time after the delay time, but due to geographical and device issues, the time displayed on different devices may be different. Therefore, the master device and the slave device cannot guarantee that the command will be executed at the same time.

[0059] Based on this, the embodiments of the present application provide an instruction execution method, device, electronic device and storage medium, which are intended to adjust the count value of the first system timer on the master device and the count value of the second system timer on the slave device, so that the adjusted count values ​​of the first system timer and the second system timer are the same. Obtain the target sending count value and the target delay count value, and determine the device execution count value according to the target sending count value, the target delay count value and the pre-designed value. When the count value of the first system timer reaches the pre-designed value, the target instruction and the device execution count value are sent to each slave device, and the slave device can receive the target instruction before the second system timer reaches the device execution count value. The first system timer and the second system count value can also reach the device execution count value at the same time, and the master device and the slave device execute the target instruction at the same time when they reach the device execution count value, which solves the problem that the master device and the slave device cannot guarantee the execution of instructions at the same time point.

[0060] The instruction execution method, device, electronic device and storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the instruction execution method in the embodiments of the present application is described.

[0061] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0062] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0063] The instruction execution method provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the instruction execution method, etc., but is not limited to the above forms.

[0064] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0065] Please refer to Figure 1 , Figure 1 It is an optional flowchart of the instruction execution method provided in an embodiment of the present application. The instruction execution method is applied to a master device, the master device is communicatively connected to at least one slave device, a first system timer is set on the master device, and a second system timer is set on the slave device. Figure 1 The method may include but is not limited to steps S101 to S107.

[0066] Step S101, obtaining a current count value of a first system timer to obtain a first count value, and obtaining a current count value of each second system timer to obtain at least one second count value;

[0067] Step S102, adjusting the count values ​​of the first system timer and the second system timer respectively according to the first count value and the second count value; wherein the count values ​​of the first system timer and the second system timer after adjustment are the same;

[0068] Step S103, obtaining instruction sending mode information, and determining a target sending count value according to the instruction sending mode information; wherein the target sending count value is a count value required for the master device to send the instruction to all slave devices;

[0069] Step S104, obtaining a target delay count value; wherein the target delay count value is a maximum delay count value required for the master device to send an instruction to each slave device;

[0070] Step S105, determining the device execution count value according to the target sending count value, the target delay count value and the pre-designed value; wherein the pre-designed count value is the count value of the first system timer when sending the target instruction;

[0071] Step S106, generating a target instruction, and when the count value of the first system timer reaches a pre-designed value, sending the target instruction and the device execution count value to each slave device, so that the slave device executes the target instruction when the count value of the second system timer reaches the device execution count value;

[0072] Step S107, executing the target instruction when the count value of the first system timer reaches the device execution count value.

[0073] In step S101 of some embodiments, the master device is connected to at least one slave device via Bluetooth, ZigBee technology, etc., and the system timer may be a System timer, also known as a system tick timer, which is a counting timer. When the hardware and software in the communication modules of the master device and the slave device are the same, the error between the system tick frequencies is further reduced. Therefore, the counting of the system timer is more accurate than the system time on the device.

[0074] It should be noted that due to regional and device issues, the current count values ​​of system timers on different devices may be different. In order to make the adjusted count values ​​of the first system timer and the second system timer the same, it is necessary to know the current count value of the first system timer and the current count value of each second system timer at the same time. Therefore, the current count value of the first system timer is obtained to obtain the first count value, and the current count value of each second system timer is obtained to obtain the second count value. For example, at the same time, the current count value of the first system timer of the master device is 30, then the first count value is 30, the current count value of the second system timer a of the slave device a is 40, then the second count value a is 40, and the current count value of the second system timer b of the slave device b is 20, then the second count value b is 20.

[0075] In step S102 of some embodiments, the count values ​​of the first system timer and the second system timer are uniformly adjusted to the same value, so that the first system timer and the second system timer can reach the device execution count value at the same time. For example, the count values ​​are uniformly adjusted to 35, or uniformly adjusted to the count value of the first count value or the second count value. Continuing with the above example, at the same time, the count values ​​of the first system timer, the second system timer a and the second system timer b are uniformly adjusted to 35. Then the count value of the first system timer needs to be increased by 5, the count value of the second system timer a needs to be reduced by 5, and the count value of the third system timer b needs to be increased by 15. The specific adjustment method is not limited here.

[0076] In step S103 of some embodiments, after the count values ​​of the first system timer and the second system timer are uniformly adjusted to 35, if the master device sends a target instruction to the slave device, it takes 5 count values ​​for the slave device to receive the target instruction, but the device execution count value is 38, which will result in the master device and the slave device being unable to execute the instructions at the same time. Therefore, the device execution count value needs to be the count value after all devices have received the target instruction.

[0077] Specifically, if the count value required by the master device to send the instruction to all slave devices is 10, the target sending count value is 10. Depending on the instruction sending mode, the target sending count value will also be different. For example, if the instruction sending mode is a broadcast sending mode, the count value required by the master device to send the instruction to all slave devices is 0, and the target sending count value is 0. In this embodiment, the instruction sending mode is determined according to the instruction sending mode information.

[0078] In step S104 of some embodiments, for each slave device, the delay count value required for the master device to send the target instruction to the slave device and for the slave device to receive the target instruction is different. The delay count values ​​of all slave devices are polled and calculated, and the maximum delay count value is obtained by sorting, and the target delay count value is the maximum delay count value.

[0079] In step S105 of some embodiments, after the count values ​​of the first system timer and the second system timer are adjusted, the target instruction can be sent when the count value of the first system timer reaches a pre-designed value, and the pre-designed value is greater than or equal to the count value after the adjustment of the first system timer. The device execution count value is greater than or equal to the sum of the target sending count value, the target delay count value and the pre-designed value. Continuing with the above example, the count values ​​of the first system timer, the second system timer a and the second system timer b are uniformly adjusted to 35. If the pre-designed value is also 35, the target sending count value is 0, and the target delay count value is 5, then the device execution count value can be 40.

[0080] In steps S106 to S107 of some embodiments, the master device generates a target instruction, and when the count value of the first system timer reaches a pre-designed value, the target instruction and the device execution count value are sent to each slave device, so that the slave device executes the target instruction when the count value of the second system timer reaches the device execution count value. The master device also executes the target instruction when the count value of the first system timer reaches the device execution count value. For example, the device execution count value may be 40, and when the count value of the second system timer reaches 40, the slave device executes the target instruction. When the count value of the first system timer reaches 40, the master device executes the target instruction. Since the count value of the first system timer and the count value of the second system timer simultaneously change from the same count value to the device execution count value, the count value of the first system timer and the count value of the second system timer simultaneously reach the device execution count value, thereby achieving the simultaneous execution of the target instruction by the master device and the slave device.

[0081] In the steps S101 to S107 shown in the embodiment of the present application, the first count value is obtained by obtaining the current count value of the first system timer, and the current count value of each second system timer is obtained to obtain at least one second count value. The count values ​​of the first system timer and the second system timer are adjusted according to the first count value and the second count value, respectively, wherein the count values ​​of the first system timer and the second system timer after adjustment are the same. The target sending count value is determined according to the instruction sending mode information; wherein the target sending count value is the count value required for the master device to send the instruction to all slave devices. The target delay count value is obtained; wherein the target delay count value is the maximum delay count value required for the master device to send the instruction to each slave device. The device execution count value is determined according to the target sending count value, the target delay count value and the pre-designed value. The target instruction is generated, and when the count value of the first system timer reaches the pre-designed value, the target instruction and the device execution count value are sent to each slave device, and the slave device executes the target instruction when the count value of the second system timer reaches the device execution count value. The master device executes the target instruction when the count value of the first system timer reaches the device execution count value. In this embodiment, the system timers of the master device and the slave device can reach the device execution count value at the same time, and execute the target instruction at the same time when the count value of the system timer reaches the device execution count value, thereby solving the problem that the master device and the slave device cannot guarantee the execution of instructions at the same time point.

[0082] See also Figure 2 In some embodiments, step S102 may include but is not limited to steps S201 to S202:

[0083] Step S201, selecting a count value according to a first count value and at least one second count value to obtain a target count value;

[0084] Step S202: adjusting the count values ​​of the first system timer and the second system timer respectively according to the target count value.

[0085] In step S201 of some embodiments, when the count values ​​after adjustment of the first system timer and the second system timer are not selected from the first count value and the second count value, the count of each system timer needs to be adjusted. Therefore, in order to reduce the number of adjustments, the count value selection can be performed on the first count value and at least one second count value to obtain a target count value, and then the count values ​​of the first system timer and the second system timer are adjusted based on the target count value.

[0086] Specifically, the counting value selection method can be to use the maximum / minimum counting value as the target counting value, or to use the counting value with the largest number as the target counting value. For example, if the first counting value is 25, the second counting value a is 40, and the second counting value b is 25, then the counting value with the largest number is 25, and the target counting value is 25.

[0087] In step S202 of some embodiments, the count values ​​of the first system timer and the second system timer are adjusted according to the target count value, and when the target count value is equal to the first count value or the second count value, there is no need to adjust the corresponding system timer, thereby reducing the number of adjustments. The above example is used for illustration, and when the target count value is equal to the first count value and the second count value b, there is no need to adjust the first system timer and the second system timer b, and only the count value of the second system timer a corresponding to the second count value a needs to be adjusted.

[0088] In steps S201 to S202 shown in this embodiment, a target count value is obtained by selecting a count value according to the first count value and at least one second count value, and the count values ​​of the first system timer and the second system timer are adjusted respectively according to the target count value, thereby reducing the number of adjustments.

[0089] See also Figure 3 In some embodiments, step S202 may include but is not limited to steps S301 to S303:

[0090] Step S301, obtaining a difference between a target count value and a first count value to obtain a first difference value;

[0091] Step S302, obtaining a difference between the target count value and the second count value to obtain a second difference value;

[0092] Step S303: adjusting the count value of the first system timer according to the first difference, and adjusting the count value of the second system timer according to the second difference.

[0093] In steps S301 to S302 of some embodiments, since the count value of the system timer changes in real time, when adjusting the count values ​​of the first system timer and the second system timer respectively according to the target count value, the first system timer is adjusted according to the difference between the target count value and the first count value, and the second system timer is adjusted according to the difference between the target count value and the second count value. Therefore, the difference between the target count value and the first count value is obtained to obtain the first difference, and then the difference between the target count value and the second count value is obtained to obtain the second difference.

[0094] In step S303 of some embodiments, if the first count value is 30, the second count value a is 40, and the second count value b is 20, the largest count value is selected as the target count value, so the target count value is 40. Then the first difference between the target count value and the first count value is 10, indicating that the count value of the first system timer needs to be increased by 10 count values. The second difference between the target count value and the second count value a is 0, indicating that the count value of the second system timer a does not need to be adjusted. The second difference between the target count value and the second count value b is 20, indicating that the count value of the second system timer b needs to be increased by 20 count values. During the adjustment, 5 count values ​​have passed, and the current count value of the first system timer is 35. After increasing by 10 count values, the current count value of the first system timer is 45. Since 5 count values ​​have passed, the current count value of the second system timer a is also 45. The current count value of the second system timer b is 25. After increasing by 20 count values, the current count value of the second system timer b is also 45. Therefore, after the adjustment, the count values ​​of the first system timer, the second system timer a, and the second system timer b are the same.

[0095] In steps S301 to S303 of this embodiment, by acquiring the first difference and the second difference, the count value of the first system timer can be adjusted based on the first difference, and the count value of the second system timer can be adjusted based on the second difference.

[0096] See also Figure 4 In some embodiments, step S101 may include but is not limited to steps S401 to S404:

[0097] Step S401, sending a query instruction to the slave device, and recording the count value of the first system timer when sending the query instruction to obtain a first count value;

[0098] Step S402, receiving a first message returned by the slave device according to the query instruction; wherein the first message includes a third count value, and the third count value is a count value of the second system timer when the slave device receives the query instruction;

[0099] Step S403, acquiring a count value of the first system timer when the first message is received, to obtain a fourth count value;

[0100] Step S404, determining a second count value according to the first count value, the third count value and the fourth count value.

[0101] In step S401 of some embodiments, when the master device needs to obtain the second count value of the slave device, it needs to send a query instruction to the slave device, and the count value of the first system timer is the first count value when the query instruction is sent.

[0102] In step S402 of some embodiments, after receiving the query instruction, the slave device returns a first message to the master device, the first message includes a third count value, and the third count value is the count value of the second system timer when the slave device receives the query instruction.

[0103] In steps S403 to S404 of some embodiments, after receiving the first message, the master device records the count value of the first system timer when the first message is received to obtain a fourth count value, thereby determining the second count value based on the first count value, the third count value and the fourth count value.

[0104] Specifically, the delay count value for the master device to send a query instruction to the slave device can be determined based on the first count value and the fourth count value. For example, if the master device sends a query instruction to the slave device when the count value of the first system timer is 30, the first count value is 30. When the slave device receives the query instruction, the count value of the second system timer is 42, the third count value is 42, and the slave device returns a first message to the master device, and the first message includes the third count value. When the master device receives the first message, the count value of the first system timer is 34, the fourth count value is 34, and the delay count value is (34-30) / 2=2. Since the third count value is 42, it means that when the first count value is 30, the second count value is 42-2=40, thereby obtaining the second count value.

[0105] It should be noted that if the second count values ​​of multiple slave devices need to be obtained, query instructions are sent to multiple slave devices at the same time. For example, when the second count values ​​of two slave devices are obtained at the same time, the master device sends a query instruction to slave device a and slave device b when the count value of the first system timer is 30, and the first count value is 30. When slave device a receives the query instruction, the count value of the second system timer a is 42, and the third count value a is 42. When slave device b receives the query instruction, the count value of the second system timer b is 23, and the third count value b is 23. Slave device a returns a first message a to the master device, and the first message a includes the third count value a. When the master device receives the first message a, the count value of the first system timer is 34, and the fourth count value a is 34, and the delay count value is (34-30) / 2=2. Since the third count value a is 42, it means that when the first count value is 30, the second count value a is 42-2=40, thereby obtaining the second count value a. Slave device b returns a first message b to the master device, and the first message b includes the third count value b. When the master device receives the first message b, the count value of the first system timer is 36, then the fourth count value b is 36, and the delay count value is (36-30) / 2=3. Since the third count value b is 23, it means that when the first count value is 30, the second count value is 23-3=20, so the second count value b is 20. The method for obtaining the second count values ​​of three or more slave devices is similar to the above, and will not be repeated here.

[0106] In steps S401 to S404 of this embodiment, by determining the first count value and the second count value, the count values ​​of the first system timer and the second system timer can be adjusted based on the first count value and the second count value, so that the adjusted count values ​​of the first system timer and the second system timer are the same.

[0107] See also Figure 5 In some embodiments, the instruction sending mode information includes polling sending mode information or broadcast sending mode information, and step S103 includes but is not limited to steps S501 to S502:

[0108] Step S501, if the instruction sending mode information is the polling sending mode information, then obtain the sending interval count value of sending instructions to each slave device, and determine the target sending count value according to each sending interval count value;

[0109] Step S502: If the instruction sending mode information is the broadcast sending mode information, the target sending count value is zero.

[0110] In step S501 of some embodiments, the polling transmission mode is that the master device sends the instruction to each slave device when the first system timer is a different count value. If the instruction transmission mode is the polling transmission mode, the sum of all transmission interval count values ​​is the target transmission count value. Among them, the transmission interval count values ​​are generally set to be equal. When the transmission interval count values ​​are all 2 count values, if there are a total of 5 slave devices, the target transmission count value is 8.

[0111] In step S502 of some embodiments, the broadcast transmission mode is that the master device simultaneously sends the instruction to each slave device by broadcasting, and the target transmission count value is zero.

[0112] In step S501 to step S502 shown in this embodiment, different instruction sending modes have different target sending count values. By acquiring the instruction sending mode information, the target sending count value can be determined.

[0113] See also Figure 6 In some embodiments, step S104 may include but is not limited to steps S601 to S604:

[0114] Step S601, sending a test instruction to each slave device, and recording the count value of the first system timer when sending the test instruction to obtain a fifth count value;

[0115] Step S602, receiving a second message returned by the slave device according to the test instruction, and recording the count value of the first system timer when the second message is received to obtain a sixth count value;

[0116] Step S603, determining a delay count value of the slave device according to the fifth count value and the sixth count value, and obtaining a candidate delay count value;

[0117] Step S604: sort each candidate delay count value, and the largest candidate delay count value is the target delay count value.

[0118] In step S601 of some embodiments, since the device execution count value is determined based on the target delay count value, the target delay count value is acquired in advance. The target delay count value is the maximum delay count value required for the master device to send the instruction to each slave device. Therefore, a test instruction must be sent to each slave device, and the count value of the first system timer when the test instruction is sent is recorded to obtain the fifth count value. When the master device sends the test instruction to the slave device, the count value of the first system timer is 35, then the fifth count value is 35.

[0119] In steps S602 to S603 of some embodiments, after receiving the test instruction, the slave device returns a second message to the master device. The master device records the count value of the first system timer when receiving the second message to obtain a sixth count value. The delay count value of the slave device can be determined based on the fifth count value and the sixth count value. For example, if the fifth count value is 35 and the count value of the first system timer is 39 when the master device receives the second message, then the sixth count value is 39, and the candidate delay count value of the slave device is (39-35) / 2=2.

[0120] In step S604 of some embodiments, the maximum candidate delay count value is used as the target delay count value. It should be noted that the test instruction can be sent to each slave device at the same time, or the test instruction can be sent to each slave device in a time-sharing manner. For example, if there are only two slave devices, namely slave a and slave b, if the fifth count value a and the fifth count value b are both 35, the sixth count value a is 39, and the sixth count value b is 41. Then the selected delay count value a is 2, the selected delay count value b is 3, and the target delay count value is 3. If the fifth count value a is 35, the fifth count value b is both 40, the sixth count value a is 39, and the sixth count value b is 46. Then the selected delay count value a is 2, the selected delay count value b is 3, and the target delay count value is 3.

[0121] In steps S601 to S604 shown in this embodiment, the fifth count value and the sixth count value are obtained, thereby obtaining a candidate delay count value based on the fifth count value and the sixth count value, and the largest candidate delay count value is used as the target delay count value, so that the device execution count value can be determined based on the target delay count value.

[0122] Please refer to Figure 7 In some embodiments, step S105 may include but is not limited to steps S701 to S702:

[0123] Step S701, obtaining the sum of the target sending count value, the target delay count value and the pre-designed value to obtain the expected execution count value;

[0124] Step S702, determining a device execution count value according to the expected execution count value; wherein the device execution count value is greater than or equal to the expected execution count value.

[0125] In step S701 to step S702 of this embodiment, the target transmission count value, the target delay count value and the pre-designed value are added to obtain the expected execution count value, and the device execution count value is greater than or equal to the expected execution count value, so that the master device and the slave device can simultaneously execute the target instruction when the count value of the system timer reaches the device execution count value.

[0126] See also Figure 8The embodiment of the present application further provides an instruction execution device, which can implement the above instruction execution method and is applied to a master device, wherein the master device is communicatively connected to at least one slave device, a first system timer is set on the master device, and a second system timer is set on the slave device. The device includes:

[0127] A first acquisition module 801 is used to acquire a current count value of a first system timer to obtain a first count value, and acquire a current count value of each second system timer to obtain at least one second count value;

[0128] An adjustment module 802 is used to adjust the count values ​​of the first system timer and the second system timer according to the first count value and the second count value respectively; wherein the count values ​​of the first system timer and the second system timer after adjustment are the same;

[0129] The second acquisition module 803 is used to acquire instruction sending mode information and determine the target sending count value according to the instruction sending mode information; wherein the target sending count value is the count value required for the master device to send the instruction to all slave devices;

[0130] The third acquisition module 804 is used to acquire a target delay count value; wherein the target delay count value is a maximum delay count value required for the master device to send an instruction to each slave device;

[0131] The determination module 805 is used to determine the device execution count value according to the target sending count value, the target delay count value and the pre-designed value; wherein the preset count value is the count value of the first system timer when sending the target instruction;

[0132] A generating module 806, configured to generate a target instruction, and when the count value of the first system timer reaches a pre-designed value, send the target instruction and the device execution count value to each slave device, so that the slave device executes the target instruction when the count value of the second system timer reaches the device execution count value;

[0133] The execution module 807 is used to execute the target instruction when the count value of the first system timer reaches the device execution count value.

[0134] The specific implementation of the instruction execution device is basically the same as the specific implementation of the above-mentioned instruction execution method, and will not be repeated here.

[0135] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above instruction execution method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0136] See also Fig. 9 , Fig. 9The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0137] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.

[0138] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the instruction execution method of the embodiment of this application;

[0139] Input / output interface 903, used to implement information input and output;

[0140] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WI FI, Bluetooth, etc.);

[0141] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);

[0142] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .

[0143] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned instruction execution method is implemented.

[0144] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0145] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0146] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0147] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0148] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0149] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0150] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0151] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0152] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0153] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0154] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0155] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A method for executing an instruction, characterized in that: Applied to a master device, the master device is communicatively connected to at least one slave device, a first system timer is set on the master device, and a second system timer is set on the slave device, the method includes: Obtaining a current count value of the first system timer to obtain a first count value, and obtaining a current count value of each of the second system timers to obtain at least one second count value; Adjusting the count values ​​of the first system timer and the second system timer respectively according to the first count value and the second count value; wherein the count values ​​of the first system timer and the second system timer after adjustment are the same; Acquire instruction sending mode information, and determine a target sending count value according to the instruction sending mode information; wherein the target sending count value is a count value required for the master device to send instructions to all the slave devices; Obtaining a target delay count value; wherein the target delay count value is a maximum delay count value required for the master device to send an instruction to each of the slave devices; Determine the device execution count value according to the target sending count value, the target delay count value and the pre-designed value; wherein the preset count value is the count value of the first system timer when sending the target instruction; Generate a target instruction, and when the count value of the first system timer reaches the pre-designed value, send the target instruction and the device execution count value to each of the slave devices, so that the slave device executes the target instruction when the count value of the second system timer reaches the device execution count value; The target instruction is executed when the count value of the first system timer reaches the device execution count value.

2. The method according to claim 1, characterized in that The adjusting the count values ​​of the first system timer and the second system timer respectively according to the first count value and the second count value includes: Selecting a count value according to the first count value and at least one of the second count values ​​to obtain a target count value; The count values ​​of the first system timer and the second system timer are adjusted respectively according to the target count value.

3. The method according to claim 2, characterized in that The adjusting the count values ​​of the first system timer and the second system timer respectively according to the target count value includes: Obtaining a difference between the target count value and the first count value to obtain a first difference; Obtaining a difference between the target count value and the second count value to obtain a second difference value; The count value of the first system timer is adjusted according to the first difference, and the count value of the second system timer is adjusted according to the second difference.

4. The method according to claim 1, characterized in that The obtaining of the current count value of the first system timer to obtain a first count value, and the obtaining of the current count value of each of the second system timers to obtain at least one second count value, includes: Sending a query instruction to the slave device, and recording a count value of the first system timer when sending the query instruction, to obtain the first count value; receiving a first message returned by the slave device according to the query instruction; wherein the first message includes a third count value, and the third count value is the count value of the second system timer when the slave device receives the query instruction; Acquire a count value of the first system timer when the first message is received to obtain a fourth count value; The second count value is determined according to the first count value, the third count value and the fourth count value.

5. The method according to claim 1, characterized in that: The instruction sending mode information includes polling sending mode information or broadcast sending mode information, and the acquiring instruction sending mode information and determining the target sending count value according to the instruction sending mode information includes: If the instruction sending mode information is the polling sending mode information, obtaining a sending interval count value of sending instructions to each of the slave devices, and determining the target sending count value according to each of the sending interval count values; If the instruction sending mode information is the broadcast sending mode information, the target sending count value is zero.

6. The method according to claim 1, characterized in that The obtaining of the target delay count value comprises: Sending a test instruction to each of the slave devices, and recording the count value of the first system timer when sending the test instruction, to obtain a fifth count value; receiving a second message returned by the slave device according to the test instruction, and recording a count value of the first system timer when the second message is received to obtain a sixth count value; Determine the delay count value of the slave device according to the fifth count value and the sixth count value to obtain a candidate delay count value; Each of the candidate delay count values ​​is sorted, and the largest candidate delay count value is used as the target delay count value.

7. The method according to claim 1, characterized in that The determining the device execution count value according to the target sending count value, the target delay count value and the pre-designed value includes: Obtaining a sum of the target sending count value, the target delay count value and the pre-designed value to obtain an expected execution count value; The device execution count value is determined according to the expected execution count value; wherein the device execution count value is greater than or equal to the expected execution count value.

8. An instruction execution device, characterized in that: Applied to a master device, the master device is communicatively connected to at least one slave device, a first system timer is set on the master device, and a second system timer is set on the slave device, the device comprises: A first acquisition module, configured to acquire a current count value of the first system timer to obtain a first count value, and acquire a current count value of each of the second system timers to obtain at least one second count value; an adjustment module, configured to adjust the count values ​​of the first system timer and the second system timer respectively according to the first count value and the second count value; wherein the count values ​​of the first system timer and the second system timer after adjustment are the same; A second acquisition module is used to acquire instruction sending mode information, and determine a target sending count value according to the instruction sending mode information; wherein the target sending count value is a count value required for the master device to send instructions to all the slave devices; A third acquisition module is used to acquire a target delay count value; wherein the target delay count value is a maximum delay count value required for the master device to send an instruction to each of the slave devices; A determination module, configured to determine a device execution count value according to the target sending count value, the target delay count value and a pre-designed value; wherein the preset count value is a count value of the first system timer when sending a target instruction; a generating module, configured to generate a target instruction, and when the count value of the first system timer reaches the pre-designed value, send the target instruction and the device execution count value to each of the slave devices, so that the slave device executes the target instruction when the count value of the second system timer reaches the device execution count value; An execution module is used to execute the target instruction when the count value of the first system timer reaches the device execution count value.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the instruction execution method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the instruction execution method according to any one of claims 1 to 7 is implemented.