Download as pdf or txt
Download as pdf or txt
You are on page 1of 84

20

SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
31
28
Contents 8

00
15
7-
,S
8. Program Blocks and Program Editor ................................................................... 8-3

ng
8.1. Plant Description: The Conveyor Model as Distribution Conveyor ....................................... 8-4

ni
8.2. Types of Program Blocks ...................................................................................................... 8-5
8.2.1. Structured Programming ....................................................................................................... 8-6

i
ra
8.2.2. Block Overview in STEP 7 .................................................................................................... 8-7
et
8.3. Adding a New Block .............................................................................................................. 8-8

20
R
8.3.1. Automatic Numbering of Blocks ............................................................................................ 8-9
8.3.2. Block Properties: Programming Language, Time Stamps .................................................. 8-10
m

20
8.3.2.1. Block Properties: Know-how Protection and Copy Protection ............................................ 8-11
te

8.3.2.2. Block Properties: IEC Check and Data Type Conversion .................................................. 8-12

01
ys

8.3.2.3. Other Block Attributes for S7-1200/1500 ............................................................................ 8-13


8.3.3. Block Editor Settings ........................................................................................................... 8-14
lS

31
8.4. Block Programming: Instructions ........................................................................................ 8-15
rta

8.4.1. Block Programming: Local Constants in FCs/FBs/OBs ...................................................... 8-16

28
8.4.2. Block Programming: Networks............................................................................................ 8-17
Po

8.4.4. Programming an Instruction using "Empty Box" ................................................................. 8-18


8.4.5. ENO can be Deactivated .................................................................................................... 8-19
A

0
8.4.6. Implicit Data Type Conversion ............................................................................................ 8-20
TI

50

8.4.7. Edge Evaluations (1) ........................................................................................................... 8-21


8.4.7.1. Edge Evaluations (2) ........................................................................................................... 8-22
IC

-1

8.4.8. Closing / Saving / Rejecting a Block ................................................................................... 8-23


S7
AT

8.5. Block Calls .......................................................................................................................... 8-24


8.5.1. Changing the Block Call...................................................................................................... 8-25
M

8.5.2. Parameter Visibility / Predefinition (1) ................................................................................. 8-26


ng
SI

8.5.2.1. Parameter Visibility / Predefinition (2) ................................................................................. 8-27


i
in

8.6. Compiling a Single Block .................................................................................................... 8-28


ra

8.6.1. Compiling Individual / All Changed Blocks ......................................................................... 8-29


8.6.2. Downloading Blocks into the CPU ...................................................................................... 8-30
et

8.6.3. Downloading Blocks into the CPU: S7-1500 - Memory Concept........................................ 8-31
R

8.6.4. Monitoring a Block .............................................................................................................. 8-32


m

8.7. Task Description: Using Time Constants for Monitoring the Transport Sequences
te

for Time ............................................................................................................................... 8-33


ys

8.7.1. Exercise 1: Declaring the User Constant "maxTime" and using it in "FC_Fault" .............. 8-34
lS

8.8. Task Description: Part Transportation THROUGH the Light Barrier ................................. 8-35
8.8.1. Exercise 2: Integrating the Edge Evaluation in "FC_Conveyor" ......................................... 8-36
rta

8.9. Task Description: Controlling the Indicator Lights, Commissioning "FC_Signal" .............. 8-37
8.9.1. Exercise 3: Commissioning "FC_Signal" ............................................................................ 8-38
Po

8.10. S7-300/400 Blocks: "Upload from Device" (Upload into Project) ....................................... 8-39
A

8.10.1. S7-1200/1500 Blocks: "Upload from Device" (Upload into Project) ................................... 8-40
TI

8.10.2. "Online Backup" (PLC Copy) .............................................................................................. 8-41


8.11.1. Deleting Blocks ................................................................................................................... 8-42
IC

8.13. Analog Value Scaling and Direct I/O Access with ":P" ....................................................... 8-43
AT

8.13.1. Scaling with NORM_X and SCALE_X ................................................................................ 8-44


M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-1
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.14. MIN, MAX, LIMIT ................................................................................................................ 8-45
8.14.1. Verification with IN_RANGE, OUT_RANGE, OK................................................................ 8-46

31
8.15. OB Structure S7-300/400 <–> S7-1500 .............................................................................. 8-47
8.15.1. OB Start Information ........................................................................................................... 8-48

28
8.15.1.1. RD_SINFO .......................................................................................................................... 8-49
8.16. Exercise 4: Weight Acquisition and Checking the Weight .................................................. 8-50

00
8.17. Exercise 5 (Additional): Displaying and Acknowledging the Startup Type ......................... 8-51
8.18. Creating a Global Data Block: "Only in Load Memory" / "Optimized Block Access" .......... 8-52

15
8.18.1. Comparison: Non-Optimized / Optimized Block Accesses ................................................. 8-53

7-
8.18.1.1. Global DB with "Optimized Block Access": Exclusively Symbolic Addressing .................. 8-54
8.18.2. Data Block Editor ................................................................................................................ 8-55

,S
8.18.3. Default, Start and Monitor Value ......................................................................................... 8-56
8.18.4. Snapshot, Setpoint, Start Value .......................................................................................... 8-57

ng
8.18.5. Changing the Snapshot / Start Value of Several / All Data Blocks ..................................... 8-58

ni
8.18.6. S7-300/400: Download DB into the CPU / Upload from the CPU ...................................... 8-59

i
8.18.7. S7-1200/1500: Download DB into the CPU / Upload from the CPU .................................. 8-60
8.19.
ra
Instance and Multiple Instance Data ................................................................................... 8-61
et
8.19.1. Passing an Instance as a Parameter .................................................................................. 8-62

20
R
8.20. Exercise 6: Copying "DB_OP" from the Library and Creating "DB_Memory" .................... 8-63
m

20
8.20.1. Exercise 7: Expanding "DB_OP" and Function Test with Snapshot / Start Values ............ 8-64
te

8.21. Task Description: "Re-usable" Programming ..................................................................... 8-65

01
ys

8.21.1. Exercise 8: Programming "FC_Fault" to be Re-usable....................................................... 8-66


8.21.2. Exercise 9: Replacing "FC_Fault" with "FB_Fault" ............................................................. 8-67
lS

31
8.22. Global Error Handling with Asynchronous Error OBs ......................................................... 8-68
rta

8.22.1. Global Error Handling with Synchronous Error OBs ........................................................... 8-69

28
8.22.2. Local Error Handling of Synchronous Errors ...................................................................... 8-70
Po

8.22.4. Exercise 10 (Additional): Integrating Local Error Handling ................................................. 8-71


A

8.23. Additional Information ......................................................................................................... 8-73


0
TI

8.23.1. Block Groups....................................................................................................................... 8-74


50

8.23.2. Optimized Blocks: Quantity Structure ................................................................................. 8-75


IC

-1

8.23.3. SIMATIC S7-1200/1500: Memory Model ............................................................................ 8-76


8.23.3.1. SIMATIC S7-1200: Memory Areas and Storage Location .................................................. 8-76
S7
AT

8.23.3.2. SIMATIC S7-1500: Memory Areas and Storage Location .................................................. 8-77
8.23.3.3. SIMATIC S7-1200/1500: Memory Concept for CPU PowerOFF/ON ................................. 8-78
M

,
ng

8.23.4. Functions, Standard and System Instructions .................................................................... 8-79


SI

8.23.4.1. Standard and System Instructions ...................................................................................... 8-80


i
in

8.23.4.2. System Instructions <-> SFB/SFC (STEP 7 V5.x) .............................................................. 8-81


8.23.5. OB Priorities and System Reaction .................................................................................... 8-82
ra

8.23.6. Cyclic Interrupt OBs: Priority and "Event Queueing" .......................................................... 8-83
et

8.23.7. Instruction Profiles .............................................................................................................. 8-84


R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-2 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8. Program Blocks and Program Editor

31
28
At the end of the chapter the participant will ...

... be familiar with the different block types

00
... be familiar with and be able to use new editing possibilities for block

15
programming

7-
... be able to save blocks, download them into the CPU and upload them
from the CPU into the project

,S
... be able to explain the OB structure of S7-1200/1500

ng
... be familiar with and be able to use integrated error handling for S7-1500

i ni
... be able to use non-optimized data blocks

ra

et
be familiar with the offline and online functions of the editor

20
R
m

20
te

01
ys
lS

31
rta

28
Po
A

0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-3
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.1. Plant Description: The Conveyor Model as Distribution Conveyor

31
28
DI DO
I 0.0 S_OperationOFF (NC)
I 0.1 S_OperationON P_Operation Q 0.1

00
I 0.2 S_Right
I 0.3 S_Left

15
7-
,S
I 0.7 S_Acknowledge P_Fault Q 0.7

ng
i ni
ra
"FC_Mode" :
et Operation ON/OFF
"FC_Conveyor" : Control of the conveyor motor

20
R
"FC_Fault: Transport monitoring
m

20
"FC_Weight" : Commissioning takes place later
te

01
ys
lS

31
Conveyor Model as Distribution Conveyor
rta

On the conveyor, parts are transported from Bay 1 or 2 through to the light barrier, whereby the

28
Po

transport sequences are monitored for time.

Operating Modes
A

0
TI

50

The operation "P_Operation" (Q0.1) can be switched on via the switch "S_OperationON"
(I 0.1) and switched off via the switch "S_OperationOFF" (I 0.0, NC).
IC

-1
S7
AT

Operation OFF ("P_Operation", Q0.1 = 0)


When the operation is switched off, the conveyor can be jogged to the right via the switch
M

"S_Right" (I 0.2) and to the left via the switch "S_Left" (I 0.3).
ng
SI

Operation ON ("P_Operation", Q0.1 = '1')


in
ra

When the operation is switched on, parts are transported from Bay 1 or 2 through to the light
barrier. For this, the part must be placed on the conveyor at Bay 1 or 2 and the relevant bay
et

pushbutton must be pressed. Further condition is that exactly one of the two bays is occupied.
R

If a transport sequence takes longer than 6 seconds, the conveyor motor is automatically
m

switched off and the fault is indicated with a 2Hz flashing light at the "P_Fault" (Q0.7) indicator
te

light. Only after this is acknowledged with the switch "S_Acknowledge" (I 0.7), can a new
ys

transport sequence be started.


lS

"FC_Weight", Acquisition of the Weight Values


rta

Later, the weights of the transported parts are to be acquired and stored in a database. This
function is already implemented in "FC_Weight", but will only be commissioned in a later chapter.
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-4 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.2. Types of Program Blocks

31
28
Operating System
DB DB

00
Cycle

15
Time OB FC FB

7-
,S
Organization
Process blocks

ng
ni
FB FC
Error

i
ra
et
Legend:

20
R
The maximum nesting depth
OB = Organization block
FB depends on the CPU!
m

20
FB = Function block
te

FC = Function FB with

01
DB = Data block Instance DB
ys
lS

31
Blocks
rta

The automation system (PLC) provides various types of blocks in which the user program and the

28
Po

related data can be stored. Depending on the requirements of the process, the program can be
structured in different blocks. You can use the entire operation set in all blocks (FB, FC and OB).
A

0
Organization Blocks (OBs)
TI

50

Organization blocks (OBs) form the interface between the operating system and the user
IC

-1

program. The entire program can be stored in an OB which is called cyclically by the operating
S7
AT

system (linear program) or the program can be divided and stored in several blocks (structured
program).
M

,
ng

Functions (FCs)
SI

A function (FC) contains a partial functionality of the program. It is possible to program functions
in

as parameter-assignable so that when the function is called it can be assigned parameters. As a


ra

result, functions are also suited for programming frequently recurring, complex partial
et

functionalities such as calculations.


R

Function Blocks (FBs)


m

Basically, function blocks offer the same possibilities as functions. In addition, function blocks
te

have their own memory area in the form of instance data blocks. As a result, function blocks are
ys

suited for programming frequently recurring, complex functionalities such as closed-loop control
tasks.
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-5
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.2.1. Structured Programming

31
"DB_Motor" "DB_Controller"
Modularization of the entire task:

28
"FB_ "FB_
• Partial tasks are solved in separate "TON"
Motor" Controller"
programs or blocks "OB_
Cycle_A"
• Parameter assignment enables flexible usage

00
"DB_Valves"
• Example: Drilling cycle with changeable "FB_ "FC_

15
"BLKMOV"
depth Valves" Limit"

7-
,S
Re-usability of blocks: "DB_Motor"

ng
"OB_Cycle_B"
 Blocks can be called as often as is "FB_Motor"

ni
required "DB_Motor" Decl. Name Typ

i
in Start BOOL

ra
 Restrictions: "FB_Motor"
in Stop BOOL
et Start Motor_on
out Motor_on BOOL
• No access to global operands out Speed INT

20
Stop Speed
R
stat Speed_old INT
• Communication only via the parameter temp Calc_1 INT
m

20
list :
te

A #Start

01
ys
lS

31
Modularization of the Entire Task
rta

