Справочник Пользователя для Mitsubishi Electronics 13JW55
4 - 31
4.7.3
CALL(P) Call
RET Return
0
103
104
M0
X1
X2
CALL
P10
FEND
Y70
50
M5
CALL
P10
157
RET
P10
Subroutine
program
program
Sequence
program
program
1
2
• The above program is a basic style to execute the subroutine program using the
CALL and RET instructions.
Keep this structure, otherwise an error occurs and the programmable controller
stops.
1
• A subroutine program consists of the ladders for executing the same data many
times in one program.
A subroutine program starts at a pointer P and ends with the RET instruction.
2
• The pointer P number is from 0 to 4095. (Same as the pointer numbers used for
the CJ and SCJ instructions.)
• A subroutine program is executed as shown in the following diagrams.
Input condition
Sequence program
CALL
P10
Sequence program
FEND
Subroutine program
Sequence program
RET
0
P10
END
FEND
0
0
CALL P10
P10
RET
Next step
after CALL
after CALL
Execution of
subroutine program
subroutine program
FEND
(When CALL P10 is not executed)
(When CALL P10 is executed)
Executing a subroutine program