Mitsubishi Electronics FX3G Manuel D’Utilisation

Page de 964
228
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
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
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
(FX
3S
: P0 to P62 and P64 to P255, FX
3G
/FX
3GC
: P0 to P62 and P64 to P2047, 
FX
3U
/FX
3UC
: P0 to P62 and P64 to P4095)
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
X Y M T C S D .b KnX KnY KnM KnS T C D R U \G
V Z Modify K H
E
" "
P

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
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