Omron SYSMAC CJ - REFERENCE MANUAL 01-2008 Reference Manual page 873

Sysmac cs/cj/one nsj series programmable controllers
Table of Contents

Advertisement

Subroutines
Precautions
834
The region of the program beginning at the first GSBN(751) instruction is the
subroutine region. A subroutine is executed only when it has been called by
GSBS(750).
The global subroutine region (between GSBN(751) and GRET(752)) must be
defined in interrupt task 0. If it is defined in another task, an error will occur
and the Error Flag will be turned ON when the GSBS(750) instruction is exe-
cuted.
The GSBS(750) instruction can be written both cyclic tasks (including extra
cyclic tasks) and interrupt tasks.
Cyclic or interrupt task
Interrupt task 0
• When the subroutine is not being executed, the instructions are treated as
NOP(000).
• Place the global subroutine region (GSBN(751) to GRET(752)) in inter-
rupt task 0 just before the END(001) instruction. When two or more global
subroutines are being used, group them together in interrupt task 0 after
the end of the main program. If part of the main program is placed after
the global subroutine region, that program section will be ignored.
Interrupt task 1
GSBS
n
GSBN
n
Global
subroutine
region
GRET
END
GSBN
Global
n
subroutine
region
GRET
This part of the
program will not
be executed.
END
Section 3-19

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents