WO2014134810A1 - 电子烟微控制器的多任务执行方法及装置 - Google Patents

电子烟微控制器的多任务执行方法及装置 Download PDF

Info

Publication number
WO2014134810A1
WO2014134810A1 PCT/CN2013/072302 CN2013072302W WO2014134810A1 WO 2014134810 A1 WO2014134810 A1 WO 2014134810A1 CN 2013072302 W CN2013072302 W CN 2013072302W WO 2014134810 A1 WO2014134810 A1 WO 2014134810A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
time
status bit
time slice
microcontroller
Prior art date
Application number
PCT/CN2013/072302
Other languages
English (en)
French (fr)
Inventor
向智勇
Original Assignee
Xiang Zhiyong
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 Xiang Zhiyong filed Critical Xiang Zhiyong
Publication of WO2014134810A1 publication Critical patent/WO2014134810A1/zh

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/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
    • 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

Definitions

  • the present invention relates to the field of electronic cigarettes, and more particularly to a multi-task execution method and apparatus for an electronic cigarette microcontroller.
  • E-cigarettes are an alternative to using cigarettes to heat up and provide a cigarette to smokers, and have become more popular with smokers.
  • a microcontroller is used to handle various tasks such as detection of a smoke sensor, driving of a nebulizer heating, load overcurrent detection, load short circuit detection, and charge detection.
  • the microcontroller processes these tasks, it is in the form of a task module. After one task is executed, another task is executed until the last task is processed and then returned to the first task. In this way, the implementation of these tasks is performed cyclically.
  • the technical problem to be solved by the present invention is that the task processing method of the above-mentioned electronic cigarette micro-controller of the prior art may cause system instability and cause defects, and provide a multi-task execution method of the electronic cigarette microcontroller And the device can improve the task execution efficiency of the electronic cigarette microcontroller and stabilize the system.
  • the execution time sequence of each task is divided into a plurality of time slices, so that a time slice is arbitrarily taken out from each task and the sum of the extracted time slices is added to be less than or equal to a minimum value of the interval duration. ;
  • Each of the tasks is executed according to a time slice corresponding to a current status bit of each task, and when the time slice corresponding to the current status bit ends, switching to the next task of the task.
  • the status bit pointing to the time slice of the task further includes: when switching from the current task to the next task, causing the status bit of the current task to point to the next time slice of the task, or When the status bit of the current task has pointed to the last time slice of the task, the status bit of the current task is pointed to the first time slice.
  • the method further includes: setting a timing time of the timer, such that the timing time is equal to a time slice pointed by the current status bit, and when the timing time expires, the task is switched.
  • the method further includes: determining each time slice of each task according to the task requirement, and determining the number of time slices of each task according to the execution time of the task and each time slice.
  • a task determining module configured to determine a task to be performed by the microcontroller, and an allowable interval duration for each task to be performed twice;
  • a time slice division module configured to divide the execution time sequence of each task into a plurality of time slices, so that each time slice is arbitrarily taken out from each task and the sum of the extracted time slices is added to be less than or equal to The minimum of the interval durations;
  • a status bit determining module for setting a status bit for each task, the status bit pointing to a time slice of the task
  • a task execution and switching module configured to execute each of the tasks according to a time slice corresponding to a current status bit of each task, and switch to a next task of the task when the time slice corresponding to the current status bit ends.
  • the status bit determining module is further configured to: when switching from the current task to the next task, point the status bit of the current task to the next time slice of the task, or the status bit of the current task has pointed to the last time slice of the task When the status bit of the current task is pointed to the first time slice.
  • the task execution and switching module is further configured to set a timer time of the timer, such that the timing time is equal to the time slice pointed by the current status bit, and the task is switched when the timing time expires.
  • the multi-task execution method and device for implementing an electronic cigarette microcontroller of the invention has the following beneficial effects: improving the task execution efficiency of the electronic cigarette micro-controller, making the electronic cigarette system more stable, and micro-controlling the electronic cigarette Low performance requirements and low cost are easy to implement.
  • FIG. 1 is a flow chart of a multi-task execution method of an electronic cigarette microcontroller according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of task switching in the execution task of the multi-task execution method of the electronic cigarette microcontroller shown in FIG. 1;
  • Fig. 3 is a multitask execution apparatus of an electronic cigarette microcontroller in accordance with an embodiment of the present invention.
  • the electronic cigarette controller is used to process a plurality of tasks, including detection of a smoke sensor, driving of a nebulizer heating, load overcurrent detection, load short circuit detection, charge detection, and the like. Due to the multiple tasks, the task switching method adopted by the microprocessor should be efficient and stable.
  • the multi-task execution method and device of the electronic cigarette micro-controller according to the embodiment of the invention implements reasonable control of the execution time of each task, so as to realize stable and efficient control of the electronic cigarette micro-controller to the entire electronic cigarette system. .
  • FIG. 1 shows an embodiment of the present invention. Multi-task execution method for an electronic cigarette microcontroller.
  • the microcontroller is configured to process a plurality of tasks, the method comprising:
  • the allowable interval duration is the time interval after the microcontroller executes a task and the next time it is executed.
  • Each task has different requirements for this interval duration. For example, in order to realize real-time detection of load short-circuit, the allowable interval duration of load short-circuit detection is approximately 1ms, while the detection of smoking sensors allows an interval of approximately 100ms .
  • the interval duration can be determined according to the real-time nature of the task, and the interval of the task with high real-time requirements is short. This interval can also be determined based on other needs of the task execution.
  • the execution time sequence of each task is divided into a plurality of time slices, so that a time slice is arbitrarily taken out from each task and the sum of the extracted time slices is added to be less than or equal to a minimum value of the interval duration.
  • the time interval can meet the interval time requirement of the task.
  • the number of tasks a microcontroller needs to perform is 4, respectively for task 1, task 2, task 3, task 4.
  • the minimum value of the interval duration is the interval length of task 1: 10ms.
  • the time slice of each task should be divided: task 1 A time slice, a time slice of task 2, a time slice of task 3, and a time slice of task 4 are less than or equal to 10 ms.
  • a time slice of task 1 can be made 2ms, one time slice of task 2 is 5ms, one time slice of task 3 is 1ms, and one time slice of task 4 is 2ms.
  • each time slice in each task and the time slice of a different task can be set to be different.
  • Each time slice of each task is determined according to the task requirements, and the number of time slices of each task is determined according to the execution time of the task and each time slice. For example, for the button detection task in the electronic cigarette, since the button detection needs to wait for the anti-jitter delay, if the button duration is 5 ms, and the anti-shake delay is 10 ms. Then, it is preferable to set a time slice of the key detection task to 5 ms so that the detection portion of the action of the key of the task can be completed in one time slice.
  • the execution status of each task In order to enable the task to switch and cycle the execution of the task, it is possible to determine the execution status of each task, and set a status bit for each task to record the execution status information of the task. This status bit points to the time slice of the task. After setting the status bit for each task, it is possible to obtain the execution of the task based on the time slice pointed to by the status bit. For example, if the status bit of a task points to the second time slice, it indicates that the execution status of the task is the execution of the second time slice.
  • the status bit of the current task is pointed to the next time slice of the task, or the status bit of the current task has been pointed to the last time slice of the task, so that the status bit of the current task is pointed The first time slice.
  • the status bit points to the next time slice, and all the time slices of the task are cycled to the end, so that the status bit returns to the initial state, that is, at the end of all time slices, the status bit points to the first time slice. .
  • setting up a task The number of time slices of 1 is 5 and the initial status bit is set to point to the first time slice.
  • the first time the task is executed 1 is executed.
  • the first time slice, at the end of the first time slice, the status bit points to the second time slice;
  • the second time the task 1 is executed, according to the corresponding time slice of the status bit, the task 1 is executed.
  • the second time slice, at the end of the second time slice, the status bit points to the third time slice, and so on, the status bit points to the fifth time slice and then points back to the first time slice.
  • the status bit of a task points to the last time slice and then points back to the first time slice to prove that the task has been completely executed.
  • Each of the tasks is executed according to a time slice corresponding to a current status bit of each task, and when the time slice corresponding to the current status bit ends, switching to the next task of the task.
  • the timer time of the timer needs to be set, and the timing time is equal to one time slice of each task.
  • the timing time expires, the task is switched.
  • FIG. 2 is a schematic diagram showing the switching of tasks when a task is executed by a multi-task execution method of an electronic cigarette microcontroller according to an embodiment of the invention.
  • the tasks that the electronic cigarette's microcontroller needs to perform include Task 1, Task 2, ... Task n.
  • Task 1, task 2, ... task n The execution time is divided into different numbers of time slices.
  • the multi-task execution method of the electronic cigarette microcontroller according to the present invention, the microcontroller is not in accordance with task 1, task 2 The order of ... performs these tasks. Instead, these tasks are performed in the form of time slices, that is, when task 1 is executed, it is a time slice of task 1, not the total execution time of task 1.
  • the time when the microcontroller switches to the same task for the second time is shortened by the sum of all task execution times of the prior art for any time slice addition time of all tasks.
  • the setting according to the invention The execution time sequence of each task is divided into a plurality of time slices, so that a time slice is arbitrarily taken out from each task and the sum of the extracted time slices is added to be less than or equal to a minimum value of the interval duration. . Therefore, even the task of minimizing the time interval between two executions, such as the short-circuit detection of the electronic cigarette, can ensure the real-time performance of the task, and the task is not caused by the time interval between the two executions exceeding the requirements. Invalid.
  • FIG. 3 is a diagram showing a multi-task execution apparatus of an electronic cigarette microcontroller according to an embodiment of the present invention, the apparatus comprising:
  • the task determination module 100 is configured to determine a task to be executed by the microcontroller and an allowable interval duration for each task to be performed twice.
  • Time slice division module 101 For dividing the execution time sequence of each task into a plurality of time slices, so that a time slice is arbitrarily taken out from each task and the sum of the extracted time slices is added to be less than or equal to the interval duration. The minimum value.
  • the status bit determination module 102 is configured to set a status bit for each task, the status bit pointing to a time slice of the task.
  • Status bit determination module 102 Also used to make the current task's status bit point to the next time slice of the task when the current task is switched to the next task, or the current task's status bit has pointed to the last time slice of the task, so that the current task is The status bit points to the first time slice.
  • Task execution and switching module 103 for Each of the tasks is executed according to a time slice corresponding to a current status bit of each task, and when the time slice corresponding to the current status bit ends, switching to the next task of the task.
  • Task Execution and Switching Module 103 It is also used to set the timer's timing time so that its timing time is equal to the time slice pointed to by the current status bit. When the timing time expires, the task is switched.
  • modules 100, 101, 102, 103 Both can be used by the electronic cigarette's microcontroller to perform the above data processing work.
  • a multi-task execution method and apparatus for implementing the electronic cigarette microcontroller of the present invention by dividing the execution time of different tasks into time slices, and arbitrarily taking out a time slice from each task and taking the time of the removal
  • the sum of the slices is less than or equal to the minimum of the interval durations, thereby improving the task execution efficiency of the electronic cigarette microcontroller, making the electronic cigarette system more stable, and the multi-task execution method and apparatus of the present invention for the electronic cigarette
  • the microcontroller has low performance requirements and does not require the addition of new hardware structures, so it is easy to implement and low in cost.

