Chapter 4. Ladder Diagram (LD) Programming
140 PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C
4.8.1 Array Size
Counts the number of elements in the array assigned to input IN and
writes the number to output Q.
In an array of structure variables, the number of structure variables is
written to Q; the elements in the structure variables are not counted.
Tip: If the array assigned to input IN of ARRAY_SIZE is passed to a parameterized C block for
processing, also pass the value of output Q to the block. In the C block logic, use the value of output
Q to ensure all array elements are processed without exceeding the end of the array. For a two-
dimensional array, this method works only if all elements are treated identically; for example, all are
initialized to the same value.
Operands
Array of any data type whose elements
are counted.
If a non-array variable is assigned to IN,
the value of Q is 1.
Data flow, I, Q, M, T, S, SA, SB, SC, G, discrete
symbolic, I/O variable
Number of elements in the array
assigned to input IN.
DINT or DWORD variable.
Data flow, I, Q, M, T, G, R, P, L, AI, AQ, W,
symbolic, I/O variable
Example
The two-dimensional array TestArray has its Array Dimension 1 property set to 4 and its Array
Dimension 2 property set to 3. ARRAY_SIZE calculates 4 × 3 and writes the value 12 to the variable
Elements.