CN101320337A - Timer and its implementing method - Google Patents

Timer and its implementing method Download PDF

Info

Publication number
CN101320337A
CN101320337A CNA2008101167444A CN200810116744A CN101320337A CN 101320337 A CN101320337 A CN 101320337A CN A2008101167444 A CNA2008101167444 A CN A2008101167444A CN 200810116744 A CN200810116744 A CN 200810116744A CN 101320337 A CN101320337 A CN 101320337A
Authority
CN
China
Prior art keywords
task
timing
timer
tasks
milliseconds
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
CNA2008101167444A
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.)
Vimicro Corp
Original Assignee
Vimicro Corp
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 Vimicro Corp filed Critical Vimicro Corp
Priority to CNA2008101167444A priority Critical patent/CN101320337A/en
Publication of CN101320337A publication Critical patent/CN101320337A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention provides a timer and an implement method that is used for a multi-task system. The timer comprises a setup unit, a timing unit, a counting unit and an execution unit. The setup unit is used for setting up the timing time and the time zero of multiple tasks. The timing unit is used for setting up a timing cycle according to the timing time of the multiple tasks. The counting unit is used for setting up maximum timing count based on the timing time and the timing cycle of the multiple tasks; counts numbers according to the time zero and sends out the information of task execution at the end of timing time. The execution unit is used for receiving the information of the task execution and executing the task corresponding to the task execution information by a preset method according to the task execution information. In the invention, only a timer can perform reasonable and orderly management for the multiple masks in the system, thus reducing system resource occupied by the timer, improving system execution efficiency and decreasing difficulty in testing and maintaining the timer.

Description

