Creating Reusable Code Blocks - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents
Read-only data blocks
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".
Optimized and standard data blocks
You can also configure a data block to be either standard or optimized. A standard DB is
compatible with STEP 7 Classic programming tools and the classic S7-300 and S7-400
CPUs. Data blocks with optimized access have no fixed defined structure. The data
elements contain only a symbolic name in the declaration and no fixed address within the
block. The CPU stores the elements automatically in the available memory area of the block
so that there are no gaps in the memory. This makes for optimal use of the memory
capacity.
To set optimized access for a data block, follow these steps:
1. Expand the program blocks folder in the STEP 7 project tree.
2. Right-click the data block and select "Properties" from the context menu.
3. For the attributes, select "Optimized block access".
Note that optimized block access is the default for new data blocks. If you deselect
"Optimized block access", the block uses standard access.
6.3.5

Creating reusable code blocks

S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
Programming concepts
6.3 Using blocks to structure your program
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.
Selecting the "Add new
and open" check box
(default) opens the code
block in the Project view.
177
Table of Contents
loading

Table of Contents