Abstraction is the basis for solving complex problems, in which we concentrate on the

28
fundamental aspects of a program in every abstraction level and ignore all the details that are not
Po

essential. Abstraction helps us to divide complex tasks into partial tasks which can then be solved
on their own.
A

0
TI

50

Structured Programming
IC

-1

STEP 7 supports this concept of modularization with its block model. The partial tasks that result
from the division of the entire task are assigned to blocks in which the necessary algorithms and
S7
AT

data for solving the partial problems are stored. STEP 7 blocks such as functions (FC) and
function blocks (FB) can be assigned parameters so that the concepts of structured programming
M

,
ng

can be implemented with them. This means:


SI


i

Blocks for solving partial tasks implement their own data management with the help of local
in

variables.
ra

• Blocks communicate with the "outside world", that is, with the sensors and actuators of the
et

process control or with other blocks of the user program, exclusively through their block
R

parameters. No access to global operands such as inputs, outputs, bit memories or variables
in DBs can be made from within the statement section of blocks.
m
te

Advantages
ys

Structured programming has the following advantages:


lS

• The blocks for the partial tasks can be created and tested independent of one another.
rta

• Blocks can be called as often as is required in different locations with different parameter
sets, that is, they can be reused.
Po

• "Re-usable" blocks for special tasks can be delivered in pre-designed libraries.


A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-6 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.2.2. Block Overview in STEP 7

31
Block / Instructions Properties

28
STEP 7 V5.x TIA

- User interface

00
Organization block (OB) - Graduated priorities (0 to 27)
- Specific start information in the local data stack

15
- Parameter-assignable (parameters must be assigned with the call)
Function (FC)
- Without (dedicated) memory (only temporary variables)

7-
,S
- Parameter-assignable (parameters can be assigned with the call)
Function block (FB) - With (dedicated) memory (static variables)

ng
- Structured local data storage (Instance DB)
Data block (DB) - Structured global data storage (valid throughout the entire program)

ni
i
System Instruction - Function / Instruction (without memory) stored in the CPU’s

ra
function (SFC) operating system and callable by the user
et
System function Instruction with - FB / Instruction (with memory) stored in the CPU’s operating system

20
R
block (SFB) Instance and callable by the user
m

20
System data
- Data block for configuration data and parameters
te

block (SDB)

01
ys
lS

31
Blocks in STEP 7
rta

Blocks are, by their function, their structure or their application, limited parts of the user program.

28
The blocks in STEP 7 can be - in keeping with their contents - divided into two classes:
Po

• User blocks:
A

0
User blocks include Organization Blocks (OB), Function Blocks (FB), Functions (FC) and Data
TI

50

Blocks (DB). The programming person stores the program instructions for data processing or
process control in the blocks (OB, FB and FC). In the data blocks (DB), the programming person
IC

-1

can save data that occur during program execution and then reuse them at a later time. User
S7
AT

blocks are created in a programming device and are downloaded from there into the CPU.
• System blocks / Instructions:
M

,
ng
SI

These include System Function Blocks (SFB), System Functions (SFC) as well as the System
i

Data Blocks (SDB). SFBs and SFCs as well as Instructions with and without Instance are used to
in

solve frequently required PLC standard tasks. They are integrated in the CPU’s operating system
ra

and therefore do not require any further load or work memory.


et

Downloading Blocks Later On


R

In addition to the advantages of structured programming, the STEP 7 block concept also provides
m

the following advantage:


te

User blocks (OB, FB, FC and DB) in STEP 7 can be modified and downloaded into the CPU
ys

during runtime. That way, software parts of the system can be upgraded during running operation
lS

or (software) errors that occur can be eliminated.


rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-7
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.3. Adding a New Block

31
28
00
15
Automatic number

7-
assignment.

,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Inserting a Block
rta

A new block is created as shown in the picture. When you create a block, the type of block (OB,

28
Po

FB, FC or DB), the programming language, the symbolic name and number, among other things,
must be defined. The block numbers can also be assigned automatically or manually.
A

0
Under "Additional information", the block can be documented in more detail, among other things,
TI

50

with a Version number and an Author.


IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-8 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.3.1. Automatic Numbering of Blocks

31
28
00
15
7-
,S
ng
During compiling, the
system renumbers the

ni
blocks and solves the

i
ra
conflict.
et
Copy and Paste

20
R
m

20
te

01
ys
lS

31
Automatic Numbering of Blocks
rta

When copying program blocks (OB. FC, FB, DB) from a reference project or a library into your

28
own project, for example, block number conflicts can occur. If the number of the copied(-in) block
Po

is already assigned in the project, two blocks with the same number but with different names exist
in the project after the copying. During the next compilation of the program, TIA Portal solves this
A

0
block number conflict automatically by renumbering.
TI

50

Attention:
IC

-1

The automatic solving of block number conflicts is only possible if "automatic" numbering is
S7
AT

activated in the properties of the blocks concerned.


M

,
ng

Note:
SI

Conflicts can also be solved automatically by the system for know-how protected blocks. A
in

password input is not necessary (requirement: encryption was made??? with >= V13 SP1)
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-9
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.3.2. Block Properties: Programming Language, Time Stamps

31
28
Selecting the
programming
language

00
15
7-
,S
ng
i ni
ra
et
Time stamps

20
R
m

20
te

01
ys
lS

31
Properties
rta

Each block has certain properties that you can display and edit. These properties are used to:

28
Po

• Identify the block


• Display the memory requirements and the compilation status of the block
A

0
TI


50

Display the time stamp



IC

-1

Display the reference information



S7
AT

Specify the access protection


• Display and change the programming language
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-10 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.3.2.1. Block Properties: Know-how Protection and Copy Protection

31
28
S7-1500 S7-1200
S7-300/400/WinAC

00
15
7-
,S
ng
ni
i
ra
et
S7-1500 S7-1200

20
R
S7-300/400/WinAC
m

20
te

01
ys
lS

31
Know-how Protection
rta

Blocks can be protected from unauthorized access with a password. With a know-how protected

28
block, only the following data can be read:
Po

• Transfer parameters Input, Output, InOut, Return


A

0
• Block title
TI

50

• Block comment
IC

-1

• Block properties
S7
AT

• Cross references with the information about which global tags are used
M

Just like unprotected blocks, know-how protected blocks can also be copied, called, downloaded
ng
SI

into the CPU and deleted. The code of the block, however, is protected from unauthorized
i

reading and changing.


in
ra

Copy Protection
et

For S7-1200/1500, you can also generate a copy protection in which you define on which
R

memory card or CPU (each identified through a serial number) the block can be executed.
m

Caution!
te
ys

If you forget the password, it is no longer possible to access the block.


lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-11
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.3.2.2. Block Properties: IEC Check and Data Type Conversion

31
28
00
Compatibility of operands is checked in
accordance with IEC 61131

15
7-
,S
ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
When ‘IEC check’ is activated, the compatibility of operands is checked in accordance with
rta

IEC 61131.

28
Po

With IEC Check (Default)



A

The implicit conversion from BOOL into other data types is not possible.
0
TI

50

• Only the data types REAL, BYTE, WORD, DINT, INT, SINT, UDINT, UINT, USINT, TIME, DT,
STRING, CHAR and WCHAR can be implicitly converted.
IC

-1

• The bit length of the source data type must not exceed the bit length of the target data type.
S7
AT

An operand of the data type WORD cannot, for example, be specified at a parameter when
this parameter expects the data type BYTE.
M

,
ng
SI

Without IEC Check


i
in

• The implicit conversion from BOOL into other data types is not possible.
ra

• Only the data types REAL, LREAL, BYTE, WORD, DWORD, SINT, INT, DINT, USINT, UINT,
et

UDINT, TIME, DTL, TOD, DATE, STRING, CHAR and WCHAR can be implicitly converted.
R
m

Note: Implicit Conversion


te

The programming editor identifies operands that are implicitly converted with a gray rectangle. A
ys

dark gray rectangle signals that an implicit conversion without the loss of accuracy is possible, for
example, when you convert the data type SINT to INT. A light gray rectangle (only without IEC
lS

check) signals that an implicit conversion is possible but during runtime errors could occur. If, for
example, you convert the data type DINT to INT and an overflow results, the enable output ENO
rta

is set to "0".
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-12 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.3.2.3. Other Block Attributes for S7-1200/1500

31
28
00
15
7-
,S
Internal programming and
access error handling

ng
Optimized access

i ni
Only STL blocks

ra
et

20
R
m

20
te

01
ys
lS

31
"Handle Errors within Block"
rta

Similar to the mechanism of error masking in S7-300/400, S7-1200/1500 allows for local error

28
handling by means of the instructions GET_ERROR or GET_ERROR_ID. By calling one of these
Po

instructions in a block, the block is given the attribute "Handle errors within block".
A

0
Attribute "Optimized Block Access"
TI

50

The "Optimized block access" attribute can be assigned to all code (logic) and data blocks. It has
IC

-1

the following effects with the different blocks:


S7
AT

For data blocks:


− The variables of the data block can only be accessed symbolically
M

− The retentive behavior of the variables can be adjusted variable-by-variable


ng
SI

− With S7-1200, these DBs are created memory-optimized


i
in

− With S7-1500, these DBs are created access-optimized


ra

For code (logic) blocks:


et

− Optimized machine code


R

− No access to CPU registers


m

− No indirect addressing via pointer with absolute addresses


te

− Temp variables are initialized before processing the code of the block
ys
lS

"Parameter Passing via Registers" (STL)


With S7-300/400, it is possible for block calls using the instructions UC and CC to use the
rta

registers (accumulators, address register and data block register) to pass parameters from block
Po

to block. With S7-1200/1500, these registers are non-existent and are emulated for instructions
that explicitly access these registers. If values are to be passed from block to block using these
emulated registers, the attribute "Parameter passing via registers" must be activated.
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-13
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.3.3. Block Editor Settings

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Block Editor Settings
rta

With the settings, you merely define how a block is to be represented when it is opened. In the

28
editor, you can make changes to the representation (such as showing and hiding comments) at
Po

any time.

A

View
0
TI

50

Setting the Operand representation and Tag information with and without comments when
the block is opened
IC

-1

• Compilation
S7
AT

When "Delete actual parameters on interface update" is activated, the calls of parameterized
blocks are also automatically adjusted if, within the block, parameters already supplied with
M

an actual parameter during the call, are deleted after the fact.
ng
SI

• IEC Check
i
in

When IEC check is activated, the compatibility of operands is checked in accordance with
ra

IEC 61131.
et

• Mnemonics
R

Setting the syntax for the programming language: German (e.g. E for Eingang (Input)) or
International (e.g. I for Input)
m

• View - Layout
te

This changes the vertical spacing between operands and other objects (for example,
ys

operands and contact). The change only becomes visible the next time a block is opened.
lS

• Operand Field
Setting the maximum width and height of function block diagram and ladder diagram symbols
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-14 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.4. Block Programming: Instructions

31
28
Insert Network

00
Display Favorites
On / Off

15
7-
,S
ng
i ni
ra
et Add Instruction

20
R
m

20
te

01
ys
lS

31
Block Programming
rta

The instructions within a block can be programmed as follows:

28
Po

• using drag & drop from the Favorites or the Instructions catalog to anywhere in the program
• by first selecting the location in the program and then double-clicking on the desired
A

0
instruction in the Favorites or the Instructions catalog
TI

50

Operands can be entered with an absolute or a symbolic address. If the tag table is highlighted
IC

-1

(not opened!) in the Project tree, tags (variables) can also be pulled from the Details view to the
S7
AT

appropriate location in the program using drag & drop.


M

Favorites
,
ng
SI

Frequently used elements are available in the Favorites group or Favorites bar, which you can
i
in

expand by dragging & dropping instructions from other groups in the task card to the favorites
group in the task card.
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-15
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.4.1. Block Programming: Local Constants in FCs/FBs/OBs

31
28
00
15
7-
,S
ng
Constants can also be
used as Array limits

i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Local Constants in FCs, FBs und OBs
rta

In addition to the global constants created in the PLC tag tables, local constants can also be

28
declared within the code blocks.
Po

Application:
A

0
TI

If, within a block, the same constant value is required for several instructions, this value can be
50

passed in the form of a local constant which is created in the declaration part of the block and
IC

-1

preassigned with a constant value.


S7
AT

If it is necessary to change the constant value, it only has to be adjusted once in the declaration
part of the block and not in every individual instruction.
M

,
ng

As shown in the picture, local constants can also be used to define the limits of local variables
SI

and/or parameters of the data type Array during the declaration.


i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-16 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.4.2. Block Programming: Networks

31
28
00
15
Open / Close Network comments
all networks On / Off

7-
Insert / Delete Free comments

,S
Network On / Off

ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Networks
rta

Just as the entire user program is subdivided into individual blocks, the individual blocks in turn

28
are made up of individual networks.
Po

Each network can be given a network label and a comment. Within the networks, the individual
A

instructions can be given free comments.


