Technical data
Appendix
27.3 Data Types and Parameter Types
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 597
27.3.3 Complex Data Types
27.3.3.1 Complex Data Types
Complex data types define data groups that are larger than 32 bits or data groups consisting of
other data types. STEP 7 permits the following complex data types:
• DATE_AND_TIME
• STRING
• ARRAY
• STRUCT
• UDT (user-defined data types)
• FBs and SFBs
The following table describes the complex data types. You define structures and arrays either in
the variable declaration of the logic block or in a data block.
Data Type Description
DATE_AND_TIME
DT
Defines an area with 64 bits (8 bytes). This data type saves in binary coded decimal
format:
STRING Defines a group with a maximum of 254 characters (data type CHAR). The standard
area reserved for a character string is 256 bytes long. This is the space required to
save 254 characters and a header of 2 bytes. You can reduce the memory required for
a string by defining the number of characters that will be stored in the character string
(for example: string[9] 'Siemens').
ARRAY Defines a multi-dimensional grouping of one data type (either elementary or complex).
For example: "ARRAY [1..2,1..3] OF INT" defines an array in the format 2 x 3
consisting of integers. You access the data stored in an array using the Index ("[2,2]").
You can define up to a maximum of 6 dimensions in one array. The index can be any
integer (-32768 to 32767).
STRUCT Defines a grouping of any combination of data types. You can, for example, define an
array of structures or a structure of structures and arrays.
UDT Simplifies the structuring of large quantities of data and entering data types when
creating data blocks or declaring variables in the variable declaration. In STEP 7, you
can combine complex and elementary data types to create your own "user-defined"
data type. UDTs have their own name and can therefore be used more than once.
FB, SFB You determine the structure of the assigned instance data block and allow the transfer
of instance data for several FB calls in one instance DB.
Structured data types are saved in accordance with word limits (WORD aligned).