-

Task/Event Properties and Types (non-safety-related Controllers only)

This topic contains the following sections:

Task properties

The 'Tasks and Events' table defines the task properties. Depending on the selected task type, the following properties can be set for a task.

Note
Some task properties defined here are written to the TASK_INFOS system variable (device-dependent variable) which can be used for monitoring the application behavior. For details on the TASK_INFOS system variable, refer to the PLCnext Info Center and the respective controller manual.

PropertyDescription
NameName of the task or program instance.

For PLCnext Technology controllers, also the core names (ESMx) are listed in this column.
Task TypeThe task type specifies the condition which starts the execution of the task.
See the "Task/event types" description below for a list of the available types.
Event NameEvent that triggers the execution of the task. Only available for Event Tasks. The task is started as soon as the selected event occurs.

The selection list provides all predefined user events and system events.

User events are defined by the user in a C++ program. Please refer to the PLCnext Info Center, the controller documentation, or the controller adaptation manual for information about available events.

For a description of the available system events refer to the topic "System Event Tasks".
Program TypeProgram that is assigned to the task (type of the instance).

Left-clicking into the field opens the Role Picker. The tree on the left shows the structure of the program POUs as organized in the 'Programs' folder (COMPONENTS area). On the right, the available program POUs are provided for selection.
Interval (ms)Time interval in ms in which the cyclic task is executed (integer or floating point value). Only available for cyclic tasks.

The time value should be a multiple of the timer resolution of the target device.

Note
Enter floating point values 0.xxx for specifying interval durations in the range of µs.

PriorityPriority for calling the task (number between 0 and 15). 0 is the highest and 15 the lowest priority. The task with the highest priority is called first.
Threshold (ms)Execution time threshold value in milliseconds. This value supports you in monitoring the application:
If a value > 0 is specified and the task execution lasts longer than this threshold, the value of the EXEC_TIME_THRESHOLD_CNT variable (contained in the TASK_INFOS system variable) is incremented.
Both the set threshold value and the threshold exceeded counter can be read out from the TASK_INFOS system variable which is contained in the ESM_DATA system variable (data structure) for monitoring purposes:
  • Set threshold value: ESM_DATA.ESM_INFOS[*].TASK_INFOS[*].EXEC_TIME_THRESHOLD (data type LINT)
  • Current counter value: ESM_DATA.ESM_INFOS[*].TASK_INFOS[*].EXEC_TIME_THRESHOLD_CNT (data type UDINT)
The EXEC_TIME_THRESHOLD_CNT value is reset at each controller cold and warm start.
Watchdog (ms)Maximum time a task is allowed to run for one cycle (call). If the watchdog time exceeds, a watchdog error is generated. This way, the watchdog monitors the execution and completion of a task within the defined time. The watchdog is executed during each system cycle.

For cyclic tasks, the watchdog time normally should be shorter than the system cycle time.

The valid value range depends on the target. Please refer to the PLCnext Info Center and the device manual for minimum and maximum watchdog settings.

Note
The value 0 deactivates the watchdog.

For information on the watchdog time refer to the topic "Tasks and Watchdog".
CommentComment for the core, task or program instance.

Task types

Task typeDescription
Cyclic TaskThe task is executed cyclically according to the time interval set in the 'Interval (ms)' field.

Fixed program call intervals are important if, for example, the program is part of a control loop. Here, the interval influences the controller characteristic.
Idle TaskAn Idle task is not time scheduled. It is executed if no other task with higher priority is currently executed.

Note
Only one Idle task per ESM is allowed. A corresponding error message is issued in the Error List if the ESM already contains an Idle task.

Event Task

User Event Task
Two different types of event tasks are distinguished: User event tasks and system event tasks.

  • A system event task executes its associated programs each time a particular system event occurs. This way, the application can react on particular occurrences such as controller errors, exceeded watchdog, CPU overload or a simple change of the operational controller state.

    For a description of the available system events refer to the topic "System Event Tasks".

  • A user event task executes its assigned programs each time a particular event occurs. These task-triggering events are either defined by the controller manufacturer or defined by the user (see the following note). Please refer to your controller documentation for detailed information about available events and the associated event numbers.
For a description of the available system events refer to the topic "System Event Tasks".