![Mitsubishi Electric CR750 Series Скачать руководство пользователя страница 196](http://html.mh-extra.com/html/mitsubishi-electric/cr750-series/cr750-series_instruction-manual_238840196.webp)
4-176
Detailed explanation of command words
CallP (Call P)
[Function]
This instruction executes the specified program (by calling the program in a manner similar to using GoSub
to call a subroutine). The execution returns to the main program when the End instruction or the final step in
the sub program is reached.
[Format]
[Terminology]
<Program name> Designate the program name with a character string constant or character string variable.
For the standards for program names, please refer to
<Argument>
Designate the variable to be transferred to the program when the program is called. Up
to 16 variables can be transferred.
[Reference Program]
(1) When passing the argument to the program to call.
Main program
1 M1=0
2 CallP "10" ,M1,P1,P2
3 M1=1
4 CallP "10" ,M1,P1,P2
:
10 CallP "10", M2,P3,P4
:
15 End
Sub program side
1 FPrm M01, P01,P02
2 If M01<>0 Then GoTo *LBL1
3 Mov P01
4 *LBL1
5 Mvs P02
6 End
'Return to the main program at this point.
* When step 2 and 4 of the main program are executed, M1, P1 and P2 are set in M01, P01 and P02 of
the sub program, respectively. When step 10 of the main program is executed, M2, P3 and P4 are set in
M01, P01 and P02 of the sub program, respectively.
(2) When not passing the argument to the program to call.
Main program
1 Mov P1
2 CallP "20"
3 Mov P2
4 CallP "20"
5 End
"200" sub program side
201 Mov P1
'P1 of the sub program differs from P1 of the main program.
202 Mvs P002
203 M_Out(17)=1
204 End
'Return to the main program at this point.
CallP[] "<Program name> " [, <Argument> [, <Argument>