Arrays in Schneider PLC EcoStruxure Control Expert let you store multiple values under one name, making programs cleaner and easier to manage. In this guide, you’ll learn how to declare arrays in Structured Text, access individual elements, use FOR loops to manipulate array data, and work with multi-dimensional arrays. Practical examples, common mistakes, and best practices are included to help both beginners and engineers understand arrays easily.
An Array Data Type in Schneider PLC EcoStruxure Control Expert is a data item that contains a set of data elements of the same type. Arrays allow you to group multiple related values under a single name, making programming cleaner and easier to manage.
Arrays can store:
An array in Schneider PLC EcoStruxure Control Expert is characterized by two main parameters:
Note: The most complex array can have up to 15 dimensions, and its total size cannot exceed 65,535 bytes.
The general syntax for declaring an array combines these two parameters:
ARRAY [lower_bound..upper_bound] OF data_type;
The dimension of an array defines how many indices are required to access each element. Each dimension adds a level of complexity to the array structure.
Here are some examples of arrays with different dimensions:
💡 Note: Schneider PLC arrays can go up to 15 dimensions, but managing very high-dimensional arrays can become complex and memory-intensive.
Arrays are an essential part of PLC programming because they allow you to store multiple values under a single name. In Schneider PLC EcoStruxure Control Expert, you can create both single-dimensional and multi-dimensional arrays in the Variable Table.
Follow these steps to create an array:
💡 Tip: Always choose meaningful names for arrays and dimensions to make your program easier to read and maintain. Single-dimensional arrays are great for simple lists, while multi-dimensional arrays are ideal for tables, matrices, or structured data.
This example demonstrates how to fill a 2-dimensional integer array named plant_dint using a timer-driven counter in Schneider PLC. The counter increments from 0 to 10, stores each value sequentially in the array, and resets after reaching the maximum. The row index is incremented to fill the next row automatically.Overview of the Program
in first we have a pulse timer The TP timer produces a pulse at fixed intervals (1 second). This pulse drives the CTU counter, ensuring it increments regularly.
a counterThe CTU counter increments the variable cv_counter every time it receives a pulse from the timer. It counts from 0 up to a preset value of 10. The current value is used to populate one column in the current row of the array.
Step 2: Pulse Timer (TP)
Step 3:MOVE Block
The MOVE block transfers the current counter value into the correct array element plant_dint[array_dim, cv_counter]. This stores the value in the proper row and column sequentially.
Step 4: EQ Block
The EQ block compares the counter value with the preset maximum (10). When the values are equal, it triggers the counter reset so the next row can start from 0.
Step 5: ADD Block
The ADD block increments array_dim by 1 after the counter completes a full row. This moves the logic to the next row of the 2D array.
Step 6: Filling the 2D Array
The program fills the array row by row as follows:
The timer triggers the counter, MOVE stores the value, EQ resets the counter, and ADD increments the row automatically.
Summary
This example demonstrates how to fill arrays in Schneider PLC using Structured Text and FOR loops. Two types of arrays are shown: a single-dimensional real array and a two-dimensional integer array. FOR loops allow efficient and systematic initialization of array elements, which is useful in PLC programming for storing sequences, calibration data, or process values.
this example, a single-dimensional array named plant_real is filled with real numbers converted from integers using the INT_TO_REAL function. A FOR loop iterates from 0 to 9, assigning each loop index as a real value to the corresponding array element. This ensures that the array is populated sequentially, with plant_real[0] = 0.0, plant_real[1] = 1.0, and so on up to plant_real[9] = 9.0. Using this approach reduces repetitive code and makes it easy to modify the array size if needed.
This example demonstrates how to fill a two-dimensional integer array named plant_dint using nested FOR loops. The array has 5 rows and 11 columns. The outer loop iterates through each row, while the inner loop iterates through each column. Each element is assigned the column index value, so every row contains values from 0 to 10. This method fills the 2D array systematically, allowing each row and column to be initialized efficiently. The use of nested loops ensures that the array is structured and ready for further processing, such as timers, counters, or other PLC logic.