GE PACSystems RX7i Cpu Programmer's Reference Manual page 51

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

Chapter 3. Program Data
Ensuring that a Variable Index does not Exceed the Upper Boundary of an Array
One-Dimensional Array
Once per scan, execute ARRAY_SIZE_DIM1 to count the number of elements in the array.
1.
Note: The array size of a variable can be changed in a RUN Mode Store but it will not be changed
while logic is executing.
ARRAY_SIZE_DIM1 places the count value in the variable associated with its output Q.
Before executing an instruction that uses a variable index, compare the value of the index variable
2.
with the number of elements in the array.
Tip: In LD, use a RANGE instruction.
Notes Checking before executing each instruction that uses an indexed variable is recommended in
case logic has modified the index value beyond the array size or in case the array size has
been reduced before the scan to less than the value of an index variable that has not been
reduced accordingly since.
Valid range of an index variable: 0 through (n–1), where n is the number of array elements.
Array indexes are zero-based.
Two-Dimensional Array
Execute both ARRAY_SIZE_DIM1 and ARRAY_SIZE_DIM2 to count the number of elements in
respectively the first and second dimensions of the array.
36
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
GFK-2950C

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents