FreeRTOS Support Archive

The FreeRTOS support forum can be used for active support both from Amazon Web Services
and the community. In return for using our software for
free, we request you play fair and do your bit to help others! Sign up
to receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.

How to control time-dependent tasks

The tasks can do the every so often themselves by using vTaskDelay/vTaskDelayUntil to wait for their next activation time (you will need something that gives you absolute time for #2, and likely 32 bit ticks if you don't want task 2 to need to wait up momentarily to see that it needs to go back to sleep for a while, unless your tick rate is slower the once a second (at 1 Hz, the max delay with 16 bit ticks is about 18 hours, and the tick rate is likely higher).

Having task 1 suspend after 2 minutes is a strange requirement. With a RTOS, normally a task will do the stuff it needs to do, and then wait until it needs to do it again. For it to abruptly stop (and presumably resume where it stopped 8 minutes later) is a very unusual type of situation. If task 1 is doing lots of small steps, then perhaps it could check an elapsed time after each on to decide if it should do the next or sit and wait. (Again this doesn't sound very RTOSish, maybe if you start the REAL problem, and not how to implement your solution, we might be able to give better help.)

How to control time-dependent tasks

Agree with Richard D, maybe you are better describing the problem to get ideas for solutions.

Task 1 can use vTaskDelayUntil() to start ever 10 minutes, and either just look at the time periodically to know when to stop, or it could start a software timer with a 2 minute period when it starts and have the software timer tell it when to stop.

To know when 12.00 was you would need a real time clock, or be sent the time from a remote interface. If you have a real time clock then use it to set an alarm at 12.00 and wake task 2 from the alarm handler.