µTasker Forum
µTasker Forum => ATMELTM AT91SAM7X and AVR32 => Topic started by: kmjackson on July 07, 2010, 12:07:36 PM
-
Hi Mark,
I need a PERIODIC software timer. Is there a way to set this up or should I just keep retriggering it? Iguess the other option is to use a GLOBAL_HARDWARE_TIMER.
Thank you,
Kenneth
-
Hi Kenneth
You can get details about timer use here:
http://www.utasker.com/docs/uTasker/uTaskerTimers.PDF
It is possible to configure a task as a periodic task which will be scheduled at the defined period (in the task configuration table) or, using monostable timers, a task can periodically schedule itself. The second method is more flexible but the first is simplest for simple tasks which just need to perform something periodically (doesn't otherwise use timers etc.).
A periodic HW timer is used when high accuracy is required since it is executed from the HW timer interrupt routine.
Global HW timers are not recommended and are not supported in all projects. The other methods are usually adequate and are reliable.
Regards
Mark
-
Hi Mark,
Just to clarify my understanding and that of others, if a Task has a state of UTASKER_GO it will run in polled mode, if its period time in the ctTaskTable is set to 0 or NO_DELAY_RESERVE_MONO i.e. it will be run every time the it is checked in the sheduling loop.
But if it has a period set to a value in the ctTaskTable then it will instead run at this periodic rate.
const UTASKTABLEINIT ctTaskTable[] = {
// task name, task routine, input queue size, start delay, period, initial task state
{ "Wdog", fnTaskWatchdog, NO_QUE, 0, (DELAY_LIMIT)( 0.2 * SEC ), UTASKER_GO}, // watchdog task (runs immediately and then periodically)
{ "M-Menu", fnMenuTask, MEDIUM_QUE, 0, (DELAY_LIMIT)( 0.125 * SEC ), UTASKER_GO}, //
Cheers
Martin
-
Hi Martin
The UTASKER_GO (initial) state together with a periodic timer value will cause the task to run immediately and then move to periodic mode.
It will only remain in periodic polling mode when no periodic value to set (i.e. 0). Therefore your understanding is correct.
Regards
Mark
-
Hi Mark,
I just wanted to clarify this for other users at it was not immediatly obvious from the documentation when I started with uTasker.
I think you mean above
It will only remain in polling mode when no periodic value to set (i.e. 0). Therefore your understanding is correct.