EasyManuals Logo

Mitsubishi MELFA CR1D User Manual

Mitsubishi MELFA CR1D
458 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
Page #197 background imageLoading...
Page #197 background image
4MELFA-BASIC IV
Detailed explanation of command words 4-184
Def FN (Define function)
[Function]
Defines a function and gives it name.
[Format]
[Terminology]
<Identification character> The identification character has the following four type.
Numeric value type:M
Character string type:C
Position type:P
Joint type:J
<Name> Describe a user-selected character string. (5 is the maximum)
<Dummy argument> 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.
<Function Definition Expression>
Describe the expression for what operation to use as a function.
[Reference Program]
1 Def FNMAve(MA,MB)=(MA+MB)/2 ' Define FNMAVE to obtain the average of two numeric val-
ues.
2 MDATA1=20
3 MDATA2=30
4 MAVE=FNMAve(MDATA1,MDATA2) ' Substitute average value 25 of 20 and 30 in numeric vari-
able MAVE.
5 Def FNPADD(PA,PB)=PA+PB ' Position type addition.
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.
Def[]FN <Identification character><Name> [(<Dummy Argument> [, <Dummy Argument>]...)]
= <Function Definition Expression>

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Mitsubishi MELFA CR1D and is the answer not in the manual?

Mitsubishi MELFA CR1D Specifications

General IconGeneral
BrandMitsubishi
ModelMELFA CR1D
CategoryController
LanguageEnglish

Related product manuals