Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual
Page 25

4Ć5
Array variables are specified by adding a subscript(s) after the
variable name, which includes the appropriate terminating character
to denote the type of data stored in the array. The terminating
character is followed by a left parenthesis (or bracket), the
subscript(s), and a right parenthesis (or bracket). Multiple subscripts
are separated by commas. Note that subscripts can be integer
constants as well as arithmetic expressions that result in integer
values.
array variable name
A% (5)
subscript
terminating character
(denotes variable
type)
An array with one dimension, i.e., one subscript, is said to be
oneĆdimensional. An array with two subscripts is said to be
twoĆdimensional, etc. The first element in each dimension of the
array is always element 0. Therefore, the total number of elements in
each dimension of the array is always one more than the largest
subscript. For example, array A%(10) is a oneĆdimensional array
containing eleven integer values.
Example 1 Ć OneĆdimensional array
0 1
2
3 4
5
185 2 53 79 99 122
A%
value of A
Example 2 - TwoĆdimensional array
B% (6, 3)
0
1
2
3
4
5
6
0
1
2
3
185 2 53 79 99 122 40
70 36 46 31 34 85 6
77 73 21 365 476 51 47
18 23 53 342 39 224 107
B%
In the case of string arrays, Version 1.0 Executive software always
allocated the maximum amount of memory for each element in the
array, regardless of whether the string stored in that element was of
the maximum length, 31 characters. Version 2.0 (and later)
Executive software allows the programmer to specify the maximum
size of elements in the array, from 1 to 255 characters.
To specify the maximum size of string variables in an array, add a
colon and a number (1Ć255) immediately after the $ character when
declaring the variable in an application task or defining it during
configuration. For example, defining A$:10(20) as a local variable in