Timer Routines

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Timer Routines

    Hello,

    I got a couple of questions regarding software-timers:
    Lets assume this code:

    C Source Code

    1. OS_CREATETIMER(&gTimer1, TimerRoutine1, 100);
    2. OS_CREATETIMER(&gTimer2, TimerRoutine2, 200);

    Now after 200 OS-Ticks they shall be called at the same time. Now what happens? Is TimerRoutine1 called and as soon as it is finished the OS-Scheduler calls TimerRoutine2? Or is TimerRoutine2 delayed until the next OS-Tick (which would be 201)?
    The manual says the Softwaretimers use the C-Stack. What does this actually mean? Do they use the stack of the thread they just interrupted or the stack of main()?

    thanx, Arne
  • Hello Arne,

    Is TimerRoutine1 called and as soon as it is finished the OS-Scheduler calls TimerRoutine2?

    Yes, it is like this. The scheduler runs all callback functions where the software timer is expired.

    Do they use the stack of the thread they just interrupted or the stack of main()?

    The software timer callback functions run like the scheduler on the C-stack. The C-stack is the stack which is used in main() before the call of OS_Start().

    Best regards,
    Til
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.