Returning from the subroutine program
RET/SRET
These instructions indicate an end of a subroutine program.
The RET instruction can be used as SRET.
Ladder diagram
Processing details
• These instructions indicate an end of a subroutine program.
• When the RET instruction is executed, the program execution returns to the step following the CALL(P) or XCALL
instruction that called the subroutine program.
Main routine program
CALL (P)
END
Precautions
• If the RET (SRET) instruction is executed in a user interrupt program (I-IRET), a compiling error occurs.
Operation error
Error code
Description
(SD0/SD8067)
3381
The END, FEND, GOEND, or STOP instruction is executed before the RET instruction is executed.
3382
While the number of nesting levels is decreased by the return instruction, the result becomes negative.
(The number of RET (SRET) instructions is larger than that of the CALL instructions.)
7 APPLICATION INSTRUCTION
348
7.4 Structuring instruction
Subroutine program
(P)
RET(SRET)
Structured text
Not supported