99BProgramming concepts
6.3 Using blocks to structure your program
S7-1200 Programmable controller
142
System Manual, 11/2011, A5E02486680-05
The data stored in a DB is not deleted when the execution of the associated code block
comes to an end. There are two types of DBs:
●
A global DB stores data for the code blocks in your program. Any OB, FB, or FC can
access the data in a global DB.
●
An instance DB stores the data for a specific FB. The structure of the data in an instance
DB reflects the parameters (Input, Output, and InOut) and the static data for the FB. (The
Temp memory for the FB is not stored in the instance DB.)
Note
Although the instance DB reflects the data for a specific FB, any code block can access
the data in an instance DB.
You can configure a DB as being read-only:
1.
Right-click the DB in the project navigator and select "Properties" from the context menu.
2.
In the "Properties" dialog, select "Attributes".
3.
Select the "Data block write-protected in the device" option and click "OK".
Creating reusable code blocks
Use the "Add new block" dialog
under "Program blocks" in the
Project navigator to create OBs,
FBs, FCs, and global DBs.
When you create a code block, you
select the programming language
for the block. You do not select a
language for a DB because it only
stores data.