Abstract

一种电子烟微控制器的多任务执行方法及装置,该方法包括:确定所述微控制器要执行的任务以及每个任务两次被执行可允许的间隔时长(S1);将每个任务的执行时间顺序划分为多个时间片,使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值(S2);为每个任务设置状态位,所述状态位指向该任务的时间片(S3);根据每个任务的当前状态位对应的时间片执行所述每个任务,当所述当前状态位对应的时间片结束时,切换至该任务的下一任务(S4)。上述多任务执行方法的有益效果是,提高电子烟微控制器的任务执行效率,使电子烟的系统更加稳定,且对电子烟的微控制器性能要求低,成本低易于实现。

Description

电子烟微控制器的多任务执行方法及装置 技术领域
本发明涉及电子烟领域,更具体地说,涉及一种电子烟微控制器的多任务执行方法及装置。
背景技术
电子烟是一种利用对烟液进行加热产生雾化,给吸烟者提供一种香烟的替代品,已经越来越受到吸烟消费者的欢迎。
目前,在电子烟中,利用微控制器来处理各种任务,如抽烟传感器的检测、雾化器加热的驱动、负载过流检测、负载短路检测、充电检测等。微控制器处理这些任务时,是按照任务模块的形式,一个任务执行完成后,再执行另一任务,直到最后一个任务处理完成后又回到第一个任务。以此,实现循环执行这些任务。
但有些任务模块,如负载过流检测、负载短路检测等对两次执行的时间间隔要求很短。由于每个任务执行的时间长短不同,会导致第一次执行完某任务后,再次循环到执行该任务的时间间隔超过了该任务对两次执行的时间间隔的要求。因此,采用现有技术的微控制器循环执行任务的方式,将导致某些任务的失效,使得这些任务对应的功能时有时无,导致系统不稳定,并可能引起不良后果,如烧坏电路、整机失效、起火等。
发明内容
本发明要解决的技术问题在于,针对现有技术的上述电子烟的微控制器的任务处理方式会导致系统不稳定,引起不良后果的缺陷,提供一种电子烟微控制器的多任务执行方法及装置,可提高电子烟微控制器的任务执行效率,使系统稳定。
本发明解决其技术问题所采用的技术方案是:
一种电子烟微控制器的多任务执行方法,所述微控制器用于处理多个任务,其中所述微控制器包括定时器,该方法包括:
确定所述微控制器要执行的任务以及每个任务两次被执行可允许的间隔时长;
将每个任务的执行时间顺序划分为多个时间片,使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值;
为每个任务设置状态位,所述状态位指向该任务的时间片;
根据每个任务的当前状态位对应的时间片执行所述每个任务,当所述当前状态位对应的时间片结束时,切换至该任务的下一任务。
所述为每个任务设置状态位,所述状态位指向该任务的时间片还包括:当从当前任务切换至下一任务时,使当前任务的状态位指向该任务的下一时间片,或当前任务的状态位已指向该任务的最后一个时间片时,使当前任务的状态位指向第一时间片。
所述当状态位对应的时间片结束时,切换至该任务的下一任务 还包括:设置定时器的定时时间,使其定时时间等于当前状态位指向的时间片,定时时间到时,进行任务的切换。
所述方法还包括:每个任务的每个时间片根据任务需求进行确定,每个任务的时间片个数根据该任务的执行时间和每个时间片进行确定。
一种电子烟微控制器的多任务执行装置,所述微控制器用于处理多个任务,其中所述微控制器包括定时器,该装置包括:
任务确定模块,用于确定所述微控制器要执行的任务以及每个任务两次被执行可允许的间隔时长;
时间片划分模块,用于将每个任务的执行时间顺序划分为多个时间片,使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值;
状态位确定模块,用于为每个任务设置状态位,所述状态位指向该任务的时间片;
任务执行和切换模块,用于根据每个任务的当前状态位对应的时间片执行所述每个任务,当所述当前状态位对应的时间片结束时,切换至该任务的下一任务 。
所述状态位确定模块还用于当从当前任务切换至下一任务时,使当前任务的状态位指向该任务的下一时间片,或当前任务的状态位已指向该任务的最后一个时间片时,使当前任务的状态位指向第一时间片。
所述任务执行和切换模块还用于设置定时器的定时时间,使其定时时间等于当前状态位指向的时间片,定时时间到时,进行任务的切换。
实施本发明的一种电子烟微控制器的多任务执行方法及装置,具有以下有益效果:提高电子烟微控制器的任务执行效率,使电子烟的系统更加稳定,且对电子烟的微控制器性能要求低,成本低易于实现。
附图说明
下面将结合附图及实施例对本发明作进一步说明,附图中:
图 1 是本发明一实施例的 电子烟微控制器的多任务执行方法流程图 ;
图 2 是本发明 图 1 所示的电子烟微控制器的多任务执行方法的执行任务时的任务切换示意图 ;
图 3 是本发明一实施例的 电子烟微控制器的多任务执行装置 。
具体实施方式
为了对本发明的技术特征、目的和效果有更加清楚的理解,现对照附图详细说明本发明的具体实施方式。
在本发明实施例中电子烟的微控制器用于处理多个任务,这些任务包括抽烟传感器的检测、雾化器加热的驱动、负载过流检测、负载短路检测、充电检测等。由于有多个任务,微处理器采用的任务切换方式应高效和稳定。本发明实施例中涉及的电子烟微控制器的多任务执行方法及装置,通过对各个任务的执行时间进行合理的控制,以实现电子烟微控制器对电子烟整个系统的稳定且高效的控制。
如图 1 所示为本发明一实施例的 电子烟微控制器的多任务执行方法。所述微控制器用于处理多个任务,该方法包括:
S1 、确定所述微控制器要执行的任务以及每个任务两次被执行可允许的间隔时长。
每个任务两次被执行可允许的间隔时长是指:微控制器执行完某一任务后,下一次再执行该任务的时间间隔。每个任务对这个间隔时长的要求是不相同的,例如为了实现对负载短路的实时检测,负载短路检测可允许的间隔时长大约为 1ms ,而抽烟传感器的检测可允许的间隔时长大约为 100ms 。这个间隔时长可根据任务的实时性确定的,实时性要求高的任务的间隔时长短。这个间隔时长还可根据任务执行的其他需要进行确定。
S2 、将每个任务的执行时间顺序划分为多个时间片,使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值。
将每个任务的执行时间顺序划分为多个时间片,使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值,是为了使任务循环执行而再次执行到对间隔时长要求最短的任务时,其时间间隔能够满足该任务对间隔时长的要求。例如,微控制器需要执行的任务数为 4 ,分别为任务 1 、任务 2 、任务 3 、任务 4 。间隔时长中的最小值为任务 1 的间隔时长: 10ms 。则每个任务的时间片的划分应满足:任务 1 的一个时间片、任务 2 的一个时间片、任务 3 的一个时间片和任务 4 的一个时间片之和小于等于 10ms 。为满足这个条件,可使任务 1 的一个时间片为 2ms ,任务 2 的一个时间片为 5ms ,任务 3 的一个时间片为 1ms ,任务 4 的一个时间片 2ms 。
此外,为了保证每个任务在一个时间片内被执行的部分任务的合理性,每个任务的时间片的划分应与每个任务的具体情况相对应。因此,每个任务中的每个时间片以及不同任务的时间片都可设置为不相同。即 每个任务的每个时间片根据任务需求进行确定,每个任务的时间片个数根据该任务的执行时间和每个时间片进行确定。 例如,对于电子烟中的按键检测任务,由于按键检测需要进行防抖动时延的等待,若按键的时长为 5ms ,而防抖动时延的时长为 10ms ,则按键检测任务的一个时间片设置为 5ms 为最佳,以使得在一个时间片内这个任务的按键的动作的检测部分能够完成。
S3 、为每个任务设置状态位,所述状态位指向该任务的时间片。
为了使任务切换和循环执行任务时,能够确定的获知每个任务的执行状态,为每个任务设置状态位,以记录该任务的执行状态信息。该状态位指向该任务的时间片。为每个任务设置了状态位后,就能够根据状态位所指向的时间片,获得该任务被执行的情况。例如,若某一任务的状态位指向第二时间片,则说明该任务的执行状态为执行到了第二时间片。
当从当前任务切换至下一任务时,使当前任务的状态位指向该任务的下一时间片,或当前任务的状态位已指向该任务的最后一个时间片时,使当前任务的状态位指向第一时间片。 每个任务的一个时间片结束时,状态位指向下一时间片,一直循环到该任务的所有时间片结束,使状态位回到初始状态即所有时间片结束时,状态位指向第一时间片。例如,设置任务 1 的时间片个数为 5 ,且设置初始状态位指向第一个时间片。则第一次执行任务 1 ,根据状态位的对应的时间片,则执行任务 1 的第一个时间片,第一个时间片结束时,状态位指向第二时间片;第二次执行任务 1 ,根据状态位的对应的时间片,则执行任务 1 的第二个时间片,第二个时间片结束时,状态位指向第三时间片,以此类推,状态位指向第五时间片后又重新指向第一时间片。某一任务的状态位指向最后一个时间片后又重新指向第一时间片则证明该任务已被完整执行完一次。
S4 、根据每个任务的当前状态位对应的时间片执行所述每个任务,当所述当前状态位对应的时间片结束时,切换至该任务的下一任务。
为了保证任务切换的进行,需对定时器的定时时间进行设置,并使其定时时间等于每个任务的一个时间片,定时时间到时,进行任务的切换。
如图 2 所示为按照本发明一实施例的 电子烟微控制器的多任务执行方法执行任务时的任务的切换示意图。 如图 2 所示,电子烟的微控制器所需要执行的任务包括任务 1 、任务 2 、……任务 n 。任务 1 、任务 2 、……任务 n 的执行时间划分为包含不同数量的时间片。按照本发明的 电子烟微控制器的多任务执行方法,微控制器并不是按照任务 1 、任务 2 ……的顺序执行这些任务。而是按照时间片的形式执行这些任务,即执行任务 1 时,是执行任务 1 的某一时间片,而并不是任务 1 的全部执行时间。当任务 1 的这一时间片执行完后切换到任务 2 的某一时间片,以此类推,直到执行完所有任务的其中一时间片后,再次循环到执行任务 1 的某一时间片。采用本发明的电子烟微控制器的多任务执行方法,当切换任务时,实际上是切换至不同任务的不同时间片。而不同任务的每个时间片根据不同任务的需求进行确定,不同任务的时间片个数是根据该任务的执行时间和每个时间片进行确定。因此,每个任务一次的实际执行时间由现有技术的每个任务执行的总时间缩短为某一时间片的时间。而微控制器第二次切换到同一任务的时间由现有技术的所有任务执行时间的总和缩短为了所有任务的任意一个时间片相加的时间。且根据本发明的设置: 将每个任务的执行时间顺序划分为多个时间片,使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值。因此,即使是对两次执行的时间间隔要求最短的任务如电子烟的负载短路检测等任务的实时性都能得到保证,而不至于由于两次执行的时间间隔超过其要求而导致这些任务的失效。
图 3 所示为本发明一实施例的 电子烟微控制器的多任务执行装置,该装置包括:
任务确定模块 100 ,用于确定所述微控制器要执行的任务以及每个任务两次被执行可允许的间隔时长。
时间片划分模块 101 ,用于将每个任务的执行时间顺序划分为多个时间片,使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值。
状态位确定模块 102 ,用于为每个任务设置状态位,所述状态位指向该任务的时间片。
状态位确定模块 102 还用于当从当前任务切换至下一任务时,使当前任务的状态位指向该任务的下一时间片,或当前任务的状态位已指向该任务的最后一个时间片时,使当前任务的状态位指向第一时间片。
任务执行和切换模块 103 ,用于 根据每个任务的当前状态位对应的时间片执行所述每个任务,当所述当前状态位对应的时间片结束时,切换至该任务的下一任务 。
任务执行和切换模块 103 还用于设置定时器的定时时间,使其定时时间等于当前状态位指向的时间片,定时时间到时,进行任务的切换。
应理解,上述模块 100 、 101 、 102 、 103 均可由电子烟的微控制器充当以执行上述数据处理工作。
应理解,上述各个模块的具体实现过程可与上述方法实施例的描述相对应,此处不再详细描述。
实施本发明的电子烟微控制器的多任务执行方法及装置,通过将不同任务的执行时间进行时间片的划分,并使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值,从而提高了电子烟微控制器的任务执行效率,使电子烟系统更加稳定,且本发明的多任务执行方法和装置对电子烟的微控制器性能要求低,不需要增加新的硬件结构,因此易于实现且成本也低。
上面结合附图对本发明的实施例进行了描述,但是本发明并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本发明的启示下,在不脱离本发明宗旨和权利要求所保护的范围情况下,还可做出很多形式,这些均属于本发明的保护之内。

