Mitsubishi Electronics FX3G Video Gaming Accessories User Manual


 
224
FX3G/FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
8 Program Flow – FNC 00 to FNC 09
8.2 FNC 01 – CALL / Call Subroutine
8.2 FNC 01 – CALL / Call Subroutine
Outline
This instruction calls and executes a program which should be processed commonly in a sequence program.
This instruction reduces the number of program steps, and achieves efficient program design.
For creating a subroutine program, FEND (FNC 06) and SRET (FNC 02) instructions are required.
1. Instruction format
2. Set data
For the pointer in the CALL instruction, P0 to P62 and P64 to P4095 can be specified in FX3U/FX3UC PLCs, and
P0 to P62 and P64 to P2047 can be specified in FX
3G PLCs.
Because P63 is dedicated to CJ (FNC 00) instruction (for jump to END step), it cannot be used as a pointer for CALL
(FNC 01) instruction.
3. Applicable devices
Explanation of function and operation
1. 16-bit operation
While the command input is ON, CALL instruction is executed and the program execution jumps to a step with a label
.
Then, a subroutine program with the label is executed.
When SRET (FNC 02) 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 label (P) for CALL instruction after FEND instruction.
Operand type Description Data type
Pointer number (P) indicating the label number for the jump destination
(FX3U/FX3UC : P0 to P62 and P64 to P4095, FX3G : P0 to P62 and P64 to P2047)
Pointer number
Oper-
and
Type
Bit Devices Word Devices Others
System User Digit Specification System User
Special
Unit
Index
Con-
stant
Real
Number
Charac-
ter String
Pointer
XYMTCSD.b KnX KnY KnM KnS T C D R U\G VZModifyKH E ""P
33
P
FNC 01
CALL
CALL
CALLP
Continuous
Operation
Pulse (Single)
Operation
Mnemonic Operation Condition
16-bit Instruction
3 steps
32-bit Instruction
Mnemonic Operation Condition
Pn
Pn
Pn
Pn
Pn
M8000
FNC 01
CALL
Pn
FNC 06
FEND
RUN monitor
(normally ON)
FNC 02
SRET
Command
User program
User program
Main program
Program area from the step 0 to FEND
instruction
Subroutine program
Program area from a label to SRET
instruction
User program
Label
Pn
Pn
Pn