Operator: __CURRENTTASK
The operator is an extension of the IEC 61131-3 standard.
At runtime, the operator provides information about the IEC task that is currently running.
Tip
The operator is supported only on target systems in which the target system setting memory-layout\max-stack-size is set to a value > 0.
The operator allows for access to a structure with two variables.
TaskIndex: Zero-based index that identifies the taskpTaskInfo: Detailed information about the currently running taskCan be assigned to a
POINTER TO Task_Info2from the libraryCmpIecTask
The operator cannot be used in the declaration of a POU. The would result in an error message. If the current task cannot be determined, then the TaskIndex -1 and the pTaskInfo are zero.
//Declaration
VAR
idx : INT;
pInfo : POINTER TO Task_Info2;
END_VAR
//Program code
idx := __CURRENTTASK.TaskIndex;
pInfo := __CURRENTTASK.pTaskInfo;