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.

RTI module act as the task scheduler

Hi,

I need to use the RTI module to realize the tasks scheduler(just like every 100ms, the can1 send out data, every 200ms, the Ethernet send data and every 200ms, some functions run),I noticed that the RTI interrupt is just 4(4 compare interrupts).

If I need to use five different cycles to implement different function, how did I do that? Can I just write the application in the notification of the RTI module? Any suggestions?

I cannot use the FreeRTOS because of the special application, so I need to implement them with timer.

yong

  • Hello Yong,

    Often this is done with a switch-case statement. i.e., use the RTI interrupt to fire off every 100ms (or whatever your tightest timing is) then setup the ISR to increment a circular counter for which execution loop to run. In your main loop, you would then use the switch-case to execute the tasks associated with the counter. In other words, for the first 100ms the counter would be 1 and all tasks associated with this loop would be executed in main. On the second loop, the counter would be incremented to 2 and the second item(s) in the switch-case statement would be executed.

    If not all loops are on the same 100ms increment, a second compare and counter could be setup for the resolution needed.

    If latency is an issue, you could put the switch right in the ISR. Just be sure to clear the RTI interrupt on entry so lower priority tasks can be interrupted if they exceed the 100ms execution time.

  • Thanks very much,I know how to do now.

    Regards,

    yong