OS_TIMER and Interraction with a specific task...

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

  • OS_TIMER and Interraction with a specific task...

    I have set up a timer using OS_TIMER to force an action every 200 msec. Right now, I am doing that by use of a global variable associated with the specific task. However, I am wondering if there is a better way to do this - could I send a message to the task and also cause the task to be run via commands that would be sent when the timer expires?



    MSP430F5529, IAR Tools, embOS (For MSP430)

    Todd Anderson

    PDT
  • Hello Todd,

    yes, you could e.g. use task events to signal the timeout from your software timer to a specific task, it could look like this:

    C Source Code

    1. OS_TIMER TIMER200;
    2. void HPTask(void) {
    3. while (1) {
    4. OS_WaitEvent(1);
    5. }
    6. }
    7. void Timer200(void) {
    8. OS_SignalEvent(0x01, &TCBHP);
    9. OS_RetriggerTimer(&TIMER200); /* Make timer periodical */
    10. }
    11. void InitTask(void) {
    12. /* Create and start Timer200 */
    13. OS_CREATETIMER(&TIMER200, Timer200, 200);
    14. }
    Display All


    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.
  • Hello Todd,

    yes, that's correct!

    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.