Mitsubishi Electric CR750-Q Instruction Manual page 223

Cr750/cr751/cr760 series
Hide thumbs Also See for CR750-Q:
Table of Contents

Advertisement

Def FN (Define function)
[Function]
Defines a function and gives it name.
[Format]
Def[]FN <Identification character><Name> [(<Dummy Argument> [, <Dummy Argument>]...)]
= <Function Definition Expression>
[Terminology]
<Identification character>
<Name>
<Dummy argument>
<Function Definition Expression>
[Reference Program]
1 Def FNMAve(MA,MB)=(MA+MB)/2
2 MDATA1=20
3 MDATA2=30
4 MAVE=FNMAve(MDATA1,MDATA2)
5 Def FNpAdd(PA,PB)=PA+PB
6 P10=FNpAdd(P1,P2)
[Explanation]
(1) FN + <Name> becomes the name of the function. The function name can be up to 8 characters long.
Example) Numeric value type .... FNMMAX Identification character: M
Character string type ... FNCAME$ Identification character: C (Describe $ at the end of the name)
(2) A function defined with Def FN is called a user-defined function. A function as long as one step can be
described.
(3) Built-in functions and user-defined functions that have already been defined can be used in the function
definition expression. In this case, up to 16 levels of user-defined functions can be written.
(4) If the variables used in <Function Definition Expression> are not located in <Dummy Argument>, then
the value that the variable has at that time will be used. Also, an error will occur if during execution, the
number or argument type (numeric value or character string) of arguments differs from the number or
type declared.
(5) A user-defined function is valid only in the program where it is defined. It cannot be used by a CallP des-
ignation program.
The identification character has the following four type.
Numeric value type: M
Character string type: C
Position type: P
Joint type: J
Describe a user-selected character string. (5 is the maximum)
When a function has been called up, it is transferred to the function.
It is possible to describe all the variables, and up to 16 variables can be used.
Describe the expression for what operation to use as a function.
' Define FNMAve to obtain the average of two numeric val-
ues.
' Substitute average value 25 of 20 and 30 in numeric vari-
able MAVE.
' Position type addition.
Detailed explanation of command words 4-203
4MELFA-BASIC V

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cr750Cr751-qCr751-dCr760-dCr760-qCr750-d

Table of Contents