A kind of timer and its implementation
Technical field
The present invention relates generally to computer realm, relates in particular to a kind of timer and its implementation.
Background technology
Timer, the important component part as in the computer system is widely used.By the fixed cycle operator of timer, thereby make the computer system can be accurately and carry out each task without any confusion.
Timer mainly comprises timing unit and counting unit two parts.
For timing unit, generally comprise figure place and be 8,16 or 32 s' timing unit, the designer selects the timing unit of corresponding figure place according to actual needs, sets the time of day duration simultaneously, i.e. timing cycle T.Timing cycle T is as the machine cycle of the instruction that adds up in the computer system, by the microcontroller (MCU in the computer system, Micro Control Unit) crystal oscillator frequency decision, existing a lot of microcontroller such as single-chip microcomputer etc. all have predetermined crystal oscillator frequency, but crystal oscillator frequency is higher than the actual operating frequency of computer system far away, therefore, need realize setting to timing cycle T by crystal oscillator frequency being carried out suitable frequency division, for example, crystal oscillator frequency is carried out 1/2 or 1/4 frequency division.
For counting unit, the designer is according to the maximum count frequency n of predetermined timing t design counting unit.After timer is activated, counter begins counting from initial value " 0 ", because 1 operation that adds each time in the counting process all needs to take a timing cycle T, therefore, when the rolling counters forward number of times reaches maximum timing frequency n time, when promptly predetermined timing t equals timing time n * T, trigger the task of interrupting carrying out at this time point.
In single-chip microcomputer, often adopt 8,16 or 32 s' register to design timer, overflow the realization timing function by register.That is to say that after timer was activated, its count value was constantly carried out from initial value " 0 " and added 1 operation, when the numerical value of accumulative total causes the storage unit of register to be overflowed, triggers the task of interrupting carrying out at this time point.For example, in 16 timer, when counting unit becomes binary number 0xFFFF, do not produce interruption this moment, and add 1 when finishing at counting next time, because this time counting adds 1 and cause the storage unit of timer to be overflowed, thereby trigger the task of interrupting carrying out at this time point.
In the prior art, usually in computer system, set a plurality of timers and come a plurality of task executions of control and management.For example, according to setting a plurality of timers in the computer system that do not coexist of task execution time point with different timing cycle and maximum timing number of times.This computer system, because the use of a plurality of timers has not only taken bigger system resource, and it is relatively low to carry out efficient, in addition, has increased timer in test with the difficulty aspect safeguarding.
Summary of the invention
In view of this, the object of the present invention is to provide a kind of timer and its implementation, reach the purpose of a plurality of task executions in the system being carried out the rational and orderly management by a timer.
According to an aspect of the present invention, provide a kind of timer, be applied to comprise the system of a plurality of tasks, having comprised:
Setup unit is used to set the timing and the time zero of described a plurality of tasks;
Timing unit is used for setting timing cycle according to described timing;
Counting unit is used for setting maximum timing number of times according to described timing and described timing cycle, and counts according to described time zero, and when described timing finished, the transmission task was carried out message;
Performance element is used to receive described task and carries out message, and carries out message according to described task and trigger execution and the corresponding task of described task execution message in a predefined manner.
According to a kind of feature of the present invention, described setup unit is set at described time zero with the initial time point.
According to another kind of feature of the present invention, described a plurality of tasks comprise current task and the last task adjacent with current task at least; Described setup unit is set at the triggered time point of the described last task adjacent with current task the described time zero of described current task.
According to another kind of feature of the present invention, described counting unit is calculated highest common factor according to the described timing of described a plurality of tasks, and described highest common factor is set at described timing cycle.
According to another kind of feature of the present invention, described predetermined way is the pointer mode.
According to a further aspect in the invention, provide a kind of implementation method of timer, be applied to comprise that the system of a plurality of tasks comprises:
Set the timing and the time zero of described a plurality of tasks;
Set timing cycle according to described timing;
Set maximum timing number of times according to described timing and described timing cycle, and count according to described time zero, when described timing finished, the transmission task was carried out message.
Receive described task and carry out message, and carry out message trigger according to described task and carry out and the corresponding task of described task execution message.
According to a kind of feature of the present invention, the time zero of a plurality of tasks of described setting is: the initial time point is set at described time zero.
According to another kind of feature of the present invention, described a plurality of tasks comprise current task and the last task adjacent with current task at least; The time zero of a plurality of tasks of described setting is: the described time zero that the triggered time point of the described last task adjacent with current task is set at described current task.
According to another kind of feature of the present invention, described timing according to a plurality of tasks is set timing cycle and is: the described timing according to described a plurality of tasks calculates highest common factor, and described highest common factor is set at described timing cycle.
According to another kind of feature of the present invention, described predetermined way is the pointer mode.
The described timer of the embodiment of the invention and its implementation, only with regard to realizing a plurality of task executions in the system are carried out the management of rational and orderly by a timer, reduced taking to system resource, improve system and carried out efficient, reduced the difficulty of timer being tested and safeguarded the aspect.
Description of drawings
Fig. 1 is the structured flowchart of timer 1 in the present invention's first specific embodiment;
Fig. 2 is the process flow diagram of the implementation method of timer 1 in the present invention's first specific embodiment;
Fig. 3 is the structured flowchart of timer 3 in the present invention's second specific embodiment;
Fig. 4 is the process flow diagram of the implementation method of timer 3 in the present invention's second specific embodiment.
Embodiment
Describe specific embodiments of the invention in detail below in conjunction with accompanying drawing.
Fig. 1 is the structured flowchart of timer 1 in the present invention's first specific embodiment.Among Fig. 1,
Timer 1 comprises: setup unit 101, timing unit 102, counting unit 103 and performance element 104, wherein,
Setup unit 101 is used for setting according to system's needs the timing and the time zero of a plurality of tasks.
Setup unit 101 is set at the time zero of current task with the initial time point, need in the management system every task carrying out by setting up task scheduler.It is as shown in table 1,
Task names Timing Time zero
First task 50 milliseconds The initial time point
Second task 150 milliseconds The initial time point
The 3rd task 100 milliseconds The initial time point
The 4th task 200 milliseconds The initial time point
Table 1
Three important component parts in the table 1 are respectively task names, time zero and timing, are specifically described as follows:
Current system comprises four tasks: first task, second task, the 3rd task, the 4th task.These four tasks need trigger execution through different timings, specifically trigger implementation and are:
With the initial time point is time zero, every through behind 50 milliseconds the timing, triggers and carries out a first task;
With the initial time point is time zero, every through behind 150 milliseconds the timing, triggers one time second task of carrying out;
With the initial time point is time zero, every through behind 100 milliseconds the timing, triggers an order three tasks of carrying out;
With the initial time point is time zero, every through behind 200 milliseconds the timing, triggers an order four tasks of carrying out.
Timing unit 102 is used for setting timing cycle according to the timing of a plurality of tasks.
For example, because in the task scheduler that setup unit 101 is created, the timing of first task is 50 milliseconds, the timing of second task is 150 milliseconds, the timing of the 3rd task is 100 milliseconds, the timing of the 4th task is 200 milliseconds, therefore, and 50 milliseconds of timing cycles that are this timing unit 102 of the highest common factor of the timing of above-mentioned four tasks.
Usually, the designer sets the timing cycle of timer as required, in the present embodiment, only the timing cycle of timer need be set at 50 milliseconds, and promptly timer will trigger once the interruption to carry out corresponding task every 50 milliseconds.Certainly do not get rid of the designer yet and design timer according to the corresponding timing cycle of different timing selection of time of carrying out a plurality of required by task in the system.For example, when being respectively 50 milliseconds, 60 milliseconds, 70 milliseconds, 80 milliseconds for the timing of a plurality of tasks in the system, because 50 milliseconds, 60 milliseconds, 70 milliseconds, 80 milliseconds highest common factors are 10 milliseconds, therefore, it is 10 milliseconds timer that the designer then needs to select timing cycle.
Counting unit 103 is used for setting maximum timing number of times and counting according to the time zero of setting according to the timing of a plurality of tasks and timing cycle, when timing finishes, and promptly when counts reaches maximum timing number of times, transmission task execution message.
Counting unit 103 draws the maximum timing number of times of a plurality of tasks according to the task scheduler of setup unit 101 foundation and the timing cycle of timing unit 102 settings.For example, for four tasks of said system, wherein,
Counting unit 103 serves as that the counting starting point is counted with the triggered time point of carrying out the 4th task, when counts reaches 4, promptly through after 200 milliseconds, sends first task and carries out message;
Counting unit 103 serves as that the counting starting point is counted with the triggered time point of carrying out first task, and when counts reached 1, promptly through after 50 milliseconds, second task that sends was carried out message;
Counting unit 103 serves as that the counting starting point is counted with the triggered time point of carrying out second task, and when counts reached 3, promptly through after 150 milliseconds, the 3rd task that sends was carried out message;
Counting unit 103 serves as that the counting starting point is counted with the triggered time point of carrying out the 3rd task, and when counts reached 2, promptly through after 100 milliseconds, the 4th task that sends was carried out message.
Performance element 104 is used for the task execution message that count pick up unit 103 sends, and carries out message trigger execution and the corresponding task of this task execution message according to this task.For example,
Performance element 104 is carried out message trigger according to first task and is carried out first task;
Performance element 104 is carried out message trigger according to second task and is carried out second task;
Performance element 104 is carried out message trigger according to the 3rd task and is carried out the 3rd task;
Performance element 104 is carried out message trigger according to the 4th task and is carried out the 4th task.
For task executions, can adopt multiple mode, for example, when timer finishes at timing, trigger the interrupt notification processor in the mode of task pointer and carry out the task corresponding with this timing.
Fig. 2 is the process flow diagram of the implementation method of timer 1 in the present invention's first specific embodiment, and concrete implementation step is as follows:
Step 201 is set the timing and the time zero of a plurality of tasks according to system's needs, enters step 202.
In this step, need in the management system every task carrying out by setting up task scheduler.This task scheduler comprises: task names, time zero and timing wherein, are set at the initial time point time zero of current task.
For example, current system comprises four tasks: first task, second task, the 3rd task, the 4th task.These four tasks need trigger execution through different timings, specifically trigger implementation and are:
With the initial time point is time zero, every through behind 50 milliseconds the timing, triggers and carries out a first task;
With the initial time point is time zero, every through behind 150 milliseconds the timing, triggers one time second task of carrying out;
With the initial time point is time zero, every through behind 100 milliseconds the timing, triggers an order three tasks of carrying out;
With the initial time point is time zero, every through behind 200 milliseconds the timing, triggers an order four tasks of carrying out.
Step 202 is set timing cycle according to the timing of a plurality of tasks, enters step 203.
For example, because in the task scheduler of step 201, the timing of first task is 50 milliseconds, the timing of second task is 150 milliseconds, the timing of the 3rd task is 100 milliseconds, the timing of the 4th task is 200 milliseconds, and therefore, the highest common factor of the timing of above-mentioned four tasks is timing cycle for 50 milliseconds.
Usually, the designer sets the timing cycle of timer as required, in the present embodiment, only the timing cycle of timer need be set at 50 milliseconds, and promptly timer will trigger once the interruption to carry out corresponding task every 50 milliseconds.Certainly do not get rid of the designer yet and design timer according to the corresponding timing cycle of different timing selection of time of carrying out a plurality of required by task in the system.For example, when being respectively 50 milliseconds, 60 milliseconds, 70 milliseconds, 80 milliseconds for the timing of a plurality of tasks in the system, because 50 milliseconds, 60 milliseconds, 70 milliseconds, 80 milliseconds highest common factors are 10 milliseconds, therefore, it is 10 milliseconds timer that the designer then needs to select timing cycle.
Step 203, set maximum timing number of times and count according to the timing of a plurality of tasks and timing cycle, when timing finishes, promptly when counts reaches maximum timing number of times according to the time zero of setting, the transmission task is carried out message, enters step 204.
For example, for four tasks of said system, wherein,
With the triggered time point of carrying out the 4th task serves as that the counting starting point is counted, and when counts reaches 4, promptly through after 200 milliseconds, sends first task and carries out message;
With the triggered time point of carrying out first task serves as that the counting starting point is counted, and when counts reached 1, promptly through after 50 milliseconds, second task that sends was carried out message;
With the triggered time point of carrying out second task serves as that the counting starting point is counted, and when counts reached 3, promptly through after 150 milliseconds, the 3rd task that sends was carried out message;
With the triggered time point of carrying out the 3rd task serves as that the counting starting point is counted, and when counts reached 2, promptly through after 100 milliseconds, the 4th task that sends was carried out message.
Step 204, the reception task is carried out message, carries out message trigger according to this task and carries out and the corresponding task of this task execution message.For example,
Carry out message trigger according to first task and carry out first task;
Carry out message trigger according to second task and carry out second task;
Carry out message trigger according to the 3rd task and carry out the 3rd task;
Carry out message trigger according to the 4th task and carry out the 4th task.
Though the technical scheme of first embodiment of the invention has only been described the system that comprises four different tasks, 50 milliseconds timing cycle, time span are respectively 50 milliseconds, 150 milliseconds, 100 milliseconds, 200 milliseconds timing, but do not mean that the present invention only limits to this, the designer can be according to the technical scheme of first embodiment of the invention, at the system that comprises a plurality of different tasks, according to system's needs, timer is set, thereby a plurality of task executions in the system are managed by a timer.
Fig. 3 is the structured flowchart of timer 3 in the present invention's second specific embodiment.Among Fig. 3,
Timer 3 comprises: setup unit 301, timing unit 302, counting unit 303 and performance element 304, wherein,
Setup unit 301 is used for setting according to system's needs the timing and the time zero of a plurality of tasks.
Wherein, a plurality of tasks in the system comprise current task and the last task adjacent with current task at least; Setup unit 301 will be adjacent with current task the triggered time point of last task be set at the time zero of current task.
Setup unit 301 can need in the management system every task carrying out by setting up task scheduler.It is as shown in table 2,
Task names Timing Time zero
First task 200 milliseconds The triggered time point of the 4th task
Second task 50 milliseconds The triggered time point of first task
The 3rd task 150 milliseconds The triggered time point of second task
The 4th task 100 milliseconds The triggered time point of the 3rd task
Table 2
Three important component parts in the table 2 are respectively task names, time zero and timing, are specifically described as follows:
Current system comprises four tasks: first task, second task, the 3rd task, the 4th task.These four tasks need trigger execution through different timings, specifically trigger implementation and are:
For first task, when just starting, be time zero with the initial time point in system; After four tasks in system all are performed once, be time zero then, behind 200 milliseconds timing, trigger and carry out first task with the time point that triggers the 4th task of execution.
For second task, be time zero to trigger the time point of carrying out first task, behind 50 milliseconds timing, trigger second task of execution;
For the 3rd task, be time zero with the time point that triggers second task of execution, behind 150 milliseconds timing, trigger the 3rd task of execution;
For the 4th task, be time zero with the time point that triggers the 3rd task of execution, behind 100 milliseconds timing, trigger the 4th task of execution.
System moves in circles in the manner described above and carries out above-mentioned four tasks.
Timing unit 302 is used for setting timing cycle according to the timing of a plurality of tasks.
For example, because in above-mentioned task scheduler, triggering the timing of carrying out first task is 200 milliseconds, the timing that triggers second task of execution is 50 milliseconds, the timing that triggers the 3rd task of execution is 150 milliseconds, the timing that triggers the 4th task of execution is 100 milliseconds, therefore, and 50 milliseconds of timing cycles that are this timing unit 302 of the highest common factor of the timing of above-mentioned four tasks.
Usually, the designer sets the timing cycle of timer as required, in the present embodiment, only the timing cycle of timer need be set at 50 milliseconds, and promptly timer will trigger once the interruption to carry out corresponding task every 50 milliseconds.Certainly do not get rid of the designer yet and design timer according to the corresponding timing cycle of different timing selection of time of carrying out a plurality of required by task in the system.For example, when being respectively 50 milliseconds, 60 milliseconds, 70 milliseconds, 80 milliseconds for the timing of a plurality of tasks in the system, because 50 milliseconds, 60 milliseconds, 70 milliseconds, 80 milliseconds highest common factors are 10 milliseconds, therefore, it is 10 milliseconds timer that the designer then needs to select timing cycle.
Counting unit 303, be used for setting maximum timing number of times and counting according to the time zero of setting according to the timing of a plurality of tasks and timing cycle, when timing finished, promptly when counts reached maximum timing number of times, the transmission task was carried out message and counts is carried out zero clearing.
Counting unit 303 draws the maximum timing number of times of a plurality of tasks according to the task scheduler of setup unit 301 foundation and the timing cycle of timing unit 302 settings.
For example, for four tasks of said system, wherein,
The maximum timing number of times of first task is that the maximum timing number of times of 4, the second tasks is that the maximum timing number of times of 1, the three task is that the maximum timing number of times of 3, the four tasks is 2.
Counting unit 303 serves as that the counting starting point is counted with the triggered time point of carrying out the 4th task, when counts reaches 4, promptly through after 200 milliseconds, sends first task and carries out message;
Counting unit 303 serves as that the counting starting point is counted with the triggered time point of carrying out first task, and when counts reached 1, promptly through after 50 milliseconds, second task that sends was carried out message;
Counting unit 303 serves as that the counting starting point is counted with the triggered time point of carrying out second task, and when counts reached 3, promptly through after 150 milliseconds, the 3rd task that sends was carried out message;
Counting unit 303 serves as that the counting starting point is counted with the triggered time point of carrying out the 3rd task, and when counts reached 2, promptly through after 100 milliseconds, the 4th task that sends was carried out message.
Performance element 304 is used for the task execution message that count pick up unit 303 sends, and carries out message trigger execution and the corresponding task of this task execution message according to this task.For example,
Performance element 304 is carried out message trigger according to first task and is carried out first task;
Performance element 304 is carried out message trigger according to second task and is carried out second task;
Performance element 304 is carried out message trigger according to the 3rd task and is carried out the 3rd task;
Performance element 304 is carried out message trigger according to the 4th task and is carried out the 4th task.
For the execution of each task in the said system, can adopt multiple mode, for example, when timer finishes at timing, trigger the interrupt notification processor in the mode of task pointer and carry out the task corresponding with this timing.In practical work process, every task all is a function, and all corresponding entry address of each function, by designing in an array with the respectively a plurality of one to one entry addresses of the multi-task, when timer when timing finishes, timer finds the entry address that needs to trigger carrying out of task by the pointer redirect, carries out the task corresponding with this entry address according to entry address pointer triggering terminal notification processor.
Fig. 4 is the process flow diagram of the implementation method of timer 3 in the present invention's second specific embodiment, and concrete implementation step is as follows:
Step 401 is set the timing and the time zero of a plurality of tasks according to system's needs, enters step 402.
In this step, need in the management system every task carrying out by setting up task scheduler.This task scheduler comprises: task names, timing and time zero, and wherein, a plurality of tasks in the system comprise current task and the last task adjacent with current task at least; The triggered time point of last task that will be adjacent with current task is set at the time zero of current task.
Current system comprises four tasks: first task, second task, the 3rd task, the 4th task.These four tasks need trigger execution through different timings, specifically trigger implementation and are:
For first task, when just starting, be time zero with the initial time point in system; After four tasks in system all are performed once, be time zero then, behind 200 milliseconds timing, trigger and carry out first task with the time point that triggers the 4th task of execution.
For second task, be time zero to trigger the time point of carrying out first task, behind 50 milliseconds timing, trigger second task of execution;
For the 3rd task, be time zero with the time point that triggers second task of execution, behind 150 milliseconds timing, trigger the 3rd task of execution;
For the 4th task, be time zero with the time point that triggers the 3rd task of execution, behind 100 milliseconds timing, trigger the 4th task of execution.
System moves in circles in the manner described above and carries out above-mentioned four tasks.
Step 402 is set timing cycle according to the timing of a plurality of tasks, enters step 403.
For example, because in the task scheduler in step 401, triggering the timing of carrying out first task is 200 milliseconds, the timing that triggers second task of execution is 50 milliseconds, the timing that triggers the 3rd task of execution is 150 milliseconds, the timing that triggers the 4th task of execution is 100 milliseconds, and therefore, the highest common factor of the timing of above-mentioned four tasks is a timing cycle for 50 milliseconds.
Usually, the designer sets the timing cycle of timer as required, in the present embodiment, only the timing cycle of timer need be set at 50 milliseconds, and promptly timer will trigger once the interruption to carry out corresponding task every 50 milliseconds.Certainly do not get rid of the designer yet and design timer according to the corresponding timing cycle of different timing selection of time of carrying out a plurality of required by task in the system.For example, when being respectively 50 milliseconds, 60 milliseconds, 70 milliseconds, 80 milliseconds for the timing of a plurality of tasks in the system, because 50 milliseconds, 60 milliseconds, 70 milliseconds, 80 milliseconds highest common factors are 10 milliseconds, therefore, it is 10 milliseconds timer that the designer then needs to select timing cycle.
Step 403, set maximum timing number of times and count according to the timing of a plurality of tasks and timing cycle according to the time zero of setting, when timing finished, promptly when counts reached maximum timing number of times, the transmission task was carried out message and counts is carried out zero clearing.
Step 404, the reception task is carried out message, carries out message trigger according to this task and carries out and the corresponding task of this task execution message.For example,
Carry out message trigger according to first task and carry out first task;
Carry out message trigger according to second task and carry out second task;
Carry out message trigger according to the 3rd task and carry out the 3rd task;
Carry out message trigger according to the 4th task and carry out the 4th task.
Though the technical scheme of the present invention's second specific embodiment has only been described the system that comprises four different tasks, 50 milliseconds timing cycle, time span are respectively 50 milliseconds, 150 milliseconds, 100 milliseconds, 200 milliseconds timing, but do not mean that the present invention only limits to this, the designer can be according to the technical scheme of second embodiment of the invention, at the system that comprises a plurality of different tasks, according to system's needs, timer is set, thereby a plurality of task executions in the system are managed by a timer.
Counting unit in first, second specific embodiment of the present invention is by setting the maximum count number of times, whether reach the maximum count number of times and come the transmission task to carry out message to add 1 operation judges, can certainly subtract 1 operation judges counts and whether reduced to 0 and come the transmission task to carry out message by setting the maximum count number of times, adopting.
Timer in the embodiment of the invention not only can be that the timer of example, in hardware can also be the timer of form of software, the function of timer and type can design as required, as linear timer with thread function, cycle timer with circulatory function has the condition timer of condition triggering function etc.
The described timer of the embodiment of the invention and its implementation, only realize a plurality of task executions in the system are carried out the management of rational and orderly by a timer, minimizing takies system resource, and the raising system carries out efficient, has reduced the difficulty of timer being tested and safeguarded the aspect.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. timer is applied to comprise it is characterized in that the system of a plurality of tasks, comprising:
Setup unit is used to set the timing and the time zero of described a plurality of tasks;
Timing unit is used for setting timing cycle according to described timing;
Counting unit is used for setting maximum timing number of times according to described timing and described timing cycle, and counts according to described time zero, and when described timing finished, the transmission task was carried out message;
Performance element is used to receive described task and carries out message, and carries out message according to described task and trigger execution and the corresponding task of described task execution message in a predefined manner.
2. timer according to claim 1 is characterized in that,
Described setup unit is set at described time zero with the initial time point.
3. timer according to claim 1 is characterized in that,
Described a plurality of task comprises current task and the last task adjacent with current task at least;
Described setup unit is set at the triggered time point of the described last task adjacent with current task the described time zero of described current task.
4. timer according to claim 1 is characterized in that, described counting unit is calculated highest common factor according to the described timing of described a plurality of tasks, and described highest common factor is set at described timing cycle.
5. timer according to claim 1, it is characterized in that, described predetermined way is the pointer mode, wherein, described performance element finds the entry address of carrying out the corresponding task of message with described task by the pointer redirect, triggers according to the entry address pointer and interrupts carrying out the task corresponding with this entry address.
6. the implementation method of a timer is applied to comprise it is characterized in that the system of a plurality of tasks, comprising:
Set the timing and the time zero of described a plurality of tasks;
Set timing cycle according to described timing;
Set maximum timing number of times according to described timing and described timing cycle, and count according to described time zero, when described timing finished, the transmission task was carried out message;
Receive described task and carry out message, and carry out message trigger according to described task and carry out and the corresponding task of described task execution message.
7. method according to claim 6 is characterized in that,
The time zero of a plurality of tasks of described setting is: the initial time point is set at described time zero.
8. method according to claim 6 is characterized in that,
Described a plurality of task comprises current task and the last task adjacent with current task at least;
The time zero of a plurality of tasks of described setting is: the described time zero that the triggered time point of the described last task adjacent with current task is set at described current task.
9. method according to claim 6 is characterized in that,
Described timing according to a plurality of tasks is set timing cycle and is: the described timing according to described a plurality of tasks calculates highest common factor, and described highest common factor is set at described timing cycle.
10. method according to claim 6 is characterized in that, described predetermined way is the pointer mode,
Wherein, find the entry address of carrying out the corresponding task of message with described task, trigger according to the entry address pointer and interrupt carrying out the task corresponding with this entry address by the pointer redirect.
CNA2008101167444A 2008-07-16 2008-07-16 Timer and its implementing method Pending CN101320337A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNA2008101167444A CN101320337A (en) 2008-07-16 2008-07-16 Timer and its implementing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNA2008101167444A CN101320337A (en) 2008-07-16 2008-07-16 Timer and its implementing method

