8 APPLICATION INSTRUCTION
8.4 Structuring Instruction
403
8
Returning from the subroutine program
RET/SRET
These instructions indicate an end of a subroutine program.
The RET instruction can be used as SRET.
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.
Precautions
• If the RET (SRET) instruction is executed in a user interrupt program (I-IRET), a compiling error occurs.
Operation error
Ladder diagram
Structured text
Not supported
FBD/LD
Not supported.
A: Main routine program
B: Subroutine program
Error code
(SD0/SD8067)
Description
3381H
The END, FEND, GOEND, or STOP instruction is executed before the RET instruction is executed.
3382H
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.)
33E3H
The RET instruction is programmed and written between the FOR and NEXT instructions.
33E5H
The RET instruction is programmed and written between the STL and RETSTL instructions.
33E6H
The program for executing the RET instruction is written before the CALL or XCALL instruction is executed.
33E7H
The RET instruction is programmed and written between the MC and MCR instructions.
A program is written with no (P) before the RET instruction.
The program for executing the RET instruction is written between the I and IRET instructions.
CALL (P)
END
(P)
RET(SRET)
B
A
Summary of Contents for MELSEC iQ-F FX5
Page 1: ...MELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks ...
Page 2: ......
Page 17: ...15 CONTENTS ...
Page 24: ...22 MEMO ...
Page 1050: ...1048 26 TIME DATA FUNCTIONS 26 4 Division MEMO ...
Page 1068: ...1066 29 COUNTER FUNCTION BLOCKS 29 4 Counter Function Block Operation error There is no error ...
Page 1107: ...I 1105 MEMO ...
Page 1111: ......