CN112905244A - Instrument control method, device and equipment - Google Patents

Instrument control method, device and equipment Download PDF

Info

Publication number
CN112905244A
CN112905244A CN202011530801.0A CN202011530801A CN112905244A CN 112905244 A CN112905244 A CN 112905244A CN 202011530801 A CN202011530801 A CN 202011530801A CN 112905244 A CN112905244 A CN 112905244A
Authority
CN
China
Prior art keywords
task
meter
flag
triggering
executed
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.)
Pending
Application number
CN202011530801.0A
Other languages
Chinese (zh)
Inventor
吕坤峰
温兴孔
朱艾维
蔺成丽
陈时健
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Goldcard Smart Group Co Ltd
Original Assignee
Goldcard Smart Group Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Goldcard Smart Group Co Ltd filed Critical Goldcard Smart Group Co Ltd
Priority to CN202011530801.0A priority Critical patent/CN112905244A/en
Publication of CN112905244A publication Critical patent/CN112905244A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4418Suspend and resume; Hibernate and awake
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • G06F9/4887Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a method, a device and equipment for controlling an instrument. The method comprises the following steps: and the instrument classifies the tasks and initializes the tasks according to the task priority and the execution time consumption. Aiming at the tasks with high priority, high real-time requirement and short execution time, the instrument initializes the tasks into an interruption task. Tasks other than tasks are interrupted and the meter can initialize these tasks as timed tasks. A meter get flags field. The meter determines the value of each flag bit in the flag field. When the meter determines that all the flag bits in the flag field are 0, the meter enters a sleep state. When the meter determines that a flag bit of 1 exists in the flag field, the meter is in a suspended state. The method avoids the instrument from being frequently awakened after the instrument enters the dormancy state, and increases the reliability of low power consumption.

Description

Instrument control method, device and equipment
Technical Field
The present application relates to the field of electronic devices, and in particular, to a method, an apparatus, and a device for controlling an instrument.
Background
With the intelligent development of the instrument, the intelligent functions of the instrument are more and more, and the software control program in the instrument is more and more complex. The resources on the micro control unit of the meter and the energy of the battery are limited without increasing the hardware cost.
Currently, to increase battery life, most meters reduce energy consumption by using a low power mode. The use of the low power consumption mode depends on the design of a software control program, and an unreasonable software control program may cause problems such as frequent awakening and task deadlock, thereby increasing power consumption.
Therefore, how to reduce the power consumption of the meter becomes an urgent problem to be solved.
Disclosure of Invention
The application provides a method, a device and equipment for controlling an instrument, which are used for solving the problem of how to reduce the power consumption of the instrument.
In a first aspect, the present application provides a meter control method, comprising:
initializing a triggering mode of a task according to task priority and execution time consumption of the task, wherein the triggering mode comprises interruption mode triggering and timer triggering, the task priority of the task triggered by the interruption mode is high, the execution time consumption is short, and the task priority of the task triggered by the timer is low and/or the execution time consumption is long;
acquiring a flag field, wherein the flag field comprises a preset number of flag bits, each flag bit corresponds to one task only, the flag bits comprise 0 and 1, when the flag bits are 0, the flag bits indicate that the tasks corresponding to the flag bits are executed, and when the flag bits are 1, the flag bits indicate that the tasks corresponding to the flag bits are executed;
and judging whether all the zone bits in the zone field are 0, and entering a low power consumption state when all the zone bits in the zone field are 0.
Optionally, the task further includes:
dividing the task into a plurality of task segments in a multi-segment execution mode according to the time consumed by executing the task, wherein the execution time of the task segments is a first preset time, and the execution interval of the task segments is a second preset time;
triggering the task according to an interrupt triggering instruction;
and executing the task in a segmented mode according to the timer triggering instruction.
Optionally, the method further includes:
acquiring a trigger instruction, wherein the trigger instruction is triggered by interruption or a timer, and the trigger instruction comprises a task to be executed;
and exiting the low power consumption state according to the trigger instruction, and executing the task to be executed.
Optionally, the method further includes:
according to the trigger instruction, marking the position 1 of the mark corresponding to the task to be executed;
and after the task to be executed is completed, marking the position 0 corresponding to the task to be executed.
Optionally, the method further includes:
determining a related task according to the task to be executed;
and establishing a timer of the related task according to a preset trigger condition and the related task.
Optionally, the method further includes:
acquiring a suspension duration which is the duration of the flag fields not being all 0;
and executing reset protection when the suspension duration is greater than or equal to a third preset duration.
In a second aspect, the present application provides a meter control apparatus comprising:
the initialization module is used for initializing a triggering mode of a task according to the task priority and the execution time consumption of the task, wherein the triggering mode comprises an interruption mode triggering and a timer triggering, the task priority of the task triggered by the interruption mode is high, the execution time consumption is short, and the task priority of the task triggered by the timer is low and/or the execution time consumption is long;
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a flag field, the flag field comprises a preset number of flag bits, each flag bit uniquely corresponds to one task, the flag bits comprise 0 and 1, when the flag bit is 0, the flag bits represent that the tasks corresponding to the flag bits are finished being executed, and when the flag bit is 1, the flag bits represent that the tasks corresponding to the flag bits are being executed;
and the dormancy module is used for judging whether all the zone bits in the zone field are all 0, and entering a low power consumption state when all the zone bits in the zone field are 0.
Optionally, the device is further configured to divide the task into a plurality of task segments in a multi-segment execution manner according to the execution time of the task, where the execution time of the task segment is a first preset time, and the execution interval of the task segment is a second preset time; triggering the task according to an interrupt triggering instruction; and executing the task in a segmented mode according to the timer triggering instruction.
Optionally, the apparatus further includes:
the second acquisition module is used for acquiring a trigger instruction, wherein the trigger instruction is triggered by interruption or a timer, and the trigger instruction comprises a task to be executed;
and the execution module is used for exiting the low power consumption state and executing the task to be executed according to the trigger instruction.
Optionally, the execution module is specifically configured to, according to the trigger instruction, mark position 1 corresponding to the task to be executed; and after the task to be executed is completed, marking the position 0 corresponding to the task to be executed.
Optionally, the apparatus further includes:
the determining module is used for determining related tasks according to the tasks to be executed;
and the establishing module is used for establishing a timer of the related task according to a preset trigger condition and the related task.
Optionally, the apparatus further includes:
a third obtaining module, configured to obtain a suspension duration, where the suspension duration is a duration that the flag fields are not all 0;
and the resetting module is used for executing resetting protection when the suspension duration is greater than or equal to a third preset duration.
In a third aspect, the present application provides a meter comprising: a memory and a processor;
the memory is used for storing program instructions;
the processor is adapted to invoke program instructions in the memory to perform the meter control method of the first aspect and any possible design of the first aspect.
In a fourth aspect, the present application provides a readable storage medium having stored therein executable instructions that, when executed by at least one processor of a meter, cause the meter to perform the method of controlling a meter according to the first aspect and any one of the possible designs of the first aspect.
In a fifth aspect, the present application provides a computer program product comprising computer programs/instructions which, when executed by a processor, implement the method of controlling a meter according to the first aspect and any one of the possible designs of the first aspect.
According to the instrument control method, the instrument control device and the instrument control equipment, tasks are classified and initialized according to task priorities and execution time consumption; initializing an interrupt task aiming at a task with high priority, high real-time requirement and short execution time; tasks except the interrupt task are initialized into a timing task; acquiring a mark field; judging the value of each zone bit in the zone field; when all the zone bits in the zone field are 0, entering a dormant state; when the flag bit in the flag field is 1, the flag field is in a suspended state, so that the effects of avoiding the instrument from being frequently awakened after entering the sleep state and increasing the reliability of low power consumption are achieved.
Drawings
In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a flowchart of a meter control method according to an embodiment of the present application;
FIG. 2 is a timing diagram for timing task execution according to an embodiment of the present application;
FIG. 3 is a flow chart of another method for controlling a meter according to an embodiment of the present application;
FIG. 4 is a timing diagram illustrating another example of an interrupt task execution according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an instrument control device according to an embodiment of the present application;
FIG. 6 is a schematic structural diagram of another instrument control device provided in an embodiment of the present application;
fig. 7 is a schematic hardware structure diagram of a meter according to an embodiment of the present application.
Detailed Description
To make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the present application, and it is obvious that the described embodiments are some, but not all embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
With the intelligent development of the instrument, the intelligent functions of the instrument are more and more, and the software control program in the instrument is more and more complex. The resources on the micro control unit of the meter and the energy of the battery are limited without increasing the hardware cost. Therefore, in order to increase the battery life, most meters reduce energy consumption by using a low power consumption mode. Currently, most meters are in low power consumption mode in idle state. Besides, the instrument realizes awakening by setting different timing cycles and executes tasks after awakening. When an instrument is abnormal, for example, the instrument does not enter a low power consumption mode for a long time, the prior art generally uses a watchdog to realize abnormal reset.
In the actual implementation process of the meter, the meter is required to be in a low power consumption state as much as possible, and the design of a software control program is relied on. However, the unreasonable software control program may cause problems such as frequent wakeups, task deadlock, and the like, and cause problems such as power consumption increase, and even failure to reset after an exception occurs. Therefore, how to reasonably design a software control program of the instrument and reduce the power consumption of the instrument becomes an urgent problem to be solved.
In order to solve the problems, the application provides an instrument control method. The method and the device adopt a task management mode to divide and manage the tasks in the instrument. The tasks of the meter are divided into interrupt tasks and timing tasks according to any priority, real-time requirements and execution time. The interrupt task is triggered by an interrupt mode, and the timing task is triggered by a timer. According to the method and the device, through the division and execution of the tasks, the time of the low power consumption state of the instrument is increased to the maximum extent on the premise of ensuring the optimal execution of the functions. Meanwhile, the meter also counts the time length of non-dormancy, and when the meter does not enter a low-power consumption state for a certain continuous time, the reset processing is carried out, so that the reliability of low power consumption is improved.
The technical solution of the present application will be described in detail below with specific examples. These particular embodiments may be combined with each other below, and details of the same or similar concepts or processes may not be repeated in some embodiments.
In the present application, a meter is used as an execution subject, and a meter control method according to the following embodiment is executed. Specifically, the execution body may be a hardware device of the meter, or a software application in the meter, or a computer-readable storage medium or a chip on which a software application implementing the following embodiments is installed.
Fig. 1 shows a flowchart of a meter control party according to an embodiment of the present application. As shown in fig. 1, with the meter as the execution subject, the method of this embodiment may include the following steps:
s101, initializing a task triggering mode according to task priority and execution time consumption of the task, wherein the triggering mode comprises interruption mode triggering and timer triggering, the task priority of the task triggered by the interruption mode is high, the execution time consumption is short, and the task priority of the task triggered by the timer is low and/or the execution time consumption is long.
In this embodiment, the meter classifies and initializes the tasks according to the task priority and the execution time consumption.
Aiming at tasks with high priority, high real-time requirement and short execution time, the instrument initializes the tasks into an interrupt task. The interrupt task needs to be triggered by means of an interrupt. The interrupt tasks include on-off valve execution, key detection, metering pulse signal detection, external alarm detection, and the like. Specifically, the meter assigns an interrupt signal to each interrupt task. The meter may determine the specific triggered interrupt task from the interrupt signal.
Tasks other than interrupt tasks, which are typically not as high in priority, do not require real-time completion of the tasks, at which point the meter may initialize these tasks as timed tasks. The timing task needs to be triggered by a timer. The timing tasks can comprise acousto-optic reminding tasks, liquid crystal display tasks, settlement tasks, storage tasks, power supply detection tasks, local communication tasks, remote communication tasks, event processing tasks and the like. Specifically, the meter sets a timer for each timing task. The meter may determine the timing task triggered by the timer based on the timer. When timing requirements of a plurality of timing tasks are consistent, the meter can also set the same timer for the plurality of timing tasks. At this time, when the timer finishes timing, the plurality of timing tasks are triggered simultaneously.
The real-time requirement of the timing task is low, so that the instrument can adjust the suspension time of the instrument by adjusting the timing time of the timer. For example, when there are multiple timed tasks, the meter may approximate the times at which the tasks are triggered by setting the time of the timer. Furthermore, the meter can process the tasks more intensively, so that frequent awakening is avoided.
In the timing task, the execution of the task is time-consuming. For a timing task with short time consumption for task execution, the instrument can complete the execution of the timing task after the timing task is triggered. For example, as shown in task 3 in fig. 2. When task 3 is triggered, the meter executes task 3 until task 3 completes execution.
However, for an interrupt task that takes a long time for task execution, if the meter executes the interrupt task until completion after the interrupt task is triggered, a problem may occur in that the execution time course of the interrupt task is interrupted. Aiming at the problem, the instrument avoids the instrument from being hung for too long time by dividing the interrupt task into a plurality of task segments and using a timer to trigger execution for a plurality of times. The execution of this interrupt task may be as shown in task 2 in fig. 4. The specific process can comprise the following steps:
step 1, dividing the task into a plurality of task segments in a multi-segment execution mode according to the execution time consumption of the task, wherein the execution time length of the task segments is a first preset time length, and the execution interval of the task segments is a second preset time length.
In the step, the instrument divides the interrupt task into a plurality of task segments according to a first preset time length, and the execution time length of each task segment is the first preset time length. The first predetermined duration is a shorter duration.
And 2, triggering the task according to the interrupt triggering instruction.
In this step, the instrument triggers the execution of the task by interrupting the trigger instruction. When the task is triggered, the timer for the task is triggered at the same time.
And 3, triggering each task segment of the task one by one according to a timer triggering instruction, wherein the triggering interval of the timer triggering instruction is a second preset time length.
In this step, after the timer of the task is triggered, the meter triggers the execution of each task segment at regular time according to the timer triggering instruction. And the second preset time length is the dormancy time length between the two task segments. In particular, the trigger may be used to trigger a start execution of a task and an end execution of the task. In the process, the meter starts executing the task or stops executing the task only according to the trigger instruction of the timer. The specific execution of the task is determined according to the actual execution of the meter.
For example, when the first preset duration of the meter is 1 second and the second preset duration is 2 seconds, the meter triggers a task every 2 seconds. The meter executes 1 second after each trigger task. When the task needs to be executed for 5 seconds, the instrument triggers 5 times of tasks, and the task is executed and completed. If in the 5-second execution, the meter has problems of resource occupation and the like, and the task is delayed to be completed. The meter will perform the task again for 1 second after a 2 second interval after the 5 th execution is complete.
In addition, for a timing task which takes a long time for task execution, if the meter continues to execute the timing task after the task is triggered until the task is completed, the meter may also have a problem of suspending the long process. In response to this problem, the meter may also divide the timing task into a plurality of task segments and trigger the timer to complete execution multiple times. The execution of this interrupt task may be as shown in task 4 in fig. 2. The specific process can comprise the following steps:
step 1, dividing the task into a plurality of task segments in a multi-segment execution mode according to the execution time consumption of the task, wherein the execution time length of the task segments is a first preset time length, and the execution interval of the task segments is a second preset time length.
In the step, the instrument divides the timing task into a plurality of task segments according to a first preset time length, and the execution time length of each task segment is the first preset time length. The first predetermined duration is a shorter duration.
And 2, triggering each task segment of the task one by one according to a timer triggering instruction, wherein the triggering interval of the timer triggering instruction is a second preset time length.
In this step, after the timer of the task is triggered, the meter triggers the execution of each task segment at regular time according to the timer triggering instruction. And the second preset time length is the dormancy time length between the two task segments. In particular, the trigger may be used to trigger a start execution of a task and an end execution of the task. In the process, the meter starts executing the task or stops executing the task only according to the trigger instruction of the timer. The specific execution of the task is determined according to the actual execution of the meter.
S102, obtaining a mark field, wherein the mark field comprises a preset number of mark bits, each mark bit uniquely corresponds to one task, each mark bit comprises 0 and 1, when the mark bit is 0, the mark field indicates that the task corresponding to the mark bit is completed, and when the mark bit is 1, the mark field indicates that the task corresponding to the mark bit is being executed.
In this embodiment, a flag field is provided in the meter. Each flag bit in the flag field corresponds to only one task. When the flag bit indicates 1, it indicates that the task corresponding to the flag bit in the meter is being executed, i.e., the task is in a suspended state. When the flag bit shows 0, it indicates that the task corresponding to the flag bit in the instrument has been completed. And after the instrument acquires the mark field, determining the state of each task in the instrument according to the value of each mark bit in the mark field.
S103, judging whether all the zone bits in the zone field are 0, and entering a low power consumption state when all the zone bits in the zone field are 0.
In this embodiment, after the meter acquires the flag field, the value of each flag bit in the flag field is determined. When the meter determines that all the flag bits in the flag field are 0, the meter enters a sleep state, i.e., a low power consumption state. When the meter determines that the flag bit in the flag field is 1, the meter is in a suspended state and cannot enter the sleep state.
According to the instrument control method, the instrument classifies the tasks and initializes the tasks according to the task priority and the execution time consumption. Aiming at tasks with high priority, high real-time requirement and short execution time, the instrument initializes the tasks into an interruption task. Tasks other than tasks are interrupted and the meter can initialize these tasks as timed tasks. A meter get flags field. The meter determines the value of each flag bit in the flag field. When the meter determines that all the flag bits in the flag field are 0, the meter enters a sleep state. When the meter determines that a flag bit of 1 exists in the flag field, the meter is in a suspended state. In the application, the task is divided into the interrupt task and the timing task, so that the interrupt task can be timely and quickly executed, the timing task can determine the execution time as required, the instrument is prevented from being frequently awakened after entering sleep, and the reliability of low power consumption is improved.
Fig. 3 is a flowchart illustrating another meter control method according to an embodiment of the present application. On the basis of the embodiment shown in fig. 1, as shown in fig. 3, the instrument is taken as an execution subject, and in this embodiment, the task and the triggering thereof may include:
s201, acquiring a trigger instruction, wherein the trigger instruction is triggered by interruption or by a timer, and the trigger instruction comprises a task to be executed.
In this embodiment, the meter acquires an interrupt signal, and generates a trigger instruction according to the interrupt signal, where the trigger instruction is used to trigger an interrupt task. The meter can determine the interrupt task corresponding to the interrupt signal according to the interrupt signal. The meter determines the interrupted task as a task to be performed.
Or, the meter can also acquire a timing signal of the timer, and when the timing of the timer is finished, the meter generates a trigger instruction according to the timing information, wherein the trigger instruction is used for triggering a timing task. The meter may determine the corresponding timing task based on the timer. The meter determines the timing task as a task to be performed.
And S202, exiting the low power consumption state according to the trigger instruction, and executing the task to be executed.
In this embodiment, when the trigger instruction is generated, the meter is woken up from the sleep state. The meter exits the low power state and begins executing the task to be executed.
When the meter starts to execute the task to be executed, the meter sets the flag bit corresponding to the task in the flag field to 1. At this point, the meter is in a suspended state.
And after the instrument finishes the task to be executed, the instrument executes the start operation of the mark position and sets the mark position to be 0.
In one example, when the task to be executed is an interrupt task, the execution of the interrupt task may be as shown in task 1 in fig. 4. The execution of the interrupt task takes less time. For example, when the interrupt task is a metering pulse, the interrupt task is performed by simply incrementing the counter value by one.
In another example, when the task to be executed is a timing task, the execution of the interrupt task may be as shown in task 3 in fig. 2. The execution of this interrupt task takes a long time. Therefore, the meter needs to perform the timing task dispersedly to avoid that a plurality of timing tasks which take a long time to perform are performed continuously, which results in that the meter is suspended for a long time and an abnormality occurs.
And S203, determining related tasks according to the tasks to be executed.
In this embodiment, there may be dependencies between the various tasks in the meter. For example, for a metering pulse, when the accumulated value reaches a certain value, the meter may need to perform storage, calculation, and other tasks. In this case, the tasks such as storage and calculation are related to the metering pulse task.
Therefore, after the meter determines the task to be executed, the meter needs to determine the related task and the preset trigger condition of the related task according to the task to be executed.
And S204, establishing a timer of the related task according to the preset trigger condition and the related task.
In this embodiment, since the execution of the related task generally has no real-time requirement, the related task may be a timing task. When a task to be executed has a relevant task, the meter can determine a preset trigger condition of the relevant task according to the relevant task. And when the task to be executed meets the preset triggering condition, the instrument triggers the related task.
Both interrupt tasks and timed tasks may have related tasks and both may trigger related tasks. The related tasks may be as illustrated by task 2 in fig. 4 and task 4 in fig. 2. Wherein, task 2 is the related task triggered by the interrupt task, and task 4 is the related task triggered by the timing task.
And when the related task is triggered, a timer corresponding to the related task is established. In this case, the related task is called a timing task to be started, and waits for the timer to finish timing and trigger as in other timing tasks.
S205, obtaining the suspension duration, wherein the suspension duration is the duration that the flag fields are not all 0.
In this embodiment, the meter counts the duration of continuous suspension. The hang time is the continuous time during which the meter has not gone to sleep. I.e. the duration for which the flag fields of the meter are not all 0.
And S206, when the suspension duration is greater than or equal to a third preset duration, executing reset protection.
In this embodiment, when the suspension duration is longer than a third preset duration, the meter considers that the task execution is abnormal. Namely, the problems of deadlock of tasks and the like in the instrument can exist. At this point, the meter assumes that normal execution will not go to sleep. The meter performs reset protection. The third preset time length is determined according to the longest task execution time and is the time length obtained after the allowance time is added on the basis of the longest task execution time.
According to the instrument control method, the instrument acquires an interrupt signal and generates a trigger instruction according to the interrupt signal, and the trigger instruction is used for triggering an interrupt task. Alternatively, the meter may also obtain a timing signal of a timer, and the triggering instruction is used for triggering a timing task. When the trigger instruction is generated, the meter is awakened from the sleep state and starts to execute the task to be executed. When a task to be executed has a relevant task, the meter may determine a preset trigger condition of the relevant task according to the relevant task. And when the task to be executed meets the preset triggering condition, the instrument triggers the related task. The meter counts the duration of continuous hang up. And when the suspension duration is longer than a third preset duration, the instrument executes reset protection. In the application, the task is divided into the interrupt task and the timing task, so that the interrupt task can be timely and quickly executed, and the timing task can determine the execution time according to needs, so that the instrument is prevented from being frequently awakened after entering the dormancy, and the reliability of low power consumption is improved. Meanwhile, the method and the device have the advantages that the length of the hanging time is obtained, so that the resetting operation is executed when the length of the hanging time is too long, and the reliability of low power consumption is further improved.
Fig. 5 is a schematic structural diagram of a meter control device according to an embodiment of the present application, and as shown in fig. 5, a meter control device 10 according to the present embodiment is used for implementing an operation corresponding to a meter in any one of the method embodiments, where the meter control device 10 according to the present embodiment includes:
the initialization module 11 is configured to initialize a task triggering mode according to a task priority and execution time consumption of a task, where the triggering mode includes an interrupt mode triggering and a timer triggering, the task priority of the task triggered by the interrupt mode is high, the execution time consumption is short, and the task priority of the task triggered by the timer is low, and/or the execution time consumption is long.
The first obtaining module 12 is configured to obtain a flag field, where the flag field includes a preset number of flag bits, each flag bit uniquely corresponds to one task, and the flag bits include 0 and 1, and when the flag bit is 0, it indicates that the task corresponding to the flag bit is completed, and when the flag bit is 1, it indicates that the task corresponding to the flag bit is being executed;
and the sleep module 13 is configured to enter a low power consumption state when all the flag bits in the flag field are 0.
In one example, when the time consumed for executing the task is long, the device is further configured to divide the task into a plurality of task segments in a multi-segment execution manner according to the time consumed for executing the task, where the execution time of the task segments is a first preset time, and the execution interval of the task segments is a second preset time; triggering a task according to the interrupt triggering instruction; and triggering each task segment of the task one by one according to a timer triggering instruction, wherein the triggering interval of the timer triggering instruction is a second preset time length.
The instrument control device 10 provided in the embodiment of the present application may implement the above method embodiment, and for details of the implementation principle and the technical effect, reference may be made to the above method embodiment, which is not described herein again.
Fig. 6 shows a schematic structural diagram of another instrument control device provided in an embodiment of the present application, and based on the embodiment shown in fig. 5, as shown in fig. 6, the instrument control device 10 of the present embodiment is used to implement the operation corresponding to the instrument in any one of the method embodiments described above, and the instrument control device 10 of the present embodiment further includes:
the second obtaining module 14 is configured to obtain a trigger instruction, where the trigger instruction is triggered by an interrupt or by a timer, and the trigger instruction includes a task to be executed;
and the execution module 15 is configured to exit the low power consumption state and execute the task to be executed according to the trigger instruction.
The determining module 16 is configured to determine a related task according to a task to be executed;
and the creating module 17 is configured to create a timer for the related task according to a preset trigger condition and the related task.
A third obtaining module 18, configured to obtain a suspension duration, where the suspension duration is a duration that the flag fields are not all 0;
and the reset module 19 is configured to execute reset protection when the suspension duration is greater than or equal to a third preset duration.
In one example, the execution module 15 is specifically configured to, according to the trigger instruction, mark the position 1 corresponding to the task to be executed; and after the task to be executed is completed, marking the position 0 corresponding to the task to be executed.
The instrument control device 10 provided in the embodiment of the present application may implement the above method embodiment, and for details of the implementation principle and the technical effect, reference may be made to the above method embodiment, which is not described herein again.
Fig. 7 shows a hardware structure diagram of a meter provided in an embodiment of the present application. As shown in fig. 7, the meter 20 is used for implementing the operation corresponding to the meter in any of the above method embodiments, and the meter 20 of the present embodiment may include: memory 21, processor 22 and communication interface 24.
A memory 21 for storing executable instructions of the processor. The Memory 21 may include a Random Access Memory (RAM), a Non-Volatile Memory (NVM), at least one disk Memory, a usb disk, a removable hard disk, a read-only Memory, a magnetic or optical disk, and so on.
And the processor 22 is used for realizing the meter control method in the above embodiment according to the executable instructions stored in the memory. Reference may be made in particular to the description relating to the method embodiments described above.
Alternatively, the memory 21 may be separate or integrated with the processor 22.
When the memory 21 is a separate device from the processor 22, the meter 20 may further include:
a bus 23 for connecting the memory 21 and the processor 22. The bus 23 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
A communication interface 24, the communication interface 24 being connectable to the processor 21 via a bus 23. The communication interface 24 is used to acquire a trigger instruction.
The meter provided by this embodiment can be used to execute the above-mentioned meter control method, and its implementation manner and technical effect are similar, and this embodiment is not described herein again.
The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are executed by a processor to implement the methods provided by the above-mentioned various embodiments.
The present application also provides a program product comprising execution instructions stored in a computer-readable storage medium. The at least one processor of the device may read the execution instructions from the computer-readable storage medium, and the execution of the execution instructions by the at least one processor causes the device to implement the methods provided by the various embodiments described above.
Embodiments of the present application further provide a chip, which includes a memory and a processor, where the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that a device in which the chip is installed executes the method in the above various possible embodiments.
It should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of modules is merely a division of logical functions, and an actual implementation may have another division, for example, a plurality of modules may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
Modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one unit. The unit formed by the modules can be realized in a hardware mode, and can also be realized in a mode of hardware and a software functional unit.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional modules are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a processor to execute some steps of the methods according to the embodiments of the present application.
Those of ordinary skill in the art will understand that: all or a portion of the steps for implementing the above-described method embodiments may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer-readable storage medium. Which when executed performs steps comprising the method embodiments described above. And the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method of controlling a meter, the method comprising:
initializing a triggering mode of a task according to task priority and execution time consumption of the task, wherein the triggering mode comprises interruption mode triggering and timer triggering, the task priority of the task triggered by the interruption mode is high, the execution time consumption is short, and the task priority of the task triggered by the timer is low and/or the execution time consumption is long;
acquiring a flag field, wherein the flag field comprises a preset number of flag bits, each flag bit uniquely corresponds to one task, each flag bit comprises 0 and 1, when the flag bit is 0, the flag bit indicates that the task corresponding to the flag bit is completed, and when the flag bit is 1, the flag bit indicates that the task corresponding to the flag bit is being executed;
and judging whether all the zone bits in the zone field are 0, and entering a low power consumption state when all the zone bits in the zone field are 0.
2. The method of claim 1, further comprising:
dividing the task into a plurality of task segments in a multi-segment execution mode according to the execution time consumption of the task, wherein the execution time of the task segments is a first preset time, and the execution interval of the task segments is a second preset time;
triggering the task according to an interrupt triggering instruction;
and triggering each task segment of the task one by one according to a timer triggering instruction, wherein the triggering interval of the timer triggering instruction is a second preset time length.
3. The method of claim 1, further comprising:
acquiring a trigger instruction, wherein the trigger instruction is triggered by interruption or a timer, and the trigger instruction comprises a task to be executed;
and exiting the low power consumption state according to the trigger instruction, and executing the task to be executed.
4. The method of claim 3, further comprising:
according to the trigger instruction, marking the position 1 of the mark corresponding to the task to be executed;
and after the task to be executed is completed, marking the position 0 corresponding to the task to be executed.
5. The method of claim 3, further comprising:
determining a related task according to the task to be executed;
and establishing a timer of the related task according to a preset trigger condition and the related task.
6. The method according to any one of claims 1-5, further comprising:
acquiring a suspension duration which is the duration of the flag fields not being all 0;
and executing reset protection when the suspension duration is greater than or equal to a third preset duration.
7. An instrument control device, characterized in that the device comprises:
the initialization module is used for initializing a triggering mode of the task according to the task priority and the execution time consumption of the task, wherein the triggering mode comprises an interruption mode triggering and a timer triggering, the task priority of the task triggered by the interruption mode is high, the execution time consumption is short, and the task priority of the task triggered by the timer is low and/or the execution time consumption is long;
the first obtaining module is used for obtaining a flag field, the flag field comprises a preset number of flag bits, each flag bit uniquely corresponds to one task, the flag bits comprise 0 and 1, when the flag bit is 0, the flag bits indicate that the tasks corresponding to the flag bits are completed, and when the flag bit is 1, the flag bits indicate that the tasks corresponding to the flag bits are being executed;
and the dormancy module is used for entering a low power consumption state when the zone bits in the zone field are all 0.
8. A meter, characterized in that the meter comprises: a memory, a processor; a memory for storing executable instructions of the processor; a processor for implementing the meter control method of any of claims 1 to 6 in accordance with executable instructions stored by said memory.
9. A computer-readable storage medium having computer-executable instructions stored thereon, which when executed by a processor, implement the meter control method of any one of claims 1 to 6.
10. A computer program product, characterized in that it comprises computer instructions which, when executed by a processor, implement the meter control method of any one of claims 1 to 6.
CN202011530801.0A 2020-12-22 2020-12-22 Instrument control method, device and equipment Pending CN112905244A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011530801.0A CN112905244A (en) 2020-12-22 2020-12-22 Instrument control method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011530801.0A CN112905244A (en) 2020-12-22 2020-12-22 Instrument control method, device and equipment

