Tab ‘Configuration’

Object: task

Priority Possible values: 0..31, where 0 is the highest priority
Type
Cyclic CODESYS processes the task in cycles. The cycle time of the task is defined in the input field Interval.
Event CODESYS starts processing the task as soon as the global variable defined in the input field Event contains a rising edge.
Freewheeling

CODESYS starts processing the task again automatically in a continuous loop at program start and at the end of a complete pass. Cycle time is not defined.

Note: In applications in which a repeater is used in combination with a cable length > 500 m a freewheeling task disturbes a CS31 communication.

Status CODESYS starts task processing if the variable defined in the Event input field yields the Boolean value TRUE.
External Event CODESYS starts processing the task as soon as the event defined in the Event input field occurs. The target system determines which events are supported and offered in the dropdown list. (Not to be confused with system events).
Interval

Task-Cycle Time

Mandatory for the types Cyclic and External Event when the event requires a time; the time interval after which the task should be restarted. If you enter a number here, then you can select the desired unit in the dropdown list after the input field.

If you select ms, then an entry is automatically displayed in TIME format, for example t#200ms, as soon as the window is in focus again. You can also enter the task cycle time directly in TIME format. Entries in [µs] format are always displayed as a pure number.

Attention

For fieldbuses, a fixed cycle matrix is necessary to ensure a determined behavior. Therefore, you should not use TypeFreewheeling for a bus cycle task.

Attention

Please note the difference between the processing types Status and Event. If the given event yields TRUE, then the start condition of a task of type Status is satisfied. In contrast, the start of a task of type Event requires a switch of the event from FALSE to TRUE. If the scanning rate of the task scheduler is too low, then the rising edge of the event can remain unnoticed.

Attention

Please note: When setting the task cycle time, identify which bus system is currently being used. For example, the task cycle time in a CAN bus system must match the currently set baud rate and the number of frames used in the bus. In addition, the times set for heartbeat, node guarding, and sync should always be a multiple of the task cycle time. If not, then CAN frames can be lost.

Watchdog

Defines the time monitoring for a task. If the target system supports an extended watchdog configuration, then it is possible that the following settings are predefined in the device description:

  • Upper and lower limit
  • Default watchdog time
  • Time percentage

The default watchdog settings depend on the device.

Enable

The watchdog is active.

If the task exceeds the currently set Time of the watchdog, then the task is ended with an error status (exception). Then the currently defined Sensitivity is also taken into account. If you activate the option Update I/Os in the PLC Settings of the controller, then CODESYS resets the outputs to the defined default values.

Possible cases:

  • Several consecutive timeouts:

    Sensitivity: 0, 1 - exception in cycle 1

    Sensitivity: 2 - exception in cycle 2

    Sensitivity: n - exception in cycle n

  • One timeout: Exception if the cycle time of the current cycle is longer than (time * sensitivity). Example: Time=t#10ms, Sensitivity=5 (i.e., exception as soon as the one-time task runs longer than 50 ms)

Time (e.g. t#200ms)

Watchdog Time

Defines the time monitoring for a task (with Sensitivity); description as for Enable.

Depending on the target system, the monitoring interval is given as a percentage of the task interval. In this case, the dropdown list for the unit is disabled and displays %.

Sensitivity

Number

Defines the time monitoring for a task (with the watchdog time); description as for Enable.

Note

Using the functions from the library CmpIecTask.library, you can deactivate a watchdog for specific PLC cycles. This is useful for cycles that demand more time due to initialization.

Example

Deactivating/reactivating the watchdog:

hIecTask := RTS_IEC_HANDLE //Declaration of the variable hIecTask hIecTask := IecTaskGetCurrent(0); IecTaskDisableWatchdog(hIecTask); // Watchdog disabled ... IecTaskEnableWatchdog(hIecTask); Watchdog enabled

List of POUs that the task controls:

The calling order corresponds to the POU order in the list (from top to bottom).

Add Call Defines a new program call
Open POU Opens the selected POU

Move up

Move down

Changes the calling order