Technical data
Appendix
27.3 Data Types and Parameter Types
Programming with STEP 7
604 Manual, 05/2010, A5E02789666-01
27.3.3.5 Using Structures to Access Data
Structures
A structure combines various data types (elementary and complex data types, including arrays and
structures) to form one unit. You can group the data to suit your process control. You can therefore
also transfer parameters as a data unit and not as single elements. The following figure illustrates a
structure consisting of an integer, a byte, a character, a floating-point number, and a Boolean
value.
A structure can be nested to a maximum of 8 levels (for example, a structure consisting of
structures containing arrays).
Creating a Structure
You define structures when you declare data within a DB or in the variable declaration of a logic
block.
The following figure illustrates the declaration of a structure (Stack_1) that consists of the following
elements: an integer (for saving the amount), a byte (for saving the original data), a character (for
saving the control code), a floating-point number (for saving the temperature), and a Boolean
memory bit (for terminating the signal).
Assigning Initial Values for a Structure
If you want to assign an initial value to every element of a structure, you specify a value that is valid
for the data type and the name of the element. You can, for example, assign the following initial
values (to the structure declared in the above figure):
Amount = 100
Original_data = B#(0)
Control_code = 'C'