Publications (1)

Publication Number Publication Date
CN112905244A true CN112905244A (en) 2021-06-04

Family

ID=76111570

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011530801.0A Pending CN112905244A (en) 2020-12-22 2020-12-22 Instrument control method, device and equipment

Country Status (1)

Country Link
CN (1) CN112905244A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101158913A (en) * 2007-11-15 2008-04-09 上海华为技术有限公司 Method and system for checking tasks endless loop
CN103488953A (en) * 2013-10-08 2014-01-01 飞天诚信科技股份有限公司 Intelligent switching method applied to multifunctional equipment
US20140082053A1 (en) * 2011-03-30 2014-03-20 Lin Chen System and method for generating information file based on parallel processing
CN105092103A (en) * 2014-05-04 2015-11-25 昆山双桥传感器测控技术有限公司 WIFI based node type pressure sensor and working state management and control method thereof
CN107656803A (en) * 2017-09-22 2018-02-02 交控科技股份有限公司 Without software task dispatching method and device under operating system in train control system
CN108536531A (en) * 2018-04-03 2018-09-14 中国电子科技集团公司第七研究所 A kind of SCM Based task scheduling and method for managing power supply
CN109254839A (en) * 2018-08-24 2019-01-22 上海哔哩哔哩科技有限公司 It determines the method in task triggered time, construct the method and system of task timer
CN111143047A (en) * 2019-12-24 2020-05-12 北京无线电测量研究所 Timing and random double-interrupt processing system and method
CN112105041A (en) * 2020-08-17 2020-12-18 漳州立达信光电子科技有限公司 Control method and device for environment adjusting equipment powered by battery and terminal

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101158913A (en) * 2007-11-15 2008-04-09 上海华为技术有限公司 Method and system for checking tasks endless loop
US20140082053A1 (en) * 2011-03-30 2014-03-20 Lin Chen System and method for generating information file based on parallel processing
CN103488953A (en) * 2013-10-08 2014-01-01 飞天诚信科技股份有限公司 Intelligent switching method applied to multifunctional equipment
CN105092103A (en) * 2014-05-04 2015-11-25 昆山双桥传感器测控技术有限公司 WIFI based node type pressure sensor and working state management and control method thereof
CN107656803A (en) * 2017-09-22 2018-02-02 交控科技股份有限公司 Without software task dispatching method and device under operating system in train control system
CN108536531A (en) * 2018-04-03 2018-09-14 中国电子科技集团公司第七研究所 A kind of SCM Based task scheduling and method for managing power supply
CN109254839A (en) * 2018-08-24 2019-01-22 上海哔哩哔哩科技有限公司 It determines the method in task triggered time, construct the method and system of task timer
CN111143047A (en) * 2019-12-24 2020-05-12 北京无线电测量研究所 Timing and random double-interrupt processing system and method
CN112105041A (en) * 2020-08-17 2020-12-18 漳州立达信光电子科技有限公司 Control method and device for environment adjusting equipment powered by battery and terminal

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘利强: "《实时嵌入式系统软件设计方法》", 30 April 2012, 哈尔滨工程大学出版社, pages: 206 - 212 *
张钧良: "《Visual Basic 6.0程序设计教程 第2版》", 29 February 2004, 东南大学出版社, pages: 170 - 173 *

