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.

RTOS: Task, Timer



Tool/software: TI-RTOS

Hi

i have two task functions, lets say:

Void task1(UArg arg0, UArg arg1)

{

Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);

//do somthing

Task_sleep(1sek);

Semaphore_post(semHandle);

}

Void task2(UArg arg0, UArg arg1)

{

Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);

//do somthing

Task_sleep(1sek);

Semaphore_post(semHandle);

}

Problem is when task1 is running and reach to point Task_sleep(), then Task2 start to run.

i want task to wait 1sek before it's move to task2

how can i do that?

  • Hi Abbas,

    What is the count for the semaphore before these two tasks run? For example, what is the value of count in the semaphore creation. Also, is it a binary or counting semaphore.

    If the count is 1 (and I'm assuming task1 is running first because it is higher priority or was created first if they are the same priority), the task1 Semaphore_pend will not block and decrements the count to 0. Then it will sleep for 1sek. During this time, the Idle task will run. After 1sek, the semaphore is posted and the task2 should run.

    Todd
  • Thanks... it's working now :)