DVP-ES2/EX2/EC5/SS2/SA2/SX2/SE&TP Operation Manual - Programming
API
Mnemonic Function
SS2
SX2
02 SRET Subroutine Return
OP Descriptions Program Steps
N/A
No contact to drive the instruction is required
Automatically returns program execution to the address
after CALL instruction in O100.
SRET: 1 step
SS2
SX2
SS2
SX2
SS2
SX2
Explanations:
SRET indicates the end of subroutine program. The subroutine will return to main program and
begin execution with the instruction after the CALL instruction.
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.
20
24
P2
Subroutine
Subroutine return
Call subroutine P2
CALL P2
X0
X1
SRET
FEND
Y0
M1
Y1
M2
Y2
Program example 2:
1. When the rising-edge of 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.
4. When X13 is ON, execute CALL P13, jump to and run subroutine P13.
5. When X14 is ON, execute CALL P14, jump to and run subroutine P14. When the SRET
instruction is reached, jump back to the last P subroutine to finish the remaining instructions.