Omron SYSMAC C200H-ASC02 Operation Manual page 43

Ascii unit
Hide thumbs Also See for SYSMAC C200H-ASC02:
Table of Contents

Advertisement

BASIC Language
DATA Statement
DEF FN statement
40
GOTO 40
100
IF LOC(2)<>0 THEN A$=INPUT$ (LOC(2), #2)
110
RETURN
Purpose:
Defines numeric and character constants to be specified in a
subsequent READ statement
Format:
DATA <constant>[,<constant>]...
<constant> may be a numeric constant in any format; i.e., fixed-
point, floating-point, or integer. <constant> can also be a charac-
ter string. Quotation marks are necessary only if the constant
contains comas, colons, or spaces.
Example:
DATA CF, 10, 2.5, "A.:B"
Remarks:
Any number of DATA statements can be used in a program. READ state-
ments access DATA statements in order (by line number). The data con-
tained therein may be thought of as one continuous list of items, regardless
of how many items are on a line or where the lines are placed in the pro-
gram.
DATA statements are non-executable and can be placed anywhere in a pro-
gram. A data statement can contain as many constants as will fit on one line
(separated by comas).
The variable type given in the READ statement must agree with the corre-
sponding constant in the DATA statement.
DATA statements may be reread from the beginning by use of the
RESTORE statement.
No comment (with ":" or "'") can be written after the DATA statement.
Purpose:
To define and name a function written by the user
Format:
DEF FN<name>[(<arg1>[,<arg2>]...)] = <def>
<name>, which must be a legal variable name, is the name of
the function.
<argn> is a list of variable names called parameters that will be
replaced with values calculated when the function is called. The
items in the list are separated by comas.
<def> is an expression that performs the operation of the func-
tion and is limited to one line.
Example:
DEF FNA (X, Y, Z) = SQR(X^2 + Y^2 + Z^2)
Remarks:
A user function must be defined with the DEF FN statement before it can be
called. To call a user function once it has been defined, append FN to the
assigned name of the function and set it equal to some variable.
distance = FNA(X,5,5)
Variable names that appear in the defining expression serve only to define
the function; they do not affect program variables that have the same name.
The variables in the parameter list represent, on a one-to-one basis, the
argument variables or values that will be given in the function call.
Section 4-2
33

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents