Why does my RTOS MicroC project run smoothly outside tasks but fail within tasks?
Please guys @Middleware & OS , why is my RTOS MicroC project encountering issues where functions execute smoothly outside tasks but fails within tasks. Any pointers on troubleshooting this issue? Observe my cod e👇👇👇👇
Any insights or advice on where to begin looking would be greatly appreciated. Thank you in advance!
8 Replies
Exactly how are they failing? Is there a crash? Do they nothing, as if they where not even called? Another behavior?
@Manuel , my functions (adjustTemperature() and monitorPressure()) works correctly when called from outside the tasks, but fail to execute when called from within tasks. That is task 1 and 2 . But it seams my code is correct right ? Or is there anything I am doing wrong
I have no experience with MicroC, therefore cannot say for sure. But the code looks straight forward. Are you sure your tasks are run at all?
Yes it's actually running, except sem.wait(); is actually running an infinity loop synchronously , blocking the functions beneath not to be attended to . I don't know let me just try as much troubleshooting as I can @Manuel
What does
sem.wait()
do? What has to happen to end the waiting?sem.wait() attempts to acquire the semaphore. If the semaphore is available and not throwing a zero value ,the task decrements the semaphore value and continues execution. Else if the semaphore is not available and its value is zero, the task enters a waiting state until the semaphore becomes available, I think I know where my issue is coming from , thanks for helping @Manuel
Let us know what the solution was, so we can learn from it, too. 🙂
Semosphere has to be returning a value of more than zero , that was what I was meant to check