6. BASIC INSTRUCTIONS
6
−
62
MELSEC-A
6.5.2 Subroutine call, return
(CALL, CALLP, RET)
Available Device
Bit device
Word (16-bit) device
Constant
Pointer
Level
Ca
rr
y
fla
g
Err
o
r
fla
g
X Y M L S B F T C D W R A0
A1
Z V K H P I N
D
igit specification
In
d
e
x
M9012 (M9010, M9011)
P
O
O
O
Functions CALL,
CALLP
(1) Executes the subroutine program specified by the pointer (P**).
(2) Up to five levels of nesting of the CALL/CALLP instruction are allowed.
RET
(1) Executes the sequence program located at the next step to the CALL(P)
instruction when the RET instruction is executed.
(2) Indicates the end of subroutine program.
POINT
For the PC CPUs shown below, setting indicated below is required.
•
A0J2HCPU, AnSCPU, AnSHCPU,A2CCPU, AnCPU, AnNCPU, A3HCPU,
A3MCPU,
A3VCPU
In a sequence between the RET instruction in a subroutine program and the
END instruction at the end of a sequence program, a dummy circuit must
always be set. Otherwise, the PC will fail to operate correctly.
(A NOP instruction has the same effect. However, take it into consideration
that "NOP batch deletion" must not be executed by a peripheral device.)
Applicable
CPU
All CPUs
Subroutine execution commands
P**
RET
CALL
P**
Head pointer number of
subroutine program (P0 to
253)
Setting data
Subroutine program
P**
CALLP
Call of subroutine
program
Head pointer number
(label) of subroutine
program
Return of
subroutine
program
P**
Summary of Contents for MELSEC-A series
Page 1: ......
Page 2: ......
Page 13: ...A 11 MEMO...
Page 505: ...APPENDICES APP 100 MELSEC A MEMO...
Page 507: ......
Page 508: ......