Author Topic: EVK1105 PERIODIC Software Timer  (Read 10108 times)

Offline kmjackson

  • Newbie
  • *
  • Posts: 33
    • View Profile
EVK1105 PERIODIC Software Timer
« 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

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: EVK1105 PERIODIC Software Timer
« Reply #1 on: July 07, 2010, 01:33:52 PM »
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

Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Re: EVK1105 PERIODIC Software Timer
« Reply #2 on: July 27, 2010, 03:48:43 PM »
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

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: EVK1105 PERIODIC Software Timer
« Reply #3 on: July 27, 2010, 06:29:22 PM »
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
« Last Edit: July 29, 2010, 09:36:29 PM by mark »

Offline mhoneywill

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Re: EVK1105 PERIODIC Software Timer
« Reply #4 on: July 28, 2010, 10:11:03 AM »
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.