199
FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
8 Program Flow – FNC 00 to FNC 09
8.2 FNC 01 – CALL / Call Subroutine
1
In
troduct
io
n
2
Ov
e
rv
ie
w
3
In
st
ru
ct
ion
Li
st
4
D
evi
ce
s
in
De
ta
il
5
Speci
fied t
h
e
D
evi
ce &
C
onst
a
nt
6
Bef
o
re
Pr
ogr
a
m
m
ing
7
Bas
ic
In
st
ru
cti
o
n
8
FNC0
0
-FNC0
9
P
ro
g
ra
m F
lo
w
9
FNC1
0
-FNC1
9
M
ov
e
&
C
om
par
e
10
FNC
20-
FNC
2
9
Ar
ith.
&
Logi
c
O
per
at
io
n
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 saves 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 CALL instruction, P0 to P62 and P64 to P4095 can be specified.
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
(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
3
3
−
−
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