0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-17
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.4.4. Programming an Instruction using "Empty Box"

31
28
00
15
7-
,S
Select the
instruction

ng
Select the
data type

i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Programming an Instruction using "Empty Box"
rta

An instruction can also be programmed in the so-called "Empty box". The empty box is first pulled

28
from the "Instructions" task card using drag & drop, or it is pulled from the "Favorites" onto the
Po

network. Then at the empty box, you select which instruction is to be used with which data type.
A

0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-18 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.4.5. ENO can be Deactivated

31
S7-1500 S7-1200 S7-300/400/WinAC

28
The setting applies for
this and all instructions
that are subsequently
inserted

00
15
1xR ENO deactivated

7-
,S
ENO activated

ng
i ni
ra
et

20
R
m

20
More than one logic path is possible in a network
te

01
ys
lS

31
ENO Output can be Deactivated
rta

All math operations as well as the MOVE box have an ENO output in LAD and FBD through

28
which the result can be checked for validity.
Po

This ENO output can be deactivated for the purposes of runtime optimization through the menu
A

item "Do not generate ENO", so that the internal result check for validity does not take place.
0
TI

50

Note:
IC

-1

For each instruction, you can individually activate or deactivate the EN/ENO mechanism in order
S7
AT

to generate the ENO or if you do not wish to use it. If you activate or deactivate the EN/ENO
mechanism for an instruction, further instructions which you drag into your program after that are
M

also inserted with an activated or deactivated EN/ENO mechanism.


ng
SI

Caution:
in
ra

With a math operation, the ENO output should only then be deactivated if type conversions or
result overflows can be ruled out.
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-19
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.4.6. Implicit Data Type Conversion

31
S7-1500 S7-1200 S7-300/400/WinAC

28
SInt
More than Unproblematic type conversion (gr/gr)
2 inputs! for example, INT -> DINT

00
?

15
7-
Int Type conversions and
calculation (e.g. no

,S
overflow) OK?
?

ng
Risky type conversion (gr/w)
for example, REAL -> INT

ni
DInt

i
ra
Display in the online status
?
et

20
R
m

20
Real
te

01
ys
lS

31
Implicit Type Conversion
rta

Basically, math operations are only possible with operands of the same data type. If, for example,

28
two variables of different data types are to be processed mathematically (e.g. addition,
Po

multiplication...), the data types of the two variables must be adapted to one another with explicit
data type conversions.
A

0
TI

In S7-1200/1500, with the math instructions in LAD and FBD, data type conversions are implicit,
50

that is, possibly necessary data type conversions are integrated in the math instruction.
IC

-1

The programming editor identifies operands that are implicitly converted with a gray rectangle. A
S7
AT

dark gray rectangle signals that an implicit conversion without the loss of accuracy is possible, for
example, when you convert the data type SINT to INT. A light gray rectangle signals that an
M

implicit conversion is possible but during runtime errors could occur (only without IEC check). If,
ng
SI

for example, you convert the data type DINT to INT and an overflow results, the enable output
ENO is set to "0".
i
in

The example shows an integer addition of "INT_Value" and "REAL_Value". For this,
ra

"REAL_Value" is implicitly converted from REAL to INT and then added to "INT_Value". The
et

integer result of the addition is converted in an implicit type conversion from INT to DINT and
R

assigned to "DINT_sum".
m

Attention
te

For data type conversions into a data type with a smaller value range – in the example the
ys

conversion of the value of the variable "REAL_Value" from REAL to INT – is in this respect risky,
lS

in that an overflow leads to an invalid conversion result. Accordingly, the result of the integer
addition would then also be invalid. By evaluating the ENO output, errors that result in this way
rta

can be discovered.
Po

Note:
If you monitor such a risky data type conversion online, then you can see by way of color whether
A

the current conversion of data occurs without error or not.


TI

Red indicates that the data type conversion is faulty and green that the conversion is without
IC

errors.
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-20 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.4.7. Edge Evaluations (1)

31
S7-300/400/WinAC

28
S7-1500 S7-1200 S7-1500 S7-1200 S7-300/400/WinAC

"Scan operand for positive

00
"Set operand on positive "Detect positive signal
signal edge" signal edge" edge"

15
7-
,S
ng
ni
(FB Evaluation)

i
ra
et

20
R
"LB"
m

20
"M_aux_Stop"
te

OB1 OB1 OB1


cycle cycle cycle

01
ys
lS

31
Scan Operand for Positive (–|P|– ) or Negative (–|N|– ) Signal Edge
rta

If, for a positive signal edge scan (see picture), the state of the given operand changes above the

28
box from '0' to '1' ("rising edge"), RLO '1' is output at the output to the box for the duration of one
Po

program cycle.
A

0
Set Operand on Positive (–[P]– ) or Negative (–[N]– ) Signal Edge
TI

50

If the state of the operand or the result of the logic operation at the input to the instruction
IC

-1

changes from '0' to '1' ("rising edge") or from '1' to '0' ("falling edge"), the operand above the
instruction is assigned ‘True’ for one cycle.
S7
AT

In addition, the value of the input signal (in the example, "LB") is output at the output of the
instruction and is available for further logic operations.
M

,
ng
SI

Note
i
in

The instructions compare the current signal or the RLO of the logic operation with the signal or
ra

the RLO of the previous program cycle. This is stored in a so-called edge memory bit (in the
et

example, "M_aux_LS"). It must be ensured that the status of this edge memory bit is not
overwritten elsewhere in the program. For each RLO edge evaluation, a separate edge memory
R

bit must be used accordingly, even then when the same operand (in the example, AND
m

operation") is evaluated again, for example, in another block!


te

Detect Positive (R_TRIG ) or Negative (F_TRIG) Signal Edge


ys

This has the same behavior as with "scan operand for signal edge", however, the evaluation
lS

occurs via a standard instruction which is passed an instance data block, or which can also be
created as a multiple instance within another FB. An edge memory bit is no longer necessary
rta

and, in addition, the input EN can be used and the output ENO can be evaluated.
Po

In the SCL programming language, this is the only way to do an edge evaluation without having
to program it.
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-21
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.4.7.1. Edge Evaluations (2)

31
"Scan RLO for positive/negative signal edge" S7-1500 S7-1200 S7-300/400/WinAC

28
FBD LAD

00
15
7-
,S
"B_LB"

ng
ni
"K_Right"

i
ra
& RLO et

20
R
"M_Imp_pos" OB1 OB1
cycle cycle
m

20
"M_Imp_neg"
te

OB1 OB1

01
cycle cycle
ys
lS

31
Signal Edge Evaluation (P_TRIG, N_TRIG)
rta

With an RLO edge evaluation, it is possible to detect whether the status of a logic operation (in

28
the example an AND operation) has changed from '0' to '1' (rising or positive edge) or from '1' to
Po

'0' (falling or negative edge). If this is the case the instruction supplies, for the duration of one
cycle, RLO '1' as the result, which can be further logically linked or can be assigned to another
A

0
operand (in the example, the memory bit "M_Imp_pos" (M16.1)) as status. In the following cycle,
TI

50

the instruction then once again supplies '0' as the result even if the AND operation still is status
'1'.
IC

-1
S7
AT

Note
The instructions compare the current status or the result of the logic operation with the status or
M

,
ng

the RLO in the previous program cycle. This is also stored in a so-called edge memory bit (in the
SI

example "M_aux_LS"). Just as for all edge memory bits, it must be ensured that the status of this
i
in

edge memory bit is not overwritten elsewhere in the program. For each RLO edge evaluation, a
separate edge memory bit must also be used accordingly, even then when the same operand (in
ra

the example, AND operation) is evaluated again, for example, in another block!
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-22 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.4.8. Closing / Saving / Rejecting a Block

31
CLOSE project and with that the block

28
(save or reject all changes)

00
15
SAVE project and with

7-
that the block

,S
(all changes !!)
CLOSE the block
(no saving, no rejection)

ng
ni
i
ra
et

20
R
m

20
te

01
ys
lS

31
Closing a Block
rta

By clicking on the symbol in the title bar, the block is merely closed. Changes are neither

28
rejected nor are they saved on the hard drive!
Po

Saving a Block
A

0
TI

By using "Save project" the entire project, and with that also the block, is saved on the hard drive.
50

All changes made to the project are saved.


IC

-1
S7
AT

Rejecting a Block
M

It is possible to reject block changes using the function Undo or by closing the entire project
ng
SI

without saving. All changes made in the project are rejected.


i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-23
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.5. Block Calls

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Block Calls
rta

If a block calls another block, the instructions of the called block are executed. Only when the

28
Po

execution of the called block is completed, is the execution of the calling block taken up again
and execution continues with the instruction that follows the block call.
A

0
The block call can be programmed using drag & drop or copy & paste.
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-24 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.5.1. Changing the Block Call

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
rta

28
In order to replace the call of a block with another block call, you can open a selection list of all
Po

FCs and FBs at the calling point by double-clicking on the name of the already called block.
A

Advantage:
0
TI

50

If both blocks have the same formal parameter(s) then they keep their actual parameter(s) and
therefore not all formal parameters have to be supplied with new actual parameters.
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-25
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.5.2. Parameter Visibility / Predefinition (1)

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Visibility in Block Calls in LAD/FBD:
rta

When a block is called, the block parameters can be hidden. Here, there are several possibilities:

28
‘Show’, ‘Hide’ or ‘Hide if no parameter is assigned’.
Po

In a block call, hidden parameters are indicated through a small icon in the form of a triangle (see
next page).
A

0
TI

50

Predefined Actual Parameter:


IC

-1

If it is already know during block creation with which actual parameter the formal parameter is to
be supplied, then you can store this information as a property of the parameter.
S7
AT

When the block is called, this parameter is automatically supplied with the actual parameter.
M

However, it can be changed at any time.


ng
SI

In addition, you can also store the property "Show if parameter assigned on block call is not
i
in

identical to the predefined actual parameter" for the parameter (only to be displayed when the
actual parameter does not match the predefined actual parameter). .
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-26 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.5.2.1. Parameter Visibility / Predefinition (2)

31
1 2

28
00
15
7-
,S
4 3

ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
rta

In the example you can see that the parameters "Sensor_1" and "Sensor_2" have the property

28
"Hide". For that reason, they are not displayed during the call Picture(1). In addition, the
Po

parameter "Sensor_1" was preassigned with the actual parameter "B_Bay1" Picture(2) and with
the property "Show if parameter assigned on block call is not identical to the predefined actual
parameter". Since the actual parameter of "Sensor_1" is changed in Picture(3), it is no longer
A

0
hidden in Picture (4).
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-27
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.6. Compiling a Single Block

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Compiling
rta

Whatever is selected (highlighted) in the Project tree is compiled (in the example shown

28
Po

"FB_Auto"). Individual blocks, the entire program ("Program blocks" folder selected) or the entire
station with software and hardware ("Station" selected) can be compiled.
A

0
In selecting the Program blocks folder, the following possibilities are available:
TI

50

• Software (only changes),


IC

-1

• Software (rebuild all) or Software (rebuild all blocks)


S7
AT

• Software (reset memory reserve),


M

In the Inspector window "Info -> Compile", the status of the compilation is hierarchically displayed.
ng

If errors occurred during compilation, you can jump directly from the error entry to the error
SI

location by double-clicking on it.


i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-28 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.6.1. Compiling Individual / All Changed Blocks

31
OB1

28
FB1

FB2

00
FB2

15
All changed blocks In : Bool1
compiled:

7-
FB2 call in FB1

,S
updated

ng
OB1

ini
ra
FB1
et Only FB2 compiled: FB2
FB2

20
R
FB2 call in FB1
not yet updated In : Bool1
m

20
te

01
ys
lS

31
Compile  Software (Only Changes):
rta

If one individual block is selected in the Project tree or if a compilation is triggered through the

28
button shown to the left when a block is open, only this single block is compiled. The
Po

disadvantage of compiling one individual block is that interface conflicts in the calling blocks
caused by interface changes are not corrected.
A

0
TI

If several blocks are selected or a block group, only those blocks modified since the last
50

compilation are compiled (delta compilation).


IC

-1

If the "Program blocks" folder is selected, the delta compilation for the entire program is carried
S7
AT

out.
M

Compile  Software (Rebuild All Blocks):


,
ng
SI

All, even those blocks not modified since the last compilation, are compiled.
i
in

Compile  Reset Memory Reserve:


ra
et

With the compilation process, the memory reserve of data blocks is also reset that is, that
variables that were created later on in the course of data block expansions are removed from the
R

memory reserve and integrated in the regular part of the data block.
m
te

Note:
ys

The function "Loading (block extensions) without reinitialization" in which an existing memory
reserve is used, is explained in a later chapter.
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-29
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.6.2. Downloading Blocks into the CPU

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Downloading Software:
rta

Software includes the blocks of the user program. The first time you download, they are

28
completely loaded. In subsequent downloads, only the software changes are loaded.
Po

However, all changes are always downloaded, that is, the offline program and the online program
A

are always the same after the download.


