Def Fn; 22 Def Fn - Omron SCARA YRCX Series Programming Manual

Robot controller
Hide thumbs Also See for SCARA YRCX Series:
Table of Contents

Advertisement

22

DEF FN

8
Defines functions which can be used by the user
A
B
C
D
MEMO
E
F
G
H
I
J
K
L
M
8-40
Chapter 8 Robot Language Lists
Format
DEF FN name
% (dummy argument, dummy argument...)=function definition expression
!
$
Values
name .....................................Function name. Max. of 16 characters including "FN".
dummy argument ..................Numeric or character string variable.
Explanation
Defines the functions which can be used by the user. Defined functions are called in
the FN <name> (<variable>) format.
• The <dummy argument> names are the same as the variable names used in the <function
definition expression>. The names of these variables are valid only when the <function
definition expression> is evaluated. There may be other variables with the same name in the
program.
• When calling a function that uses a <dummy argument>, specify the constant, variable, or
expression type which is the same as the <dummy argument> type. The <dummy argument>
can be omitted. If <dummy arguments> are the same type, the difference of variable names
does not affect.
• If a variable used in the <function definition expression> is not included in the <dummy
argument> list, the current value of that particular variable is used for the calculation.
• A space must be entered between "DEF" and "FN". If no space is entered, DEFFN will be
handled as a variable.
• The DEF FN statement cannot be used in sub-procedures.
• Definition by the DEF FN statement must be declared before statements which use functions.
SAMPLE
DEF FNPAI=3.141592
DEF FNASIN(X)=ATN(X/SQR(-X^2+1))
····················· Both the <dummy argument> and <function
·
·
·
A=FNASIN(B)*10 ·················· "X" is not required for calling.
definition expression> use "X".

Advertisement

Table of Contents
loading

Table of Contents