Data Structure Data Type - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

97BPLC concepts
4.4 Data types
To create an array from the block interface editor, name the array and choose data type
"Array [lo .. hi] of type", then edit "lo", "hi", and "type" as follows:
● lo - the starting (lowest) index for your array
● hi - the ending (highest) index for your array
● type - one of the data types, such as BOOL, SINT, UDINT
Table 4- 25
ARRAY data type rules
Data Type
Array syntax
ARRAY
Name [index1_min..index1_max, index2_min..index2_max] of <data type>
All array elements must be the same data type.
The index can be negative, but the lower limit must be less than or equal to the upper limit.
Arrays can have one to six dimensions.
Multi-dimensional index min..max declarations are separated by comma characters.
Nested arrays, or arrays of arrays, are not allowed.
The memory size of an array = (size of one element * total number of elements in array)
Array index
Constant or
variable
Example: array
declarations
Example: array
addresses
4.4.5

Data structure data type

You can use the data type "Struct" to define a structure of data consisting of other data
types. The struct data type can be used to handle a group of related process data as a single
data unit. A Struct data type is named and the internal data structure declared in the data
block editor or a block interface editor.
Arrays and structures can also be assembled into a larger structure. A structure can be
nested up to eight levels deep. For example, you can create a structure of structures that
contain arrays.
92
Valid index data types
USInt, SInt, UInt, Int, UDInt,
DInt
ARRAY[1..20] of REAL
ARRAY[-5..5] of INT
ARRAY[1..2, 3..4] of CHAR
ARRAY1[0]
ARRAY2[1,2]
ARRAY3[i,j]
Array index rules
Value limits: -32768 to +32767
Valid: Mixed constants and variables
Valid: Constant expressions
Not valid: Variable expressions
One dimension, 20 elements
One dimension, 11 elements
Two dimensions, 4 elements
ARRAY1 element 0
ARRAY2 element [1,2]
If i =3 and j=4, then ARRAY3 element
[3, 4] is addressed
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents