Statement: dim, Statements: do – until [rel expr – Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual
Page 56

Operating Functions
Chapter 5
5–19
Mode:
COMMAND AND/OR RUN
Type:
Assignment
DIM reserves storage for matrices. The storage
area is first assumed to
be zero.
Matrices in the BASIC Module may have only one
dimension and the size
of the dimensioned array may not exceed 254
elements. Once a variable is dimensioned in
a program it may not be
re-dimensioned.
An attempt to re-dimension an array causes an
ARRAY SIZE
ERROR. If an arrayed variable is used that is not
dimensioned by the DIM statement,
BASIC assigns a default value of
10 to the array size. All arrays are set equal
to zero when the RUN
command, NEW command
or the CLEAR statement is executed. The
number of bytes allocated
for an array is 6 times the array size plus 1.
The array
A(100) requires 606 bytes of storage. Memory size usually
limits the size of a dimensioned
array.
Variations: More than one variable
can be dimensioned by a single
DIM statement.
Example:
u10 DIM A(25), B(15), A1(20)
Example: Default error on attempt to re-dimension
array
u10 A(5)10 –BASIC ASSIGNS DEFAULT OF 10 TO ARRAY SIZE HERE
u20 DIM A(5) –ARRAY CANNOT BE RE–DIMENSIONED
uRUN
ERROR: ARRAY SIZE – IN LINE
20
20
DIM
A(5)
-
X
Mode:
RUN
Type:
CONTROL
The DO – UNTIL
[rel expr] instruction provides a means of “loop
control”
within a module program. All statements between the DO
and
the UNTIL [rel expr] are executed until the relational expression
following the UNTIL statement is TRUE.
You may nest DO – UNTIL
loops.
5.4.7
Statement: DIM
5.4.8
Statements: DO – UNTIL
[rel expr]