This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

best way to timing in TIRTOS?

I am relatively new to TIRTOS and am trying to understand what is the best way to trigger a series of events at certain times. More specifically, i have a static table of times, i.e. [0.17sec, 1.85sec, 2.8sec, 30sec, 600sec]. At each of these time steps, i would like to change the period parameter of the PWM driver.

From what i understand so far, there a few different ways to do this:

* a task that sleeps for the amount of MS defined by each tilmestep

* a one shot clock for each of these time intervals

Are there other/better ways to do this? 

One detail is that this is a very high priority event, that should take precedence over everything else in the system. The timing between each step as well as the immediate change in PWM parameter is highly critical. 

Thanks in advance for your suggestions.

  • Hi pixbroker,

    I think both of the methods you are thinking of would work.

    However, based on the critical need you mention, I would recommend that you use a Clock instance for this.

    When a Clock expires, and its corresponding Clock function is run, it runs in the context of a software interrupt (Swi). This is the highest priority thread, outside of an actual hardware interrupt ISR (Hwi). This means it would take precedence over any currently running Task functions in the application. It could still be interrupted, however, say by a Hwi.

    The Clock_setPeriod() API could also be used to change the expiration period of the Clock object, in order to follow the table of times you mention.

    Please refer to the Clock module under the SYS/BIOS API guide, as well as the chapter "3.2 Overview of Threading Modules" of the SYS/BIOS User's Guide.

    Steve