Using Tasks
Relationship of Tasks to
Block Programs
Block program 000
Task 0
Block program 001
Block program n
Task 1
Task n
4-2-5
Global Subroutines
180
8. Assign I/O memory into memory shared by tasks and memory used only
for individual tasks, and then group I/O memory used only for individual
tasks by task.
Up to 128 block programs can be created in the tasks. This is the total number
for all tasks. The execution of each entire block program is controlled from the
ladder diagram, but the instructions within the block program are written using
mnemonics. In other words, a block program is formed from a combination of
a ladder instruction and mnemonic code.
Using a block program makes it easier to write logic flow, such as conditional
branching and process stepping, which can be hard to write using ladder dia-
grams. Block programs are located at the bottom of the program hierarchy,
and the larger program units represented by the task can be split into small
program units as block programs that operate with the same execution condi-
tion (ON condition).
Program
Global subroutines can be called from more than one task. With regular sub-
routine instructions, it is not possible to call a subroutine in one task from a dif-
ferent task.
With the CS1 or CJ1 CPU Units, global subroutines cannot be used, i.e., a
subroutine in one task cannot be called from other tasks. With the CS1-H,
CJ1-H, CJ1M, or CS1D CPU Units, however, global subroutines can be cre-
ated in interrupt task number 0, and these subroutines can be called from any
cyclic task (including extra cyclic tasks).
Note The CS1G/H-CPU@@(-V1) and CJ1@-CPU@@ CPU Units do not support this
function.
The GSBS instruction is used to call a global subroutine. The subroutine num-
ber must be between 0 and 1,023. The global subroutine is defined at the end
of interrupt task number 0 (just before END(001)) between the GSBN and
GRET instructions.
Global subroutines can be used to create a library of standard program sec-
tions that can be called whenever necessary.
Section 4-2
Block program area 000
Block program area 001
Need help?
Do you have a question about the CJ - PROGRAMMING MANUAL 08-2008 and is the answer not in the manual?
Questions and answers