0
TI

50

In addition, you must keep in mind that when data blocks are structurally changed, these can only
be loaded with a re-initialization. That is, with loading, all actual values are overwritten with the
IC

-1

start values.
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-30 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.6.3. Downloading Blocks into the CPU: S7-1500 - Memory Concept

31
SMC Card: CPU load memory
• PLC tag table

28
• PLC data types
• Block comments/symbols
• Hardware configuration
• PLC alarms

00
Code work memory:
 Code blocks (FC, FB, OB)

15
Data work memory:

7-
 Global DBs
 Instance-DBs

,S
 Technology objects

ng
1xR Retentive memory:

ni
Retentive variables from:
 Global DBs

i
ra
 Instance-DBs
et  Technology objects
 Bit memories
 SIMATIC timers / counters

20
R
m

20
Other memory areas
 Bit memories
te

 SIMATIC timers / counters

01
 Process images (PII/PIQ)
ys
lS

31
Memory Areas of the CPU
rta

The SMC (Simatic Memory Card) is the load memory of the CPU. Accordingly, an inserted SMC

28
is absolutely necessary for operating the CPU.
Po

The data of the entire station is stored on the SMC, that is, the complete S7 program including
A

documentation, PLC tags and data types as well as the complete hardware configuration
0
TI

including distributed I/O and parameter assignments. In addition, other files can also be found on
50

the SMC, such as, recipes, HMI backups.....


IC

-1

When downloading the S7 program into the CPU, all blocks are always first loaded into the load
S7
AT

memory from where the CPU automatically copies the parts of the blocks that are relevant for
execution into the work memory.
M

,
ng
SI

Work Memory
i
in

The work memory is a volatile RAM memory which cannot be expanded. It is divided into two
areas:
ra


et

Code work memory which contains the parts of the code (logic) blocks relevant for execution.
R

• Data work memory which contains the data of the data blocks and technology objects
relevant for execution.
m
te

Retentive Memory Depends on the CPU (88-700kByte)


ys

The retentive memory is a non-volatile memory for saving the variables declared as retentive
lS

whose value is retained during a power failure.


rta

The contents of the retentive memory is only erased by a


• memory reset
Po

• resetting of the CPU to factory settings


A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-31
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.6.4. Monitoring a Block

31
28
00
Monitor Block

15
On / Off

7-
,S
Receiving online
values

ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
Monitoring Blocks
rta

The test function Monitor block is used to follow the program execution within a block. The

28
statuses or contents of the operands used in the block at the time of program execution are
Po

displayed on the monitor.


A

0
Monitoring
TI

50

Blocks can only be monitored if there is an online connection to the CPU. Furthermore, the offline
IC

-1

block must be identical to the online block. If the opened block does not match the block stored
online in the CPU, the block must be downloaded into the CPU before monitoring.
S7
AT

In test mode, the statuses of the LAD / FBD elements are represented by different colors and the
M

values of the operands are displayed.


ng
SI

With block calls, the input value as well as the output value of the operand is displayed for INOUT
i
in

parameters
ra
et
R
m
te
ys
lS
rta

Notes
Po

The Status display is only active when the CPU is in RUN mode and the instructions to be
monitored are being processed!
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-32 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.7. Task Description: Using Time Constants for
Monitoring the Transport Sequences for Time

31
28
"K_Left" "K_Right"

00
(Q 4.6) (Q 4.5)

DI DO

15
I 0.0 S_OperationOFF (NC)

7-
I 0.1 S_OperationON P_Operation Q 0.1
I 0.2 S_Right

,S
I 0.3 S_Left
2Hz flashing light

ng
for conveyor fault

ni
I 0.7 S_Acknowledge P_Fault Q 0.7

i
ra
et

20
R
Globally usable
m

20
User constants
te

01
ys
lS

31
rta

Function Up Until Now

28
Po

When "P_Operation" (Q0.1) is switched on, parts are transported from Bay 1 or 2 through the
light barrier. A transport sequence is started as soon as a part is placed on the conveyor at Bay 1
A

or 2 and the associated bay pushbutton is pressed. The transport sequence ends as soon as the
0
TI

50

part has passed the light barrier.


If a transport sequence takes longer than the monitoring time of 6 seconds, a fault exists and the
IC

-1

conveyor motor is automatically switched off.


S7
AT

A fault is indicated with a 2Hz flashing light at the simulator LED "P_Fault" (Q0.7) and can be
acknowledged via the Simulator switch "S_Acknowledge" (I 0.7).
M

,
ng
SI

As long as an unacknowledged fault exists, no new transport sequence can be started.


i
in

The maximum allowable transportation time of 6 seconds is specified up until now directly in the
ra

program that is, "FC_Fault" and is now to be preset by means of a global constant in the global
PLC tag table.
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-33
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.7.1. Exercise 1: Declaring the User Constant "maxTime"
and using it in "FC_Fault"

31
28
00
Download block Split editor

15
into the CPU horizontally

7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
rta

Task

28
Po

The maximum allowable transportation time of 6 seconds is specified up until now directly in the
program that is, "FC_Fault" and is now to be preset by means of a global constant in the global
PLC tag table.
A

0
TI

50

What to Do
IC

-1

1. Open the PLC tag table "STEP 7 classic symbols". There, open the "User constants", and in it
S7
AT

declare the constant "maxTime" as shown in the picture and then leave the Tag table editor
open.
M

2. Open the "FC_Fault" block.


ng
SI

3. Split the editor horizontally using the button "Split editor area" so that you can see the User
i
in

constants table as well as "FC_Fault" in the working area (as seen in the picture).
ra

4. In "FC_Fault", use the global time constant "maxTime" which you declared, instead of the
et

absolute specified time S5T#6s. Do this by dragging "maxTime" from the User constants
R

table into "FC_Fault" using drag & drop.


m

5. Download all modified blocks into the CPU and test the program function.
te

6. Save your project.


ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-34 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.8. Task Description:
Part Transportation THROUGH the Light Barrier

31
28
00
Previous New
STOP position STOP position

15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
rta

Function in FC_Conveyor Up Until Now

28
Po

When "P_Operation" (Manual mode) is switched off, the conveyor motor, which is started by
means of the outputs "K_Right" and "K_Left", can be jogged using the simulator switch "S_Right"
A

or "S_Left".
0
TI

50

When "P_Operation" (Automatic mode) is switched on, the conveyor motor is switched on by
means of the output "K_Right" when a work piece is placed on the conveyor exactly in front of
IC

-1

one of the proximity switches of Bay 1 or 2 and the bay pushbutton of the occupied bay is
S7
AT

pressed.
The conveyor motor is stopped when the part has reached the light barrier or "P_Operation" is
M

,
ng

switched off.
SI

i
in

Task Description:
ra

The function "FC_Conveyor", which serves to control the conveyor motor, remains unchanged in
et

principle. However, when the conveyor motor is in Automatic mode, it is only to stop when the
part has passed through the light barrier.
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-35
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.8.1. Exercise 2: Integrating the Edge Evaluation in "FC_Conveyor"

31
28
Conveyor Start Transport Phase Conveyor Stop

00
Part within

15
light barrier

7-
Start condition
for transportation

,S
ng
"B_LB"

ni
(I 4.0)

i
ra
et
"K_Right"

20
R
(Q4.5)
Up to now NEW
m

20
te

01
ys
lS

31
Task:
rta

When "P_Operation" is switched on, the parts are to be transported from Bay 1 or 2 THROUGH

28
the light barrier.
Po

What to Do:
A

0
TI

1. Program the necessary changes in "FC_Conveyor". Instead of using the light barrier signal
50

"B_LB" itself as the reset condition of the memory bit "M_AutoRight", gate the result of an
IC

-1

edge evaluation that is now to be programmed.


S7
AT

Use the memory bit "M_AuxLB" (M16.0) as an auxiliary or edge memory bit for the necessary
edge evaluation.
M

,
ng

2. Download the modified block "FC_Conveyor" into the CPU and test the program function.
SI

3. Save your project.


in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-36 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.9. Task Description: Controlling the Indicator Lights,
Commissioning "FC_Signal"

31
28
"B_Bay1" "B_Bay2"
(I 4.5) (I 4.6)

00
15
7-
,S
ng
i ni
ra
"P_Bay1"
et
"P_Bay2" "P_BayLB"

20
R
(Q 4.1) (Q 4.2) (Q 4.4)
m

20
Constant light: A new part can be placed 2Hz flashing light:
te

Caution, conveyor motor running

01
1Hz flashing light: Start conveyor
ys

2Hz flashing light: Caution, conveyor motor running


lS

31
rta

Task Description

28
Po

When "P_Operation" is switched on and as long as no error "P_Fault" exists, the indicator lights
"P_Bay1" and "P_Bay2" are to be controlled as follows:
A

0
• They show
TI

50

− a constant light when a new part can be placed on the conveyor


IC

-1

(conveyor motor is stopped, both proximity switches are free, there is no existing conveyor
fault)
S7
AT

− 1Hz flashing light at the bay where the associated proximity switch detects a part, but only
M

as long as the conveyor has not yet been started (if parts are placed on the conveyor at
,
ng

both proximity switches, neither indicator light must light up)


SI

− 2Hz flashing light as long as the conveyor motor is running


i
in


ra

The indicator light at the light barrier bay "P_BayLB" shows 2Hz flashing light as long as the
conveyor motor is running.
et

The described functions are already partially programmed in the block "FC_Signal", which is
R

stored in the "SysUp_Lib" global library. The block is to be commissioned and completed by you
m

in the next exercise.


te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-37
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.9.1. Exercise 3: Commissioning "FC_Signal"

31
28
00
15
7-
,S
ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
What to Do
rta

1. Open the "SysUp_Lib" global library (if it hasn’t already been opened in Chapter 5). You will

28
find the library in the folder C:\02 Archives\TIA-Portal\TIA-SYSUP\SysUp_Lib.
Po

2. Using drag & drop, copy the "FC_Signal" block in Chapter08 into the "Program blocks"
A

container from the "SysUp_Lib" global library (as shown in the picture).
0
TI

50

3. Complete "FC_Signal" in such a way that it fulfills all required functions.


IC

-1

4. Program the call of "FC_Signal" in "OB_Cycle".


S7
AT

5. Download all modified blocks into the CPU and test the program function.
6. Save your project.
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-38 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.10. S7-300/400 Blocks: "Upload from Device" (Upload into Project)

31
28
00
15
7-
,S
If blocks are different online / offline,
blocks that already exist offline in the

ng
project are not overwritten, but are
additionally saved under another name

i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Uploading Blocks into the Project:
rta

With "Upload from device", individual blocks or the entire CPU program can be uploaded into the

28
Po

project from the CPU.


As a result...
A

0
• ... blocks that only exist online in the CPU are uploaded into the offline project.
TI

50

• ... blocks that are different online / offline are saved in the project in the offline project under a
IC

-1

different name (but with the same number!).


S7
AT

• ... blocks that only exist offline are not affected.


M

,
ng

When is What Uploaded?


SI

• When an individual block or the "Program blocks" folder is selected, only the online blocks
i
in

(without symbols and comments!) are uploaded into the project under the above-mentioned
ra

conditions.
et

• When the entire station is selected, all blocks are uploaded into the offline project.
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-39
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.10.1. S7-1200/1500 Blocks: "Upload from Device" (Upload into Project)

31
28
00
15
7-
,S
• blocks that are different
online/offline are overwritten in

ng
the project or are saved under
another name

i ni
ra
• only offline existing blocks
remain unaffected in the project
et

20
R
• only online existing blocks are
uploaded into the project
m

20
te

01
ys
lS

31
Uploading Blocks into the Project:
rta

With "Upload from device", individual blocks or the entire CPU program including technology

28
objects, PLC tag tables and PLC data types can be uploaded into the project from the CPU.
Po

If the Blocks folder or individual blocks is/are selected, then...


A

0

TI

50

... blocks that only exist online in the CPU are uploaded into the offline project.
• ... blocks that are different online / offline are either overwritten in the offline project with the
IC

-1

uploaded blocks, or the uploaded blocks are additionally saved under a different name (but
S7
AT

with the same number!) in the project. (selectable in the Upload dialog)

M

... blocks that only exist offline are not affected.


,
ng
SI

If the Station is selected, then...


i
in

... offline all blocks, PLC data types, technology objects and symbols are deleted (!) and the
ra

online blocks, PLC data types, technology objects and symbols are uploaded into the project.
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-40 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.10.2. "Online Backup" (PLC Copy)

31
S7-300/400/WinAC

28
S7-1500 S7-1200

00
Binary copy !
- cannot be read
1xR

15
- cannot be edited

7-
,S
ng
Hardware
configuration &
parameterization

ni
1xR

i
User
ra
program
et

20
R
m

20
te

01
ys
lS

31
PLC Copy:
rta

It is possible for the purposes of online data backup to create a binary PLC copy. This copy has a

28
time stamp and contains all hardware configuration and parameter assignment data as well as
Po