Similar Documents

Publication Publication Date Title
CN102789305B (en) Postponing suspend
US8209559B2 (en) Low power polling techniques
EP2261771B1 (en) Power managed lock optimization
US11907762B2 (en) Resource conservation for containerized systems
US20130067475A1 (en) Managing processes within suspend states and execution states
US7694164B2 (en) Operating system-independent method and system of determining CPU utilization
US7617488B2 (en) Method and apparatus and determining processor utilization
EP2756389A1 (en) Managing processes within suspend states and execution states
CN110908724A (en) Android App starting method and related components
EP3803663B1 (en) Watchdog timer hierarchy
CN115361451B (en) Network communication parallel processing method and system
US20130117492A1 (en) Platform communication protocol
US9958928B2 (en) Method and apparatus for controlling an operating mode of a processing module
CN107479900B (en) Hot plug software scheme suitable for real-time operating system
CN112905244A (en) Instrument control method, device and equipment
CN108132803B (en) Timing keep-alive and awakening method, system, terminal and medium based on mobile terminal
CN116010143A (en) Method for automatically feeding dogs under dormancy and energy storage system
CN114610578A (en) Resource state management method and device, electronic equipment and storage medium
CN112241318A (en) Processor heartbeat counting method for eliminating characterization blind spots
JPWO2018138798A1 (en) Computer apparatus, task activation method, and task activation program
WO2018059000A1 (en) Method and device for controlling mobile terminal, and mobile terminal
CN111597016B (en) System task time protection method, system, storage medium and terminal
US20060112395A1 (en) Replacing idle process when doing fast messaging
CN115312012A (en) LCD electric meter display method, device and system for reducing chip power consumption
JP2013167945A (en) Information processing device, task wake-up control method, and task start-up control program

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