I would like to know what is the most efficient way to create a periodic task in Nucleus. Create a timer that post an event every task cycle and the task waits for this event? Other idea?
You can use NU_Sleep() to get the same results. You can have something like this:
VOID Simple_Server_Task(UNSIGNED argc, VOID *argv)
/* Everything you want to execute for the cycle. */
< statement 1>
< statement 2>
Thanks for you answer but NU_Sleep() function will not take into account the time spent executing the statements in the task. Therefore if I suspend the task for let say 10ms (NU_Sleep(10)), the task cycle will be 10ms + task execution time. This might be good enough for some applications but I need to have a task cycle that is independant of the task execution time.
In that case using an application timer is good approach as you suggested earlier.
Hugo - I see that this question was initially posted in the Member Resources area. I was just about to move it to this community, but then discovered you had already posted your question here. I will delete the initial one from the Member Resources.
Retrieving data ...