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

%SW30

%SW33

%SW36

%SW39

%SW42

%SW45

Maximum

%SW31

%SW34

%SW37

%SW40

%SW43

%SW46

Minimum

%SW32

%SW35

%SW38

%SW41

%SW44

%SW47

NOTE: The maximum and minimum times are taken from the times measured since the last cold restart.

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

%SW0

MAST

0..255ms

Cyclic

0 = cyclic operation

%SW1

FAST

1..255ms

5ms

-

%SW2

AUX0

10ms..2.55s

100ms

The values of the period are expressed in 10ms.

%SW3

AUX1

10ms..2.55s

200ms

%SW4

AUX2

10ms..2.55s

300ms

%SW5

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.

NOTE: The values of the periods do not depend on the priority of tasks. It is possible to define the period of a fast task which is larger than the master task.

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

%SW11

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.

NOTE:
  • 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

%S30

MAST

%S31

FAST

%S32

AUX0

%S33

AUX1

%S34

AUX2

%S35

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

%SW8.0

%SW8.1

%SW8.2

%SW8.3

%SW8.4

%SW8.5

writing of outputs

%SW9.0

%SW9.1

%SW9.2

%SW9.3

%SW9.4

%SW9.5

NOTE: By default, the input reading and output writing phases are active (bits of system words %SW8 and %SW9 set to 0).

On Quantum, inputs/outputs which are distributed via DIO bus are not assigned by the words %SW8 and %SW9.