the complete user program (for S7-300/400 without symbols, without comments and without
UDTs).
A

0
TI

The PLC copy cannot be opened, that is, it cannot be read nor can it be edited.
50

By downloading this PLC copy into the CPU, the CPU is reset to exactly the configuration,
IC

-1

parameterization and program state that you had when the PLC copy was created.
S7
AT

Caution:
M

,
ng

The PLC Copy is only possible when the CPU is in the STOP state!
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-41
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.11.1. Deleting Blocks

31
28
Online connection
to the CPU

00
S7-300/400

15
7-
,S
ng
1xR

i ni
ra
et

20
R
m

20
S7 - 1200/1500
te

01
ys
lS

31
Deleting Blocks
rta

S7-300/400:

28
Po

Blocks can be deleted online directly in the CPU and/or offline in the project. If a block is selected
when you have an online connection and "Delete" is activated, the dialog shown in the picture
A

appears with the question as to whether the delete is to be online (from the device) or offline
0
TI

(from the project).


50

S7-1200/1500:
IC

-1

Blocks can only be deleted offline in the project. If this has happened, the blocks still existing
S7
AT

online in the CPU are deleted during the next consistent block download into the CPU.
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-42 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.13. Analog Value Scaling and Direct I/O Access with ":P"

31
S7-1500 S7-1200 S7-300/400/WinAC

28
OUT
HI_LIM = 500,0

00
15
7-
,S
LO_LIM = 0,0
IN

ng
0 27648

fixed, cannot be parameterized !

i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Scaling Analog Values
rta

For reading in and scaling analog values, the "Basic Instruction" SCALE is available, among

28
Po

others, which corresponds to the Library Block "SCALE" (FC105) in STEP 7 Classic. When
programmed this "Basic Instruction", the FC is stored in the directory "System blocks -> Program
resources" of the Project Navigation.
A

0
TI

50

With the SCALE instruction, the data type of the input parameter IN is defined as integer and the
value range as -27648 (BIPOLAR = TRUE) or 0 (BIPOLAR = FALSE) to +27648. The use of this
IC

-1

instruction is thus specially tailored to the scaling of values of analog input modules.
S7
AT

Direct I/O Access


M

Direct I/O accesses are identified with the addition ":P". This addition can be programmed in
ng
SI

conjunction with the absolute address or the symbolic name of the analog channel.
i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-43
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.13.1. Scaling with NORM_X and SCALE_X

31
S7-1500 S7-1200 S7-300/400/WinAC

28
OUT

1,0

00
15
7-
0,0

,S
IN
MIN: 0 MAX: 27648

ng
Can be parameterized!

ni
OUT

i
MAX

ra
500,0
et

20
R
m

20
MIN
te

0,0
IN

01
ys

0.0 1,0
lS

31
NORM_X
rta

NORM_X scales the input signal "Value" with parameter-assignable data type and value range

28
(via the input parameters "MIN" and "MAX") to the norm signal 0.0…1.0 output at output OUT.
Po

SCALE_X
A

0
TI

SCALE_X maps the norm signal with value range 0.0 ... 1.0 at input "Value" to the value range
50

that can be parameterized via the inputs MIN and MAX. The value scaled in such a way is output
IC

-1

at output OUT (MIN <= OUT <= MAX).


S7
AT

Through the combination of these instructions, any value ranges can be mapped or scaled on
other value ranges.
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-44 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.14. MIN, MAX, LIMIT

31
28
S7-300/400/WinAC S7-300/400/WinAC

S7-1500 S7-1200 S7-1500 S7-1200

00
15
7-
More than 2

,S
inputs possible !

ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
MIN / MAX
rta

The "Get minimum" ("Get maximum") instruction compares the values of the inputs IN1, IN2 and

28
Po

IN3 and outputs the smallest (largest) input value at output OUT. The error-free processing of the
instruction (ENO = 1) presumes that the values at all inputs are valid and are of the same data
type.
A

0
TI

50

LIMIT
IC

-1

The "Limit" instruction limits the value at input IN to the values at the inputs MN and MX. When
S7
AT

the value at input IN satisfies the condition MN <= IN <= MX, it is output at the output OUT.
• If the input value IN falls below the lower limit MN, the value of MN is output at the output
M

OUT.
ng
SI

• If the input value IN exceeds the upper limit MX, the value of MX is output at the output OUT.
i
in

• If the value at input MN is greater than the value at input MX, the result is undefined and the
ra

enable output ENO supplies RLO '0'.


et

The error-free processing of the instruction (ENO = 1) presumes that the values at all inputs are
R

valid and are of the same data type, and that MX > MN.
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-45
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.14.1. Verification with IN_RANGE, OUT_RANGE, OK

31
S7-1500 S7-1200 S7-300/400/WinAC

28
00
15
7-
,S
ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
IN_RANGE / OUT_RANGE
rta

The "IN_RANGE" ("OUT_RANGE") instruction checks whether the value at input VAL lies within

28
(outside of) the value range defined via the inputs MIN and MAX. If this condition is satisfied, the
Po

instruction output supplies RLO "1".


A

The error-free processing of the instruction presumes that the values at both inputs are valid and
0
TI

are of the same (parameter-assignable) data type.


50
IC

-1

OK / NOT_OK
S7
AT

The OK (NOT_OK) instruction checks whether the value of the variable specified via the
instruction corresponds to a valid REAL or LREAL. If this is the case, the function "OK" supplies
M

the value "TRUE" at its output and the function "NOT_OK" supplies the value "False".
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-46 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.15. OB Structure S7-300/400 <–> S7-1500

31
Restart (warm start)

28
OB 100, >=123

00
No longer supported:
OB 101 and OB102

15
7-
Cyclic Periodic Event-driven

,S
program program execution program execution
execution Interrupt OBs Error OBs

ng
OB 10...17, >=123 OB 20...23, >=123 OB 80, 82, 83, 86
OB 1, >=123

ni
(Time-of-day interrupts) (Time-delay interrupts) (Asynchronous errors)
(Cyclic program),

i
ra
OB 30...38, >=123 OB 40...47, >=123 OB 121, 122
i.e. several (Hardware interrupts)
(Cyclic interrupts) et (Synchronous errors)
cyclic
programs

20
OB 61…64, >=123
R
are possible !!! (Isochronous interrupts)
m

20
No longer supported:
OB 91, 92
No longer supported: OB 60 Multi-computing
te

(Motion Control interrupts)


OB90 Background program OB 7x Redundancy

01
ys
lS

31
Restart (Warm Start) Program
rta

After voltage recovery, operating mode switch-over via the CPU mode selector or through PG

28
Po

operation, a restart program is carried out before the cyclic program execution. In the restart OBs
you can carry out a pre-assignment of communication connections, for example.
A

0
Cyclic Program Execution
TI

50

The programs in OB1 and the other OBs for cyclic program execution are executed in a
IC

-1

continuous loop. The cyclic OBs are executed according to the block numbers in ascending
order. This makes it possible for the user to subdivide the entire cyclic program into separate
S7
AT

partial programs which can also be managed in libraries.


M

With the cyclic program execution, the reaction time results from the execution time for the CPU’s
ng
SI

operating system and the sum of the command runtimes of all executed instructions. The reaction
time, that is, how fast an output can be switched in relation to an input signal, amounts to a
i
in

minimum of one time and a maximum of two times the cycle time.
ra
et

Periodic Program Execution


R

This makes it possible to interrupt the cyclic program execution at fixed intervals. With the cyclic
interrupts, a "Cycle interrupt" OB for example OB35) is executed after an adjustable time base
m

(for example, every 100ms) has expired. In these blocks, closed-loop control blocks with their
te

sampling time, for example, are called. With the time-of-day interrupts, an OB, which carries out a
ys

data backup, is executed at a specific time, for example, every day at 17:00 hours.
lS

Event-driven Program Execution


rta

In order to be able to react quickly to a process event, the hardware interrupt can be used. After
an event occurs, the cycle is immediately interrupted and an interrupt program is executed. With
Po

time-delay interrupts, a freely definable event can be reacted to with a time-delay; with an error
OB, the user can influence the behavior of the controller in case there is an error.
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-47
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.15.1. OB Start Information

31
OB86 - Start information (non-optimized)

28
00
15
7-
,S
ng
ni
OB86 - Start information (optimized)

i
ra
et RD_SINFO

20
R
For reading out the
entire start
m

20
information
te

01
ys
lS

31
Start Information
rta

When the operating system calls organization blocks, the user is provided with system start

28
information.
Po

• For non-optimized OBs, the start information has a length of 20 bytes and is available after
A

the start of the OB execution in the first 20 bytes of local data.


0
TI

50

• For optimized OBs, the start information is passed by means of input parameters and is
reduced for runtime reasons. It can, however, with the exception of the "Date and time" be
IC

-1

read out with the instruction "RD_SINFO".


S7
AT

Note
M

,
ng

In order to avoid errors, the structure of the declaration section for non-optimized OBs should not
SI

be changed by the user. Following the standard declaration section, the user can declare further,
i
in

additional temporary variables.


ra

The switch-over from non-optimized block to optimized block is done via Properties > Attributes >
et

Optimized block access.


R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-48 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.15.1.1. RD_SINFO

31
28
optimized non-optimized

00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
rta

The function RD_SINFO supplies the start information of the most recently called OB that is not

28
yet completely executed (current OB) at the parameter TOP_SI and it supplies the start
Po

information of the most recently called OBs with the event class "Startup" at the parameter
START_UP_SI.
A

0
Since the parameters TOP_SI and START_UP_SI are of the data type Variant, it is possible by
TI

50

means of the data type of the actual parameter to conditionally define which information exactly
IC

-1

and in which structure the information is to be returned. For this, there are several system data
types available (see Help for RD_SINFO).
S7
AT

In the example shown, the system data type "SI_classic" is used for TOP_SI and "SI_none" is
M

used for START_UP_SI.


,
ng
SI

With the help of the data type "SI_classic", you get the same start information and in the same
i

structure as they would be found in a non-optimized OB in the temporary data. Only date and
in

time are not supplied.


ra

You use the system data type SI_none when, with the exception of the block number, no further
et

start information is to be queried.


R
m

Advantage of OBs with optimized access:


te

• Optimized and thereby quickest possible data access


ys

• Fast OB call since no 20 bytes temporary data are written,


lS

• Start information is only queried as required and not with every call
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-49
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.16. Exercise 4: Weight Acquisition and Checking the Weight

31
2Hz flashing light when
"P_VoltageDisplay1" (QW32)
weight incorrect

28
DI DO
0 ... 12V
I 0.0 S_OperationOFF (NC) P_WeightFault Q 0.0
I 0.1 S_OperationON P_Operation Q 0.1

00
I 0.2 S_Right
I 0.3 S_Left

15
P_RestartMan
12V

7-
P_RestartAuto
I 0.7 P_Fault Q 4.7

,S
S_Acknowledge

ng
0V

ni
i
ra
"S_Slider1" (IW10)
et
Potentiom. for setting (simulating) the weight:

20
R
0 to 10V 0 to 500kg
m

20
“M_WeightOK” = 1
te

when 100kg <= weight <= 400kg

01
ys
lS

31
Checking the Weight
rta

The weight of the transported parts (0 to 500kg) is to simulated on the slide control "S_Slider1"

28
Po

and displayed on "P_VoltageDisplay1" in volts (0 to 10V).


To start with, the current (set) part weight (0 to 500kg) is to be stored in the local temporary
A

0
variable #Weight of the data type INT. Later, it will be stored in a DB variable in order to be able
TI

50

to display it on the touchpanel.


IC

As long as a valid weight (weight > 100kg and weight < 400kg) is set, the variable "M_WeightOK"
-1

is assigned the value ‘True’; if not, the simulator indicator light "P_WeightFault" is to show a 2Hz
S7
AT

flashing light.
M

What to Do
ng
SI

1. Insert an OB of the event class "Cyclic interrupt" (OB_ Cyclic interrupt) and, in its Properties
i
in

under "Cycle time" set a call interval of 100ms.


ra

2. In "OB_ Cyclic interrupt", program the required functions using the instructions NORM_X and
et

SCALE_X. You will find these instructions in "Basic instructions" -> "Conversion operations".
R

3. Download all modified blocks into the CPU and test the function.
m

4. Save your project.


te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-50 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.17. Exercise 5 (Additional): Displaying and Acknowledging the
Startup Type

31
28
00
DI DO

15
I 0.0 S_OperationOFF (NC)

7-
I 0.1 S_OperationON P_Operation
I 0.2 S_Right

,S
I 0.3 S_Left

ng
P_RestartMan
P_RestartAuto

ni
I 0.7 S_Acknowledge P_Fault

i
ra
et
Display the type

20
R
of restart
m

20
te

01
ys
lS

31
rta

Task

28
Po

A manual restart is to be displayed via the simulator LED "P_RestartMan" and an automatic
restart via the simulator LED "P_RestartAuto".
A

0
Both LEDs are to be switched off in the moment when "P_Operation" is switched on.
TI

