What types of access are available in STEP 7 (TIA Portal) to access data values in blocks and what should you watch out for with the differences between the types?
There are different ways of accessing data values in blocks. This entry describes the procedures for STEP 7 V5.x and STEP 7 (TIA Portal).
Procedure for STEP 7 V5.x
You can address all declarations in function blocks absolutely with known addresses in compliance with the SIMATIC rules. This data is displayed by the system and is also stored in the CPU's memory in the SIMATIC format.
Procedure for STEP 7 (TIA Portal)
STEP 7 (TIA Portal) provides blocks with different access options:
- Blocks with standard access:(S7-300 / S7-400 and S7-1200 / S7-1500)
The blocks with standard access have a fixed structure. The data elements receive a symbolic name in the declaration and a fixed address in the block.
- Blocks with optimized access: (S7-1200 / S7-1500)
The blocks with optimized access do not have a specifically defined structure. The data elements receive only one symbolic name in the declaration and no fixed address in the block.
The tables below explain the differences between standard and optimized block access:
|Standard block access||Optimized block access|
|CPU modules||S7-1200/1500, compatible with S7-300/400||Only for the S7-1200/1500|
|Data storage||You can structure a storage-optimized or any type of data structure according to the declaration.||Managed and optimized by the system. You can set up any type of structure without forfeiting memory.|
|Performance||High-performance access to the S7-1200/1500 depends on the declaration of the data.||Access is always as fast as possible because the data storage is optimized by the system and is independent of the declaration.|
|Susceptibility to errors||Absolute access (from HMI or indirect addressing, for example) can lead to inconsistencies when changing the declaration.||None, because access is generally symbolic. Declaration changes do not lead to access errors, because HMI access, for example, is symbolic.|
|Retain||Block - granular||Variables - granular|
Standard blocks are more flexible in their access mechanisms but are also more susceptible to errors. Optimized blocks permit only type-safe access and provide extremely good performance. We recommend you avoid mixing standard and optimized blocks as far as possible. The system automatically implements the data models upon access between the blocks, but that costs resources. The conversion of data between source format and destination format required for this needs storage as well as a long processing time.
|Access type||Standard block access||Optimized block access|
|Indirect (pointer version)||Yes||Only with symbolic notation|
|Download without reinitialization||No||Yes (for S7-1200 with firmware V4.0 and higher)|
Change block access type
The block access is set automatically when a block is created. Newly created blocks on CPUs of the series
- S7-1200/S7-1500 are preset by default to "Optimized access".
- S7-300/S7-400 are preset by default to "Standard access" and cannot be changed.
The block access is not changed automatically if you copy or migrate a block from a CPU of the series S7-300/S7-400 to a CPU of the series S7-1200/S7-1500. You have to change the block access manually for each block after migration.
For example, to change the block access from "Standard" to "Optimized" you proceed as follows:
- Open the "Program Blocks" folder in the project navigation.
- Right-click the block the access type of which you want to change.
- Select the "Properties..." item in the pop-up menu.
- In the "Attributes" tab you enable the "Optimized block access" function.
- Confirm with "OK" the "Change block access" message that follows.
- Close the "Properties" dialog with "OK".
- Save and compile the changes before loading the program into the CPU.
In this way you have now set the temporary variables to optimized access. The formal parameters (Input, Output, InOut) and the static variables are then displayed in the "Retain" column with the setting "Non-retain".
- In blocks with Standard access, the Retain setting is possible only for all the variables of the block. No variable can be excluded.
- In blocks with "Optimized" access, the Retain setting Variables - granular is possible.
If after changing the block access the variables are still set to "Set in IDB" in the "Retain" column, change this via the drop-down list box for each variable separately and compile the program.
If an error message is issued, check for the following causes:
- The instance DBs of the processed block are being accessed with absolute addressing.
- The BLKMOV instruction is accessing data in the block or in its instance DB.
Otherwise you must reset these variables to "Set in IDB" in the declaration.
This procedure is not possible for declarations with the keyword "AT". More information about this is available in Entry ID: 57132240.
The screens in this FAQ response were created with STEP 7 (TIA Portal) V13.
More information on the topic of "Block Access" is available in the system manual "STEP 7 Professional V13 SP1", under: