11.07.2015 Views

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Task routinesExampleint sec,min;void TaskShowTime() {int t0 = OS_GetTime();while (1) {ShowTime(); /* Routine to display time */OS_DelayUntil (t0 += 1000);if (sec < 59) sec++;else {sec=0;min++;}}}In the example above, the use of OS_Delay() could lead to accumulating delays and would cause the simple "clock"to be slow.OS_SetPriority()DescriptionAssigns a specified priority to a specified task.Prototypevoid OS_SetPriority (OS_TASK* pTask,unsigned char Priority);ParameterDescriptionpTaskPriorityTable 10: OS_SetPriority() parameter listAdditional InformationCan be called at any time from any task or software timer. Calling this function might lead to an immediate task switch.ImportantThis function may not be called from within an interrupt handler.OS_GetPriority()DescriptionReturns the priority of a specified task.Prototypeunsigned char OS_GetPriority (OS_TASK* pTask);ParameterDescriptionpTaskTable 11: OS_GetPriority() parameter listReturn valuePriority of the specified task as an "unsigned character" (range 1 to 255).Additional InformationIf pTask is the NULL pointer, the function returns the priority of the currently running task. If pTask does not specifya valid task, the debug version of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> calls OS_Error(). The release version of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>cannot check the validity of pTask and may therefore return invalid values if pTask does not specify a valid task.ImportantPointer to a data structure of type OS_TASK.Priority of the task. Must be within the following range:1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!