STE 58762
- -
2-26
As shown in Fig. 2, the multitask operation is realized, changing over a plural number of individual
programs by time sharing, as if the programs were executed in parallel. The order of program
execution is shown in the following table.
Order Program to be executed
1 A1 Program 1 start
2 B1 Program 2 start
3 C1 Program 3 start
4 A2
5 B2
6 C2 1-cycle end of program 3
7 A3
8 B3 1-cycle end of program 2
9 C1 Program 3 start
10 A4 1-cycle end of program 1
11 B1 Program 2 start
12 C2
13 A1 Program 1 start
: :
Next, the start of multitask is described.
A program that can be treated as multitask is the program block containing no arguments. The
program block means an area between the PROGRAM command and END command, which
consists of the SCOL language statements. The subroutine without argument can be dealt with as
a task. The argument cannot be kept in the task.
To deal with a program as task, use the TASK command. The TASK command executes a
program specified in the argument as a task. Unless the program starts by the TASK command,
the program is not performed as a task.
The program block (statements between the PROGRAM command and the END command)
described at the head of the program file is an exception. Even if the TASK command is not used,
the program is performed as a task.
To execute the program 2 as a task in the Fig. 2, the TASK (“PROG2”) is required to be executed in
the program 1. (The program 1 is described at the head of the file, and the program starts as a
task without TASK command.)
To execute the program 3 as a task, a new task (“PROG 3”) is required to be executed in the task
(in the program 1 or 2 in this case) which has been already started.
If the task and program which have been started are reset or the task operation is released by the
SCOL language, the task is kept active.