Cyclic and Periodic Operation
In multitasking operation, the highest priority task shall be used in periodic mode in order to allow enough time for lower priority tasks to be executed.
For this reason, only the task with the lowest priority should be used in cyclic mode. Thus, choosing cyclic operating mode for the master task excludes using auxiliary tasks.
Measurement of Task Durations
The duration of tasks is continually measured. This measurement represents the duration between the start and the end of execution of the task. This measurement includes the time taken up by tasks of higher priority which may interrupt the execution of the task being measured.
The following system words give the current, maximum and minimum cycle times for each task (value in ms)
Measurement of times |
MAST |
FAST |
AUX0 |
AUX1 |
AUX2 |
AUX3 |
---|---|---|---|---|---|---|
Current |
|
|
|
|
|
|
Maximum |
|
|
|
|
|
|
Minimum |
|
|
|
|
|
|
Task Periods
The task periods are defined in the task properties. They can be modified by the following system words.
System words |
Task |
Values |
Default values |
Observations |
---|---|---|---|---|
|
MAST |
0..255ms |
Cyclic |
0 = cyclic operation |
|
FAST |
1..255ms |
5ms |
- |
|
AUX0 |
10ms..2.55s |
100ms |
The values of the period are expressed in 10ms. |
|
AUX1 |
10ms..2.55s |
200ms |
|
|
AUX2 |
10ms..2.55s |
300ms |
|
|
AUX3 |
10ms..2.55s |
400ms |
When the cycle time of the task exceeds the period, the system sets the system bit %S19 of the task to 1 and continues with the following cycle.
Watchdog
The execution of each task is controlled by a configurable watchdog by using the task properties.
The following table gives the range of watchdog values for each of the tasks:
Tasks |
Watchdog values (min...max) (ms) |
Default watchdog value (ms) |
Associated system word |
---|---|---|---|
MAST |
10..1500 |
250 |
|
FAST |
10..500 |
100 |
- |
AUX0 |
100..5000 |
2000 |
- |
AUX1 |
100..5000 |
2000 |
- |
AUX2 |
100..5000 |
2000 |
- |
AUX3 |
100..5000 |
2000 |
- |
If watchdog overflow should occur, the application is declared in error, which causes the PLC to stop immediately (HALT state).
The word %SW11 contains the watchdog value of the master task in ms. This value is not modifiable by the program.
The bit %S11 indicates a watchdog overflow. It is set to 1 by the system when the cycle time becomes greater than the watchdog.
The reactivation of the task requires the terminal to be connected in order to analyze the cause of the error, correct it, reinitialize the PLC and switch it to RUN.
It is not possible to exit HALT by switching to STOP. To do this you must reinitialize the application to ensure consistency of data.
Task Control
When the application program is being executed, it is possible to activate or inhibit a task by using the following system bits:
System bits |
Task |
---|---|
|
MAST |
|
FAST |
|
AUX0 |
|
AUX1 |
|
AUX2 |
|
AUX3 |
The task is active when the associated system bit is set to 1. These bits are tested by the system at the end of the master task.
When a task is inhibited, the inputs continue to be read and the outputs continue to be written.
On startup of the application program, for the first execution cycle only the master task is active. At the end of the first cycle the other tasks are automatically activated except if one of the tasks in inhibited (associated system bit set to 0) by the program.
Controls on Input Reading and Output Writing Phases
The bits of the following system words can be used (only when the PLC is in RUN) to inhibit the input reading and output writing phases.
Inhibition of phases... |
MAST |
FAST |
AUX0 |
AUX1 |
AUX2 |
AUX3 |
---|---|---|---|---|---|---|
reading of inputs |
|
|
|
|
|
|
writing of outputs |
|
|
|
|
|
|
On Quantum, inputs/outputs which are distributed via DIO bus are not assigned by the words %SW8 and %SW9.