Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
7 Applied Instructions (Program Flow)
7.7 FEND / Main Routine Program End
124
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
2. In the case of CALL instruction
*1. If task names other than "MELSEC_MAIN" are used, FEND instruction is added automatically, and
cause an error.
Refer to item 6 of "Cautions".
Cautions
1) The function FEND instruction is usually added automatically during compilation.
It is not necessary to program the FEND instruction in the program block except when creating subroutine
program and interrupt routine program. As for the subroutine programs, refer to the following.
Refer to Section 7.2.
2) When FEND instruction is programmed two or more times, put a subroutine program or interrupt routine
program after the last FEND instruction.
3) When CALL or CALLP instruction is used, put a label after FEND instruction. And the SRET instruction is
required in every case.
4) When CALL or CALLP instruction is used, if FEND instruction is executed after CALL or CALLP
instruction was executed and before SRET instruction is executed, an error is caused.
5) When FOR instruction is used, if FEND instruction is executed after FOR instruction was executed and
before NEXT instruction is executed, an error is caused.
6) When CALL instruction is used, set the registered task name to "MELSEC_MAIN".
Any other task names add FEND instruction automatically at the end of the program block (*1 in "2. In the
case of CALL instruction") during compilation, and cause an error during writing to the PLC (due to
already existing FEND instruction located at the end of the main program (*2 in "2. In the case of CALL
instruction")).
It is not possible to use CALL instruction in multiple tasks. Use function blocks.
CALL
EN ENO
p
P21
0
When X011
is ON
When X011 is OFF
X011
Main routine program
Main routine program
Subroutine program
FEND
EN ENO
P21
*1
*2