Starting, Aborting, And Waiting For A Task - Omron SYSMAC CV500-BSC11 Operation Manual

Basic units
Table of Contents

Advertisement

Multitasking
Declaring the End of Task Program
Examples of Programming Tasks
Single Task
Multiple Tasks

6-2-3 Starting, Aborting, and Waiting for a Task

Starting a Task
Aborting a Task
The number of WORK bytes is the number of bytes of work area used by the task.
The default value is 1024 bytes.
The PARACT statement must appear on alone on a line; it cannot be used in a
multi-statement line.
END PARACT
The END PARACT statement is used on the last line of the task program to de-
clare end the task program.
The END PARACT statement must appear alone on a line; it cannot be used in a
multi-statement line.
If there is only one task, it must be task number 0.
10 RDIM
. . . . . . . . . . . . . . . . . . . . . .
20 DIM
. . . . . . . . . . . . . . . . . . . . . . .
30 PARACT 0
. . . . . . . . . . . . . . . . .
1000 END PARACT
. . . . . . . . . . . .
Task 0 is will be executed first when the program is started. Other tasks may be
started by the first task.
10 RDIM
. . . . . . . . . . . . . . . . . . . . . .
20 DIM
. . . . . . . . . . . . . . . . . . . . . . .
30 PARACT 8
. . . . . . . . . . . . . . . . .
100 END PARACT
. . . . . . . . . . . . .
110 PARACT 0
. . . . . . . . . . . . . . . .
300 END PARACT
. . . . . . . . . . . . .
310 PARACT 1
. . . . . . . . . . . . . . . .
660 END PARACT
. . . . . . . . . . . . .
A task can be started with the TASK statement and aborted by the EXIT state-
ment. In addition, one task can wait for the end of another task that has been
started by using the TWAIT statement.
If an attempt is made to start, stop, or wait for a task number that has not been
declared by a PARACT statement, an error occurs.
. . . . . . . . . . . . . . . . . . .
100 TASK 1
. . . . . . . . . . . . . . . . . . .
200 EXIT 1
Declaration of non-volatile variables
Declaration of global volatile variables
Beginning of task
End of task
Declaration of non-volatile variables
Declaration of global volatile variables
Beginning of task 8
Note that tasks
can be declared
in any order.
End of task 8
Beginning of task 0
End of task 0
Beginning of task 1
End of task 1
Execution of task 1 is started from the
task's PARACT statement. If task 1 has
already been started, an error message
is displayed.
The EXIT command aborts a specified
task. If the is not running, an error mes-
sage is displayed.
Section 6-2
99

Advertisement

Table of Contents
loading

Table of Contents