50

What to Do
IC

-1
S7

1. Insert the new OB of the event class Startup "Startup".


AT

2. Define the outputs Q0.5 and Q0.6.


M

,
ng

3. Program the setting of the simulator LEDs in "Startup" (see picture) and the resetting in
SI

"FC_Mode" (For an optimized block, use the instruction "RD_SINFO")


i
in

4. Download all blocks into the CPU and test the program function.
ra

5. Save your project.


et
R

Solution Hints
m

The startup block "Startup" is executed once for a manual (CPU STOP –> RUN) as well as for an
te

automatic restart (power restoration). From the point of view of the program, the type of restart
can be determined by evaluating the start information of "Startup". Information on the OB-specific
ys

start information can be found in the online help.


lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-51
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.18. Creating a Global Data Block:
"Only in Load Memory" / "Optimized Block Access"

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
1xR
te

01
ys
lS

31
rta

Creating a Global Data Block

28
Po

(Global) data blocks are created in exactly the same way as code (logic) blocks.
In creating a data block you can select of which type the data block is to be or for what purpose it
A

0
is to be used:
TI

50

• Global-DB for saving global data or for creating global variables


IC

-1

• Instance-DB or "private memory" for a user function block or an "instruction", behind which a
S7
AT

function block (FB) is also ultimately hidden



M

Maximum size in the load memory: 16MB


,
ng

maximum size in the work memory: depends on the CPU (example: CPU1516: 5MB)).
SI

i
in

"Optimized Block Access" Attribute


ra

In S7-1200/1500, data blocks can be created with the attribute "Optimized block access":
et

• In S7-1200, these data blocks are created memory-optimized, that is, that fill bytes, as they
R

came into being in S7-300/400 through the changing, successive creating of variables of the
m

dimensions bit, byte word and double-word, are no longer inserted.


te

• In S7-1500, these data blocks are created access-optimized taking the S7 machine code into
ys

consideration, so that – regardless of the memory requirements of the variables – the access
times to these are minimized.
lS

"Only Store in Load Memory" Attribute (in S7-300/400 "unlinked" Attribute)


rta

This attribute means that in downloading into the CPU, the data block is only stored in the load
Po

memory of the CPU and not automatically transferred to the work memory.
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-52 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.18.1. Comparison: Non-Optimized / Optimized Block Accesses

31
28
Non-Optimized Block Access Optimized Block Access

Managed and optimized by the system:

00
Data storage Any, depending on the user declaration The user can set up any structure,
without burdening the memory capacity.

15
The access is not always as fast as it The access always takes place as

7-
could be for S7-1200/1500, since the quickly as possible, since the data
Performance

,S
data could be "unfavorably" located storage is optimized by the system and is
depending on the declaration. independent of the declaration.

ng
Lower, since generally symbolic
Absolute accesses (e.g. from HMI or

ni
accesses are used. Declaration changes
Prone to errors through indirect addressing) can lead to
do not lead to access errors since, e.g.

i
ra
inconsistencies with declaration changes.
et HMI accesses take place symbolically.

Retentiveness Block-by-block Variable-by-variable (Tag-by-tag)

20
R
m

20
Recommendation: Mix non-optimized and optimized blocks as little as possible. The system automatically
te

converts the data models during access between the blocks which, however, uses up resources!

01
ys
lS

31
Data Storage
rta

For the declaration of global variables (tags) within global data blocks or of static variables within

28
function blocks or temporary variables, the Block Editor inserts "fill bytes", if necessary, for blocks
Po

with "non-optimized access". This occurs, for example, when variables of the data types BOOL
and INT are declared in alternate sequence because INT variables are always placed on even
A

0
absolute addresses. Optimized data storage tries to forgo the "fill bytes" wherever possible. This
TI

50

is possible since the system optimizes the arrangement and storage of data.
IC

-1

Performance
S7
AT

If both the data block and the code (logic) block which accesses the data block are created with
the attribute "Optimized block access", the accesses take place with optimized performance.
M

,
ng

This is possible since the system stores the variables in such a way that the data can be
SI

accessed all at once without bits or bytes having to be masked out or restructured during a call.
i
in

Prone to Errors
ra
et

Since optimized blocks work exclusively with symbolic variables, they are less prone to error.
Also, the readability of a program improves because of the use of symbolic variables.
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-53
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.18.1.1. Global DB with "Optimized Block Access":
Exclusively Symbolic Addressing

31
28
S7-1500 S7-1200 S7-300/400/WinAC

00
Optimized data block:

15
Absolute addresses of tags
are not available

7-
,S
ng
i ni
ra
et

20
R
m

20
Not possible in
te

optimized

01
code (logic) block !!!
ys
lS

31
rta

Addressing of Tags in a Data Block with "Optimized Access":

28
The absolute addresses of tags are no longer available in data blocks created as optimized.
Po

This has the following impact:


A

0
• No absolute addresses are displayed in the PLC program as well as in the HMI program.
TI

50

• The tags can only be accessed symbolically in the PLC program as well as in the HMI
IC

-1

program.
S7
AT

• Since the absolute addresses of tags are not available, pointers to these tags (32-bit pointers)
also cannot be created and an indirect access to tags via such pointers is not possible.
M

,
ng

• HMI devices that are not integrated in the project (older Siemens panels or third-party
SI

devices) cannot access data blocks created as optimized!


i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-54 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.18.2. Data Block Editor

31
Insert / Add new tag
Reset Start values to default values

28
Update interface

00
1xR

15
7-
,S
ng
Retentiveness of not
optimized DBs can

ni
only be set for the

i
entire DB; for

ra
et optimized DBs it can
Non-optimized DBs be set variable-by-
Absolute addresses variable (tag-by-tag)

20
R
of tags,
in Structures as well
m

20
Minimize / Maximize
no relative Offset
Structures / Arrays
te

01
ys
lS

31
Offset
rta

The offset denotes the absolute address of a variable within a DB. In the STEP 7 program, the

28
use of the symbolic address or name is preferable since it is easier to read and less prone to
Po

errors than absolute addressing.


A

The absolute addresses of variables within the data block are always displayed in S7-300/400; in
0
TI

S7-1200 and S7-1500, only if the data block was created without the attribute "optimized block
50

access".
IC

-1

The address is always the absolute (even within structures) and not the relative offset.
S7
AT

Retentiveness
M

,
ng

In S7-300/400, the retentive behavior cannot be defined for the individual variables, but always
SI

only for all variables or the entire data block.


i
in

When "Retain" is activated, the monitoring values are retained until the next time the data block is
ra

downloaded into the CPU.


et

When "Retain" is not activated, the monitoring values in the work memory are overwritten with the
R

start values from the load memory after every STOP - RUN - transition of the CPU.
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-55
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.18.3. Default, Start and Monitor Value

31
Current value of variable in the CPU (online)

28
Snapshot of current value (offline)

Start value of variable

00
Default start value

15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Default Value
rta

Default values cannot be edited within global data blocks. Only the default values of structure

28
elements within PLC data types (UDTs) and the default values of parameters and static variables
Po

within FBs can be edited.


A

If a variable of the data type Structure is declared according to the PLC data type (UDT) within a
0
TI

global DB, the default values edited in the PLC data type are then displayed (as not editable) in
50

the data block and adopted as (editable) start values.


IC

-1

Within an FB, their default values also have to be specified in the declaration of parameters and
S7
AT

static variables. In the instance DBs of the FB, these default values are then displayed (as not
editable) and adopted as (editable) start values.
M

,
ng
SI

Start Value
i
in

In declaring a variable, the default value of a variable is automatically adopted as an (editable)


start value. The first time the DB is loaded into the CPU, the CPU starts the program execution
ra

with this value. The next time the DB is loaded into the CPU, the CPU behavior depends on the
et

retentive settings of the DB variable and on the type of DB loading (with or without re-
R

initialization).
m

Monitoring Value
te

The monitoring value of a variable is the current value that the variable presently has in the work
ys

memory of the CPU.


lS

Snapshot
rta

The value "Snapshot" is a monitoring value for an already passed point in time x, at which the
Po

current monitoring values are read out of the CPU and stored offline as the values of the
"Snapshot".
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-56 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.18.4. Snapshot, Setpoint, Start Value

31
Load Snapshot as Monitor values / Actual values

28
Snapshot of the Monitor values / Actual values

Insert new variable without losing actual values

00
15
7-
,S
ng
ni
i
ra
Apply snapshots as start values (All or Initialize variables
only setpoints) et (All or only setpoints)

20
R
m

20
te

01
ys
lS

31
Snapshot
rta

28
With the "Snapshot of monitor value" function, the actual values of the online DB are stored in
Po

the offline DB. With the "Load snapshot as monitor value / actual value" function, the values
are once more loaded into the online DB.
A

0
TI

50

Copy Snapshot to Start Values


IC

-1

Saved values can be adopted in the Start value column by means of the button (for all
S7
AT

snapshots selected in the Setpoint column) or the button (for all snapshots). The next time
M

this DB is transferred, these values are applied as start value (no structural change of the DB -> a
ng

download without re-initialization is possible).


SI

i
in

Adjusting Actual Values


ra
et

Furthermore, the entire DB can be initialized with the button and all values selected in the
R

Setpoint column can be initialized with the button.


m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-57
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.18.5. Changing the Snapshot / Start Value of Several / All Data Blocks

31
28
00
15
7-
,S
ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
Snapshot of Several / All Data Blocks
rta

Just as a snapshot can be made, written back, the DB initialized and snapshots copied into the

28
start values for an individual data block, this can also be done for several or all blocks.
Po
A

0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-58 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.18.6. S7-300/400: Download DB into the CPU / Upload from the CPU

31
28
00
15
"Download"
DB Load Memory Work Memory

7-
Default values Original DB DB DB
Default value

,S
Start values
& Start value STEP 7
(with data types) Monitor Value
Program

ng
DB

ni
Default values

i
Copied,
ra
Start values additionally
et

20
R
created DB
m

20
(Snapshot) "Upload"
te

01
ys
lS

31
"Download" (to Device)
rta

In downloading a data block from the PG into the CPU, the default values, the start values as well

28
as the data types of the variables are transferred into the load memory of the CPU. From the load
Po

memory, the start values are then automatically applied as monitoring values in the work memory
of the CPU. The STEP 7 program works with the monitoring values of the work memory.
A

0
TI

50

"Upload" (from Device)


IC

-1

Data blocks which differ online / offline, (also in terms of the start values) are created as new,
additional data blocks with a different name in the offline project during upload, that is, the data
S7
AT

blocks already existing in the offline project are not overwritten.


M

In these additionally created data blocks, the default values uploaded from the CPU are also
ng
SI

adopted offline as default values, and the monitoring values uploaded from the CPU are adopted
offline as snapshot and start values.
i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-59
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.18.7. S7-1200/1500: Download DB into the CPU / Upload from the CPU

31
28
00
15
"Download" Load Memory
DB Work Memory

7-
DB DB
Default value

,S
& Start value STEP 7
Default values (with data types) Monitor value
Program

ng
ni
Start values

i
ra
et
(Snapshot)

20
R
m

20
"Upload"
te

01
ys
lS

31
"Download" (to Device)
rta

In downloading a data block from the PG into the CPU, the default and start values as well as the

28
data types of the variables are transferred into the load memory of the CPU. From the load
Po

memory, the start values are then automatically applied as monitoring values in the work memory
of the CPU. The STEP 7 program works with the monitoring values of the work memory.
A

0
TI

50

"Upload" (from Device)


IC

-1

In uploading a data block from the CPU into the PG, the start values from the load memory and
the current monitoring values from the work memory are transferred into the PG. In doing so, the
S7
AT

"snapshot" values stored offline are overwritten with the monitoring values loaded from the CPU.
The values from this "snapshot" can then be applied offline in the project as new "start values".
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-60 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.19. Instance and Multiple Instance Data

31
28
Instance data in Instance- data in
1 2 multi-instance-DB
S7-300/400/WinAC
sep. instance-DB

00
15
Instance data in

7-
3 global DB

,S
ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
Instantiation
rta

The concept of the instantiation of function blocks has great meaning and forms the fundamental

28
Po

difference to functions. The creation of tags within a high level language, such as, "C" specifying
the tag name and the data type is called "instantiation" or "instance formation".
A

0
Just as tags, function blocks are also "instantiated". Only through the assignment of its own data
TI

50

area in which the values of the block parameter as well as the static variables are stored does a
function block become an executable unit (FB instance).
IC

-1

The control of a physical process unit, such as, a drive or a boiler then takes place with the help
S7
AT

of an FB instance, that is, a function block with associated data area. The relevant data for this
process unit is then stored in this data area.
M

,
ng

The formation of an instance, that is, the assignment of its own memory area during an FB call
SI

can occur in several ways in STEP 7:


i
in

− by explicitly specifying a so-called instance data block during the call of the function block.
1
ra
et

− by explicitly declaring instances of a function block within a higher-level function block


2
R

(multiple instance model).


− Only for S7-1200/1500:
m

