Author Topic: Multiple Task Interupts  (Read 6154 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
Multiple Task Interupts
« on: March 28, 2011, 12:20:47 PM »
Hi Mark,
  If multiple fnInterruptMessage(..) is called for the same task, before the task has a chance to be executed, are they nested? Or will the task only be executed once. I tried it and it only gets executed once, but want to make sure it is always the case.

 And if both fnInterruptMessage(..) and uTaskerMonoTimer() gets called once each at the same time, will both be processed in the task?

Thanks
Neil
« Last Edit: March 28, 2011, 04:36:19 PM by neil »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Multiple Task Interupts
« Reply #1 on: March 28, 2011, 05:19:09 PM »
tt]fnInterruptMessage()[/tt] posts an interrupt event to the destination task's input queue.

If fnInterruptMessage() is called twice before the task processes the first one the task will have 2 such events in its queue (as long as its queue is large enough to accept all events).

When uTaskerMonoTimer() times out it posts a timer event to the input queue of the task to be woken. The timer event is similar to an interrupt event (it has an event number but no data).

If fnInterruptMessage() is called once or more times and also a monostable timer has fired before the task processes the first it will find that there are multiple events in its queue - each in the order that it was posted.

Regards

Mark

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
Re: Multiple Task Interupts
« Reply #2 on: March 28, 2011, 06:00:20 PM »
Hi Mark,
  Thats great, thanks.

Is there anyway known the number of events that can be called if SMALL_QUEUE /MEDIUM_QUE or LARGE_QUEUE is selected?

Thanks
Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: Multiple Task Interupts
« Reply #3 on: March 28, 2011, 06:59:03 PM »
Neil

If you indent to have a lot of such events at the same time you will need to have an adequately large queue. The pre-defined values are just afew typical values but don't respect any rules.

If you have a task that received onyl interrupt and timer events it is best to set its queue equal to  (HEADER_LENGTH * x) so that an exact numnbner fit. If more are sent they will be lost but at least there will ne no chance of message corruption (i.e. only part of a message being received). Generally over-dimension the queue if there may be risk.

Regards

Mark