Technical data
Appendix
27.3 Data Types and Parameter Types
Programming with STEP 7
606 Manual, 05/2010, A5E02789666-01
27.3.3.6 Using User-Defined Data Types to Access Data
User-Defined Data Types
User-defined data types (UDTs) can combine elementary and complex data types. You can assign
a name to UDTs and use them more than once. The following figure illustrates the structure of a
user-defined data type consisting of an integer, a byte, a character, a floating-point number, and a
Boolean value.
Instead of entering all the data types singly or as a structure, you only need to specify "UDT20" as
the data type and STEP 7 automatically assigns the corresponding memory space.
Creating a User-Defined Data Type
You define UDTs with STEP 7. The following figure shows a UDT consisting 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). You can assign a symbolic name to the UDT in the symbol
table (for example, process data).
Once you have created a UDT, you can use the UDT like a data type if, for example, you declare
the data type UDT200 for a variable in a DB (or in the variable declaration of an FB).
The following figure shows a DB with the variables process_data_1 with the data type UDT200.
You only specify UDT200 and process_data_1. The arrays shown in italics are created when you
compile the DB.