8. Function Commands
CALL, CALLP, RET
- 227 -
Cautions
When returning from CALL or CALLP command (that is, when executing RET command), the
operation results obtained immediately before will be retained.
Thus, make sure not to program a command following to CALL or CALLP as it may cause an illegal
operation. The example is shown below.
SM3
CALL P10
CALL P20
FEND
P252
P10
X0
Y0
SM32
0
P20
INC D0
RET
INC D1
RET
END
7
8
12
13
17
18
(1) The program of P10 label is always called.
(2) The operation results when returning from P10 is determined by the results of "LD X0".
(3) "OUT Y0" will be executed after returning from P10. In this time, the X0 state will affect the P10
results.
(4) In the same manner as (3), the X0 state will affect the P20 results.
Correct the above program as shown below.
SM3
CALL P10
CALL P20
FEND
P252
P10
X0
Y0
SM32
0
P20
INC D0
RET
INC D1
RET
END
9
10
14
15
19
20
4
SM3
SM3