Mitsubishi — 5.6 Descriptions of the Applied Instructions

Chapter 5 Applied Instructions API 02  The instruction SRET indicates that a soubroutine ends. After the Explanation 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.  When X0.0 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. Example 1 20 P2 points to a subroutine.

X0.1 24 Y0.1 Subroutine Y0.0 Y0.0  When X2.0 is turned from OFF to ON, the instruction CALL P10 is Example 2 executed, and the execution of the program jumps to the subroutine to which P10 points.  When X1.1 is ON, the instruction CALL P11 is executed, and the execution of the program jumps to the subroutine to which P11 points.  When X1.2 is ON, the instruction CALL P12 is executed, and the execution of the program jumps to the subroutine to which P12 points.  When X1.3 is ON, the instruction CALL P13 is executed, and the execution of the program jumps to the subroutine to which P13 points.

 When X1.4 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. 5-23 Instruction code Operand Function SRET – Indicating that a subroutine ends Pulse instruction 16-bit instruction (1 step) 32-bit instruction –  – .0 CALL P2 CALL P2