Claims (7)

  1. 一种电子烟微控制器的多任务执行方法,所述微控制器用于处理多个任务,其中所述微控制器包括定时器,其特征在于,该方法包括:
    确定所述微控制器要执行的任务以及每个任务两次被执行可允许的间隔时长;
    将每个任务的执行时间顺序划分为多个时间片,使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值;
    为每个任务设置状态位,所述状态位指向该任务的时间片;
    根据每个任务的当前状态位对应的时间片执行所述每个任务,当所述当前状态位对应的时间片结束时,切换至该任务的下一任务。
  2. 根据权利要求 1 所述的 多任务执行方法 ,其特征在于,所述为每个任务设置状态位,所述状态位指向该任务的时间片还包括:
    当从当前任务切换至下一任务时,使当前任务的状态位指向该任务的下一时间片,或当前任务的状态位已指向该任务的最后一个时间片时,使当前任务的状态位指向第一时间片。
  3. 根据权利要求 1 所述的多任务执行方法 ,其特征在于,所述当状态位对应的时间片结束时,切换至该任务的下一任务还包括:
    设置定时器的定时时间,使其定时时间等于当前状态位指向的时间片,定时时间到时,进行任务的切换。
  4. 根据权利要求 1 所述的多任务执行方法 ,其特征在于, 所述方法还包括:
    每个任务的每个时间片根据任务需求进行确定,每个任务的时间片个数根据该任务的执行时间和每个时间片进行确定。
  5. 一种 电子烟微控制器的多任务执行装置,所述微控制器用于处理多个任务,其中所述微控制器包括定时器,其特征在于,该装置包括:
    任务确定模块( 100 ),用于确定所述微控制器要执行的任务以及每个任务两次被执行可允许的间隔时长;
    时间片划分模块( 101 ),用于将每个任务的执行时间顺序划分为多个时间片,使得分别从每个任务中任意取出一个时间片并将所述取出的时间片相加得到的总和小于等于所述间隔时长中的最小值;
    状态位确定模块( 102 ),用于为每个任务设置状态位,所述状态位指向该任务的时间片;
    任务执行和切换模块( 103 ),用于根据每个任务的当前状态位对应的时间片执行所述每个任务,当所述当前状态位对应的时间片结束时,切换至该任务的下一任务。
  6. 根据权利要求5所述的多任务执行装置,其特征在于,所述状态位确定模块(102)还用于当从前任务切换至下一任务时,使当前任务的状态位指向该任务的下一时间片,或当前任务的状态位已指向该任务的最后一个时间片时,使当前任务的状态位指向第一时间片。
  7. 根据权利要求 5 所述的多任务执行装置,其特征在于, 所述任务执行和切换模块(103)还用于设置定时器的定时时间,使其定时时间等于当前状态位的时间片,定时时间到时,进行任务的切换。
