‘Insert’ ‘Insert Task’ or ‘Insert’ ‘Append Task’

With this command you can insert a new task into the Task Configuration. The entries each consist of a symbol and the task name.

If a task or the entry ‘System events’ is selected, then the ‘Insert Task’ command will be at your disposal. The new task will be inserted after the selected one. If the entry ‘Task Configuration’ is selected, then the ‘Append Task’ is available, and the new task will be appended to the end of the existing list. The maximum number of tasks is defined by the target system. Please regard that a certain number of tasks already might be reserved for modules of the PLC Configuration (defined in the *.cfg file).

When inserting a task, the dialog for setting the Task attributes will be opened:

../_images/c4a41bbec04afca10a317d3102b2f894

Insert the desired attributes:

Name: a name for the task; with this name the task is represented in the configuration tree; the name can be edited there after a mouseclick on the entry or after pressing the <Space> key when the entry is selected.

Priority (0-31): a number between 0 and 31; 0 is the highest priority, 31 is the lowest

Types:

  • cyclic ( e74b484a43769fda0a33139018bd1ba8_c206aa7ec0563d740a317d31723fa5bf ): The task will be processed cyclic according to the time definition given in the field ‘Interval’ (see below).
  • freewheeling ( e74b484a43769fda0a33139018bd1ba8_761339d5c059867f0a317d314b4ec31a ): The task will be processed as soon as the program is started and at the end of one run will be automatically restarted in a continuous loop. There is no cycle time defined.
  • triggered by event ( e74b484a43769fda0a33139018bd1ba8_288a2936c05a1fb10a317d316b489250 ):  The task will be started as soon as the variable, which is defined in the Event field gets a rising edge.
  • triggered by external event ( e74b484a43769fda0a33139018bd1ba8_f5e7efbfc05a7bc40a317d3176f2d3b7 ):  The task will be started as soon as the system event, which is defined in the Event field, occurs. It depends on the target, which events will be supported and offered in the selection list. (Not to be mixed up with system events

Properties for \ event triggered tasks:

  • Interval (for Type ‘cyclic’ or ‘triggered by external event’ if the event requires a time entry): the period of time, after which the task should be restarted. If you enter a number, then you can choose the desired unit in the selection box behind the edit field: milliseconds [ms] or microseconds [µs]. Inputs in [ms]-format will be shown in the TIME format (e.g. “t#200ms”) as soon as the window gets repainted; but you also can directly enter the value in TIME format. Inputs in [ms] will always be displayed as a pure number (e.g. “300”).
  • Event (for Type ‘triggered by event’ or ‘triggered by external event’): a global variable which will trigger the start of the task as soon as a rising edge is detected. Use button … or the input assistant <F2> to get a list of all available global variables.

Possibly the target system defines Singleton Events. These are events, which only allow to start one single task. Whether such an event starts several tasks will be checked during compilation of the project. The check regards the data address of the event variable, not on the name. For example: If the target system defines %MX1.1 and %IB4 as Singleton-Events, using the following variables as event variables will produce two errors (a and b as well as c and d each have the same address).

\ VAR_GLOBAL
a AT %MX1.1: BOOL;
b AT %MX1.1: BOOL;
c AT %MB4: BOOL;
d AT %MD1: BOOL;
END_VAR

If there is no entry in both fields ‘Interval’ and ‘Event’, then the task interval will depend on which runtime system is used (see runtime documentation); e.g. in this case for CoDeSys SP NT V2.2 and higher an interval of 10 ms will be used).

Watchdog

For each task a time control (watchdog) can be configured. If the target system supports an extended watchdog configuration, possibly there are predefined upper and lower limits and a default for the watchdog time are defined, as well as a time definition in percent.

Activate watchdog: When this option is activated ( e74b484a43769fda0a33139018bd1ba8_33005990a23e3c0c0a317d31786279b6 ) then regarding the currently set sensitivity (see below), the task will be terminated in error status as soon as the processing takes longer than defined in the ‘Time’ field (see below).

Attention

Target system CoDeSys SP 32 Bit Full switches off the watchdog function when the flow control is active or when the execution currently is stopped at a breakpoint.

Time (e.g.: t#200ms): Watchdog time; after the expiration of this term, regarding the currently set sensitivity (see below), the watchdog will be activated unless the task has not been terminated already. Depending on the target system the time has to be entered as percent of the task interval. In this case the unit selection box is greyed and shows “%”.

Sensitivity: Here you can enter in integer numbers at which overrun of the watchdog time an error should be generated. The default entry is “1”, i.e. at the first overrun of the watchdog time an error occurs. Attention: If “0” is entered, the watchdog will be deactivated!

Manufacturer \ specific attributes:

Additionally to these standard attributes for the currently selected task manufacturer specific attributes might be displayed in a second tab “Parameters”. This will be the case if it is defined in the target-specific description file for the task configuration.