133
2-Level Nest Subroutine Call (5 levels at the most)
S R E T
C A L L P
S
FNC
01
FNC
02
1
2
M
3
○ ○ ○○
1
2
M
3
○ ○ ○○
P
S
By a numeric pointer or an user-dened 16 English characters pointer
X20
The EMERGENCY_STOP
subroutine
〜
〜
FEND
SRET
END
CALL
EMERGENCY_STOP
S
P0
subroutine
P20
subroutine
〜
CALL P0
SRET
P20
SRET
END
FEND
P0
CALL P20
〜〜〜
Call Subroutine
Subroutine Return
Operand
Devices
Numeric pointer: P0~P1023
The total amount of Mark / Branch and numeric pointers is 1024.
EMERGENCY_STOP
S : the Pointer of the subroutine
When the conditional contact X20 for the CALL
instruction is “ON”, the system will execute the CALL
action to jump to the pointer of “EMERGENCY_STOP”
and then executes the subroutine. Until the SRET
instruction in the subroutine executes, the system jumps
back the line immediately following the original CALL
instruction and then keeps running.
Subroutines should be written after the FEND instruction.
If the CJ instruction and the CALL instruction are used in
a program, the same Pointer is not allowed to assign for
both.
A same subroutine can be called in a program as many
times as required.
In a subroutine, a second CALL instruction is available
for calling other subroutine, while subroutines can be
nested for 5 levels at most.
The Timers used in the subroutine must be selected
from T192~T199.