EasyManua.ls Logo

Mitsubishi Electric CR760-D - Page 256

Mitsubishi Electric CR760-D
730 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
4-236 Detailed explanation of command words
4MELFA-BASIC V
(3) A run-time error occurs under the following conditions.
*The counter's <Default Value> is greater than <End Value> and <Increment> is a positive number.
*The counter's <Default Value> is smaller than <End Value>, and <Increment> is a negative number.
(4) A run-time error occurs if a For statement and a Next statement are not paired.
(5) When the Next statement corresponds to the closest For statement, the variable name in the Next state-
ment can be omitted. In the example, "M2" in step 5 and "M1" in step 6 can be omitted. The processing
speed will be slightly faster to omit the counter variable.
(6) In the For, it can escape to the next step of the Next by Break. That is, process of the For-Next can be
skipped.
FPrm (FPRM)
[Function]
Defines the order of the arguments, the type, and number for the main program that uses arguments in a
sub program (i.e., when the host program uses another program with Call P).
[Format]
[Terminology]
<Dummy Argument> The variable in the sub program that is transferred to the main statement when
executed. All variables can be used. Up to 16 variables may be used.
[Reference Program]
<Main program>
1 M1=1
2 P2=P_Curr
3 P3=P100
4 CallP "100",M1,P2,P3 ' It can be described like "CallP "100", 1, P_Curr, P100" also.
<Sub program "100">
1 FPrm M1,P1,P2
2 If M1=1 Then GoTo *LBL
3 Mov P1
4 *LBL
5 Mvs P2 ' Return to the main program.
6 End
[Explanation]
(1) FPrm is unnecessary if there are no arguments in the sub program that is called up.
(2) An error occur when the type or number is different between the argument of CallP and the dummy argu-
ment that defined by FPrm.
(3) It is not possible to pass the processing result of a sub program to a main program by assigning it in an
argument.
To use the processing result of a sub program in a main program, pass the values using external vari-
ables.
[Related instructions]
CallP (Call P)
FPrm[]<Dummy Argument> [,<Dummy Argument>] ...

Table of Contents

Related product manuals