Constants, Operators, Variables – Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual
Page 40
Operating Functions
Chapter 5
5–3
A constant is a real
number that ranges from +1E–127 to +.9999999
9E+127. A constant
can be an integer. We refer to constants as: [const]
An operator performs a predefined
operation on variables and/or
constants. Operators
require either one or two operands. Typical two
operand or dyadic operators include ADD (+),
SUBTRACT (–),
MULTIPLY (*)
and DIVIDE(/). We call operators that require only
one operand, unary operators. Some typical
unary operators are SIN,
COS and ABS.
A variable can be:
a letter (e.g. A, X,I)
a letter followed by a one dimensioned
expression, (e.g. J(4), GA(A +
6), I(10*SIN(X))
a letter followed by a number followed by a one dimensioned
expression
(e.g. A1(8), P7(10*SIN(X)), W8(A + B).
a letter followed by a number or letter
(e.g. AA, AC, XX, A1, X3,
G8) except
for the following combinations: CR, DO, lE, IF, IP,
ON, PI, SP, TO, UI and UO.
We refer to variables that include
a one dimensioned expression [expr] as
dimensioned or arrayed variables.
We refer to variables that contain a
letter
or a letter and a number as scalar variables. Any variables entered
in lower case are changed
to upper case. We refer to variables as:
[var].
The BASIC module
allocates variables in a “static” manner. This
means that
the first time a variable is used, BASIC allocates a portion
of memory (8 bytes)
specifically for that variable. This memory cannot
be de-allocated
on a variable to variable basis. This means that if you
execute
a statement (e.g. Q 3), you cannot tell BASIC that the
variable Q no longer exists to “free up” the 8 bytes of memory that
belong to Q. You can
clear the memory allocated to variables by
executing a CLEAR statement.
The CLEAR statement “frees” all
memory allocated
to variables.
5.2.6
Constants
5.2.7
Operators
5.2.8
Variables