Symbols and Features
Ladder Instruction Name |
Ladder Symbol |
Feature |
Number of Steps |
---|---|---|---|
RET |
|
Control |
1 |
RET instructions return the program from a subroutine to the original JSR instruction call, and continues executing instructions in rungs that follow.
Use RET instructions to interrupt the subroutine and return to the MAIN program.
Because the program automatically returns to the caller after the subroutine processing ends, it is not always necessary to use an RET instruction.
Place RET instructions at the end of rungs. RET instructions can only be used in subroutines.
Program Example
RET
RET instructions can only be used in subroutines. When the jump to subroutine instruction is executed in MAIN, the program flow moves to the subroutine. The subroutine processes instructions in rungs 1 and 2. If the variable for the normally open instruction in rung 3 is ON, the RET instruction is executed and returns the program flow to MAIN without executing the fourth rung.
When the RET instruction is not executed, the program is executes the fourth rung, then returns the program to MAIN after the subroutine ends (END).