Kepware Knowledge Base: Solution
How Are Arrays Handled in the Allen-Bradley ControlLogix Ethernet Driver?
Last Update: 11/12/2018
Because ControlLogix devices handle arrays differently than other PLCs, Kepware's Allen-Bradley ControlLogix Ethernet Driver handles arrays differently than other drivers.
- It supports 3 dimensional arrays, whereas standard drivers only support 2 dimensions.
- Individual elements of an array can be addressed directly.
- Sub-arrays of data within the array can be addressed using offsets.
When addressing an element in an array or specifying an offset, the indexing/ordering of the data is 0-based. The number of elements to be displayed in an array reference are 1-based. When addressing elements or subsets in an array, the elements are referenced using square brackets and a range or sub-array of data is referenced using braces. There are two types of arrays: single-dimension arrays and multi-dimension arrays.
Single-Dimension Arrays
A 1x16 array example is shown below. The tag name is "IArray".
73 | 78 | 84 | 255 | 256 | 257 | 258 | 259 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
Example single-dimension array references are as follows:
- IArray [5] = 257. This is the fifth element in the array.
- IArray {5} = [73, 78, 84, 255, 256]. This is the first five elements in the array.
- IArray [10] {3} = [11, 12, 13]. This is an array of 3 elements starting at the tenth element.
Multi-Dimension Arrays
A 4x4 array example is shown below. The first row is 0 and the first column is 0. The tag name is "IArray".
73 | 78 | 84 | 255 |
256 | 257 | 258 | 259 |
9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 |
Example multi-dimension array references are as follows:
- IArray [1,3] = 259. This is the last element in the second row of the array.
- IArray {4} = [73, 72, 84, 255]. This is an array of four elements with no offset.
- IArray [2, 0] {2} = [9, 10]. This is an array of two elements starting at an offset of the first element in the third row.
©
2022
PTC Inc. All Rights Reserved.