3 by explicitly declaring instances of an IEC function within a global data block.


te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-61
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.19.1. Passing an Instance as a Parameter

31
28
00
S7-300/400/WinAC

15
7-
,S
ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
The passing of an instance by means of an IN-OUT parameter offers a further possibility of
rta

instantiation. This has the advantage that the actual instance which is required within a block can

28
be specified during the call of the block. This makes it possible to also program functions, which
Po

use function blocks or instructions with instances, as re-usable.


A

0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-62 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.20. Exercise 6: Copying "DB_OP" from the Library and Creating
"DB_Memory"

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
rta

Task

28
Po

You are to copy the data block "DB_OP" from the global library "SysUp_Lib" into the project.
Since the access to the area of an optimized data block is quicker than the access to a memory
A

bit area, the vulnerability (prone) to errors therefore lower as well as changes and adjustments
0
TI

50

being easier to make, a new global data block will also be created. As things develop, variables
(tags) will be created in this DB which will be used instead of memory bits.
IC

-1

What to Do
S7
AT

1. Using drag & drop, copy the "DB_OP" block from the "SysUp_Lib" global library, into the
M

"Program blocks" container (as shown in the picture).


ng
SI

2. Create the global DB "DB_Memory".


i
in

3. Save your project.


ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-63
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.20.1. Exercise 7: Expanding "DB_OP" and
Function Test with Snapshot / Start Values

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
Copy Snapshot into
Snapshot of Actual values
Start values
te

01
ys
lS

31
rta

Task

28
Po

"DB_OP" is to be expanded by adding the variable ‘Weight’ of the data type INT in order to store
the current part weight in it that was stored in a local, temporary variable in "OB_Cyclic interrupt"
up until now.
A

0
TI

50

What to Do
IC

-1

1. Open "DB_OP" and extend it by adding the variable ‘Weight’ of the data type INT as shown in
S7
AT

the picture.
2. Download "DB_OP" into the CPU.
M

,
ng

3. Change "OB_Cyclic interrupt" in such a way that the current part weight is stored in the new
SI

data block variable "DB_OP".Weight.


i
in

4. Download the modified "OB_Cyclic interrupt" into the CPU.


ra

5. Open "DB_OP" and start the monitoring function.


et
R

6. Set any weight value you like on "S_Slider1" and monitor whether the value changes
accordingly in the variable "DB_OP".Weight.
m

7. Test the functions "Copy monitor (actual) value as snapshot" and "Copy snapshots to start
te

values".
ys

8. Save your project.


lS

Additional
rta

Overwrite all monitor values with the snapshots or select several variables in the Setpoint column
Po

and initialize these.


A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-64 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.21. Task Description: "Re-usable" Programming

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
IEC-conform Programming
rta

According to the IEC61131-3 standard, no global operands can be used within FCs and FBs, that

28
Po

is, no inputs, outputs, bit memories, data block variables, S5 timers or S5 counters - only local
operands are allowed, that is, only parameters and local variables.
A

0
The block’s communication with its "outside world" takes place exclusively via the block’s
TI

50

interface or only via the input, output and in/out parameters.


IC

This ensures that a block is "re-usable" and can also be integrated in other programs unchanged.
-1
S7
AT

Function Up Until Now, Programmed in "FC_Fault"


M

When "P_Operation" (Q0.1) is switched on, parts are transported from Bay 1 or 2 through the
,
ng

light barrier. If a transport sequence takes longer than the monitoring time of 6 seconds, a fault
SI

exists and the conveyor motor is automatically switched off.


i
in

A fault is indicated with a 2Hz flashing light at the simulator LED "P_Fault" (Q0.7) and can be
ra

acknowledged via the simulator switch "S_Acknowledge" (I 0.7).


et

As long as a fault exists, no new transport sequence can be started.


R
m

Task Description
te

1. The FC is to be changed in such a way that it satisfies the conditions of ICE-61131-3.


ys

2. Create the "FB_Fault" and replace the call of "FC_Fault" with the call of "FB_Fault".
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-65
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.21.1. Exercise 8: Programming "FC_Fault" to be Re-usable

31
28
00
15
7-
,S
ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
rta

Task

28
As an example of IEC-conform programming, the "FC_Fault" block is internally to do without the
Po

use of global variables. It "communicates with its outside world" only via the interface shown in
the previous picture. Furthermore, IEC-Timers are used for time functions and the use of memory
A

0
bits will be avoided.
TI

50

What to Do
IC

-1

1. In "FC_Fault", delete the S5-Timer and use an IEC-Timer (TON) with a Parameter instance.
S7
AT

2. Declare the parameters, local variables as well as the local constants shown in the picture and
M

only use these local operands for the program creation.


ng
SI

3. Delete the global constant "maxTime" in the "STEP 7 classic symbols".


i
in

4. In order to simplify the call of the FC, the parameter ‘Acknowledge’ is predefined with the
ra

actual parameter "S_Acknowledge" and the parameter ‘Takt’ is predefined with the actual
et

parameter "M_2Hz".
For this, select the relevant variables in the declaration section and set the Properties in the
R

Inspector window.
m

5. In addition, the parameter ‘Takt’ is given the Property "Hide".


te

6. Add a new data block "Instanz_maxTime" of the type "IEC_Timer".


ys

7. In "OB_Cycle", update the call of "FC_Fault" and, in the process, pass the data block
lS

"Instanz_maxTime" as an instance data block for the ON-delay.


rta

8. In the DB "DB_Memory", create the variable "ConveyorFault" and use it instead of the memory
bit "M_ ConveyorFault" as an actual parameter of the parameter ‘ConveyorFault’.
Po

9. In the blocks "FC_Conveyor" and "FC_Signal", replace the use of the variable
"M_ConveyorFault" with the DB variable "DB_Memory.ConveyorFault".
A
TI

10.Download all modified /new blocks into the CPU and test the program function
IC

11.Save, compile, download and test the program.


AT
M

TIA-SYSUP - S7 Blocks and Editor


8-66 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.21.2. Exercise 9: Replacing "FC_Fault" with "FB_Fault"

31
28
00
15
7-
,S
ng
ini
ra
et

20
R
m

20
te

01
ys
lS

31
rta

Task:

28
The "FC_Fault" block is to be replaced by an FB and the instance of the ON-Delay is not to be
Po

passed by means of an INOUT parameter but a multiple instance is to be used instead.


A

0
What to Do:
TI

50

1. Create a new function block with the name "FB_Fault".


IC

-1

2. Copy the parameters of "FC_Fault" into the interface of "FB_Fault"


S7
AT

3. Copy the networks of "FC_Fault" into "FB_Fault"


M

4. Change the instance of the ON-Delay from a parameter instance to a multiple instance via the
ng
SI

function "Change instance…" in the context menu at the call of the ON-Delay.
i
in

5. Replace the call of "FC_Fault" with the call of "FB_Fault"


ra

6. Save, compile, download and test the program.


et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-67
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.22. Global Error Handling with Asynchronous Error OBs

31
28
Type of Error Example Error OB Priority

Time Error: S7-300/400:

00
Max. allowed cycle time
According to the
exceeded once Exceeding the priority class of the
System reaction with OB: RUN

15
max. allowed cycle time, interrupted
without OB: STOP OB 80 block
delayed call

7-
Max. allowed cycle time of a time OB
S7-1200/1500:
exceeded by more than double

,S
System reaction with OB: STOP Can be set: 22..26

ng
Diagnostic Interrupt Wire break at diagnostics-capable S7-1200/1500: 2..26
OB 82
System reaction w/o OB: RUN module, power supply error

ni
S7-300*/400: 26/28

i
ra
Remove / Insert Interrupt S7-1200/1500: 2..26
Remove / Insert a module OB 83 S7-300*/400: 26/28
System reaction w/o OB: RUN
et

20
R
Rack Failure Failure of a DP-Slave S7-1200/1500: 2..26
OB 86
System reaction w/o OB: RUN or an IO-Device S7-300*/400: 26/28
m

20
(*= cannot be set)
te

All events lead to an entry in the diagnostics buffer

01
ys
lS

31
Changed System Behavior for Detected Asynchronous Errors:
rta

• Behavior of S7-300/400:

28
Po

If an asynchronous error is detected and the associated error OB is not programmed, the
CPU goes into the STOP state.
A


0
Behavior of S7-1200/1500
TI

50

If an asynchronous error is detected and the associated error OB is not programmed, the
CPU remains in the RUN state.
IC

-1
S7
AT

Asynchronous Errors
Asynchronous errors occur asynchronous (independent) to the program execution and
M

,
ng

accordingly cannot be assigned to a defined program location.


SI

i
in

Time Errors
ra

They occur when the current cycle time exceeds the cycle monitoring time set in the Properties of
the CPU.
et
R

Diagnostic Interrupts
m

They are triggered by diagnostics-capable modules, such as, analog modules in case of a fault
te

(for example, wire break).


ys

Remove/Insert Interrupts
lS

These interrupts are triggered when modules are removed or inserted. When a module is
rta

inserted, the operating system checks whether the correct module type was used. With this
function, it is possible to remove/insert modules while the system is running.
Po

Rack Failure
A

A rack failure is detected with the failure of a rack, a subnet or a station of distributed I/O.
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-68 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.22.1. Global Error Handling with Synchronous Error OBs

31
Type of Error Example OB Priority

28
S7-1200
Programming error Access to non-existing DB no OB

00
Access error Direct access to non-existing exists
System reaction w/o OB: RUN or defective I/O module

15
7-
,S
Programming error OB 121 S7-300/400:
Access to non-existing DB
System reaction w/o OB: STOP (only S7-1500) According to the

ng
priority class of the
interrupted
S7-1500 block

i ni
S7-1500:

ra
Access error Direct access to non-existing
et OB 122 Can be set: 2 to 26
System reaction w/o OB: RUN or defective I/O module (only S7-1500)

20
R
m

20
All errors lead to an entry in the diagnostic buffer
te

01
ys
lS

31
Synchronous Errors
rta

Synchronous errors occur synchronously to the program execution and accordingly can be

28
assigned to a defined program location.
Po

With a programming error, OB121 is called; with an access error, OB122. If, in case of an error,
A

the appropriate synchronous error OB does not exist in the CPU, the CPU switches to the STOP
0
TI

state.
50
IC

-1

S7-300/400:
S7
AT

A synchronous error OB has the same priority as the block in which the error occurred. Within the
synchronous error OB programming, the values that the interrupted block has used can be
M

accessed.
ng
SI

In the jump back to the interrupted block from the synchronous error OB, the original register
i
in

contents are once again restored.


ra

Exception: Manipulation of the ACCU1 contents by means of SFC44.


et

S7-1500:
R

You can set the priority of the synchronous error OBs from 2 to 26. The register contents that the
m

interrupted block has used are not available in the error OB and cannot be manipulated by means
te

of system functions.
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-69
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.22.2. Local Error Handling of Synchronous Errors

31
S7-1500 S7-1200 S7-300/400/WinAC

28
Error in
block OB / FC / FB

00
OB 121
GET_ OB 122

15
ERROR

GET_ERROR or no OB call,

7-
GET_ERR_ID no entry in

,S
programmed in block diagnostic buffer

ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Local Error Handling of Synchronous Errors
rta

If the "Handle errors within block" is programmed, then if this block is integrated in another

28
program, the adjustment of already existing error OBs is not necessary. Thus the "local error
Po

handling" makes it easier to design the block as re-usable.


A

0
S7-300/400: Masking Synchronous Errors
TI

50

A handling of errors within a block (local error handling) is possible through the following SFCs,
IC

-1

with which the start events of OB121 and OB122 can be masked and unmasked, while the
program is being executed:
S7
AT

• SFC36 (MSK_FLT): masks certain error codes


M

,
ng

• SFC37 (DMSK_FLT): unmasks the error codes that were masked by SFC36
SI


i

SFC38 (READ_ERR): reads the event status register


in
ra

S7-1200/1500:
et

Local error handling with the "GET_ERROR" or "GET_ERROR_ID" block has to be programmed
R

separately in every block and has no impact on the calling and called blocks.
m

With the programming of the call of "GET_ERROR" or "GET_ERROR_ID", the block receives the
te

attribute "Handle errors within block".


ys

If the call of "GET_ERROR" or "GET_ERROR_ID" is programmed after the instruction at which


an error could occur, GET_ERROR supplies an "ERROR_STRUCT" with a detailed error
lS

description as a result, and "GET_ERROR_ID" supplies an error number whose meaning can be
rta

read in the online help. Furthermore, the call of the associated error OB (OB121 or OB122) is
suppressed.
Po

If the call of "GET_ERROR" or "GET_ERROR_ID" is programmed before the instruction at which


an error could occur, the blocks do not supply an error description and only the call of the
A

associated error OB (OB121 or OB122) is suppressed.


TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-70 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.22.4. Exercise 10 (Additional): Integrating Local Error Handling

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Task
rta

