This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What's the difference between os_itv_wait and os_dly_wait?

Hello
I'm a newer to RL-ARM and I found that there're two wait function os_itv_wait and os_dly_wait in RL-ARM. Who can tell me what's the difference between them? For example is it possible to replace os_dly_wait(20) by os_itv_set(20); os_itv_wait()? Thanks.

  • The difference between them is very clearly described in the manual. You do read manuals before making use of functions you do not know by heart?

  • The os_itv_wait function waits for a periodic time interval after which the RTX kernel wakes up the calling task. You must set the time interval using the os_itv_set function.
    The os_dly_wait function pauses the calling task. The argument delay_time specifies the length of the pause and is measured in number of system_ticks. You can set the delay_time to any value between 1 and 0xFFFE.

  • Thanks Mr Westermark and Mr Michael. I didn't think I expressed my question clearly. Here I'll give an example.
    There's a task named clock in the traffice example of RTL given by Keil. The code is as following

    void clock (void)  __task {
      os_itv_set (100);                    /* set wait interval:  1 second       */
      while (1) {                          /* clock is an endless loop           */
        if (++ctime.sec == 60) {           /* calculate the second               */
          ctime.sec = 0;
          if (++ctime.min == 60) {         /* calculate the minute               */
            ctime.min = 0;
            if (++ctime.hour == 24) {      /* calculate the hour                 */
              ctime.hour = 0;
            }
          }
        }
        if (display_time) {                /* if command_status == display_time  */
          os_evt_set (0x0001,t_command);   /* signal to task command time changed*/
        }
        os_itv_wait ();                    /* wait interval (already set to 1s ) */
      }
    }
    


    Is it possible to change the os_itv_wait to os_dly_wait(100)? Thanks.

  • Note that os_dly_wait() starts the timer from when it's called. This can result in a time drift for a periodic function.

    Note also that a task may not use both os_itv_wait() and os_dly_wait(). They are mutually exclusive.

  • Thanks Mr Westermark for your answer. Can you tell me when the os_itv_wait() starts the timer?

  • Since it is a periodic timer, it counts from os_itv_set() and will restart continuously without any gap while your task runs.

    Have you looked at the documentation in the keil directory on your hdd or the online manual on this site?