The priority of a task or multiple tasks specified with i_sTaskName is changed.
It is possible to modify, with a single call of this function, the priority of more than one task specifying as i_sTaskName the common initial part of the task names.
For instance, as in the example below, with i_sTaskName = TASK_S the function modifies priorities of the tasks TASK_SetTaskPriorityByName_Test, TASK_SR_SercosGetConfiguration, and TASK_SR_TestStandInit but not of task Task_TestManager.
Input |
Data type |
Description |
---|---|---|
i_sTaskName |
STRING(80) |
The task or multiple tasks, whose priority shall be changed |
i_diPriorityOS |
DINT |
Priority 0..255 |
Data type |
Description |
---|---|
DINT |
>0: The task priority has been changed. The value indicates the number of affected tasks. -1: Incorrect task name or priority (i_diPriorityOS) outside the limitations |
PROGRAM SR_SetTaskPrioirityByName_Test
VAR
xPrioTask1_HI : BOOL := FALSE;
xPrioTask1_LO : BOOL := FALSE;
xPrioTask2_HI : BOOL := FALSE;
xPrioTask2_LO : BOOL := FALSE;
END_VAR
// Change priority of a single task
IF xPrioTask1_HI THEN
IF 1 = FC_SetTaskPriorityByName('TASK_SetTaskPriorityByName_Test', 224 + 31) THEN
xPrioTask1_HI := FALSE;
END_IF
END_IF
IF xPrioTask1_LO THEN
IF 1 = FC_SetTaskPriorityByName('TASK_SetTaskPriorityByName_Test', 224 + 5) THEN
xPrioTask1_LO := FALSE;
END_IF
END_IF
// Change priority of a group of matching task names
IF xPrioTask2_HI THEN
IF 3 = FC_SetTaskPriorityByName('TASK_S', 224 + 31) THEN
xPrioTask2_HI := FALSE;
END_IF
END_IF
IF xPrioTask2_LO THEN
IF 3 = FC_SetTaskPriorityByName('TASK_S', 224 + 10) THEN
xPrioTask2_LO := FALSE;
END_IF
END_IF