Technical data
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 267
11 Creating Data Blocks
11.1 Basic Information on Creating Data Blocks
The data block (DB) is a block in which you can, for example, store values for your machine or
plant to access. In contrast to a logic block that is programmed with one of the programming
languages Ladder Logic, Statement List, or Function Block Diagram, a data block contains only the
variable declaration section. This means the code section is irrelevant here and so is programming
networks.
When you open a data block, you can either view the block in the declaration view or in the data
view. You can toggle between the two views with the menu commands View > Declaration View
and View > Data View.
Declaration View
You use the declaration view if you want to:
• View or determine the data structure of shared data blocks,
• View the data structure of data blocks with an associated user-defined data type (UDT), or
• View the data structure of data blocks with an associated function block (FB).
The structure of data blocks that are associated with a function block or user-defined data type
cannot be modified. To modify them you must first modify the associated FB or UDT and then
create a new data block.
Data View
You use the data view if you want to modify data. You can only display, enter, or change the actual
value of each element in the data view. In the data view of data blocks, the elements of variables
with complex data types are listed individually with their full names.
Differences between Instance Data Blocks and Shared Data Blocks
A shared data block is not assigned to a logic block. It contains values required by the plant or
machine and can be called directly at any point in the program.
An instance data block is a block that is assigned directly to a logic block, such as a function block.
The instance data block contains the data that were stored in a function block in the variable
declaration table.