What you want to use is an alarm instead of a timer.  Take a look at
TEP 102 to learn about the distinction.

http://www.tinyos.net/tinyos-2.x/doc/html/tep102.html

Timers are basically built on top of Alarms.  The fired event of the
Alarm simply posting a task that signals the Timer.fired() event.

Kevin

On Sun, Mar 2, 2008 at 1:17 PM, Janos Sallai <[EMAIL PROTECTED]> wrote:
> >I thought that when the timer goes off, a hardware interrupt
>  >is generated which causes the currently executing task to be
>  >preempted, then the timer.fired event runs and when finished,
>  >the preempted task will resume.
>
>  Not exactly. You're right that when the timer goes off, a hardware
>  interrupt
>  is generated which causes the currently executing task to be preempted.
>  However, the Timer.fired event is not signaled directly from this
>  interrupt handler. Instead, the interrupt hander posts a task and
>  returns, letting the interrupted task complete. The Timer.fired event
>  will be signaled from the task posted by the interrupt handler.
>
>  Janos
>
>
>
>  -----Original Message-----
>  From: [EMAIL PROTECTED]
>  [mailto:[EMAIL PROTECTED] On Behalf Of Jamie
>  Coates
>  Sent: Sunday, March 02, 2008 2:24 PM
>  To: [email protected]
>  Subject: Tasks and Alarms
>
>  Hello everyone,
>
>  I have a question about tasks and alarms.
>
>  I am using a Crossbow WSN starter kit, MICAz.
>
>  To give some context, I am attempting to test a preemptive scheduler
>  that allows for a single background task to run that is not atomic w.r.t
>  other regular Tiny tasks. I am finding that when I use TimerMilli, fired
>  events are only delivered after the background task has finished.
>
>  I am using the timer to periodically toggle an led on the base station
>  on and off. I wanted the timer to go off during the background task's
>  execution. I thought that when the timer goes off, a hardware interrupt
>  is generated which causes the currently executing task to be preempted,
>  then the timer.fired event runs and when finished, the preempted task
>  will resume.
>
>  Can anyone tell me if I am correct, even in the case that I use a
>  regular Tiny task instead of background?
>
>  Regards,
>
>  Jamie
>
>  _______________________________________________
>  Tinyos-help mailing list
>  [email protected]
>  https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
~Kevin
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to