Hi, Senlent
Your routine performs the delay within the "while" loop. However, the question I initially raised was:
In the task scheduling of FreeRTOS, a 20ms task can execute a PWM output with a cycle of 20ms, but cannot execute a PWM output with a cycle of 50ms.
Furthermore, my entire project has at least four periodic tasks, such as 1ms, 5ms, 10ms, and 20ms, and each task performs a different function.
Returning to the original question, can a 50ms PWM output be executed within a 20ms task? Is it understood that the MOD register is re-assigned every 20ms, and when I set the MOD value to 50ms within the 20ms task, it is not possible to achieve a 50ms PWM output in time and is interrupted by the next 20ms task? The effect is that although a 50ms setting was made, it still outputs at a 20ms frequency?