Publications (1)

Publication Number Publication Date
CN101320337A true CN101320337A (en) 2008-12-10

Family

ID=40180402

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA2008101167444A Pending CN101320337A (en) 2008-07-16 2008-07-16 Timer and its implementing method

Country Status (1)

Country Link
CN (1) CN101320337A (en)

Cited By (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833478A (en) * 2010-05-28 2010-09-15 浙江大学 Method for realizing dispatch table based on Alarm
CN102087513A (en) * 2010-12-14 2011-06-08 广东雅达电子股份有限公司 Timing extension method of PLC (programmable logic controller) timer
CN102447765A (en) * 2011-11-23 2012-05-09 上海摩软通讯技术有限公司 Mobile terminal with circulating prompt function and method for realizing circulating prompt function
CN101764569B (en) * 2009-10-20 2012-06-13 深圳和而泰智能控制股份有限公司 Timer/counter multifunctional multiplexing algorithm and device
CN102722402A (en) * 2012-05-28 2012-10-10 上海微频莱机电科技有限公司 Processing system and method for dispatching multiple tasks in real time in non-preemptive mode
WO2013123868A1 (en) * 2012-02-24 2013-08-29 华为终端有限公司 Data acquisition method, device and mobile terminal
CN104507230A (en) * 2014-12-24 2015-04-08 深圳市航盛电子股份有限公司 LED (light emitting diode) lamp meter reading flickering method and system based on STM32 timer
CN105528246A (en) * 2015-12-07 2016-04-27 厦门雅迅网络股份有限公司 In-process timer management method and system based on dynamic timing periods
CN106445668A (en) * 2016-09-28 2017-02-22 深圳Tcl数字技术有限公司 Timing method and device of timer
CN106886450A (en) * 2015-12-16 2017-06-23 阿里巴巴集团控股有限公司 Method for scheduling task and system
CN107045278A (en) * 2016-12-26 2017-08-15 河南思维信息技术有限公司 A kind of multi channel timing device
CN107103234A (en) * 2017-03-01 2017-08-29 北京龙鼎源科技股份有限公司 Multitask partition method and device
CN107608779A (en) * 2017-10-25 2018-01-19 北京图森未来科技有限公司 A kind of task executing method and device, embedded device
CN107659305A (en) * 2017-10-19 2018-02-02 郑州云海信息技术有限公司 A kind of clock count method, apparatus and medium based on CPLD
CN108279971A (en) * 2018-01-26 2018-07-13 中国银行股份有限公司 A kind of timing executes the method and device of task
CN109213589A (en) * 2018-09-28 2019-01-15 深圳市景阳科技股份有限公司 A kind of method and device of Message Processing
CN109471663A (en) * 2018-10-30 2019-03-15 珠海格力智能装备有限公司 The execution method and device of SCM program
WO2019075745A1 (en) * 2017-10-20 2019-04-25 深圳市汇顶科技股份有限公司 Timing method of virtual timer, apparatus thereof, and electronic apparatus
CN109947434A (en) * 2018-12-19 2019-06-28 中国兵器装备集团上海电控研究所 Non-interrupted formula and pseudo- parallel embedded software real-time response method, system and medium
CN110413332A (en) * 2018-04-26 2019-11-05 武汉斗鱼网络科技有限公司 Timed task executes method, apparatus, terminal and computer-readable medium
CN110532081A (en) * 2019-09-02 2019-12-03 政采云有限公司 A kind of timed task processing method and processing device
CN112783624A (en) * 2021-01-18 2021-05-11 广汽零部件有限公司 Non-real-time scheduling system for automobile and task execution method
CN112925631A (en) * 2021-04-08 2021-06-08 上海科世达-华阳汽车电器有限公司 Task scheduling method and device, electronic equipment and storage medium
WO2022104990A1 (en) * 2020-11-20 2022-05-27 清华大学 Trigger device and brain-like computing system

Cited By (35)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101764569B (en) * 2009-10-20 2012-06-13 深圳和而泰智能控制股份有限公司 Timer/counter multifunctional multiplexing algorithm and device
CN101833478A (en) * 2010-05-28 2010-09-15 浙江大学 Method for realizing dispatch table based on Alarm
CN102087513A (en) * 2010-12-14 2011-06-08 广东雅达电子股份有限公司 Timing extension method of PLC (programmable logic controller) timer
CN102447765B (en) * 2011-11-23 2015-08-26 上海摩软通讯技术有限公司 There is the mobile terminal of circulation prompt facility and realize the method for circulation prompting
CN102447765A (en) * 2011-11-23 2012-05-09 上海摩软通讯技术有限公司 Mobile terminal with circulating prompt function and method for realizing circulating prompt function
WO2013123868A1 (en) * 2012-02-24 2013-08-29 华为终端有限公司 Data acquisition method, device and mobile terminal
US9483543B2 (en) 2012-02-24 2016-11-01 Huawei Device Co., Ltd. Data collecting method and apparatus, and mobile terminal
CN102722402A (en) * 2012-05-28 2012-10-10 上海微频莱机电科技有限公司 Processing system and method for dispatching multiple tasks in real time in non-preemptive mode
CN102722402B (en) * 2012-05-28 2014-03-05 上海微频莱机电科技有限公司 Processing system and method for dispatching multiple tasks in real time in non-preemptive mode
CN104507230A (en) * 2014-12-24 2015-04-08 深圳市航盛电子股份有限公司 LED (light emitting diode) lamp meter reading flickering method and system based on STM32 timer
CN105528246A (en) * 2015-12-07 2016-04-27 厦门雅迅网络股份有限公司 In-process timer management method and system based on dynamic timing periods
CN106886450A (en) * 2015-12-16 2017-06-23 阿里巴巴集团控股有限公司 Method for scheduling task and system
CN106445668A (en) * 2016-09-28 2017-02-22 深圳Tcl数字技术有限公司 Timing method and device of timer
CN106445668B (en) * 2016-09-28 2020-04-10 深圳Tcl数字技术有限公司 Timing method and device of timer
WO2018058830A1 (en) * 2016-09-28 2018-04-05 深圳Tcl数字技术有限公司 Timing method and device for timer
CN107045278A (en) * 2016-12-26 2017-08-15 河南思维信息技术有限公司 A kind of multi channel timing device
CN107103234A (en) * 2017-03-01 2017-08-29 北京龙鼎源科技股份有限公司 Multitask partition method and device
CN107103234B (en) * 2017-03-01 2020-06-26 北京龙鼎源科技股份有限公司 Multitask isolation method and device
CN107659305A (en) * 2017-10-19 2018-02-02 郑州云海信息技术有限公司 A kind of clock count method, apparatus and medium based on CPLD
CN109952560A (en) * 2017-10-20 2019-06-28 深圳市汇顶科技股份有限公司 Timing method and its device, the electronic device of virtual timer
CN109952560B (en) * 2017-10-20 2022-12-23 深圳市汇顶科技股份有限公司 Timing method and device of virtual timer and electronic device
WO2019075745A1 (en) * 2017-10-20 2019-04-25 深圳市汇顶科技股份有限公司 Timing method of virtual timer, apparatus thereof, and electronic apparatus
CN107608779A (en) * 2017-10-25 2018-01-19 北京图森未来科技有限公司 A kind of task executing method and device, embedded device
CN108279971A (en) * 2018-01-26 2018-07-13 中国银行股份有限公司 A kind of timing executes the method and device of task
CN110413332A (en) * 2018-04-26 2019-11-05 武汉斗鱼网络科技有限公司 Timed task executes method, apparatus, terminal and computer-readable medium
CN109213589A (en) * 2018-09-28 2019-01-15 深圳市景阳科技股份有限公司 A kind of method and device of Message Processing
CN109213589B (en) * 2018-09-28 2020-10-23 深圳市景阳科技股份有限公司 Message processing method and device
CN109471663A (en) * 2018-10-30 2019-03-15 珠海格力智能装备有限公司 The execution method and device of SCM program
CN109947434A (en) * 2018-12-19 2019-06-28 中国兵器装备集团上海电控研究所 Non-interrupted formula and pseudo- parallel embedded software real-time response method, system and medium
CN110532081A (en) * 2019-09-02 2019-12-03 政采云有限公司 A kind of timed task processing method and processing device
CN110532081B (en) * 2019-09-02 2022-03-22 政采云有限公司 Timed task processing method and device
WO2022104990A1 (en) * 2020-11-20 2022-05-27 清华大学 Trigger device and brain-like computing system
CN112783624A (en) * 2021-01-18 2021-05-11 广汽零部件有限公司 Non-real-time scheduling system for automobile and task execution method
CN112925631A (en) * 2021-04-08 2021-06-08 上海科世达-华阳汽车电器有限公司 Task scheduling method and device, electronic equipment and storage medium
CN112925631B (en) * 2021-04-08 2022-11-04 上海科世达-华阳汽车电器有限公司 Task scheduling method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN101320337A (en) Timer and its implementing method
JP5888629B2 (en) Method, apparatus and system for scheduling processor cores in a multiprocessor core system
JP2006524380A5 (en)
EP2790106A2 (en) Performance measurement unit, processor core including the same and process profiling method
US20120246652A1 (en) Processor Management Via Thread Status
EP2609501B1 (en) Dynamic calculation of sample profile reports
CN102222022A (en) Real-time task scheduling method based on multicore processor
CN107172304B (en) A kind of mobile terminal power consumption detection method and mobile terminal
EP3147785A1 (en) Task processing method and device
US9575766B2 (en) Causing an interrupt based on event count
US20170262290A1 (en) Causing an interrupt based on event count
CN100501694C (en) Processor availability measuring device and method
CN104375820B (en) Event driven processor and its operation method
JP5881890B2 (en) Air conditioner management apparatus and method
EP1594048A2 (en) Thread selection unit and method for a multithreaded processor
CN104679583A (en) Method and device for dynamically adjusting clock interruption
CN104216812A (en) Method and device for carrying out multi-event statistics on performance monitoring unit
CN105183930A (en) Methods and devices for setting and using hardware timer
CN106686619B (en) Performance evaluation method and equipment
CN109753314B (en) Configurable automatic flow execution method and system
CN106327038B (en) Electronic work order processing method and device
CN113676790B (en) Acquisition scheduling method and device for low-voltage centralized meter reading equipment, concentrator and medium
CN111175573A (en) Method, device, equipment and medium for detecting alternating voltage frequency
CN110109389B (en) Method for realizing key operation function
JP2009266252A5 (en)

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20081210