DVP-ES2/SA2/SS2/SA2/SX2/SE Operation Manual - Programming
3-46
API Mnemonic Operands Function
01
CALL P Call Subroutine
Controllers
ES2/EX2 SS2 SA2
SE SX2
OP Valid Range Program Steps
P0~P255 CALL, CALLP: 3 steps
PULSE 16-bit 32-bit
ES2/EX2 SS2 SA2
SE SX2 ES2/EX2 SS2 SA2
SE SX2 ES2/EX2 SS2 SA2
SE SX2
Operands:
S: The destination pointer P of the call subroutine.
Explanations:
1. When the CALL instruction is active it forces the program to run the subroutine associated
with the called pointer.
2. A CALL instruction must be used in conjunction with FEND (API 06) and SRET (API 02)
instructions.
3. The program jumps to the subroutine pointer (located after an FEND instruction) and
processes the contents until an SRET instruction is encountered. This forces the program
flow back to the line of ladder immediately following the original CALL instruction.
Points to note:
1. Subroutines must be placed after FEND instruction.
2. Subroutines must end with SRET instruction.
3. CALL pointers and CJ instruction pointers are not allowed to coincide.
4. CALL instructions can call the same CALL subroutine any number of times.
5. Subroutines can be nested 5 levels including the initial CALL instruction. (If entering the six
levels, the subroutine won’t be executed.)