Technical data

Creating Blocks and Libraries
9.3 Creating Blocks
Programming with STEP 7
226 Manual, 05/2010, A5E02789666-01
9.3.2 User-Defined Data Types (UDT)
User-defined data types are special data structures you create yourself that you can use in the
whole S7 program once they have been defined.
User-defined data types can be used like elementary data types or complex data types in the
variable declaration of logic blocks (FC, FB, OB) or as a data type for variables in a data block
(DB). You then have the advantage that you only need to define a special data structure once
to be able to use it as many times as you wish and assign it any number of variables.
User-defined data types can be used as a template for creating data blocks with the same data
structure, meaning you create the structure once and then create the required data blocks by
simply assigning the user-defined data type (Example: Recipes: The structure of the data block
is always the same, only the amounts used are different.)
User-defined data types are created in the SIMATIC Manager or the incremental editor just like
other blocks.
Note
If you call a block created in the S7-SCL programming language that contains a UDT parameter in the
program editor, this can result in a type conflict. You should therefore avoid using blocks created in
SCL if you use UDTs.
Structure of a User-Defined Data Type
When you open a user-defined data type, a new working window is displayed showing the
declaration view of this user-defined data type in table form.
The first and the last row already contain the declarations STRUCT and END_STRUCT for the
start and the end of the user-defined data type. You cannot edit these rows.
You edit the user-defined data type by typing your entries in from the second row of the
declaration table in the respective columns.
You can structure user-defined data types from:
- Elementary data types
- Complex data types
- Existing user-defined data types
The user-defined data types in the S7 user program are not downloaded to the S7 CPU. They are
either created directly using an incremental input editor and edited, or they are created when
source files are compiled.