Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
7 Applied Instructions (Program Flow)
7.2 CALL / Call Subroutine
112
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
Function and operation explanation
1. 16-bit operation
While the command input is ON, CALL instruction is executed and the program execution jumps to a step with
a specified pointer number or ladder block label. Then, the corresponding subroutine program is executed.
When SRET instruction is executed, the program execution returns to the step after CALL instruction.
At the end of the main program, put FEND instruction.
Put a pointer p for CALL instruction after FEND instruction.
Cautions
1) Instructions of pulse operation type are not provided in the FX0, FX0S or FX0N PLC.
To execute pulse operation, make the instruction execution condition pulse type.
2) Enter a pointer number or ladder block label for specifying the jump destination to the ladder block header
in the ladder block regarded as the jump destination.
Add ":" to an entered pointer.
3) To use the subroutine call, follow the steps below.
Name the task "MELSEC_MAIN".
Using a different task name prompts an error because the "one set in the program block" by FEND
instruction and the "one finally added to the program block during compiling" become redundant.
Be sure to program in combination with the SRET and FEND functions.
Refer to Section 7.3 for SRET.
Refer to Section 7.7 for FEND.
4) In CALL instructions, a same number can be used two or more times in pointer number or ladder block
label.
However, do not use a pointer number or ladder block label and number used in another instruction (CJ).
5) Cautions about the use in subroutines or interrupt routines are described later.
M8000
Command
User program
User program
Main program
Program area from the
step 0 to FEND instruction
Subroutine program
Program area from a pointer Pn
to SRET instruction
User program
CALL
EN ENO
p
SRET
EN ENO
FEND
EN ENO
Pn
Pn:
RUN monitor
(normally ON)
P9:
X030
X020
User program
CJ
EN ENO
p
CALLP
EN ENO
p
P9
P9