Chapter 3. Program Data
34
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
GFK-2950C
3.1.4
Arrays
An array is a complex data type composed of a series of variable elements with identical data types.
Any variable can become an array, except for another array, a variable element, or a UDFB. In
Machine Edition, you can create single-dimensional arrays and two-dimensional arrays.
In the controller CPU, each element of an array is treated as a separate variable with a separate,
read-only reference address. The
root
node of the array variable also has a reference address that is
editable. When you set or change the reference address of the
root
node of an array variable, the
reference addresses of its elements are filled in with a range of addresses starting at that reference
address and incremented for each element so as to create contiguous non-overlapping memory.
3.1.5
Variable Indexes and Arrays
PACSystems CPUs with firmware version 6.00 or later support variable indexes for arrays. With a
variable index, when logic is executed, the value of the variable is evaluated and the corresponding
array element is accessed.
Note:
The numbering of array elements is zero-based.
For example, to access an element of the array named ABC, you could write ABC[DEF] in logic. When
logic is executed, if the value of DEF is 5, then ABC[DEF] is equivalent to ABC[5], and the sixth
element of array ABC is accessed.
If the value of the variable index exceeds the array boundary, a non-fatal fault is logged to the CPU
fault table. In LD, the instruction for which this occurred does not pass power to the right.
Requirements and Support
An index variable must be of the INT, UINT, or DINT data type.
The valid range of values for an index variable is 0 through Y, where Y = [the number of array
elements in the array] - 1. Refer to
Ensuring that a Variable Index does not Exceed the Upper
An index variable can be one of the following:
▪
Symbolic variable
▪
I/O variable
▪
Variable mapped to % memory areas such as %R
▪
Structure element
▪
Array element with a constant index
▪
Array element with a variable index
▪
Alias variable
▪
In the logic of a UDFB or parameterized block: formal parameter
The following support a variable index:
▪
Array elements of any data type except STRING
▪
Parameter array elements of any data type
▪
Alias variables
Summary of Contents for PACSystems RSTi-EP
Page 357: ......
Page 466: ...Chapter 9 Diagnostics GFK 2950C February 2018 451 ...