In "OB_Cyclic interrupt", you are to program an access to a non-existing data block (as shown in

28
the picture) and test the system reaction without and with local error handling.
Po

What to Do
A

0
TI

1. In "OB_Cyclic interrupt", program an access to a non-existing data block as shown in the


50

picture.
IC

-1

2. Download the modified block into the CPU.


S7
AT

3. Perform a CPU restart, by switching the CPU mode selector switch to STOP and then back to
RUN.
M

,
ng
SI

i
in

Exercise is continued on the next page


ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-71
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
4. Read out the diagnostic buffer. Proceed as follows and shown in the picture below:

31
− Select your S7-1500 station
− Go Online

28
− Start "Online & diagnostics"
− There, select the diagnostic buffer in the "Diagnostics" tab.

00
15
7-
,S
ng
ini
ra
et

20
R
m

20
te

01
ys

5. In "OB_Cyclic interrupt", after the network with the access to the non-existing data block,
lS

31
program a local error handling. For this, insert a new network and call the instruction
GET_ERROR_ID (you will find the instruction in "Basic instructions -> Program control
rta

operation…"). Pass the instruction a local, temporary variable at the Output ID.

28
Po

6. Download the extended block into the CPU and perform a restart.
7. The CPU should now stay in RUN in spite of programming errors. Open "OB_Cyclic interrupt"
A

0
and activate the function "Monitor block".
TI

50

8. At the Output ID of the instruction, an Error-ID is output. Read about its meaning in the online
IC

-1

help (select instruction -> F1).


S7
AT
M

Additional Exercise:
ng
SI

Replace the instruction "GET_ERR_ID" with the instruction "GET_ERROR", save the error
i
in

information in the global data block "DB_Memory" and evaluate it. Use the Help for more
information and for evaluation.
ra
et
R

9. Then correct the access error in "OB_Cyclic interrupt".


m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-72 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23. Additional Information

31
28
00
15
7-
,S
ng
ni
i
ra
et

20
R
m

20
te

01
ys
lS

31
rta

28
Po
A

0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-73
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.1. Block Groups

31
28
00
15
7-
,S
ng
ni
1xR

i
ra
et

20
R
m

20
te

01
ys
lS

31
Block Groups
rta

To achieve more clarity, large programs with many blocks can be divided into several block

28
groups. The groupings can, for example, be related to the structure of the system to be
Po

controlled.
A

Even if the blocks are managed in different groups, each block must have a unique symbolic
0
TI

name. Regardless of the groupings, the sum of all blocks represents the user program of the
50

controller.
IC

-1

The blocks can easily be shifted between the block groups using drag & drop.
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-74 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.2. Optimized Blocks: Quantity Structure

31
Max. Size and Numbers
S7-300/400 S7-1200 S7-1500

28
(working memory size not considered)

64KB/
Max. size 64 kB 64 kB
10MB (optimized CPU 1518)

00
DB
Max. number 16,000 65,535

15
512kB/

7-
Max. size 64 kB 64 kB
FB 3MB (optimized CPU 1518)
FC

,S
Max. number 7,999 65,535

ng
4,096 (CPU319) 10,000
FC FB
DB Max. amount 1,024
6,000 (CPU412) (optimized CPU 1518)

i ni
Common

ra
FB
DB working memory S7-300
FC
et

20
R
Separate
DB working memory
m

20
for code S7-400
FB
and DBs
te

FC

01
ys
lS

31
Block Quantity Structure
rta

Compared to the S7-300/400, the maximum number as well as the size of blocks in the working

28
memory of the S7-1500 is considerably larger. As well, the S7-1500 has, just like the S7-400, one
Po

separate working memory each for code and for DBs.


A

0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-75
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.3. SIMATIC S7-1200/1500: Memory Model

31
8.23.3.1. SIMATIC S7-1200: Memory Areas and Storage Location

28
RAM

00
15
System memory:
internal Flash ● Process images (PII,PIQ)

7-
● Memory bits

,S
● Temporary local data
inserted Flash Card integrated

ng
Code work memory:
Load memory of CPU: Load memory of CPU: ● Code (logic) blocks (OBs,FCs,FBs)
● ●

ni
Code (logic) blocks (OBs, FCs, FBs) Code (logic) blocks (OBs, FCs, FBs)
● Data blocks (DBs) ● Data blocks (DBs) Data work memory:

i
ra
● Symbols, Comments ● Symbols, Comments ● Current values of data blocks
● Device configuration of CPU ● Device configuration of CPU (DBs, instance DBs)
et
● Technology objects of modules ● Technology objects of modules ● Data from technology objects

20
R
(optional) Retentive memory of CPU:
m

20
Data storage of system: ● Memory bits
te

● CPU Web Service with alarm texts ● Data from data blocks

01
● Files of any kind (DBs, instance DBs)
ys

(e.g. HMI backup, PDFs ...) ● Data from technology objects


lS

31
rta

28
The size of the internal memory areas of the CPU depends on the CPU.
Po

→ see technical data


A

0
Load Memory S7-1200
TI

50

• load memory integrated in the CPU, when no card is inserted in the card mode "Program"
IC

-1

• can be expanded (size depends on the card)


S7
AT

Inserting a card in the card mode "Program" replaces the integrated load memory.
M

,
ng

Work Memory
SI

• volatile memory integrated in the CPU


i
in

• CANNOT be expanded
ra


et

divided into two areas: code and data


R

Retentive Memory
m

• non-volatile memory integrated in the CPU


te

• for saving (backing-up) a limited amount of data in case of a power loss


ys

• retentiveness of data is parameterized


lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-76 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.3.2. SIMATIC S7-1500: Memory Areas and Storage Location

31
RAM

28
System memory:

00
inserted Flash Card ● Process images (PII,PIQ)
● Memory bits, counters, timers

15
Load memory of CPU:
● Code (logic) blocks (OBs, FCs, FBs) ● Temporary local data

7-
● Data blocks (DBs)
● Code work memory:

,S
Symbols, Comments
● Device configuration of CPU ● Code (logic) blocks (OBs,FCs,FBs)
internal Flash

ng
Technology objects of modules
Data work memory:
(optional) ● Current values of data blocks

ni
(DBs, instance DBs)
Data storage of system:

i
● Data from technology objects

ra
● CPU Web Service with alarm texts
● Files of any kind
et
Retentive memory of CPU:
(e.g. HMI backup, PDFs ...)
● Memory bits, counters, timers

20
R
● Data Logs of CPU
● Data from data blocks
Number of write cycles is limited; a
m

20
(DBs, instance DBs)
constant writing of the card influences
● Data from technology objects
te

the operating life considerably

01
ys
lS

31
The size of the internal memory areas of the CPU depends on the CPU.
rta

→ see technical data

28
Po

Load Memory S7-1500



A

memory via inserted card


0
TI

50

• size depends on the card


IC

-1

Work Memory
S7
AT

• volatile memory integrated in the CPU


M

• CANNOT be expanded
ng
SI

• divided into two areas: code and data


i
in
ra

Retentive Memory
et

• non-volatile memory integrated in the CPU


R

• for saving (backing-up) a limited amount of data in case of a power loss


m

• retentiveness of data is parameterized


te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-77
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.3.3. SIMATIC S7-1200/1500: Memory Concept for CPU PowerOFF/ON

31
Copied with PowerOFF...

28
1 Backing-up the retentive data

internal Flash

00
Copied with PowerON...

15
1 Program blocks and data from
load memory integrated

7-
(S7-1200 integrated load memory, when no load memory RAM
program card is inserted)

,S
2 Restoring the retentive data

ng
System memory:

ni
● Memory bits, counters, timers

i
ra internal Flash
et
Code work memory
1

20
1
R
Data work memory:
● Current values of data blocks
inserted Flash Card Retentive memory
m

20
(DBs, instance DBs)
Load memory ● Data from technology objects 2
te

01
ys
lS

31
rta

The CPUs are developed in such a way that they still save (back-up) the data that is

28
parameterized as retentive after PowerOFF.
Po

The retentiveness of the data is parameterized in the STEP 7 project. The maximum amount of
retentive data (size of the retentive memory) depends on the CPU.
A

0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-78 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.4. Functions, Standard and System Instructions

31
28
00
15
7-
,S
ng
ni
i
ra
et

20
R
m

20
te

01
ys
lS

31
rta

28
Po
A

0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-79
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.4.1. Standard and System Instructions

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Standard and System Instructions
rta

• If a programmed "instruction" is a standard instruction (FC or FB), the relevant block is copied

28
into the Program blocks container in the directory "Program resources" during compiling of
Po

the STEP 7 program. These blocks must also be explicitly downloaded into the CPU, which
automatically occurs with a consistent download.
A

0

TI

If, on the other hand, a programmed instruction is a system instruction (formerly SFC or SFB),
50

the instruction is neither copied as a block into the directory "Program resources" nor must be
IC

-1

downloaded into the CPU since the instruction already exists in the CPU as a component of
the operating system. For instructions which require an instance, only the associated instance
S7
AT

DB (also see in the picture) is stored in the "Program resources" which, with a consistent
download, is automatically also downloaded into the CPU.
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-80 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.4.2. System Instructions <-> SFB/SFC (STEP 7 V5.x)

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

(bas.ins. = basic instruction)

01
ys
lS

31
IEC Timers and Counters
rta

In addition to the classic SIMATIC timers and counters, IEC timers and counters are available

28
that are implemented in the form of SFBs. If the blocks are called as a single instance, a separate
Po

instance data block is required for each timer and counter function.
A

Move Operations
0
TI

50

"BLKMOV" copies the contents of a memory area (source) into another memory area
(destination). "FILL" fills a memory area (destination field) with the contents of a given memory
IC

-1

area (source field).


S7
AT

Conversion Operations
M

The "basic instructions" SCALE and UNSCALE for scaling and unscaling analog values, for
ng

example, are implemented in the form of FCs that are automatically copied into the container
SI

"CPU -> Program blocks -> System blocks -> Program resources" when used. When
i
in

downloading the program into the CPU, you must make sure that these blocks are also
ra

downloaded (-> consistent download).


et

Program Control Operations


R

"RE_TRIGR" restarts the cycle time monitoring of the CPU


m

"STP" brings the CPU into the Stop state


te

Date and Time-of-day


ys

"WR_SYS_T" sets the date and time-of-day on the CPU’s real-time clock, "RD_SYS_T" reads the
lS

current date and time of the CPU, "TIME_TCK" reads the CPU’s system time. The system time is
a free-running time counter. With every restart and with overflow, the time begins again with 0ms.
rta

"SET_RTM", "CTRL_RTM" and "READ_RTM" are used to record the measurements of operating
Po

hours counters with which, for example, the operating time of equipment can be gathered.
Alarm Messages
A
TI

"ALARM_S" and "ALARM_SQ" are blocks to generate alarm messages according to the alarm
number procedure.
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-81
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.5. OB Priorities and System Reaction

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
rta

28
Po
A

0
TI

50
IC

-1
S7
AT
M

,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-82 Training Document, V15.00.00
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.6. Cyclic Interrupt OBs: Priority and "Event Queueing"

31
S7-1500 S7-1200 S7-300/400/WinAC

28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Events to be Queued
rta

When the execution of time OBs is delayed because of events with a higher priority, the deferred

28
OB calls are processed afterwards. You have to specify in the (number of) "Events to be queued"
Po

how many deferred events are to be processed afterwards.


A

0
Report Event Overflow into Diagnostic Buffer
TI

50

If more events are deferred than are specified in (number of) "Events to be queued", the excess
IC

-1

is not processed afterwards or they are lost. This event overflow can be entered in the diagnostic
buffer by activating this option.
S7
AT

Enable Time Error:


M

,
ng
SI

This means to enable the call of the time error OB (OB80).


i
in

Event Threshold for Time Error


ra

This is the number of events that have to be queued before the operating system calls the time
et

error OB (OB80). In this time error OB, the user can determine or program the reaction to this
R

event overflow.
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


Training Document, V15.00.00 8-83
SI
20
SIMATIC TIA Portal Upgrade Course to S7-1500

20
01
8.23.7. Instruction Profiles

31
28
00
15
7-
,S
ng
i ni
ra
et

20
R
m

20
te

01
ys
lS

31
Instruction Profiles
rta

With Instruction Profiles, you can limit the number of instructions for certain controllers, such as,

28
for S7-1200. In the example shown, the instruction "WRT_DBL" (write in data block in the load
Po

memory) is no longer available for the S7-1500 CPU family when the instruction profile
"My_S7-1500_Prof" is activated.
A

0

TI

50

Instruction profiles can be created for every controller family and for every language.
• Only the instructions selected in the profile are visible in the Instructions task card and are
IC

-1

accepted by the editor.


S7
AT

• Several profiles can be created but only one can be activated. The active profile is
M

represented with a green arrow.


,
ng
SI

i
in
ra
et
R
m
te
ys
lS
rta
Po
A
TI
IC
AT
M

TIA-SYSUP - S7 Blocks and Editor


8-84 Training Document, V15.00.00
SI

You might also like