5 Applied Instructions and Basic Usage
API
Applicable model
20PM
02
SRET
Indicating that a subroutine ends
Bit device Word device
X Y M S K H KnX KnY KnM KnS T C D V Z
Note: There is no operand.
The instruction does not need to be driven by a contact.
16-bit instruction (1 step)
SRET
Continuity
instruction
- -
32-bit instruction
- - - -
Flag: None
Explanation
The instruction SRET indicates that a soubroutine ends. After the execution of
a subroutine in a program is complete, the instruction following CALL which
calls the subroutine in the main program O100 will be executed.
Example 1
When X0 is ON, the instruction CALL is executed, and the execution of the
program jumps to the subroutine to which P2 points. When the instruction
SRET is executed, the execution of the program returns to address 24.
X0
X1
CALL P2
Y1
20
P2 points to a subroutine.
24
Subroutine
Y0
Y0
Example 2
When X11 i
s ON, the instruction CALL P11 is executed, and the execution of
the program jumps to the subroutine to which P11 points.
When X20 is turned from OFF to ON, the instruction CALL P10 is executed,
and the execution of the program jumps to the subroutine to which P10 points.
When X12 is ON, the instruction CALL P12 is executed, and the execution of
the program jumps to the subroutine to which P12 points.
When X13 is ON, the instruction CALL P13 is executed, and the execution of
the program jumps to the subroutine to which P13 points.
When X14 is ON, the instruction CALL P14 is executed, and the execution of
the program jumps to the subroutine to which P14 points. When the instruction
SRET is executed, the execution of the program returns to the previous
subroutine.
When the instruction SRET in the subroutine to which P10 points is executed,
the execution of the program returns to the main program.
DVP-20PM Application Manual
5-18