Subroutines
Subroutines and
Differentiation
Note A subroutine can be called more than once in a program.
Observe the following precautions when using differentiated instructions
(DIFU(013), DIFU(014), or up/down differentiated instructions) in subroutines.
The operation of differentiated instructions in a subroutine is unpredictable if a
subroutine is executed more than once in the same cycle. In the following
example, subroutine 0001 is executed when CIO 000000 is ON and
CIO 000100 is turned ON by DIFU(013) when CIO 000001 has gone from
OFF to ON. If CIO 000001 is ON in the same cycle, subroutine 0001 will be
executed again but this time DIFU(013) will turn CIO 000100 OFF without
checking the status of CIO 000001.
Execution condition ON
Main program
Subroutine
Execution condition ON
program n
Two-level
nesting
Subroutine
program m
Program end
1
1
3
1
5
1
Subroutine
0001
4
2
Section 3-19
The subroutine is
executed again.
813
Need help?
Do you have a question about the SYSMAC CJ - REFERENCE MANUAL 08-2008 and is the answer not in the manual?
Questions and answers