Mitsubishi — 5.6 Application Instructions

5 Categories and Use of Basic Application Instructions API 01 Operands: S : The destination pointer P of the call subroutine Explanations: 1. When the CALL instruction is active it forces the program to run the subroutine associated with the called pointer 2. P cannot be modified by index register V, Z. 3. The subroutine designated by the pointer should be programmed after M102, M2 and SRET instructions. 4. The number of pointer P, when used by CALL, cannot be the same as the number designated by CJ, CJN and JMP instructions. 5. If only CALL instruction is in use, it can call subroutines of the same pointer number with no limits on the times. 6.

CALL instruction is not allowed to be used in subroutines. API 02 Explanations: SRET indicates the end of subroutine program. When SRET is executed, program execution will automatically return to the address after CALL instruction in O100 main program. Program Example 1: When X0 = ON, the CALL instruction will jump to P2 and run the subroutine. With the execution of the SRET instruction, it will jump back to address 24 and continue the execution. 20 X1 Call subroutine P2 24 Y1 Y0 Y0 Subroutine P2 Program example 2: 1. When the rising-edge contact X20 is triggered, CALL P10 instruction will transfer execution to subroutine P10. 2.

When X11 is ON, execute CALL P11, jump to and run subroutine P11. 3. When X12 is ON, execute CALL P12, jump to and run subroutine P12. DVP-PM Operation Instruction 5-18 Mnemonic Operands Function Controllers 20PM 10PM CALL P Call Subroutine OP Range Program Steps P0 ~ P255 CALL, CALL P : 3 steps Mnemonic Function Controllers SRET Subroutine Return 20PM 10PM OP Descriptions Program Steps N/A No operand. No contact to drive the instruction is required SRET: 1 steps 0 CALL P2 CAL L P2