348
7 APPLICATION INSTRUCTION
7.4 Structuring instruction
Returning from the subroutine program
RET/SRET
These instructions indicate an end of a subroutine program.
The RET instruction can be used as SRET.
• 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.
• If the RET (SRET) instruction is executed in a user interrupt program (I-IRET), a compiling error occurs.
Ladder diagram Structured text
Not supported
Error code
(SD0/SD8067)
Description
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.)
CALL (P)
END
(P)
RET(SRET)
Subroutine programMain routine program