5 Categories and Use of Basic Application Instructions
DVP-PM Operation Instruction
5-18
API Mnemonic Operands Function
01
CALL P
Call Subroutine
Controllers
20PM 10PM
OP Range Program Steps
P0 ~ P255 CALL, CALLP: 3 steps
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. P cannot be modified by index register V, Z.
3. The subroutine designated by the pointer should be programmed after M102, M2 and SRET instructions.
4. The number of pointer P, when used by CALL, cannot be the same as the number designated by CJ, CJN and
JMP instructions.
5. If only CALL instruction is in use, it can call subroutines of the same pointer number with no limits on the times.
6. CALL instruction is not allowed to be used in subroutines.
API Mnemonic Function
02
SRET Subroutine Return
Controllers
20PM 10PM
OP Descriptions Program Steps
N/A No operand. No contact to drive the instruction is required SRET: 1 steps
Explanations:
SRET indicates the end of subroutine program. When SRET is executed, program execution will automatically return
to the address after CALL instruction in O100 main program.
Program Example 1:
When X0 = ON, the CALL instruction will jump to P2 and run the subroutine. With the execution of the SRET
instruction, it will jump back to address 24 and continue the execution.
X0
X1
CALL P2
Y1
20
24
Y0
Y0
Call subroutine P2
Subroutine P2
Program example 2:
1. When the rising-edge contact X20 is triggered, CALL P10 instruction will transfer execution to subroutine P10.
2. When X11 is ON, execute CALL P11, jump to and run subroutine P11.
3. When X12 is ON, execute CALL P12, jump to and run subroutine P12.