PCT/CN2013/072302 2013-03-05 2013-03-07 电子烟微控制器的多任务执行方法及装置 WO2014134810A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310069923.8A CN104026744B (zh) 2013-03-05 2013-03-05 电子烟微控制器的多任务执行方法及装置
CN201310069923.8 2013-03-05

Publications (1)

Publication Number Publication Date
WO2014134810A1 true WO2014134810A1 (zh) 2014-09-12

Family

ID=51457913

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/072302 WO2014134810A1 (zh) 2013-03-05 2013-03-07 电子烟微控制器的多任务执行方法及装置

Country Status (3)

Country Link
US (1) US20140259026A1 (zh)
CN (1) CN104026744B (zh)
WO (1) WO2014134810A1 (zh)

Families Citing this family (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160345631A1 (en) 2005-07-19 2016-12-01 James Monsees Portable devices for generating an inhalable vapor
US10279934B2 (en) 2013-03-15 2019-05-07 Juul Labs, Inc. Fillable vaporizer cartridge and method of filling
US20160366947A1 (en) 2013-12-23 2016-12-22 James Monsees Vaporizer apparatus
FI3491948T4 (fi) 2013-12-23 2024-05-06 Juul Labs International Inc Höyrystyslaitejärjestelmiä
USD842536S1 (en) 2016-07-28 2019-03-05 Juul Labs, Inc. Vaporizer cartridge
US10076139B2 (en) 2013-12-23 2018-09-18 Juul Labs, Inc. Vaporizer apparatus
USD825102S1 (en) 2016-07-28 2018-08-07 Juul Labs, Inc. Vaporizer device with cartridge
US10159282B2 (en) 2013-12-23 2018-12-25 Juul Labs, Inc. Cartridge for use with a vaporizer device
US10058129B2 (en) 2013-12-23 2018-08-28 Juul Labs, Inc. Vaporization device systems and methods
EP3821735A1 (en) 2014-12-05 2021-05-19 Juul Labs, Inc. Calibrated dose control
SG11201806801VA (en) 2016-02-11 2018-09-27 Juul Labs Inc Securely attaching cartridges for vaporizer devices
EP3413960B1 (en) 2016-02-11 2021-03-31 Juul Labs, Inc. Fillable vaporizer cartridge and method of filling
US10405582B2 (en) 2016-03-10 2019-09-10 Pax Labs, Inc. Vaporization device with lip sensing
USD849996S1 (en) 2016-06-16 2019-05-28 Pax Labs, Inc. Vaporizer cartridge
USD851830S1 (en) 2016-06-23 2019-06-18 Pax Labs, Inc. Combined vaporizer tamp and pick tool
USD836541S1 (en) 2016-06-23 2018-12-25 Pax Labs, Inc. Charging device
USD848057S1 (en) 2016-06-23 2019-05-07 Pax Labs, Inc. Lid for a vaporizer
CN107577528B (zh) * 2017-09-01 2020-09-08 长沙小卡机器人科技有限公司 多任务序列并行运行的方法
CN107357646A (zh) * 2017-09-01 2017-11-17 长沙小卡机器人科技有限公司 多任务序列并行运行的设备
USD887632S1 (en) 2017-09-14 2020-06-16 Pax Labs, Inc. Vaporizer cartridge
CN109784647B (zh) * 2018-12-14 2023-04-18 兰州空间技术物理研究所 一种用于空间站的主动电位控制系统的任务调度方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113432A1 (en) * 2007-10-24 2009-04-30 Balbir Singh Method and system for simulating a multi-queue scheduler using a single queue on a processor
CN101425024A (zh) * 2008-10-24 2009-05-06 中国移动通信集团山东有限公司 一种多任务处理方法及装置
CN101599663A (zh) * 2009-07-07 2009-12-09 厦门士林电机有限公司 一种智能控制器的实时控制系统
CN102023892A (zh) * 2009-09-21 2011-04-20 董亮 基于微处理器的多任务时间片实时处理方法
CN102940313A (zh) * 2012-11-13 2013-02-27 卓尔悦(常州)电子科技有限公司 电子烟的智能控制器及方法

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3913070A (en) * 1973-02-20 1975-10-14 Memorex Corp Multi-processor data processing system
US8032889B2 (en) * 2006-04-05 2011-10-04 Maxwell Technologies, Inc. Methods and apparatus for managing and controlling power consumption and heat generation in computer systems
US8239869B2 (en) * 2006-06-19 2012-08-07 Condusiv Technologies Corporation Method, system and apparatus for scheduling computer micro-jobs to execute at non-disruptive times and modifying a minimum wait time between the utilization windows for monitoring the resources
US8056083B2 (en) * 2006-10-10 2011-11-08 Diskeeper Corporation Dividing a computer job into micro-jobs for execution
WO2012027350A2 (en) * 2010-08-24 2012-03-01 Eli Alelov Inhalation device including substance usage controls

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113432A1 (en) * 2007-10-24 2009-04-30 Balbir Singh Method and system for simulating a multi-queue scheduler using a single queue on a processor
CN101425024A (zh) * 2008-10-24 2009-05-06 中国移动通信集团山东有限公司 一种多任务处理方法及装置
CN101599663A (zh) * 2009-07-07 2009-12-09 厦门士林电机有限公司 一种智能控制器的实时控制系统
CN102023892A (zh) * 2009-09-21 2011-04-20 董亮 基于微处理器的多任务时间片实时处理方法
CN102940313A (zh) * 2012-11-13 2013-02-27 卓尔悦(常州)电子科技有限公司 电子烟的智能控制器及方法

Also Published As

Publication number Publication date
US20140259026A1 (en) 2014-09-11
CN104026744B (zh) 2018-12-18
CN104026744A (zh) 2014-09-10

Similar Documents

Publication Publication Date Title
WO2014134810A1 (zh) 电子烟微控制器的多任务执行方法及装置
WO2014166039A1 (zh) 一种电子烟及检测电子烟保质期的方法
ATE369690T1 (de) Verfahren und vorrichtung zur synchronisierten wiedergabe von datenströmen
WO2019114581A1 (zh) 一种激光控制方法、激光设备及存储介质
CN107643705A (zh) 控制设备和模数转换控制方法
WO2016082409A1 (zh) 终端控制方法及智能耳机
CN114690724A (zh) 工业生产监控装置和方法
JP2001119404A5 (zh)
JPH027180A (ja) 命令一斉発火方式
CN105680837B (zh) 一种双cpu延迟控制电路
CN105607915A (zh) 一种服务器双分区开机控制方法
WO2017052059A1 (ko) 실시간 제어 시스템, 실시간 제어 장치 및 시스템 제어 방법
JPS59138902U (ja) プログラマブル・コントロ−ラ
JPH04144330A (ja) フレーム検出回路
JPS62241040A (ja) ハ−ドウエア動作トレ−ス装置
WO2014036722A1 (zh) 实现非连续接收的方法及终端设备
WO2014000589A1 (zh) 地图服务器、视野的控制方法和系统、计算机存储介质
SU706881A1 (ru) Устройство дл управлени блоками пам ти
JPS6342292B2 (zh)
JPS62208151A (ja) 情報処理装置
JPS62293436A (ja) タスク管理装置
JP2004086432A5 (zh)
Xu et al. The research on port loop detection method of IEEE1394 physical layer
JPS58112460A (ja) デジタル電力制御装置
JPH01276240A (ja) タイマカウンタ

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13877349

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13877349

Country of ref document: EP

Kind code of ref document: A1