Omron CJ2 CPU UNIT SOFTWARE User Manual page 124

Cj2 cpu unit software
Hide thumbs Also See for CJ2 CPU UNIT SOFTWARE:
Table of Contents

Advertisement

5 Understanding Programming
Additional Information
Global Subroutines
With regular subroutine instructions, it is not possible to call a subroutine in one task from a dif-
ferent task. Global subroutines can be created in interrupt task number 0, and these subroutines
can be called from any cyclic task (including extra cyclic tasks).
The GSBS instruction is used to call a global subroutine. The subroutine number 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 sections that can be
called whenever necessary.
Multiple tasks
5-32
Cyclic task (including extra
cyclic task)
GSBS
n
Execution
Return
Cyclic task (including extra
cyclic task)
Call
GSBS
n
Return
Interrupt task 0
Call
GSBN
n
GRET
END
CJ2 CPU Unit Software User's Manual
n = 0 to 1,023
Global
subroutine
(shared
subroutine used
for standard
programming)

Advertisement

Table of Contents
loading

Table of Contents