100% found this document useful (2 votes)
367 views368 pages

Tia Portal Basic

The document provides a comprehensive overview of the Siemens S7-1500 PLC and TIA Portal, detailing system architecture, available modules, and installation guidelines. It emphasizes the concept of Totally Integrated Automation (T.I.A.) and outlines the functionalities of both the S7-1200 and S7-1500 controllers. Additionally, it includes exercises for practical application and troubleshooting within the TIA Portal environment.

Uploaded by

Rahman Aulia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
367 views368 pages

Tia Portal Basic

The document provides a comprehensive overview of the Siemens S7-1500 PLC and TIA Portal, detailing system architecture, available modules, and installation guidelines. It emphasizes the concept of Totally Integrated Automation (T.I.A.) and outlines the functionalities of both the S7-1200 and S7-1500 controllers. Additionally, it includes exercises for practical application and troubleshooting within the TIA Portal environment.

Uploaded by

Rahman Aulia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 368

TRAINING PLC SIEMENS

S7 – 1500

TIA PORTAL – Advance & Troubleshooting


SIMATIC TIA Portal Programming 1

Contents 2
2. System Overview .................................................................................................... 2-2
2.1. SIMATIC S7 Overview .......................................................................................................... 2-3
2.2. TIA Portal Information Center ............................................................................................... 2-4
2.3. Overview Controller .............................................................................................................. 2-5
2.3.1. Positioning the Modular S7 Controllers ................................................................................ 2-6
2.4. Overview: Available Modules ................................................................................................ 2-7
2.4.1. Central Modules .................................................................................................................... 2-7
2.4.2. Signal Modules (Central) ...................................................................................................... 2-8
2.5. SIMATIC S7-1200: The Modular Mini-PLC........................................................................... 2-9
2.5.1. SIMATIC S7-1200: Modules ............................................................................................... 2-10
2.5.2. SIMATIC S7-1200: Installation and Mounting Positions ..................................................... 2-11
2.5.3. SIMATIC S7-1200: Signal, Communication or Battery Board ............................................ 2-12
2.6. SIMATIC S7-1500: Modular Controller for the Mid to Upper Performance Range............. 2-13
2.6.1. SIMATIC S7-1500: Modules ............................................................................................... 2-14
2.6.2. I/O Addressing of the S7-1500............................................................................................ 2-16
2.6.2.1. Channel Addressing of Digital S7-1500 Modules ............................................................... 2-17
2.6.3. SIMATIC S7-1500: Installation and Mounting Positions ..................................................... 2-18
2.6.4. SIMATIC S7-1500: Connection Technology / Front Connector.......................................... 2-19
2.6.5. SIMATIC S7-1500: CPU-Display → Overview ................................................................... 2-20
2.6.6. SIMATIC S7-1500: CPU-Display → Menu and Colors ....................................................... 2-21
2.7. SIMATIC S7-1200/1500: Memory Card(s) .......................................................................... 2-22
2.8. Exercise 1: Display ............................................................................................................. 2-23
2.9. Exercise 2: Loading the Program onto the SMC ................................................................ 2-24
2.9.1. Exercise 3: Diagnostics and Program Test......................................................................... 2-25
2.10. Additional Information ......................................................................................................... 2-26
2.10.1. ET200SP and ET200pro Controller .................................................................................... 2-27
2.10.2. Software Controller ............................................................................................................. 2-28
2.10.3. ET200SP Open Controller “All in one” ................................................................................ 2-29
2.10.4. SIMATIC S7-300: Modular Automation System ................................................................. 2-30
2.10.4.1. SIMATIC S7-300: Modules ................................................................................................. 2-31
2.10.5. SIMATIC S7-400: Modular Automation System ................................................................. 2-32
2.10.5.1. SIMATIC S7-400: Modules ................................................................................................. 2-33

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-1
SIMATIC TIA Portal Programming 1

2. System Overview

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

... be familiar with the concept of “Totally Integrated Automation” (T.I.A.)

... be familiar with the TIA Portal Information Center

... have an overview of the available modules

... have an overview of the new SIMATIC S7-1200/1500 system family

... be familiar with the SIMATIC Memory Card as well as the S7-1500
Display

... know the S7-300 and S7-400 automation systems

TIA-PRO1 - System Overview


2-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.1. SIMATIC S7 Overview

SIMATIC HMI SIMATIC PG SIMATIC Software


SIMATIC PC

MPI - Network
SIMATIC NET Industrial Ethernet/PROFINET
PROFIBUS
SIMATIC PC-based
SIMATIC
Controller
Controller

PROFIBUS-DP
PROFINET

AS-Interface

Introduction
For the operation of machines, equipment and processes in almost all areas of manufacturing
you require control elements in addition to energy supply. It must be possible to initiate, control,
monitor and end the operation of any given machine or process.

Hard-wired Programmed Controller  PLC


In the hard-wired controllers of the past, the program logic was governed by the task-specific
wiring of contactors and relays.
Today, programmable logic controllers are used to solve automation tasks. The logic stored in the
program memory of an automation system does not depend on equipment design and wiring and
can be modified at any time with the help of a programming device.

Totally Integrated Automation


Production processes are no longer seen as individual partial processes, but rather as integral
components of an entire production process. The total integration of the entire automation
environment is today achieved with the help of:
• one common software environment that integrates all components and tasks into one uniform
easy to use system
• a common data management (central database)
• a common communication between all participating automation components.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-3
SIMATIC TIA Portal Programming 1

2.2. TIA Portal Information Center

https://support.industry.siemens.com
Entry ID 65601780

By entering the Product/Article No. (Entry ID) 65601780, you arrive at the start page “TIA-Portal -
An Overview of the Most Important Documents and Links”.

Here you will find all important documents and links about the TIA Portal as well as the controllers
S7-1200 and S7-1500.

In addition, you can get to the “TIA Portal Information Center”. Through it you can also get to all
important links and information.

TIA-PRO1 - System Overview


2-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.3. Overview Controller

Engineered with TIA Portal


System performance

Advanced Controller
Software
SIMATIC S7-1500
Controller

SIMATIC
S7-1500
Distributed
Controller

Basic Controller SIMATIC


ET 200
SIMATIC S7-1200

Application complexity

Depending on the complexity, different controllers from S7-1200 to S7-1500 can be used.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-5
SIMATIC TIA Portal Programming 1

2.3.1. Positioning the Modular S7 Controllers

TIA Portal

SIMATIC S7-400
Advanced

SIMATIC S7-1500

SIMATIC S7-300
Basic

SIMATIC S7-200
SIMATIC S7-1200

SIMATIC S7
The programmable logic controllers can be divided into the performance ranges Basic (S7-1200)
and Advanced (S7-1500).
The product range of the S7-1200 and S7-1500 will be expanded in the next few years such that
the S7-200, S7-300 and even the S7-400 can be completely replaced.

TIA-PRO1 - System Overview


2-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.4. Overview: Available Modules

2.4.1. Central Modules

S7-1200 S7-1500 S7-300 S7-400

Standard

Fail-safe

Compact

High
availability
Different functions
Different
Technology functions T-CPU
T-CPU

More Information under the Link:


TIA Portal Information Center > Product information > Controllers

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-7
SIMATIC TIA Portal Programming 1

2.4.2. Signal Modules (Central)

S7-1200 S7-1500 S7-300 S7-400

DI/DQ

AI/AQ

F-DI/F-DQ

F-AI

More Information under the Link:


TIA Portal Information Center > Product information > Controllers

TIA-PRO1 - System Overview


2-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.5. SIMATIC S7-1200: The Modular Mini-PLC

Features
• Modular compact control system for the low-end performance range
• Scaled CPU range
• Extensive range of modules
• Can be expanded to up to 11 modules (depends on the CPU)
• Can be networked with PROFIBUS or PROFINET
• Slot rules
− CM left of the CPU (number depends on the CPU)
− SM right of the CPU (number depends on the CPU)
• "Total package" with CPU and I/O in one device
− integrated digital and analog I/O
− an expansion with signal board
• "Micro PLC" with integrated functions

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-9
SIMATIC TIA Portal Programming 1

2.5.1. SIMATIC S7-1200: Modules

Communication module(s) Signal module(s)


(max. 3 depending on CPU) (max. 8 depending on
CPU)

...

CPU DI, DQ, DI/DQ, AI, AQ, AI/AQ


CM/CP
- Point-to-Point
(RS232, RS485) Optional signal, - DI, DQ, DI/DQ
- PROFIBUS - AI, AQ, AI/AQ
communication - Point-to-Point (RS485)
- ASi
- GPRS or battery board - Battery backup of real-time clock

Slot Rules
• CM left of the CPU (number depends on the CPU)
• Signal modules (digital, analog) right of the CPU (number depends on the CPU)

Signal Modules
• Digital input, output or mixed modules (24VDC, relay)
• Analog input, output or mixed modules (voltage, current, resistance, thermocouple)

Communication Modules (CM - Communication Module, CP - Communication Processor)


• Point-to-point connection (RS232, RS485)
• PROFIBUS
• ASi-Master
• Telecontrol (GPRS functionality)

Expansion Board
With this, the CPU can be expanded by onboard I/O or an interface.
A battery board ensures the long-term battery backup (buffering) of the real-time clock.

TIA-PRO1 - System Overview


2-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.5.2. SIMATIC S7-1200: Installation and Mounting Positions

Standard
mounting rail Bus
Busverbinder
connector
Vertical
1x expansion cable
Horizontal

Alternative attachment

Installation
The modules are mounted on a standard mounting rail or alternatively screwed into the control
cabinet.

S7-1200 Expansion Cable


It offers additional flexibility in configuring the S7-1200 system. One expansion cable can be used
for each CPU system.
• Either between the CPU and the first SM or between two SMs

Bus Connector
It is located as a mechanical slide on the left side of the SM modules.
It is mechanically attached on the right side of the CMs/CPs.

Mounting Positions
A horizontal or vertical mounting is possible.
Caution!
With a vertical mounting, the maximum allowed ambient temperature is 10 °C lower.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-11
SIMATIC TIA Portal Programming 1

2.5.3. SIMATIC S7-1200: Signal, Communication or Battery Board

Available boards:
● analog, digital
● RS485
● battery

Application
These boards are used for application-specific adaptation of the CPU to the requirements of the
plant. The physical size of the CPU remains unchanged.

Signal Board (SB)


• Digital signal board
− only inputs
− only outputs
− inputs and outputs
• Analog signal board
− only inputs
− only outputs

Communication Board (CB)


• RS485 interface

Battery Board (BB)


A battery board (housing for CR1025 battery) ensures the long-term battery backup (buffering) of
the real-time clock.
• Buffering time without battery board typically 20 days / minimum 12 days at 40°C
• Buffering time with battery board approximately 1 year

TIA-PRO1 - System Overview


2-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.6. SIMATIC S7-1500: Modular Controller


for the Mid to Upper Performance Range

Highlights of the SIMATIC S7-1500 System

• Highest performance of the entire system (terminal-terminal)


− High performance program execution in the CPU
− High performance backplane bus
− PROFINET interface with PROFINET IO IRT on every CPU
− Automatically activated system diagnostics, right down to the
IO channel

• Trace for all CPU tags

• CPU - Display for:


− Access to MLFB, FW version and serial number
− Commissioning (e.g. Setting the IP address, station name)
− Backup/Restore
− Diagnostics

• Simplified programming through user-friendly new


instructions in LAD/FBD/STL

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-13
SIMATIC TIA Portal Programming 1

2.6.1. SIMATIC S7-1500: Modules

Single-tier assembly max. 32 central modules in rack


Multi-tier distributed ET200MP

...
TM:
PS/PM CPU DI, DQ, PS - Counting
(optional) AI, AQ new power - Position sensing
segment
CM/CP:
- Point-to-Point max. 2 per rack
(RS232, RS485) for backplane bus supply of
- PROFIBUS subsequent I/O modules
- PROFINET

Slot Rules
• 1x PS/PM Slot 0
• 1x CPU in Slot 1
• As of Slot 2 any

Signal Modules
• Digital input modules: 24VDC, 230VAC
• Digital output modules: 24VDC, 230VAC
• Analog input modules: voltage, current, resistance, thermocouple
• Analog output modules: voltage, current

Communication Modules (CP - Communication Processor, CM - Communication Module)


• Point-to-Point connection
• PROFIBUS
• PROFINET
CPs and CMs are both communication modules.
CPs have, as a rule, somewhat more functionality than CMs (e.g. own web server,
firewall, or the like).

Technology Modules (TM - Technology Module)


• Counting
• Position sensing

TIA-PRO1 - System Overview


2-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

Power Supply
I/O modules in the central rack of the S7-1500 require a system power supply via the backplane
bus (communication connection to the CPU) and a load power supply (input or output circuits for
sensors/encoders and actuators).
• PM - Power Module → Load Power Supply
supplies modules with 24VDC for input and output circuits as well as sensors/encoders and
actuators
If the CPU is supplied 24V via a load power supply (PM), it supplies the system power
supply of 12W for the first inserted I/O modules.

• PS - Power System → System Power Supply


supplies S7-1500 modules in the central rack via the backplane bus
Each CPU offers a system power supply of 12W for the first inserted I/O modules.
Depending on the I/O modules used, further power segments have to be set up, as
required.
A system power supply (PS) can also supply the load circuit for 24VDC modules in
addition to the CPU.

Power Supply and Power Segments of the I/O Modules


It is necessary to set up power segments in the central rack for larger configurations or
configurations with greater I/O module power requirements (as a rule, when using CP, CM, TM).
A maximum of 3 power segments can be set up per rack (1xCPU segment plus 2 more).
If the configuration includes additional power segments, additional system power supply modules
(PS) are inserted to the right next to the CPU. The CPU continues to control all modules of the
rack. Only the system power supply of the I/O modules is subdivided here.

Example of a Small S7-1500 Configuration

Example of an S7-1500 Configuration with a 2nd. Power Segment

Interface Modules for Expansion Rack


There are no plans for a central multi-tier assembly. An expansion can be realized using the
distributed ET200MP I/O system.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-15
SIMATIC TIA Portal Programming 1

2.6.2. I/O Addressing of the S7-1500

Default addresses of the I/O modules:


• Address assignment does not depend on the slot
• Begin as of I/O address = 0
• Addresses are assigned consecutively in the order in which the manual
configuration of the I/O modules occurs

As of
Rack
PS CPU
Addr. Address requirement of a module → depends on the module
or
PM 0.0 Start address of a module → depends on the configuration

Slot No. 0 1 2 3 4 5 … 29 30 31

In order to be used by the user program, each I/O module is assigned "Module Address(es)" for
the status/modify data area of its channels.By reading and writing the address areas, the user
program can work with the process peripherals which are connected to the modules.

Default Addressing
During the device configuration, the address assignment for an added module is suggested as a
consecutive allocation of the I/O address area as of byte-address 0. This address can be
changed during the configuration of the hardware.

TIA-PRO1 - System Overview


2-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.6.2.1. Channel Addressing of Digital S7-1500 Modules

e.g. DI32

I 0.0 I 2.0
e.g. parameterized I/O address is 0..3
IB 0 IB 2

I 0.7 I 2.7

I 1.0 I 3.0

IB 1 IB 3

I 1.7 I 3.7

Each digital channel has an assigned Status LED next to the terminal connection.
The address of the binary process signal results from...
• the terminal used
• the I/O address of the module

Address Assignment of the Byte Addresses


From top to bottom and (for > 16 channels) from left to right

Address Assignment of the Bit Addresses


From top to bottom

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-17
SIMATIC TIA Portal Programming 1

2.6.3. SIMATIC S7-1500: Installation and Mounting Positions

Profile rail
with integrated mounting rail

Vertical

Horizontal
Busverbinder
Bus connector

Installation
The modules are mounted on an S7-1500 profile rail.

Bus Connector
If the installation is made on the profile rail, the modules are then connected with the U-
connector.
The U-connector establishes the mechanical and electrical connection between the modules and
is included with every I/O module.

Mounting Positions
A horizontal or vertical mounting is possible.
Caution!
With a vertical mounting, the maximum allowed ambient temperature is 20 °C lower
(ambient temperature 0 to 40 °C).

Integrated Mounting Rail


For the S7-1500 CPU, there is a profile rail on which components can also be mounted according
to EN 60715. With that, even terminals, miniature circuit breakers, small contactors or similar
components can be mounted in addition to the S7-1500.

TIA-PRO1 - System Overview


2-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.6.4. SIMATIC S7-1500: Connection Technology / Front Connector

Release latch
Entriegelungslasche

4 jumper links
can be inserted

Wiring position

Wiring position

Strain relief by means


Operating position
of cable ties

Properties of the Front Connector


• In each case 40 terminals
• Clamping techniques:
− Screw-type terminal
− SIMATIC TOP connect
System wiring for the connection of sensors/encoders and actuators
→ S7-1500 front connector wired with 20 or 40 single conductors (prefabricated)

Prewiring Position
The front connector latches up in the front cover. In this position, the front connector still juts out
of the module, but the front connector and the module are not yet electrically connected.

Jumper Links
The jumper links can be inserted in the front connector in four places for easier set up of load
groups. That is, looping the supply voltage to several potential groups.
Only one connection from left to right exists!

Automatic Coding of the I/O Modules


This enables a faster and safer exchange of the front connector.

Two Front Door Latching Positions


At the bottom of the front cover there are 2 different latching positions for different space
requirements of the conductor bundle.
• Cable storage space that grows with the need (AWG cabling)
American Wire Gauge (AWG) is an American standard measure for copper wires which
defines the wire strength and the allowed damping, whereby a lower AWG value represents a
thicker wire. By swinging up the release latch, you can pull the front connector and remove it
from the module.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-19
SIMATIC TIA Portal Programming 1

2.6.5. SIMATIC S7-1500: CPU-Display → Overview

 Every S7-1500 CPU is delivered with a Display


 Two sizes depending on the CPU type
1.36” up to CPU1513
2.4” as of CPU1516
 Has its own MLFB
→ can be ordered as replacement part
 CPU can be operated without the Display
(different front cover)
 Removal and insertion possible during running operation
→ CPU stays in RUN
 Multi-lingual display (menu)
 Message/Alarm texts and comments can be loaded in 3
languages
 Language can be switched during running operation
 Alarm acknowledgement
 Backup/Restore
 Format SMC

The available Display languages are the available user-interface languages of STEP7.

Operation

Selecting the main menu item

Shifting the selection of the submenu item

Choosing the selected submenu item

Go back one menu item

Current main
menu item
After choosing the menu item
Edit setting
Selected
submenu item Accept change

Discard change
Editable
submenu item

TIA-PRO1 - System Overview


2-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.6.6. SIMATIC S7-1500: CPU-Display → Menu and Colors

Main menu items and their meaning:

Overview (Info on: CPU, program protection, memory card, fail-safe (operation)…)

Diagnostics (alarms, diagnostic buffer, message display, watch tables, cycle time, current memory)

Settings (addresses, date & time, operating mode, CPU Reset, unlock Display, Backup, FW update
…)

Modules (status, MLFBs, version, information,… of individual modules)

Display (setting: brightness, language Display/diagnostic message,


standby,…, Display infos: MLFB, version, …)
Colors of status information and their meaning:
green RUN of CPU,
yellow STOP or CPU HOLD
red Error
white Connection setup or connection to CPU lost

Additional Symbols in the Status Information

Password is configured but not entered

Password is configured and entered

An Alarm exists

A Force job is active on the CPU

F-ability activated. Safety operation active (for fail-safe CPUs)


With deactivated safety operation, the icon is greyed out.

Fail-safe CPU (for fail-safe CPU)

S7-1500 Display Simulator


Under the link “TIA Portal Information Center” > First steps > Getting Started > SIMATIC S7-1500
and STEP7 - Getting Started > Displays of the SIMATIC S7-1500 controller family” you can test
the S7-1500 display simulator as an online version or you can download it and test it offline.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-21
SIMATIC TIA Portal Programming 1

2.7. SIMATIC S7-1200/1500: Memory Card(s)

1 Serial number of the SMC card


2 Product version
3 Order number
4 Card size
5 Slide switch for write-protect (must not be write-protected)
Written with:
● Commercially available SD card reader
● Field PG

SIMATIC Memory Card in the S7-1200: SIMATIC Memory Card in the S7-1500:

● External load memory ● Load memory


● Distribution of programs ● Firmware update
● Firmware update ● Documentation
● Documentation ● Memory Card Binding
● Memory Card Binding ● Unlinked DBs
● Unlinked DBs ● Archiving of data
● Module exchange without PG ● Module exchange without PG

Memory Card Binding – Copy Protection


The executability of the program can be bound to the serial number of the card.

Load Memory
• S7-1500
This has no integrated load memory and therefore it is imperative that a card is inserted.
• S7-1200
This has an integrated load memory. Here, an inserted memory card can replace (expand)
the integrated load memory or the card can be used for program updates (distribution of
programs).

Distribution of Programs ← only S7-1200


The use as Transfer card (card mode = "Transfer") is only supported by the S7-1200. Here, a
program can be downloaded into the CPU without a PG if a card is inserted.

Archiving of Data ← only S7-1500


It is possible to archive process values on the card.
The use of this functionality influences the operating life of the Memory Card

TIA-PRO1 - System Overview


2-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.8. Exercise 1: Display

Familiarize yourself with the Display!

What to Do:
1. Change the language and the brightness on the Display.
2. Read-out the memory card type and how much memory still exists.
3. Take a look at the diagnostic buffer.
4. Make a note of the MLFB (order number) and the Firmware of the CPU and all central
modules.

Module MLFB (order number) Firmware


CPU
DI
DO
AI

5. Change the time (of day) of the CPU, the IP address of the Interface X1, and format the
memory card.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-23
SIMATIC TIA Portal Programming 1

2.9. Exercise 2: Loading the Program onto the SMC

What to Do:
1. Set the CPU to STOP using the Display.
2. Remove the SIMATIC Memory Card.
3. Insert the SMC in the SD card reader of the programming device (PC).
4. Erase the card using Windows Explorer.
5. Open the folder “C:\02_Archives\TIA_Portal\TIA-PRO1\SMC-Project”.
6. Extract (unzip) the ZIP file (Name according to the MLFB and the firmware of the CPU) onto
the SIMATIC Memory Card.

TIA-PRO1 - System Overview


2-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.9.1. Exercise 3: Diagnostics and Program Test

What to Do:
1. Insert the SIMATIC Memory Card in the CPU and wait until the MAIN-LED no longer flashes.
2. Reset the CPU to factory defaults using the Display,
(delete all data since there could still be an old program on the CPU)
3. Switch the CPU to Run.
4. Set the language.
5. Diagnostics using the Display: Check the Watchtables, Cycle time and Memory.
6. Check whether the broadband cable of your conveyor model is connected to the
“S7-1500 DI/DO” socket on the back of your training case.
7. Switch on your conveyor model (green button).
8. Carry out a program test.

Function Description
The distribution conveyor is used to transport parts and can be operated in two different operating
modes. (Manual and Automatic)
These can be set using the control panel buttons “Operation ON” and “Operation OFF”.

Manual Mode "Operation" = off


Now, the conveyor motor can be jogged to the right “Jog right” and to the left “Jog left”.

Automatic Mode "Operation" = on


On the conveyor model, parts can be transported from Bay 1, 2 or 3 to the right, right up to the
light barrier, using the appropriate button at the respective Bay. Only one Bay may be occupied
(at a time).
The indicator lights at Bays 1, 2 and 3 show...
− A continuous light at the bay at which the associated sensor detects a part,
however only as long as the conveyor has not yet been started.
− A 2Hz flashing light as long as the conveyor motor is running.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-25
SIMATIC TIA Portal Programming 1

2.10. Additional Information

TIA-PRO1 - System Overview


2-26 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.10.1. ET200SP and ET200pro Controller

• SIMATIC S7-1500 with the design


of a SIMATIC ET 200SP or
ET200pro

• for machines with distributed


architecture and serial machines
with limited space

• Transfer of the intelligence from


the central control cabinet to
Distributed Controller

• Available in standard and fail-


safe version

Further Information under the Link:


TIA Portal Information Center > Product information > Controllers > SIMATIC controllers in
general > Distributed Controllers

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-27
SIMATIC TIA Portal Programming 1

2.10.2. Software Controller

• Use with industry-suitable SIMATIC IPCs

• Runs completely independently of the


Windows system (even with restart or
failure of Windows)

• Flexible controller for special-purpose


machines with high performance and
functional requirements

• Integration of user-specific functions via


open interfaces
(for example C++ / Matlab)

Further Information under the Link:


TIA Portal Information Center > Product information > PC-Based Automation > SIMATIC
Software Controller

TIA-PRO1 - System Overview


2-28 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.10.3. ET200SP Open Controller “All in one”

• - Controller with central, modular I/Os


• - Visualization and Windows applications
• - PC interfaces for monitor, mouse and keyboard
• - Gigabit Ethernet

Further Information under the Link:


TIA Portal Information Center > First steps > Getting Started > SIMATIC Open Controller -
Getting Started

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-29
SIMATIC TIA Portal Programming 1

2.10.4. SIMATIC S7-300: Modular Automation System

Features
• Modular compact control system for the lower and middle performance range
• Scaled CPU range
• Extensive range of modules
• Can be expanded to up to 32 modules
• Backplane bus integrated in the modules
• Can be networked with
Multipoint Interface (MPI),
PROFIBUS or
Industrial Ethernet or
PROFINET
• Central PG/PC connection with access to all modules
• No slot rules for I/O modules.

TIA-PRO1 - System Overview


2-30 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.10.4.1. SIMATIC S7-300: Modules

PS CPU IM SM: SM: SM: SM: SM: CP: FM:


(optional) (optional) DI DO DI/DO AI AO - Point-to-Point - Counting
- PROFIBUS - Positioning
- Industrial Ethernet - Closed-loop
- PROFINET control

Signal Modules (SM)


• Digital input modules: 24VDC, 120/230V AC
• Digital output modules: 24VDC, Relay
• Analog input modules: Voltage, Current, Resistance, Thermocouple
• Analog output modules: Voltage, Current

Interface Modules (IM)


The IM360/IM361 and IM365 make multi-tier configurations possible.
The interface modules loop the bus from one tier to the next.

Dummy Modules (DM)


The DM 370 dummy module reserves a slot for a signal module whose parameters have not yet
been assigned. A dummy module can also be used to reserve a slot for installation of an interface
module at a later date.

Function Modules (FM)


• Counting
• Positioning
• Closed-loop control.

Communication Processors (CP)


• Point-to-Point connections
• PROFIBUS
• Industrial Ethernet
• PROFINET.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-31
SIMATIC TIA Portal Programming 1

2.10.5. SIMATIC S7-400: Modular Automation System

Features
• The power PLC for the mid to upper performance range,
• Scaled CPU range
• Extensive range of modules
• Can be expanded to over 300 modules,
• Backplane bus integrated in the mounting rack
• can be networked with
Multipoint Interface (MPI),
PROFIBUS or
Industrial Ethernet or
PROFINET
• Central PG/PC connection with access to all modules,
• Only a few slot rules,
• Multicomputing (up to four CPUs can be used in the central rack).

TIA-PRO1 - System Overview


2-32 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

2.10.5.1. SIMATIC S7-400: Modules

PS CPU SM SM SM SM CP SM FM IM
DI DO AI AO

Signal Modules (SM)


• Digital input modules: 24VDC, 120/230VAC
• Digital output modules: 24VDC, Relay
• Analog input modules: Voltage, Current, Resistance, Thermocouple
• Analog output modules: Voltage, Current.

Interface Modules (IM)


The IM460, IM461, IM463, IM467 interface modules provide the connection between various
racks:
• UR1 (Universal Rack) with up to 18 modules
• UR2 (Universal Rack) with up to 9 modules
• ER1 (Extension Rack) with up to 18 modules
• ER2 (Extension Rack) with up to 9 modules.

Function Modules (FM)


• Counting
• Positioning
• Closed-loop control.

Communication Processors (CP)


• Point-to-Point connections
• PROFIBUS
• Industrial Ethernet
• PROFINET.

TIA-PRO1 - System Overview


Training Document, V14.01.01 2-33
SIMATIC TIA Portal Programming 1

Contents 4
4. Devices & Networks: Online Functions and Hardware Configuration .............. 4-2
4.1. Setpoint and Actual Configuration ........................................................................................ 4-3
4.2. Online Tools, Configuring and Parameterizing the Hardware .............................................. 4-4
4.3. Online Connection via Industrial Ethernet: IP Address and Subnet Mask ........................... 4-5
4.4. Default for Online Access and Visible Interfaces .................................................................. 4-6
4.4.1. Online Access: Accessible Devices ...................................................................................... 4-7
4.4.1.1. Accessible Devices: Online & Diagnostics, Task Card: Online Tools ................................. 4-8
4.4.1.2. Accessible Devices: Online & Diagnostics: Diagnostics Buffer ............................................ 4-9
4.4.1.3. Accessible Devices: Online & Diagnostics: IP Address, Name, Time, FW Update,
Memory Card ...................................................................................................................... 4-10
4.5. Resetting the CPU using the Mode Selector Switch .......................................................... 4-11
4.5.1. SIMATIC S7-1200/1500: Memory Concept for CPU Memory Reset .................................. 4-12
4.5.2. SIMATIC S7-1200/1500: Memory Concept for CPU Reset to Factory Settings ................. 4-13
4.6. Card Reader / USB Memory Device ................................................................................... 4-14
4.7. Working Areas of the Hardware and Network Editor .......................................................... 4-15
4.7.1. Hardware and Network Editor: Device View ....................................................................... 4-16
4.7.2. Hardware Catalog ............................................................................................................... 4-17
4.8. Adding a New Device (Controller)....................................................................................... 4-18
4.8.1. Selecting the Controller and the Modules ........................................................................... 4-19
4.8.2. CPU Properties: Ethernet Address ..................................................................................... 4-20
4.8.2.1. CPU Properties: Maximum Cycle Time .............................................................................. 4-21
4.8.2.2. CPU Properties: System and Clock Memory ...................................................................... 4-22
4.8.2.3. CPU Properties: Password Protection ................................................................................ 4-23
4.8.3. Inserting / Deleting a Module .............................................................................................. 4-25
4.8.4. Changing a Device / Module ............................................................................................... 4-26
4.8.5. Compiling the Hardware / Software and Downloading it into the CPU ............................... 4-27
4.9. Task Description: Creating a Project with an S7-1500 Station ........................................... 4-28
4.9.1. Exercise 1: Setting the IP Address of the PG ..................................................................... 4-29
4.9.2. Exercise 2: Erasing the SIMATIC Memory Card of the CPU.............................................. 4-30
4.9.3. Exercise 3: Resetting the CPU to Factory Settings using the Mode Selector Switch ........ 4-31
4.9.4. Exercise 4: Creating a New Project and Adding a New Device (Controller) ...................... 4-32
4.9.5. Exercise 5: Changing the Device Name and Disabling the F-activation ............................ 4-33
4.9.6. Exercise 6: Configuring the S7-1500 Station ...................................................................... 4-34
4.9.7. Exercise 7: CPU Properties: IP Address ............................................................................ 4-35
4.9.8. Exercise 8: CPU Properties: Parameterizing the Clock Memory Byte ............................... 4-36
4.9.9. Exercise 9: CPU Properties: Display Language and Display Protection ........................... 4-37
4.9.10. Exercise 10: Addresses of the DI Module........................................................................... 4-38
4.9.11. Exercise 11: Addresses of the DO Module ......................................................................... 4-39
4.9.12. Exercise 12: Addresses of the AI Module ........................................................................... 4-40
4.9.13. Exercise 13: Setting the Channel Parameters of the Analog Input Module ....................... 4-41
4.9.14. Exercise 14: Compiling the Device Configuration and Downloading it into the CPU ......... 4-42
4.9.15. Exercise 15: Setting the Time and Trying to Switch the Controller to RUN Mode ............. 4-44
4.10. Additional Information ......................................................................................................... 4-45
4.10.1. Swapping a Slot / Inserting a Module between Two Modules ............................................ 4-46
4.10.2. Copying Modules from a Reference Project ....................................................................... 4-47
4.10.3. Unspecified CPU ................................................................................................................. 4-48
4.10.4. ‘View’ Settings of the Task Cards ....................................................................................... 4-49

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-1
SIMATIC TIA Portal Programming 1

4. Devices & Networks:


Online Functions and Hardware Configuration

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

... be able to establish an online connection between PG and


CPU via Industrial Ethernet

… be able to use online functions to start and stop the CPU and
to reset it to factory settings

... be able to create and parameterize a new station

... be able to create and parameterize a setpoint (offline)


configuration

... be familiar with addressing the input and output modules of an


S7-1500 and be able to do it

TIA-PRO1 - Devices & Networks


4-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.1. Setpoint and Actual Configuration

Configuration Assignment of racks and modules of the central and


distributed I/O.

Parameter Assignment Specifying the behavior of parameter-assignable modules,


for example, startup behavior, retentive areas, etc.

Setpoint Configuration Planned hardware configuration and parameter assignment.

Actual configuration and parameter assignment of an


Actual Configuration
existing hardware.

Setpoint (Offline) and Actual Configuration


When you configure a system, a setpoint (offline) configuration is created. It contains a hardware
station with the planned modules and the associated parameters. The PLC system is assembled
according to the setpoint (offline) configuration. During commissioning, the setpoint (offline)
configuration is downloaded to the CPU.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-3
SIMATIC TIA Portal Programming 1

4.2. Online Tools, Configuring and Parameterizing the Hardware

with CPU Task Card

online → Status,
Diagnostics
offline → Configuration,
Parameterization

Online Tools
If it is possible to establish an online connection to the CPU, diagnostics and status information of
all modules can be called.
With CPUs that can be accessed online, the mode can also be controlled using the "Online tools"
task card and further status information (cycle time statistics and memory load) can be called.

Configuring and Parameterizing the Hardware


Almost all devices or components of an automation solution such as PLCs or touch panels can be
assigned parameters. The parameter assignment of the devices and network settings required for
commissioning is handled using the Hardware and Network Editor.
With this, for example, all components of an Ethernet network are assigned IP addresses via
which they communicate during later operation.
But even inside the automation device, address areas of the I/O modules must be specified and
the cycle monitoring time of the CPU must be set, for example.

TIA-PRO1 - Devices & Networks


4-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.3. Online Connection via Industrial Ethernet:


IP Address and Subnet Mask

MAC Address: 08-00-06-01-74-10 MAC Address: 08-00-06-01-74-20


Subnet Mask: 255.255.255.0 Subnet Mask: 255.255.255.0
IP Address: 192.168.111.10 IP Address: 192.168.111.12

Subnet Device Subnet Device

Internet Protocol
The Internet Protocol (IP) is the basis for all TCP/IP networks. It creates the so-called datagrams
(data packets specially tailored to the Internet protocol) and handles their transport within the
local subnet or their "routing" (forwarding) to other subnets.

IP Addresses
IP addresses are not assigned to a specific computer, but rather to the network interfaces of the
computer. A computer with several network connections (for example routers) must therefore be
assigned an IP address for each connection.
IP addresses consist of 4 bytes. With the dot notation, each byte of the IP address is expressed
by a decimal number between 0 and 255. The four decimal numbers are separated by dots
(see picture).

MAC Address
Every Ethernet interface is assigned a fixed address by the manufacturer that is unique
worldwide. This address is referred to as the hardware or MAC address (Media Access Control).
It is stored on the network card and uniquely identifies the Ethernet interface in a local network.
Cooperation among the manufacturers ensures that the address is unique worldwide.

Subnet Mask
The subnet mask specifies which IP addresses in the local network can be accessed. It separates
the IP address into the network and device part.
Only IP addresses whose network part is the same can be accessed.
e.g.: Subnet mask = 255.255.255.0 and IP address = 192.168.111.10
accessible IP addresses: 192.168.111.1 to 192.168.111.254

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-5
SIMATIC TIA Portal Programming 1

4.4. Default for Online Access and Visible Interfaces

In the Settings, you can have a default setting for the connection path for online access.
In the Online access folder, all possible interfaces of the PG/PC are displayed. Since not all of
these are required or can be used, interfaces can be hidden for better clarity.

TIA-PRO1 - Devices & Networks


4-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.4.1. Online Access: Accessible Devices

2 3

1. Online access or
Accessible devices 1
(Project or Portal view)
2. Select interface for the
search

3. Update accessible devices


or Start search

Accessible Devices in the Portal View


This function provides the option of fast access (for example for service purposes) even when
there is no offline project data for the target systems on the PG.
All accessible, programmable modules (CPUs, FMs CPs, HMI devices) are listed in the Portal
view, even if they are located in other subnets.

Access Online Functions → Button


Whenever there is an attempt to access a module online with the "Show" button and this is
located in a different subnet from the PG, a dialog opens asking whether an additional IP address
should be assigned to the PG.
Following confirmation, an additional IP address is assigned to the PG that is located in the same
subnet as the address of the CPU. After that, all online functions can be used.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-7
SIMATIC TIA Portal Programming 1

4.4.1.1. Accessible Devices: Online & Diagnostics,


Task Card: Online Tools

CPU Operator Panel: Mode Selector Switch


The operating mode of the CPU can be changed.
• RUN → STOP:
If there is a change from RUN to STOP, the CPU terminates the running user program.
• STOP → RUN:
If there is a change from STOP to RUN, the CPU performs a restart.

Cycle Time:
"Shortest", "Current" and "Longest" are the cycle times since the last CPU restart

With a Memory Reset (MRES), a CPU reset is carried out:


− All user data (even the retentive) is deleted (delete work memory)
(process images, memory bits, timers, counters, all program/data blocks)
− Retained are: IP addresses, the retentive part of the diagnostics buffer, operating hours
counter, time-of-day.

TIA-PRO1 - Devices & Networks


4-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.4.1.2. Accessible Devices:


Online & Diagnostics: Diagnostics Buffer

Details for the entry line


selected above

Online Access to the CPU


If the PG and the target system (for example CPU) are located in the same subnet, various
Online & diagnostics functions are available in the "Accessible devices" function.
• in the working area of the TIA Portal
• in the "Online tools" task card (see next page)

Diagnostics Buffer
The diagnostics buffer is a buffered memory area on the CPU organized as a circular buffer.
It contains all diagnostics events (error alarms, diagnostics interrupts, start-up information etc.)
of the CPU in the order in which they occurred. The highest entry is the last event to occur.
All events can be displayed on the programming device in plain language and in the order in
which they occurred.
All events can be displayed on the programming device in plain language and in the
order in which they occurred. In addition, not the entire diagnostics buffer is buffered with
Power OFF (only a part is retentive).

• Number of entries, 1000 to 3200


• Of that, retentive 250 to 500

Details on Event
Some additional information is also provided for the selected event in the "Details on event" box:
• Event name and number
• Additional information depending on the event, such as, the address of the instruction that
caused the event etc.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-9
SIMATIC TIA Portal Programming 1

4.4.1.3. Accessible Devices: Online & Diagnostics:


IP Address, Name, Time, FW Update, Memory Card

• Set Time (of Day)


Each S7 CPU has a real-time clock that can be set here.
• Assign IP Address
As long as no IP address has been specified already by a hardware configuration that was
downloaded earlier, this can be assigned or modified here (this function is also available
when the PG/PC and the CPU are not assigned to the same subnet).
• Reset to Factory Settings
Unlike the "memory reset", all the memory areas of the CPU (work, load and retentive
memory, diagnostics buffer and time) are deleted. Optionally (see dialog in the picture), the
IP address can also be deleted so that the CPU then only has a MAC address (Media Access
Control).
• Format Memory Card
The CPU memory card can also be deleted in the CPU via this online function. After that, the
CPU only has its IP address. All other data (including the device configuration) is deleted.
The card cannot be deleted in the card reader via the Project tree. Device configuration and
blocks have a gray background, that is, are write-protected (only status information or open
with a double-click).
• Assign Name
In PROFINET, each device must be assigned a unique device name that is stored retentively
on the device. The device name identifies a distributed I/O module (PROFINET IO) and
allows module replacement without a PG/PC.
• Firmware Update
The firmware version of the device and the modules can be updated. Under "Diagnostics ->
General", the current firmware version is displayed.

Caution: If the CPU and Display have to be updated, first the Display and then
the CPU.

TIA-PRO1 - Devices & Networks


4-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.5. Resetting the CPU using the Mode Selector Switch

RUN
STOP 1. Set the mode selector switch to STOP
MRES

RUN
2. Press and hold the mode selector switch in the MRES RUN/STOP-LED
STOP
position until the RUN/STOP LED has flashed 2x slowly of the S7-1500
MRES
RUN
STOP then let go again
MRES
within 3 sec !!!
RUN STOP
STOP 3. Press and hold the mode selector switch in the MRES
position until the RUN/STOP LED begins to flash quickly
MRES

RUN
STOP then let go again
Result:
MRES
With inserted PROGRAM card
RUN → Memory reset
4. Set the mode selector switch to RUN
STOP A CPU restart is carried out Without inserted card
MRES → Reset to factory settings

Particular Feature for CPU Memory Reset (MRES) using the Mode Selector Switch:
• when SIMATIC Memory Card (SMC) is inserted => Memory Reset
− All user data is deleted (work memory, retentive memory)
(process images, memory bits, counters, timers, all program/data blocks)
− Retained are: parameter assignment of the X1 (Ethernet) interface, the retentive part of the
diagnostics buffer, operating hours counter, CPU time-of-day
− The CPU copies all load memory data relevant for execution (memory card) into the
internal RAM work memory. (Data relevant for execution: device configuration, program
blocks, data blocks).

• when no SIMATIC Memory Card (SMC) is inserted => Reset to factory settings
− All memory areas of the CPU (work memory, retentive memory, diagnostics buffer, time-of-
day) and the IP address are deleted.
After the SMC is inserted, the load memory data relevant for execution is reloaded into the
internal RAM work memory from the memory card:
Device configuration (with IP address), program blocks, data blocks

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-11
SIMATIC TIA Portal Programming 1

4.5.1. SIMATIC S7-1200/1500: Memory Concept for CPU Memory Reset

With Memory Reset...


1 internal memory areas
Time-of-day Operating IP addresses
(system memory, entire data hours counter
and code working memory)
are deleted internal Flash Diagnostics
buffer
2 the user program and the
hardware configuration as well Load memory
as active Force jobs are
copied from the load memory Force jobs
RAM
2

System memory

Force 1
jobs 2 Code working memory
internal Flash

Data working memory


inserted Flash Card Retentive memory
Load memory

CPU Memory Reset


• What to do:
− STEP7 online function → MRES in "CPU operator panel" of "Test" and "Online tools" Task
Cards
− Display (only S7-1500) → Main menu "Settings", submenu "Memory reset"
− CPU mode selector switch (with inserted memory card)
• Impact
− An existing online connection between PG/PC and the CPU is disconnected.
− The entire RAM work memory is deleted, that is, all user data (process images, bit
memories, counters, timers, all program/data blocks, even the retentive ones)
− Retained are: IP addresses, diagnostic buffer, operating hours counter, CPU time-of-day.
− After that, the CPU copies all data relevant for execution into the RAM work memory from
the memory card. (Data relevant for execution: device configuration, program blocks, data
blocks, current Force jobs).

TIA-PRO1 - Devices & Networks


4-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.5.2. SIMATIC S7-1200/1500: Memory Concept for CPU Reset to Factory Settings

With Reset to factory ?


settings... Time-of-day Operating IP addresses
01.01.2012 hours counter
1 internal memory areas (incl.
time-of-day, diagnostics buffer,
operating hours counter) and internal Flash Diagnostic
module parameters are deleted buffer
IP addresses query in STEP7 Load memory
Force jobs
2 the user program, the RAM
hardware configuration and
active Force jobs are copied
from the external load memory
(SMC) System memory

Force 1
jobs 2 Code working memory
internal Flash

Data working memory


inserted Flash Card Retentive memory
Load memory

CPU Reset to Factory Settings


• What to do:
− STEP7 online function → MRES in "CPU operator panel" of "Test" and "Online tools" Task
Cards
− Display (only S7-1500) → Main menu "Settings", submenu "Memory reset"→ Factory
Defaults
− Mode selector switch (only without memory card)
• Impact
− An existing online connection between PG/PC and the CPU is disconnected.
− The entire RAM work memory is deleted, that is, all user data (process images, bit
memories, counters, timers, all program/data blocks, even the retentive ones, diagnostic
buffer), IP addresses are deleted if this is selected in STEP7.
− All IP addresses are retained if this was specified in STEP7.

If a memory card is inserted (or is already inserted), the CPU copies all data relevant for
execution into the internal RAM work memory from the memory card. (Data relevant for
execution: device configuration incl. IP address, program blocks, data blocks, current Force jobs).

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-13
SIMATIC TIA Portal Programming 1

4.6. Card Reader / USB Memory Device

S7-1200/1500

S7-300/400

• Removable media:
SMC
external hard drive
• Internal/external prommer: USB memory device
Memory Card
Micro Memory Card • Reader_X (user-defined memory):
Folder on hard drive

Card Reader / USB Memory


In the Card Reader/USB memory folder, you can access an SMC inserted in the SD Reader, the
internal/external prommer, removable (media) devices or user-defined folders.

Card Type of the SIMATIC Card for S7-1200/1500:


The SIMATIC Memory Card is used as a Program card or a Transfer card or for Firmware
Updates. Before the relevant data is stored on the SMC, the card type must be selected as
shown in the picture.
• SIMATIC Memory Card as Program Card:
The card contains all configuration and parameterization data for the station as well as the
entire user program with documentation. During operation, the card must remain inserted in
the CPU because it is used as a replacement for the internal CPU load memory which
remains unused.
• SIMATIC Memory Card as Transfer Card (only for S7-1200):
The card contains the same data as a Program card but it doesn’t have to remain inserted
during operation. After inserting the card and subsequent Power ON, all data is copied into
the internal load memory of the CPU. Then the card has to be removed and a restart has to
take place.
• SIMATIC Memory Card to Update Firmware:
The SIMATIC Memory Card contains the files required for a firmware update. After execution,
the SIMATIC Memory Card must be removed.

S7-300/400:
An S7-300 or S7-400 CPU does not have an SMC as load memory but a Memory Card or Micro
Memory Card. You can only access these cards with the help of an internal or external prommer.
Note: A SIMATIC Field PG has an internal prommer.

TIA-PRO1 - Devices & Networks


4-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.7. Working Areas of the Hardware and Network Editor

Connection configuration

Device configuration
and
module parameter
assignment
Topology configuration

Components of the Hardware and Network Editor


The Hardware and Network editor consists of a Device, Network and Topology view.

Device View
The Device view is used for configuring and parameterizing devices and modules.
• Hardware configuration
• Device and module parameter assignment

Network View
The Network view is used for configuring, parameterizing and networking devices.
• Configure and parameterize devices
• Connection configuration

Topology View
The Topology view is used for displaying, configuring and determining the physical structure of
networks.
• Configure the port assignment and the relationship between devices
• Online-Offline comparison as well as synchronization of the port assignment and relationships
• Topology makes it possible to exchange devices without a node initialization

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-15
SIMATIC TIA Portal Programming 1

4.7.1. Hardware and Network Editor: Device View

Device selection horizontal and vertical split

Graphic area

Tabular area

Module parameter assignment


→ Properties in the Inspector window

Components of the "Hardware and Network Editor"


"Device view" section in the working area
This editor consists of 2 areas, a tabular (left/top) and a graphic (right/bottom). The splitting left-
right or top-bottom can be changed as required.
− Graphic area = module configuration
− Tabular area = Address parameterization of configured modules
• "Properties" tab in the Inspector window
This tab is used to assign parameters to the module selected in the working area. Here, all
the properties or parameters of the selected module are displayed and can also be modified.
In the left-hand part of the Properties tab there is a navigation section in which the parameters
are arranged in groups.
• "Hardware Catalog" Task Card
Module catalog for the configuration (module grouping) in the working area

Project Tree → "Local Modules"


In the Project tree, the modules along with their parameter assignments (for example, addresses)
are stored under the relevant device in the "Local modules" folder.

TIA-PRO1 - Devices & Networks


4-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.7.2. Hardware Catalog

If several versions of modules


Search function Create /
exist, the version currently being
Select
used must be selected before
HW Profile
inserting.
Filter function

Information
(selected
module)

The Hardware catalog contains all devices and hardware components in a tree structure.
From the catalog, selected devices or modules can be dragged to the graphic working area of the
"Hardware and Network" editor.

Search Function
This allows a convenient search for specific hardware components. The search also includes the
module description texts.

Filter Function

enabled: Only modules that match the current context are displayed.

disabled: All existing objects of the catalog are displayed

Contents of the Hardware Catalog for Enabled Filter


• Network view → only objects that can be networked
• Device view → all modules or, for enabled filter, only the modules that belong to the current
device in the working area

Profile
It is possible to create and to use your own profiles. This expands the filter possibilities.

Information
The "Information" pane shows detailed information about the object selected in the catalog.
• Name
• Order number (Article no.)
• Version number

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-17
SIMATIC TIA Portal Programming 1

4.8. Adding a New Device (Controller)

Project view

Portal view

Add New Device


It is possible to create a new device in the project using the Hardware and Network editor with the
help of the “Hardware catalog” task card or through the Project tree “Add new device”.
When a new device is created, a suitable rack is also created automatically. The selected device
is inserted into the first permitted slot in the rack.
Regardless of the method selected, the added device is visible in the Device view and in the
Network view of the Hardware and Network editor.

TIA-PRO1 - Devices & Networks


4-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.8.1. Selecting the Controller and the Modules

Manual: “SIMATIC S7-1500 / ET 200MP Software: “TIA Selection Tool” (online or offline)
Automation system In a nutshell”

TIA Portal Information Center > Tools & Apps >


Entry ID: 109481357
Configurators

SIMATICS7-1500 provides you with a wide range of CPUs that can be integrated. You can
expand each CPU with I/O modules, communication modules and technology modules. If, for
example, the memory and performance of a CPU 1511-1 PN are sufficient for you, then you
expand it with communication modules for PROFINET and PROFIBUS. For technology functions,
technology CPUs and technology modules are available in addition to the Compact CPUs.

To select the correct controller there is the manual “SIMATIC S7-1500 / ET 200MP Automation
system In a nutshell” which contains further useful guidelines. It can be found under the Entry
ID: 109481357.

There is also the software TIA Selection Tool which provides an opportunity for selecting,
configuring and ordering the devices for Totally Integrated Automation. After configuring the
hardware in the TIA Selection Tool, you are given a list with all hardware components which are
required (modules, plugs, cables, profile rails etc.).
In addition, the order via the Industry Mall can be started directly from the TIA Selection Tool.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-19
SIMATIC TIA Portal Programming 1

4.8.2. CPU Properties: Ethernet Address

Select CPU

PROFINET Interface
Regardless of whether the editor is in the Device view or Network view, if the CPU is selected,
the settings of the CPU PROFINET interface can be made in the Inspector window in the
"Properties" tab.

If an online connection needs to be established between the programming device and


CPU, both devices must be assigned the same subnet mask and the IP addresses must
be located in the same subnet.

TIA-PRO1 - Devices & Networks


4-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.8.2.1. CPU Properties: Maximum Cycle Time

Cycle Time
This is the time that the CPU requires for one complete program execution, that is, one cycle.
Since parts of the user program can also be processed conditionally and the program execution
can also be interrupted (for example, by diagnostics interrupts, time interrupts, hardware
interrupts etc.), the length of the cycle time is not the same in every cycle.

Maximum Cycle Time


The operating system monitors the runtime of the program for the configured upper limit.
If the runtime of the program is longer than the “Maximum cycle time” set here
• … the operating system calls the associated time error interrupt OB.
• … the operating system enters the event in the diagnostics buffer.
• … the operating system indicates the error on the error LED of the CPU.
Behavior when the maximum cycle time is exceeded:
• S7-1200:
The CPU remains in RUN mode even if no time error interrupt OB is programmed.
• S7-1500:
If no time error interrupt OB is programmed, the CPU changes to STOP mode.
If the runtime of the S7-1200/1500 program is more than twice as long as the set maximum cycle
time (2xMaxCycleTime error), the CPU changes to STOP mode without attempting to call the
time error interrupt OB.
With the RE_TRIGR instruction, the monitoring of the cycle time can be retriggered or reset to 0.

Minimum Cycle Time


The minimum cycle time is the minimum time that should pass for the one-time execution of the
cyclic user program and the updating of the associated I/O. The start of the next CPU cycle is
delayed if this time has not yet expired.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-21
SIMATIC TIA Portal Programming 1

4.8.2.2. CPU Properties: System and Clock Memory

PLC tags

A PLC tag is automatically created for each available system or clock memory bit.

System Memory (4 bits)


These are memory bits that provide system status information.
• "FirstScan" =1 in the first CPU cycle; otherwise =0,
• "DiagStatusUpdate" =1, if the diagnostic status has changed,
• One static 1-memory bit and 0-memory bit each (“AlwaysTRUE”, “AlwaysFALSE”),

Clock Memory (8 bits)


These are memory bits whose binary state is changed periodically by the operating system of
the CPU with a pulse-pause ratio of 1:1. The various frequencies are shown in the picture.
Clock memory (bits) is used to trigger actions periodically.
For example, to make an indicator light flash

Attention!
Clock memory (bits) are not synchronized with the CPU cycle; in other words, with long
cycle times, the state of the clock memory (bits) can change more than once within one
cycle.

TIA-PRO1 - Devices & Networks


4-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.8.2.3. CPU Properties: Password Protection

Write protection for fail-safe functions

Write protection for fail-safe and standard S7 functions

Full protection for fail-safe and standard S7 functions

Full protection for fail-safe, standard S7 functions


and HMI access

HMI Standard Fail-Safe


read /Fail-Safe Standard
write functions
write read write

1
2
3
4

Protection Levels
With the following protection levels, the access rights (read / write) of the programming device to
the CPU are specified:
• Full access incl. fail-safe (no protection): → Default setting for F-CPU
Read and write access is always permitted.
• Full access (no protection): → Default setting for non-F-CPU
Read access is always permitted, write access only to standard program.
• Read access: → Write protection
Read-only access possible. No data can be changed in the CPU and no blocks or modified
hardware configuration or parameter assignment can be downloaded to the CPU without
specifying a password.
• HMI access: → Write and read protection for STEP7
No write or read access is possible from the engineering. Only the CPU type and identification
data can be displayed in the Project tree under "Accessible devices". It is not possible to
display online information or blocks under "Accessible devices" without entering a password.
• No access (complete protection): → General write and read protection for STEP7 and HMI.
Now, access for HMI devices without a configured password in the connection is also not
possible.

Access Permitted through Passwords


In the example shown, "No access (complete protection)" is selected. This means that without a
password, STEP7 and HMI devices can neither read-access nor write-access the CPU.
The above explained protection levels can, however, be lifted again with passwords:
• By specifying a password 4 an HMI device can once again read-access and write-access
the CPU. For STEP7, however, neither read-accesses nor write-accesses are possible.
• By specifying a password 3 an HMI device can once again read-access and write-access
the CPU and for STEP7, only read-accesses are permitted, not write-accesses.
• By specifying a password 2 read-accesses and write-accesses of the standard program of
the CPU are possible for both an HMI device as well as for STEP7.
TIA-PRO1 - Devices & Networks
Training Document, V14.01.01 4-23
SIMATIC TIA Portal Programming 1

• By specifying a password 1 read-accesses and write-accesses of the CPU are possible for
both an HMI device as well as for STEP7.

Permitting Access by Means of PUT/GET Communication:


• So that other controllers can access the CPU by means of PUT and GET functions, this must
be permitted in the Settings of the CPU under Protection & Security > Connection
mechanisms.

TIA-PRO1 - Devices & Networks


4-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.8.3. Inserting / Deleting a Module

Inserting from the


Hardware catalog
Possible
slots

Deleting in the Device view


deletes individual modules

1xR

Deleting in the Network


view deletes entire station

Inserting a Module
Modules can be inserted using drag & drop or by means of a double-click.

Selecting a Version
When selecting a module, you must pay attention to the correct version. If the module is selected
(highlighted) in the task card “Hardware catalog > Catalog”, the version can be selected in the
task card “Hardware catalog > Information”.

Deleting a Module
Deleted hardware components are removed from the system and assigned addresses are made
available again.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-25
SIMATIC TIA Portal Programming 1

4.8.4. Changing a Device / Module

1xR

Changing a Module
Compared to deleting and then inserting a new module, the advantage of changing is that when a
module is changed (replaced), all the parameters of the old module are adopted on the new
module. A module exchange can, for example, then be necessary when the CPU version in the
offline project is to be adapted to the CPU version (online) following a firmware update.
Hardware components can only be exchanged if the components are compatible.

It is also possible to change a device by dragging the new module from the Hardware catalog
onto the old module using drag & drop.

TIA-PRO1 - Devices & Networks


4-26 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.8.5. Compiling the Hardware / Software and Downloading it into the CPU

1xR 1xR

Status / Error
information

Compiling / Downloading the Hardware Configuration


The following components of a hardware station can be compiled and downloaded:
• Hardware and software (only changes)
All changes to the hardware configuration and hardware parameter assignment as well as all
changes to the user program are compiled/downloaded.
• Hardware (only changes) / Hardware configuration
Only the changes are compiled/downloaded,
• Hardware (rebuild all)
The entire hardware configuration and hardware parameter assignment is
compiled/downloaded.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-27
SIMATIC TIA Portal Programming 1

4.9. Task Description: Creating a Project with an S7-1500 Station

Task Description:
A new project with the name "MyProject2" is to be created. It is to contain an S7-1500 station
whose configuration is to correspond exactly to that of your training device.
Furthermore, the modules are to be assigned parameters and the input and output addresses are
to be set so that they match those specified in the chapter "Training Devices".

TIA-PRO1 - Devices & Networks


4-28 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.9.1. Exercise 1: Setting the IP Address of the PG


PG with Windows 7

Task
You are to set the IP address of the Ethernet interface of the PG.

What to Do:
1. Connect the Ethernet interface of the PG to the "P2" connection on the training device using
an Ethernet cable.
2. Assign the IP address 192.168.111.90 and the subnet mask 255.255.255.0 to this PG
interface. Proceed as shown in the picture.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-29
SIMATIC TIA Portal Programming 1

4.9.2. Exercise 2: Erasing the SIMATIC Memory Card of the CPU

Task
In order to completely erase the CPU, the SIMATIC Memory Card of the CPU must also be
erased. This can be carried out as follows:
• with the Windows Explorer (SMC is inserted in the PG’s Card Reader)
• with the TIA Portal (SMC is inserted in the PG’s Card Reader)
• with the TIA Portal (SMC is inserted in the CPU)

What to Do:
1. Check whether the SMC is inserted in the CPU.
2. In the Project view, under the interface through which there is a connection to the controller,
display all "Accessible devices"
3. Under the S7-1500 station, activate "Online & diagnostics" (see picture)
4. There under "Functions", activate "Format memory card" (see picture)

Note
If a password is stored on the CPU that is unknown to you, it is only possible to erase the SMC if
it is inserted in the PG’s Card Reader.

TIA-PRO1 - Devices & Networks


4-30 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.9.3. Exercise 3: Resetting the CPU to Factory Settings using the Mode Selector
Switch

RUN
STOP 1. Set the mode selector switch to STOP and remove the SMC
MRES

RUN
2. Press and hold the mode selector switch in the MRES RUN/STOP LED
STOP
position until the RUN/STOP LED has flashed 2x slow of the S7-1500
MRES
RUN
STOP then let go again
MRES
within 3 sec !!!
RUN STOP
STOP 3. Press and hold the mode selector switch in the MRES
position until the RUN/STOP LED begins to flash quickly
MRES

RUN
STOP then let go again
MRES

RUN
4. Insert the SMC and set the mode selector switch to RUN
STOP A CPU restart is carried out
MRES

Task
In the last exercise you erased the SMC of the CPU. Now, you are to reset the CPU to its factory
settings using the mode selector switch.

What to Do
1. Switch the CPU to STOP and remove the SMC.
2. Carry out the reset to factory settings directly on the CPU following the steps shown in the
picture.

Note:
A CPU restart is not yet possible since no program (Organization Block) has been loaded.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-31
SIMATIC TIA Portal Programming 1

4.9.4. Exercise 4: Creating a New Project and Adding a New Device (Controller)

Task
You are to create a new project with the name "MyProject2" and you are to add a new device.

What to Do
1. Save your current project.
2. Create a new one and give it the name “MyProject2”.
3. Add the controller off-line which corresponds to your training device as a new device.
(In Exercise 1 of Chapter 2 “System Overview”, you already read out the required information
via the Display and made a note of it.)

TIA-PRO1 - Devices & Networks


4-32 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.9.5. Exercise 5: Changing the Device Name and Disabling the F-activation

Task
You are to change the device name of the CPU and disable the F-activation.

What to Do
1. Select (highlight) the controller in the Project tree and rename it S7-1500.
2. Open the Device view and the Properties of the CPU in the Inspector window.
3. In the “Fail-safe” menu, deactivate the F-capability.
Result: The folder “Safety Administration” is no longer visible in the Project tree.
4. Switch to the “Protection & Security” folder and activate the protection level “Full access
incl. fail-safe (no protection)” (see picture below).

5. Save your project.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-33
SIMATIC TIA Portal Programming 1

4.9.6. Exercise 6: Configuring the S7-1500 Station

Drag & Drop

Task
In your offline project, you are to configure the S7-1500 station in such a way that the module
arrangement matches that of your actual training device.

What to Do
1. In slots 2 to 4, add the I/O modules from the "Hardware catalog" task card using drag & drop.
(In Exercise 1 of Chapter 2 “System Overview”, you already read out the required information
via the Display and made a note of it.)
2. Insert the appropriate power module from the Catalog into Slot 1.
3. Save your project.

TIA-PRO1 - Devices & Networks


4-34 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.9.7. Exercise 7: CPU Properties: IP Address

Task
The S7-1500 CPU is to be assigned an IP address offline in the project.

For PROFINET-IO Controllers, a device name is not absolutely necessary. For IO-
Devices, it is required for the device identification by the IO-Controller.

What to Do
1. In the "Device view", select the CPU.
2. In the Inspector window under "Properties", select the folder "PROFINET interface [X1] >
Ethernet addresses". Enter the IP address and the subnet mask shown in the picture.
3. Save your project.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-35
SIMATIC TIA Portal Programming 1

4.9.8. Exercise 8: CPU Properties: Parameterizing the Clock Memory Byte

Task
In the CPU Properties, you are to parameterize memory byte 10 as a clock memory byte.

What to Do
1. In the "Properties" tab, select the folder "System and clock memory ".
2. Enable the clock memory (byte) and specify address 10 for the byte address.
3. Save your project.

Note:

Only the Clock memory and not the System memory is required. For that reason,
deactivate the System memory byte.

TIA-PRO1 - Devices & Networks


4-36 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.9.9. Exercise 9: CPU Properties:


Display Language and Display Protection

Task
In the CPU Properties, you are to parameterize the display language of the CPU-Display and the
display protection.

What to Do
1. In the "Properties" tab under "Display > General", select the item Display language and set
the display language to "English".
2. In the Password menu, enable the display protection.
3. Enter a password.
4. Save your project.

Note on Password Assignment:

Upper and lower case is not relevant, since only the letters A to Z and digits 0 to 9 can be
selected when making entries on the Display.
Since there is no Display keypad, it is recommended for this exercise that you select a
simple (possibly only numerical) password.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-37
SIMATIC TIA Portal Programming 1

4.9.10. Exercise 10: Addresses of the DI Module

Task
You are to parameterize the I/O addresses of the DI module as shown in the picture.

What to Do
1. In the Device view, select the DI module (see picture).
2. In the Inspector window, in the “Properties > General” tab, go to the point “Input 0 - 31 > I/O
addresses”.
3. Enter the I/O address 0 shown in the picture, (this can also be done in the tabular area of the
Device view, see picture)
4. Set the update of the Process image to Automatic so that the address is automatically
updated by the system in every program cycle.
5. Save your project.

Notes:
1. The 1500 CPU offers the possibility of using up to 31 process image partitions. "PIP 1" to
"PIP 31" process image partitions can be assigned to certain Organization Blocks. After the
OB is started, the assigned process image partition for the inputs is updated by the system.
At the end of the OB, the outputs of the assigned process image partition are written to the
I/O outputs by the system. The process image partitions are excluded from the automatic
update.
2. A process image partition can be updated in the user program with special instructions. For
this, there are the functions "UPDAT_PI" for the process image partition of inputs and
"UPDAT_PO" for the process image partition of outputs.

TIA-PRO1 - Devices & Networks


4-38 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.9.11. Exercise 11: Addresses of the DO Module

Task
You are to parameterize the I/O addresses of the DO module as shown in the picture.

What to Do
1. In the Device view, select the DO module (see picture).
2. In the Inspector window, in the “Properties > General” tab, go to the point “Output 0 - 31 > I/O
addresses”.
3. Enter the I/O address 0 shown in the picture and set the update of the Process image to
Automatic.
4. Save your project.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-39
SIMATIC TIA Portal Programming 1

4.9.12. Exercise 12: Addresses of the AI Module

Task
You are to parameterize the I/O addresses of the AI module as shown in the picture.

What to Do
1. In the Device view, select the AI module (see picture).
2. In the Inspector window, in the “Properties > General” tab, go to the point “Input 0 - 7 > I/O
addresses”.
3. Enter the I/O address 10 shown in the picture.
4. In the assignment of the process image, set “None” since the analog value of the module is to
be read directly by the I/O later in the program and thus does not have to be updated with any
process image.
5. Save your project.

TIA-PRO1 - Devices & Networks


4-40 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.9.13. Exercise 13:


Setting the Channel Parameters of the Analog Input Module

Task:
You are to set the analog channels to the appropriate parameters:
− Set the Channel template (Measurement type) to ‘Deactivated’
− Channel 0 → Voltage +/-10V
− Channel 1 → Current (4-wire transducer) +/-20 mA

What to Do
1. In the Inspector window, in the “Properties > Module parameters” tab, go to the point
“Channel template > Inputs” and set Measurement type ‘Deactivated’ as the template.
2. Under “Properties > Input 0 - 7 > Inputs” set the Measurement type “Voltage” +/-10V for
Channel 0 and for Channel 1 set the Measurement type “Current (4-wire transducer)” +/-20
mA.
3. Save your project.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-41
SIMATIC TIA Portal Programming 1

4.9.14. Exercise 14: Compiling the Device Configuration and Downloading it into
the CPU

1xR

Task
You are to compile the configuration and parameterization of the S7-1500 hardware station and
then download it into the CPU.
Note:
As long as the CPU doesn’t have a program, the CPU does not go into RUN mode when there is
a restart! That is, if, as shown in the picture, you only download the hardware configuration into
the CPU in this exercise, the CPU will not switch into the RUN mode with a subsequent restart!

What to Do
1. In the Project view, select your S7-1500 station.
2. Compile the HW-Station (right-click on the station, see picture)
3. After an error-free compilation, download the hardware configuration into the CPU (right-click
on the station, see picture)

Note: When using the buttons shown here to the left, a Delta compilation or Delta
download of the folder(s) and subfolder(s) selected in the Project tree is always carried
out. That is, if a station (CPU) is selected, a Delta compilation or Delta download of the
entire station, (hardware and software) is carried out.

Continued on the next page

TIA-PRO1 - Devices & Networks


4-42 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4. Confirm the information in the dialog by pressing the button "Load":

5. After you have activated "Load", another dialog appears which you fill-in as follows and then
conclude with "Finish":

If you have only downloaded the hardware configuration into the CPU, the CPU should now
remain in the STOP mode.
6. In the "Inspector window" under "Info -> General" check the result of the hardware
configuration download:

7. Save your project.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-43
SIMATIC TIA Portal Programming 1

4.9.15. Exercise 15: Setting the Time and Trying to Switch the Controller to RUN
Mode

Task
By means of the TIA Portal, you are to set the time on the controller and try to start the controller.

What to Do
1. Open the Online access of the S7-1500 CPU via the object “Online & diagnostics” in the
Project tree.
2. Establish an online connection to the controller via the button “Go online” (The “Go online”
button is located in the toolbar and in the ‘Online access’ window opened in the working
area).
3. In the ‘Online access’ window, switch to the menu “Functions > Set time”.
(The PG/PC time and the Module time can be seen.)
4. Adopt the PG/PC’s time by activating the item “Take from PG/PC” and confirm with the
“Apply” button.

Note:
If the item “Take from PG/PC” is deactivated, the module time can be manually changed.

TIA-PRO1 - Devices & Networks


4-44 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.10. Additional Information

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-45
SIMATIC TIA Portal Programming 1

4.10.1. Swapping a Slot / Inserting a Module between Two Modules

Swapping a Slot or Inserting a Module between Two Modules.


Using drag & drop, drag the modules in front of or behind the slot number until the marking
appears at the desired location, as shown in the picture. The module is placed where the marking
is and the modules behind it are moved one slot to the right.

TIA-PRO1 - Devices & Networks


4-46 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.10.2. Copying Modules from a Reference Project

Via the menu "View", the “Reference projects” view can be shown, in which projects can be
opened as write-protected. Modules can be copied into the Device view from a Reference
Project. In doing so, all parameter assignments are adopted.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-47
SIMATIC TIA Portal Programming 1

4.10.3. Unspecified CPU

For the selection of the controller, you can also choose an “Unspecified CPU”. This is necessary
when the real CPU is not yet known but you would already like to start programming. Here, you
only need to specify the firmware of the CPU which is to be used later on. The firmware version
must be specified since some functions and instructions which are used for programming depend
on the firmware version.
Then, you can write the program without having configured the actual hardware. The hardware
can later be configured from the Hardware catalog or determined online.

TIA-PRO1 - Devices & Networks


4-48 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

4.10.4. ‘View’ Settings of the Task Cards

Single pane mode Multi-pane mode

Change pane
mode

You can choose between two pane modes:


• Single pane mode:
There is only one pane open at a time. If a different pane is selected, the previously open
pane is closed automatically.
• Multi-pane mode:
Several panes can be open at the same time.

Setting for the Device Configuration


Since there is generally more than one version of a module when configuring the devices (CPUs,
I/O modules), the required version must be selected.
Since this additional information on the modules selected in the catalog is shown in the
"Information" pane, it is recommended that the multi-pane mode is set here.

TIA-PRO1 - Devices & Networks


Training Document, V14.01.01 4-49
SIMATIC TIA Portal Programming 1

Contents 5
5. PLC Tags ................................................................................................................. 5-2
5.1. What are Tags and Why do You Need them? ...................................................................... 5-3
5.1.1. Addresses of PLC Tags ........................................................................................................ 5-4
5.2. Elementary Data Types Bit and Numeric.............................................................................. 5-5
5.2.1. Elementary Data Types Date, Time and Character .............................................................. 5-6
5.3. Declaration and Definition of PLC Tags ................................................................................ 5-8
5.3.1. PLC Tags and PLC Constants .............................................................................................. 5-9
5.3.2. PLC Tags in the Device View ............................................................................................. 5-11
5.3.3. Finding / Replacing / Sorting PLC Tags .............................................................................. 5-12
5.3.4. Error Indication in the PLC Tag Table ................................................................................ 5-13
5.3.5. Copy & Paste PLC Tags to Excel ....................................................................................... 5-14
5.3.6. Retentiveness of PLC Tags ................................................................................................ 5-15
5.4. Details View of PLC Tags ................................................................................................... 5-16
5.5. Monitoring PLC Tags .......................................................................................................... 5-17
5.5.1. Modifying PLC Tags by means of the Watch Table............................................................ 5-18
5.6. Exercise 1: Copying the PLC Tag Table from the Library .................................................. 5-19
5.6.1. Exercise 2: Creating the “Conveyor” Tag Table ................................................................. 5-20
5.6.2. Exercise 3: Monitoring the “Conveyor” PLC Tag Table ...................................................... 5-21
5.6.3. Exercise 4: Modifying using the Watch Table ..................................................................... 5-22

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-1
SIMATIC TIA Portal Programming 1

5. PLC Tags

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

... be familiar with PLC tags and their memory areas

… be able to create PLC tags and address them

… know elementary data types

… be familiar with global constants and system constants

... be able to apply the Details view

... learn how to monitor and modify PLC tags

TIA-PRO1 - PLC Tags


5-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

5.1. What are Tags and Why do You Need them?

A tag...

• is a memory space on the CPU


• saves values/data
• is described by its name, memory area, address and data type
(size, possible value range, use, allowed instructions)

Memory areas of PLC tags: Process state

Process control
• Process (image) tags for Inputs or Q Outputs
• Auxiliary tags for saving values in the Memory byte area
• CPU-internal Count area and Time area (Timer) e.g. clock
→ not available for S7-1200 memory (byte)

Simatic counters and timers for simple but


limited count and time functions

The Importance of PLC Tags


Next to commands, tags (variables) are the most important elements of a programming system.
Their task is to save values in a program so that they can be further processed at a later time.

Data Types
The data type determines which values are accepted by data and which instructions can be
carried out with these values.

Memory Areas of Inputs and Outputs


Within a controller, the data is stored in different memory areas. The input signals of input
modules are stored in the process image for inputs where they can be consistently read out
throughout a cycle. The control of the process happens via the process image for outputs which
is then written to the output modules.

Memory Byte Area


Internally, there is an additional storage area in which values can be saved. Since the clarity and
the re-usability of individual tags (variables) of the memory byte area are not fulfilled, there are
still other areas which will be discussed in later chapters.

CPU-internal Count and Time Areas (Simatic Counter and Timer)


These are a simple way to use count and time functions. SIMATIC counters and timers are,
however, very limited. The counters only have a value range of 0 to 999 and the timers can only
record times up to 2 hours 46 minutes and 30 seconds with an accuracy of 10 milliseconds and
are not available on 1200-series CPUs.
For greater demands on timers and counters there are functions which also will be dealt with in
later chapters.

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-3
SIMATIC TIA Portal Programming 1

5.1.1. Addresses of PLC Tags

Process image for inputs Process image for outputs


7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 ... 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 ...
%IB0 %IB1 e.g. %I 1.5 %QB0 e.g. %Q0.6 %QB1

Memory byte area Simatic Counter Simatic Timer


%MB0 7 6 5 4 3 2 1 0 %C0 2 bytes %T0 2 bytes
%MB1 7 6 5 4 3 2 1 0 %C1 2 bytes %T1 2 bytes
Times up to 2h46m30s0ms


e.g. %M1.7 Value range only 0..999
Max. accuracy >=10ms

Bit → %{Area}{Byte address}.{Bit addr.} → (e.g. %M8.4)


Byte, Word, Double-word → %{Area}{size}{Byte address} → (e.g. %MD23)
Lword (64bit) → %{Area}{Address of start bit} → (e.g. %M15.0)
SIMATIC Counter and Timer → %{Area}{Number} → (e.g. %T41)

Addressing
An address exactly defines where values are written or read.
They begin at byte address, that is, at the number “0”.
The addresses are consecutively numbered, and, within a byte, the bit address 0..7 is numbered
from right to left.

Address Style With/Without %


The %-character identifies the presentation of an address. It can be left out during address entry
since it is automatically added by the engineering framework.

PLC Tags > 32 Bits:


For tags that are greater than 32 bits (e.g. LWORD), only the start bit is specified during
addressing since this can only be accessed symbolically. The required number of bytes that must
be reserved for these tags results from the data type of the PLC tag.

TIA-PRO1 - PLC Tags


5-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

5.2. Elementary Data Types


Bit and Numeric

Description Size (Bit) S7- S7- Example


1200 1500
Bit Data BOOL 1 TRUE
Types BYTE 8 B#16#F5
WORD 16 W#16#F0F0
DWORD 32 DW#16#F0F0FF0F

LWORD 64 LW#16#5F52DE8B

Numeric SINT 50
8
Data Types USINT 20
INT -23
16
UINT 64530

DINT DINT# -2133548520


UDINT 32 UDINT#435676
REAL 1.0

LREAL 64 LREAL#-1.0e-5

LINT LINT#1543258759
64
ULINT ULINT#154316159

BOOL, BYTE, WORD


Variables of the data type BOOL consist of one bit. Variables of the data types BYTE and WORD
are bit sequences of 8 or 16 bits. The individual bits are not evaluated in these data types.
Special forms of these data types are the BCD numbers and the count value as it is used in
conjunction with the count function.
Note:
In the illustration above, #16# denotes that the value is representented in Hexadecimal format.

INT, REAL
Variables of these data types represent numbers with which relevant arithmetical calculation
operations can be carried out. (INT –> integer, REAL -> floating point number)

Extensions of INT, REAL and WORD

U - Unsigned
Variables with the extension “U” represent a variable without sign of the relevant data type. Data
types: USINT, UINT, ULINT, UDINT

S - Short
Variables with the extension “S” represent a variable with a length of 8 bits of the relevant data
type. Data types: SINT, USINT

D - Double
Variables with the extension “D” represent a variable with a length of 32 bits of the relevant data
type. Data types: DWORD, DINT, UDINT

L- Long
Variables with the extension “L” represent a variable with a length of 64 bits of the relevant data
type. Data types: LWORD, LINT, ULINT, LREAL

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-5
SIMATIC TIA Portal Programming 1

5.2.1. Elementary Data Types


Date, Time and Character

S7- S7-
Description Size (Bit) Example
1200 1500
Time Types TIME 32 T#2h46m30s630ms
DATE 16 D#1994-01-21
TIME_OF_DAY 32 TOD#18:15:18:999

S5TIME 16 S5T#1h24m10s

LTime LT#11350d20h25m14s830ms652µs315ns
LTIME_OF_DAY 64 LTOD#10:20:30.400_365_215
LDT (DATE_AND_LTIME) LDT#2008-10-25-08:12:34.567
Character CHAR 8 ‘R’
Type
WCHAR 16
WCHAR#'w'

TIME, LTIME
A variable of the data type TIME (duration in [ms]) occupies a double-word. This variable is used,
for example, for specifying time values in IEC timer functions. The contents of the variable are
interpreted as a DINT number in milliseconds and can be either positive or negative (for example:
T#1s=L#1000, T#24d20h31m23s647ms = L#2147486470).
Just like TIME, LTIME represents a duration whereby the duration is saved with nanosecond
resolution in 64 bits. That means, compared with the data type TIME, longer durations with
greater resolution can be saved in variables of the data type LTIME.

DATE
A variable of the data type DATE is stored in a word in the form of an unsigned integer. The
contents of the variable represent the number of days since 01.01.1990.

TIME_OF_DAY, LTIME_OF_DAY
The data type TOD (TIME_OF_DAY) occupies a double-word and stores the number of
milliseconds since the beginning of the day (0:00 o‘clock) as an unsigned integer. Variables of the
data type LTOD occupy two double-words and state the number of nanoseconds since the
beginning of the day.

LDT (Date_AND_LTIME)
The data type LDT (DATE_AND_LTIME) occupies 8 bytes and stores information on date and
time in nanoseconds since 01.01.1970 0:00.

S5TIME
Variables of the data type S5TIME are required for specifying time values in timer functions (S5-
timing elements). You specify the time in hours, minutes, seconds or milliseconds. You can enter
the timer values with an underline (1h_4m) or without an underline (1h4m).

TIA-PRO1 - PLC Tags


5-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

CHAR, WCHAR
The data type CHAR (8 bits) represents a character in ASCII representation and WCHAR (16
bits) a character in Unicode format.

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-7
SIMATIC TIA Portal Programming 1

5.3. Declaration and Definition of PLC Tags

Declaration of a tag:
• create/introduce (any)
• define name and data type

Definition of a tag:
• allocation of a memory area
(memory area letter, size and address)

Creating a new PLC tag:


1. Add a new tag table or
open an already existing table
2. Declare the PLC tag (name, data type)
3. Define the PLC tag (address)

“Default tag table”

Number of tags in the table

PLC Tag Tables


In order to achieve a good readability of the CPU program, it makes sense to structure the data
storage. For this, there are PLC tag tables for the PLC tags.

Tag Tables
The default tag table (name can be changed) contains additional CPU information and thus
cannot be deleted. It can be used for any PLC tags, but for better clarity, it is recommended that
several tag tables be created.

Declaration and Definition of PLC Tags


In the declaration of a tag in the PLC tag table, the symbolic name (for example, "M_Jog_Right"),
the data type (for example, Bool) and the absolute address (for example, M16.2) are defined.

TIA-PRO1 - PLC Tags


5-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

5.3.1. PLC Tags and PLC Constants

PLC Tags
The PLC tag table contains the declaration (definition) of CPU-wide valid and thus global tags
and constants. For each CPU added in the project, a PLC tag table is automatically created. A
PLC tag table contains one tab each for Tags and User constants; the Default tag table also
contains a tab for System constants. Tags are operands with changeable content used in the
user program.

User Constants
A constant defines an unchangeable data value. During program execution, constants can be
read by various program elements, but they cannot be overwritten. Changing the constant value
while the program is running is not possible.
In TIA Portal, it is possible to declare symbolic names for constants so as to make static values
available in the program under one name. These symbolic constants are valid throughout the
CPU. The declaration of the constants is made in the "User constants" tab of the PLC tag table.
Constants are operands with unchangeable content, and in addition, constants do not require an
absolute address.

Creating Tags and Constants with Group Function


By clicking on the "Fill" symbol in the lower right corner of the cell and then dragging it down, tags
and constants are automatically created (comparable to Excel).
It is possible to automatically create tags and constants through the "Name" and "Address" (only
for tags) columns. The new tags and constants are created with the name of the current
tag/constant appended by a consecutive number. From a tag or constant with the name
"T_Station", new tags/constants are then created with the names "T_Station_1", "T_Station_2"
etc.

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-9
SIMATIC TIA Portal Programming 1

System Constants
System constants are CPU-wide unique, global constants which are required by the system and
are automatically created. System constants can, for example, serve the addressing and
identification of hardware objects.
Rules
System constants are automatically assigned in the Device view or Network view when
components are inserted and are entered in the Default tag table ("System constants" tab). A
system constant is created for each module but also for each submodule. In that way, for
example, an integrated counter is also given a system constant. System constants consist of a
symbolic name as well as a numeric HW-ID and cannot be changed.
System Constant Names
The names of system constants are hierarchically structured. They consist of a maximum of four
hierarchy levels which in each case is separated by a tilde "∼". In this way, you can recognize the
"path" to the relevant hardware module based on the name.

Example
A system constant with the name "Local~PROFINET_interface_1~Port_1" denotes Port 1 of the
PROFINET interface 1 of the local CPU.

TIA-PRO1 - PLC Tags


5-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

5.3.2. PLC Tags in the Device View

System constants

The PLC tags of inputs and outputs can also be declared and changed in the Device view. In the
Properties, in the Inspector window you open the IO tags tab for this.
In addition, the system constants of the selected hardware are displayed in the "System
constants" tab.

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-11
SIMATIC TIA Portal Programming 1

5.3.3. Finding / Replacing / Sorting PLC Tags

Click on the column name to sort

Sorting
By clicking on one of the column names "Name", "Data type" or "Address", the tags are sorted
alphabetically or according to address (ascending or descending) depending on the column.

Finding / Replacing
In the PLC tag table, tags can be found and replaced via the "Tasks" Task Card. Dummies can
also be used (? for one character, * for several characters).

Example of "Find and replace":


Assign byte address 4. to all outputs with byte address 8.:
Find: Q 8. and Replace with: Q 4.

TIA-PRO1 - PLC Tags


5-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

5.3.4. Error Indication in the PLC Tag Table

If the name (symbol) already exists in the table,


a "(1)" is automatically added

!!! The absolute address is not compatible with the


data type of the tag!

Absolute address is used twice!

!!!

Syntax Check
With every entry, there is a syntax check in which existing errors are displayed in RED, or for
warnings in YELLOW. A still faulty PLC tag table can be saved but as long as it is still faulty, the
program cannot be compiled and downloaded into the CPU.

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-13
SIMATIC TIA Portal Programming 1

5.3.5. Copy & Paste PLC Tags to Excel

Import from Excel only in


"Show all tags" tag table

Export from all tag tables to


Excel

Copy & Paste from and to Excel


The Windows Copy & Paste function as well as the Import / Export function can be used to easily
copy individual or several tags from a PLC tag table or a data block to Excel to further process
it/them there and then to copy it/them back from Excel to the PLC tag table or the data block.

TIA-PRO1 - PLC Tags


5-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

5.3.6. Retentiveness of PLC Tags

S7-1500:
 Retentiveness (retain)
can be set for memory
bytes, timers and
counters
S7-1200:
 Retentiveness (retain)
Example:
can only be set for
MB0 … MB16 are retentive memory bytes

Retentive (Retain) Memory


The S7-1500 CPUs have a retentive memory for storing retentive data when the power is
switched OFF. The size of the retentive memory is documented in the technical data of the CPU.
The utilization of the retentive memory of the configured CPU is shown offline in the Project tree
under "Program info > Resources of…" or online in the Project tree under "Online & diagnostics >
Diagnostics > Memory".
When you define data as retentive, their contents are retained after a power failure, during CPU
start-up and during loading of a modified program.
You can define the following data or objects as retentive:
• Memory bytes, timers, counters
• Tags of global data blocks
• Tags of instance data blocks of a function block
Certain tags of technology objects are always retentive, for example, adjustment values of
absolute value encoders.

Memory Bytes, Timers, Counters


For the S7-1500, the number of retentive memory bytes, timers and counters can be defined in
the PLC tag table via the "Retain" button.
For the S7-1200, only the number of retentive memory bytes can be defined in the PLC tag table
via the "Retain" button.

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-15
SIMATIC TIA Portal Programming 1

5.4. Details View of PLC Tags

Select the Select the


Tag table Hardware module

The Details view shows the tags of the object selected (highlighted) in the Project tree:
For example:
• ...tags of the selected tag table
• ...channels of the selected local modules and their tags
That way it is easy for the user, using drag & drop, to integrate tags in the user program, for
example.

TIA-PRO1 - PLC Tags


5-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

5.5. Monitoring PLC Tags

Monitor all On / Off

Monitoring PLC Tags


PLC tags can be monitored directly through the PLC tag table. In so doing, the "Monitor value"
shows the current value of the tags in the CPU.

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-17
SIMATIC TIA Portal Programming 1

5.5.1. Modifying PLC Tags by means of the Watch Table

Modify values once Monitor all On / Off

Activate/Deactivate
values to be modified

In order to be able to modify tags (variables) you require a watch table which you can create in
the ‘Watch and force tables’ folder.
Any tags (values) can be monitored and modified in a Watch table. To modify a tag, a modify
value is specified, the tag to be modified is activated (is automatically activated during creation)
and by means of the button “Modify all selected values once and now” the values of the activated
tag are loaded into the controller.

TIA-PRO1 - PLC Tags


5-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

5.6. Exercise 1: Copying the PLC Tag Table from the Library

Task
You are to copy the prepared PLC tag table "My_Tags" from the "PRO1_Lib" library into your own
project.

What to Do
1. In the Task Card “Libraries > Global libraries”, open the library "PRO1_Lib" which is located in
the folder C:\02_Archives\TIA_Portal\TIA-PRO1 of your programming device.
2. Using drag & drop, copy the PLC tag table "My_Tags" from the Libraries’ folder Master
copies\Chapter 05 into your project’s folder PLC tags.
3. Save your project.

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-19
SIMATIC TIA Portal Programming 1

5.6.1. Exercise 2: Creating the “Conveyor” Tag Table

Task
You are to create a separate PLC tag table "Conveyor" for the inputs and outputs to which the
sensors and actuators of the conveyor model are connected.

What to Do
1. Using "Add new tag table", create the new PLC tag table "Conveyor".
2. Open the PLC tag table "My_Tags" and move the inputs and outputs into the newly created
PLC tag table "Conveyor" using drag & drop (mouse pointer on tag icons, see picture).
3. Save your project.
Note:
As an alternative, for every tag you can define in which tag table it is to be saved. You do this in
the tag table "Show all tags" via the column "Tag table".

TIA-PRO1 - PLC Tags


5-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

5.6.2. Exercise 3: Monitoring the “Conveyor” PLC Tag Table

"K_Right" (Q 3.5) "B_Bay1" "B_Bay2" "B_Bay3" "B_LB"


"K_Left" (Q 3.6) (I 3.5) (I 3.6) (I 3.7) (I 3.0)

"S_Bay1" "S_Bay2" "S_Bay3" "S_BayLB"


(I 3.1) (I 3.2) (I 3.3) (I 3.4)
"P_Bay1" "P_Bay2" "P_Bay3" "P_BayLB"
(Q 3.1) (Q 3.2) (Q 3.3) (Q 3.4)

Task
You are to monitor the inputs in the tag table.

What to Do
1. In order to adopt the changes and so that the CPU can switch to RUN, compile and download
the software.
2. Check whether the broadband cable of your conveyor model is connected to the “S7-1500
DI/DO” socket on the back of your training case.
3. Switch your conveyor model on.
4. Open the newly created PLC tag table "Conveyor" and activate the function "Monitoring".
5. On the conveyor model, press the Bay pushbuttons and check whether Status '1' or "TRUE" is
displayed at the corresponding inputs.
6. Save your project.

TIA-PRO1 - PLC Tags


Training Document, V14.01.01 5-21
SIMATIC TIA Portal Programming 1

5.6.3. Exercise 4: Modifying using the Watch Table

Task
You are to modify the outputs with the help of a watch table.

What to Do
1. In the Watch and force tables folder, add a new watch table.
2. Open the newly created watch table.
3. In the Project tree, select the PLC tag table "Conveyor".
4. From the Detail view, copy the PLC tags of the "Conveyor" PLC tag table into your watch table
using drag & drop.
5. For some of the outputs, specify the Modify value TRUE, that is, 1.
6. Check whether the relevant tags are activated for modifying.
7. Activate the function "Monitor all" and modify the outputs.
8. Check whether the relevant outputs are activated.
9. For the outputs, specify the Modify value FALSE, that is, 0 in order to switch them off again.
10.Modify the outputs once again.
11.Save your project.

TIA-PRO1 - PLC Tags


5-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

Contents 7
7. Program Blocks and Program Editor ................................................................... 7-2
7.1. Plant Description: The Conveyor Model as Distribution Conveyor with Mode Selection ..... 7-3
7.2. Overview of the Blocks in STEP 7 ........................................................................................ 7-4
7.2.1. Block-structured Programming ............................................................................................. 7-5
7.2.2. Program Sequence ............................................................................................................... 7-6
7.3. Adding a New Block .............................................................................................................. 7-7
7.4. Block Properties: General, Time Stamps .............................................................................. 7-8
7.4.1. Block Properties: Know-how Protection and Copy Protection .............................................. 7-9
7.5. Block Editor Settings ........................................................................................................... 7-10
7.6. Programming Block Calls.................................................................................................... 7-11
7.7. Deleting Blocks ................................................................................................................... 7-12
7.8. "Upload" Blocks "from Device" (Upload into Project).......................................................... 7-13
7.9. Task Description: Programming the Mode Selection and Manual Mode ........................... 7-14
7.9.1. Exercise 1: Adding the "FC_Mode" Block ........................................................................... 7-15
7.9.2. Exercise 2: Programming the Mode Selection in "FC_Mode" ............................................ 7-16
7.9.3. Exercise 3: Adding the "FC_Conveyor" Block .................................................................... 7-17
7.9.4. Exercise 4: Shifting the Networks from "OB_Cycle" to "FC_Conveyor" and Expanding it . 7-18
7.9.5. Exercise 5: Checking the "OB_Cycle" Properties ............................................................... 7-19
7.9.6. Exercise 6: Calling "FC_Mode" and "FC_Conveyor" in "OB_Cycle" .................................. 7-20
7.9.7. Exercise 7: Compiling, Downloading and Saving the Program .......................................... 7-21
7.10. Additional Information ......................................................................................................... 7-22
7.10.1. Block Groups....................................................................................................................... 7-23
7.10.2. S7-1500 - Memory Concept ................................................................................................ 7-24

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-1
SIMATIC TIA Portal Programming 1

7. Program Blocks and Program Editor

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

... be familiar with the different S7 block types

... be familiar with the principle of "structured programming"

… be able to add/create new blocks (functions)

... be able to set block properties

… be able to program a block call

… know what happens when a block is uploaded

… be familiar with the memory concept of the S7-1500

TIA-PRO1 - Program Blocks


7-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.1. Plant Description: The Conveyor Model


as Distribution Conveyor with Mode Selection

"K_Left" (Q 3.6) "K_Right" (Q 3.5)


DI DO

Operation ON Operation
I 0.1
″S_OperationON″ ″P_Operation″ Q 0.1

I 0.2 Jog right


″S_Right″

I 0.3 Jog left


″S_Left″ "OB_Cycle" "FC_Mode"

"FC_Conveyor"

Conveyor Model as a Distribution Conveyor


The Plant is switched ON/OFF and in Automatic or Manual mode using the switch
"S_OperationON".
In Manual mode ("P_Operation" = FALSE), the distribution conveyor can be moved to the right
and left using the switches "S_Right" and "S_Left". If both switches are activated simultaneously,
then the conveyor must not move (Lock-out!).

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-3
SIMATIC TIA Portal Programming 1

7.2. Overview of the Blocks in STEP 7

Blocks/Instructions Properties
- User interface
Organization block (OB) - Graduated priorities (0 to 27)
- Specific start information in temporary variables

- Parameter-assignable (parameters must be assigned with the call)


Function (FC)
- Without (dedicated) memory (only temporary variables)

- Parameter-assignable (parameters can be assigned with the call)


Function block (FB)
- With (dedicated) memory (static variables)

- Structured local data storage (Instance DB) (memory of an FB)


Data block (DB)
- Structured global data storage (Global DB) (valid in the entire program)

System instruction without - Instruction without memory stored in the CPU’s operating system and
instance callable by the user

- Instruction without memory stored in the CPU’s operating system and


System instruction with instance
callable by the user (therefore requires an instance)

Code Blocks
The automation system provides various types of blocks in which the user program and the
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).

Organization Blocks (OBs)


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

Functions (FCs)
A function (FC) contains a partial functionality of the program. It is possible to program functions
as parameter-assignable so that when the function is called it can be assigned parameters. As a
result, functions are also suited for programming frequently recurring, complex partial
functionalities such as calculations.

Function Blocks (FBs)


Basically, function blocks offer the same possibilities as functions. In addition, function blocks
have their own memory area in the form of instance data blocks. As a result, function blocks are
suited for programming frequently recurring, complex functionalities in which data has to be
stored over several cycles (such as closed-loop control tasks).

Data Blocks:
Data blocks are used to store data. There are global data blocks and instance data blocks which
are used for the data backup of an FB call.

System Instructions:
System instructions are used to solve frequently required standard tasks. They are integrated in
the CPU’s operating system and therefore do not require any additional memory.

TIA-PRO1 - Program Blocks


7-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.2.1. Block-structured Programming

Block-structured
Linear Program Structured Program
Program

Recipe A

Recipe B
OB_ OB_
Cycle Cycle Mixer
Dealt with in the chapter
“Functions and
Outlet
Function Blocks”

The instructions for the


All instructions are individual functions are found in
found in one block (in a individual blocks. OB_Cycle
“Program cycle OB”) calls these blocks one after the
other.

Block-structured Program
The program is divided into blocks, whereby every block only contains the program for solving a
partial task. Further structuring through networks is possible within a block. You can generate
network templates for networks of the same type. Normally, a cyclically called Organization block
contains instructions which call the other blocks in a defined sequence.

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-5
SIMATIC TIA Portal Programming 1

7.2.2. Program Sequence

Operating system
DB DB

Cycle

Time OB_Cycle FC FB

Process Organization
blocks
FB FC
Error(s)

Legend: The maximum nesting depth depends on the CPU!


OB = Organization block
FB (Reference: 24 blocks per priority class for S7-1500)
FC = Function
FB = Function block FB with
DB = Data block Instance DB

Organization blocks are automatically called by the CPU’s operating system according to certain
call events. The Program cycle OBs are responsible for the cyclic program execution. So that
blocks, such as FBs and FCs, can be processed, they have to be called by an OB. These blocks,
in turn, can call further FBs or FCs.
Data blocks are used for data backup; for this there are two types. Firstly, global data blocks
whose structure can be freely defined by the user. And second, the data blocks which are used to
store the data of individual function blocks (instance data blocks). The structure of these data
blocks depends on the interface of the respective function block. (see chapter "Functions and
Function Blocks")

TIA-PRO1 - Program Blocks


7-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.3. Adding a New Block

Automatic number
assignment.

Inserting a Block
A new block is created as shown in the picture. When you create a block, the type of block (OB,
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.
Under "Additional information", the block can be documented in more detail, among other things,
with a Version number and an Author.

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-7
SIMATIC TIA Portal Programming 1

7.4. Block Properties: General, Time Stamps

Changing the name

Selecting the
programming
language

Time stamps

Properties
Each block has certain properties that you can display and edit. These properties are used to:
• Identify the block
• Display the memory requirements and the compilation status of the block
• Display the time stamp
• Display the reference information
• Specify the access protection
• Display and change the programming language

TIA-PRO1 - Program Blocks


7-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.4.1. Block Properties: Know-how Protection and Copy Protection

Know-how Protection
Blocks can be protected from unauthorized access with a password. With a know-how protected
block, only the following data can be read:
• Parameters (Input, Output, InOut, Return)
• Block title
• Block comment
• Block properties
• Cross references with the information about which global tags are used
Just like unprotected blocks, know-how protected blocks can also be copied, called, downloaded
into the CPU and deleted. The code of the block, however, is protected from unauthorized
reading and changing.

Copy Protection
In addition to know-how protection, you can also generate a copy protection in which you define
with which memory card or on which CPU (each identified through a serial number) the block can
be executed.

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

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-9
SIMATIC TIA Portal Programming 1

7.5. Block Editor Settings

Block Editor Settings


With the settings, you merely define how a block is to be represented when it is opened. In the
editor, you can make changes to the representation (such as showing and hiding comments) at
any time.
• View
Setting the Operand representation and Tag information with and without comments when
the block is opened
• Compilation
When "Delete actual parameters on interface update" is activated, the calls of parameterized
blocks are also then automatically adjusted if, within the block, parameters which are already
supplied with an actual parameter during the call, are deleted after the fact.
• IEC Check
When IEC check is activated, the compatibility of operands is checked in accordance with
IEC 61131.
• Mnemonics
Setting the syntax for the programming language: German (e.g. E for Eingang (Input)) or
International (e.g. I for Input)
• View - Layout
This changes the vertical spacing between operands and other objects (for example,
operands and contact). The change only becomes visible the next time a block is opened.
• Operand Field
Setting the maximum width and height of function block diagram and ladder diagram symbols

TIA-PRO1 - Program Blocks


7-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.6. Programming Block Calls

In order to program the call of a block, you simply have to drag the block into the program code of
the calling block using drag & drop or copy it using copy & paste.

Block Calls
If a block calls another block, the instructions of the called block are executed. Only when the
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.

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-11
SIMATIC TIA Portal Programming 1

7.7. Deleting Blocks

With and without


online connection
to the CPU

Deleting Blocks
Online, blocks cannot be deleted directly in the CPU. If a block (even with an existing online
connection) is selected and "Delete" is activated, the dialog shown in the picture appears with the
question of whether the block is to be deleted offline.
With subsequent, consistent loading of the entire program, the blocks which only exist in the CPU
are deleted there online.

TIA-PRO1 - Program Blocks


7-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.8. "Upload" Blocks "from Device" (Upload into Project)

• blocks that are different


online/offline are overwritten in
the project or are saved under
another name
• only offline existing
blocks remain unaffected
in the project
• only online existing
blocks are uploaded
into the project

Uploading Blocks into the Project:


With "Upload from device (software)", individual blocks or the entire CPU program including
technology objects, PLC tag tables and PLC data types can be uploaded into the project from the
CPU.

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


• ... 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
uploaded blocks, or the uploaded blocks are additionally saved under a different name (but
with the same number!) in the project. (selectable in the Upload dialog)
• ... blocks that only exist offline are not affected.

If the Station is selected, then...


• ... offline all blocks, PLC data types, technology objects and symbols are deleted (!) and the
online blocks, PLC data types, technology objects and symbols are uploaded into the project.

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-13
SIMATIC TIA Portal Programming 1

7.9. Task Description:


Programming the Mode Selection and Manual Mode

DI DO

I 0.1 Operation ON Operation


Q0.1
"S_OperationON" "P_Operation"

I 0.2 Jog right


"S_Right"

I 0.3 Jog left


"S_Left"

Task Description
The Plant is switched ON/OFF and in Automatic or Manual mode using the switch
"S_OperationON".
In Manual mode ("P_Operation" = FALSE), the distribution conveyor can be moved to the right
and left using the switches "S_Right" and "S_Left". If both switches are activated simultaneously,
then the conveyor must not move (Lock-out!).

TIA-PRO1 - Program Blocks


7-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.9.1. Exercise 1: Adding the "FC_Mode" Block

Task
You are to create "FC_Mode" as a new block in which you will program the required mode
selection in the next exercise.

What to Do
1. In the "Program blocks" container, double-click on "Add new block".
2. In the dialog that appears, make the entries as shown in the picture above.

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-15
SIMATIC TIA Portal Programming 1

7.9.2. Exercise 2: Programming the Mode Selection in "FC_Mode"

Task
You are to program the mode selection as shown in the picture.

What to Do
1. Program an Instruction by pulling it from the "Instructions" task card using drag & drop.
2. Above the instruction, enter the output "P_Operation" (Q0.1) as the operand (you can enter
the symbol as well as the absolute address)
3. Assign the tag "S_OperationON" (I 0.1) as the operand to the input of the Instruction.
4. Label both the block and the network.
5. Close the block.
6. Save your project.

TIA-PRO1 - Program Blocks


7-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.9.3. Exercise 3: Adding the "FC_Conveyor" Block

Task
You are to create the function "FC_Conveyor" as a new block in which you will then program the
Jog mode that is possible in Manual mode in the next exercise.

What to Do
1. In the "Program blocks" container, double-click on "Add new block".
2. In the dialog that appears, make the entries as shown in the picture above.

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-17
SIMATIC TIA Portal Programming 1

7.9.4. Exercise 4: Shifting the Networks


from "OB_Cycle" to "FC_Conveyor" and Expanding it

Split Editor area

Task
You are to program the Jog mode of the conveyor as shown in the picture.

What to Do
1. Split the Editor (area) horizontally or vertically via one of the appropriate buttons in the
toolbar.
2. In each of the areas, open the blocks "OB_Cycle" and "FC_Conveyor".
3. Copy the networks from the "OB_Cycle" block into the "FC_Conveyor" blocks using drag &
drop.
4. Since Jogging the conveyor belt is only to be possible when "P_Operation" is FALSE,
expand the AND logic in the first network by adding an "Normaly closed contact" You do this
by dragging it from the Task Card "Instructions" or from the "Favorits".
Note:
If an incorrect type of contact was inserted, click on the contact and use the small red "arrow"
in the right corner of the contact to access an expansion menue with th available changes.
5. Assign the "P_Operation" (Q0.1) tag to the new "Normaly closed contact"..
6. Change the logic in Network 2 for Jogging the conveyor to the left in the same way.
7. Delete the networks in "OB_Cycle".
8. Close the blocks.
9. Save your project.

TIA-PRO1 - Program Blocks


7-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.9.5. Exercise 5: Checking the "OB_Cycle" Properties

1xR

Task
You are to check the Properties of the OB1 block as shown in the picture, and, if necessary,
correct them.

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-19
SIMATIC TIA Portal Programming 1

7.9.6. Exercise 6: Calling "FC_Mode" and "FC_Conveyor" in "OB_Cycle"

Drag & Drop

Task
So that the newly created blocks "FC_Mode" and "FC_Conveyor" can be executed cyclically, they
must be called in "OB_Cycle".

What to Do
1. Open the "OB_Cycle" block by double-clicking on it.
2. Program the calls of the "FC_Mode" and "FC_Conveyor" blocks as shown in the picture using
drag & drop.
3. Edit the labels for the Networks (as in the picture).
4. Close the block.
5. Save your project.

TIA-PRO1 - Program Blocks


7-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.9.7. Exercise 7: Compiling, Downloading and Saving the Program

2. Save project
3. Download program to controller
1. Compile program

Task
The newly programmed blocks are to be compiled, downloaded into the CPU and saved offline in
the project data storage.

What to Do
1. To compile the entire program (all blocks) and to download it into the CPU, select the
"Program blocks" folder in the Project tree.
2. Carry out the steps shown in the picture and check the program functioning
a. Switching between Manual and Automatic mode by activating the simulator switch
"S_OperationON" accordingly as well as checking the LED "P_Operation".
b. Try jogging with Manual or Automatic mode by activating the simulator switches "S_Right"
(I 0.2) and "S_Left" (I 0.3).
3. If necessary, also use the Test function "Monitor in block" or use a watch table.

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-21
SIMATIC TIA Portal Programming 1

7.10. Additional Information

TIA-PRO1 - Program Blocks


7-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

7.10.1. Block Groups

1xR

Block Groups
To achieve more clarity, large programs with many blocks can be divided into several block
groups. The groupings can, for example, be related to the structure of the system to be
controlled. Even if the blocks are managed in different groups, each block must have a unique
symbolic name. Regardless of the groupings, the sum of all blocks represents the user program
of the controller.
The blocks can easily be shifted between the block groups using drag & drop.

TIA-PRO1 - Program Blocks


Training Document, V14.01.01 7-23
SIMATIC TIA Portal Programming 1

7.10.2. S7-1500 - Memory Concept

SMC Card: CPU load memory


• PLC tags
• PLC data types
• Blocks with comments/symbols
• Hardware configuration
• PLC alarms

Code work memory:


Code blocks (FC, FB, OB)

Data work memory:


All data blocks, Global DBs and
Instance-DBs and Technology
objects
1xR
Retentive memory:
Retentive variables from:
Global DBs
Instance-DBs
Technology objects
Memory bytes
SIMATIC timers / counters

Other memory areas


Memory bytes
SIMATIC timers / counters
Process images (PII/PIQ)

Memory Areas of the CPU


The SMC (Simatic Memory Card) is the load memory of the CPU. Accordingly, an inserted SMC
is absolutely necessary for operating the CPU.
The data of the entire station is stored on the SMC, that is, the complete S7 program including
documentation, PLC tags and data types as well as the complete hardware configuration
including distributed I/O and parameter assignments. In addition, other files can also be found on
the SMC, such as, recipes, HMI backups.....
When downloading the S7 program into the CPU, all blocks are always first loaded into the load
memory from where the CPU automatically copies the parts of the blocks that are relevant for
execution into the work memory.

Work Memory
The work memory is a volatile RAM memory which cannot be expanded. It is divided into two
areas:
• Code work memory which contains the parts of the code (logic) blocks relevant for execution.
• Data work memory which contains the data of the data blocks and technology objects
relevant for execution.

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


The retentive memory is a non-volatile memory for saving the variables declared as retentive
whose value is retained during a power failure.
The contents of the retentive memory is only erased by a
• memory reset
• resetting of the CPU to factory settings

TIA-PRO1 - Program Blocks


7-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

Contents 6
6. Binary Operations 1 ............................................................................................... 6-2
6.1. Plant Description: The Conveyor Model as a Distribution Conveyor ................................... 6-3
6.2. Assignment ........................................................................................................................... 6-4
6.2.1. Sensors and Check Symbols ................................................................................................ 6-5
6.2.2. Binary Logic Operations: AND, OR and Negation ................................................................ 6-6
6.2.3. Theory Exercise 1: Sensor and Check Symbols .................................................................. 6-7
6.2.4. Binary Logic Operations: Exclusive OR (XOR)..................................................................... 6-8
6.3. Process Images .................................................................................................................... 6-9
6.4. Cyclic Program Execution ................................................................................................... 6-10
6.5. Linear Program ................................................................................................................... 6-11
6.6. Programming....................................................................................................................... 6-12
6.6.1. Networks ............................................................................................................................. 6-13
6.6.2. Absolute and Symbolic Addressing .................................................................................... 6-14
6.6.3. Using a PLC Tag as an Operand ........................................................................................ 6-15
6.6.4. Renaming / Rewiring PLC Tags.......................................................................................... 6-16
6.6.5. Defining (Declaring) Tags while Programming ................................................................... 6-17
6.6.6. Closing / Saving / Rejecting a Block ................................................................................... 6-18
6.6.7. Compiling a Program .......................................................................................................... 6-19
6.6.8. Downloading a Program into the CPU ................................................................................ 6-20
6.6.9. Monitoring a Block .............................................................................................................. 6-21
6.7. Exercise 1: Renaming Main OB .......................................................................................... 6-22
6.7.1. Exercise 2: Programming the Jog Mode............................................................................. 6-23
6.7.2. Exercise 3: Compiling the Program, Downloading it into the CPU ..................................... 6-24
6.7.3. Exercise 4: Monitoring the Program ................................................................................... 6-25

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-1
SIMATIC TIA Portal Programming 1

6. Binary Operations 1

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

… know what an Assignment is

... understand the difference between ‘real’ NC contacts and NO contacts


connected in the hardware, and programmed check symbols

… be familiar with the logic operations AND, OR and Exclusive-OR


and be able to apply them

… be familiar with the process image for inputs and outputs

... understand cyclic program execution

… know what a linear program is

… be familiar with the Program editor

… be able to rename and rewire PLC tags

... be able to carry out a program test with the “Monitor (block)” function

TIA-PRO1 - Binary Operations 1


6-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.1. Plant Description:


The Conveyor Model as a Distribution Conveyor

"K_Left" (Q 3.6) "K_Right" (Q 3.5)


DI DO

I 0.2 Jog right


"S_Right"

I 0.3 Jog left


"S_Left"

"OB_Cycle"

Conveyor Model as a Distribution Conveyor


The distribution conveyor can be jogged to the left and to the right using the switches "S_Right"
(I 0.2) and "S_Left" (I 0.3). If both switches are activated simultaneously, then the conveyor must
not move (Lock-out!).

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-3
SIMATIC TIA Portal Programming 1

6.2. Assignment

Function Chart (FBD) Ladder Diagram (LAD)

Scan for signal status 0

Assignment
With an assignment, the specified operand is always assigned the current RLO as status. The
assigned RLO remains available after the assignment and can be assigned to a further operand
or it can be further logically linked.

Scan for 0 (False)


The scan for 0, that is, the signal status FALSE is fulfilled when the operand has the signal status
‘0’.

TIA-PRO1 - Binary Operations 1


6-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.2.1. Sensors and Check Symbols

Process Interpretation in the PLC Program

The The sensor Voltage Signal Scan Scan


sensor is ... present status for signal status “1” for signal status “0”
Is a ... at input? at
input Symbol / Result of Symbol / Result of
Instruction check Instruction check

NO activated
contact yes 1 “Yes” “No”
LAD: 1 LAD: 0

not “NO contact” “NC contact”


no 0 “No” “Yes”
activated
0 1

NC activated no
contact 0 FBD: “No” FBD: “Yes”
0 1

not
activated yes 1 “Yes” “No”
1 0

Sensors of the Process


The use of normally open or normally closed contacts for the sensors in a controlled process
depends on the safety regulations for that process. Normally closed contacts are always used for
limit switches and safety switches, so that dangerous conditions do not arise if a wire break
occurs in the sensor circuit. Normally closed contacts are also used for switching off machinery
for the same reason.
All scans can be programmed for signal status, that is, Status '0' and '1' regardless of whether a
hardware NO contact or hardware NC contact is connected in the process.

Check Symbols of the Program


In LAD, a symbol with the name "NO contact" is used for checking for signal status "1" and a
symbol with the name "NC contact" to check for signal status "0". It makes no difference whether
the process signal "1" is supplied by an activated NO contact or a non-activated NC contact.
The "NO contact" symbol delivers the result of check “1” when the scanned operand has Status
“1“.
The "NC contact" symbol delivers the result of check “1” when the scanned operand has Status
“0“.

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-5
SIMATIC TIA Portal Programming 1

6.2.2. Binary Logic Operations: AND, OR and Negation

FBD LAD
AND

Change the
Scan

Change the
Operation
FBD
OR

Negation

AND and OR Logic Operations


With the AND and OR logic operations, basically all binary operands can be scanned, even
outputs. Instead of individual operands, the results of other logic operations can also be further
logically linked. Also, the logic operations can also be combined.

AND Logic Operation


For an AND logic operation, the result of logic operation (RLO) = '1',
when all input signals have Status '1'.

OR Logic Operation
For an OR logic operation, the result of logic operation (RLO) = '1', when at least one input signal
has Status '1'.

Negation (NOT)
The NOT instruction inverts the result of logic operation (RLO).
If, in the example shown, the RLO of the OR logic operation = '1', the NOT instruction inverts it to
RLO '0' and the output is assigned the Status “0”.
If the RLO of the OR logic operation = '0', the NOT instruction inverts it to RLO '1' and the output
is assigned the Status “1”.

TIA-PRO1 - Binary Operations 1


6-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.2.3. Theory Exercise 1: Sensor and Check Symbols

Task: In all three examples, the light should be on when S1 is activated and S2 is not activated!

Hardware

S1 S2 S1 S2 S1 S2

E 1.0
I 1.0 EI 1.1
1.1 E 1.0
I 1.0 E 1.1
I 1.1 EI 1.0
1.0 E I1.1
1.1
Automation system Automation system Automation system
Q 4.0 Q 4.0 Q 4.0

Light Light Light

Software
I 1.0 I 1.1 Q 4.0 I 1.0 I 1.1 Q 4.0 I 1.0 I 1.1 Q 4.0

LAD

& & &


I 1.0 I 1.0 I 1.0
FBD
I 1.1 Q 4.0 I 1.1 Q 4.0 I 1.1 Q 4.0

Task
In FBD, complete the logic symbols, and, in LAD correct the check symbols so that the required
function is fulfilled.

Note
The terms - "NO contact" and "NC contact" - have different meanings depending on whether they
are used in the process-hardware-context or as check symbols in the software.

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-7
SIMATIC TIA Portal Programming 1

6.2.4. Binary Logic Operations: Exclusive OR (XOR)

FBD

LAD

XOR Logic Operation


With the XOR logic operation, basically all binary operands can be scanned, even outputs.
Instead of individual operands, the results of other logic operations can also be further logically
linked. Also, the logic operations can also be combined.
All inputs of the logic operations can be programmed as scan for signal status or Status '0' and
'1', regardless of whether a hardware NO contact or NC contact is connected in the process.

For an XOR logic operation with 2 inputs, the result of logic operation (RLO)
= '1', when one and only one of the two input signals has Status '1'.
• For an XOR logic operation with more than 2 operands, the RLO ...
= '1', when an uneven number of checked operands has Status '1'
= '0', when an even number of checked operands has Status '1'.

XOR in the LAD Programming Language


In the LAD programming language, there is no explicit XOR logic operation. It must be generated
by programming the discrete instructions shown in the picture above.

TIA-PRO1 - Binary Operations 1


6-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.3. Process Images

Process image Process image


for inputs for outputs
IB 0 QB 0
IB 1 QB 1
IB 2 QB 2
: User :
: :
: program :

CPU memory area CPU memory area

Process Images
For the storage of all digital input and output states, the CPU has reserved memory areas: the
process image for inputs (PII) and the process image for outputs (PIQ). During program
execution, the CPU accesses these memory areas exclusively. It does not access the digital input
and output modules directly.

PII
The Process Image for Inputs (PII) is the memory area in which the statuses of all digital inputs
are stored. At the beginning of the cycle, the digital input modules read-in to the PII. When an
input is linked, the status of this input stored in the PII is linked. This status cannot change within
a cycle since the PII is only updated or read-in at the beginning of a cycle. This guarantees that
when there are multiple scans of the input in one cycle, the same result is always supplied.

PIQ
The Process Image for Outputs (PIQ) is the memory area in which the statuses of all digital
outputs are stored. The PIQ is output to the digital output modules at the beginning of the cycle
before the process image for inputs is updated. Outputs can be assigned as well as scanned in
the program.

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-9
SIMATIC TIA Portal Programming 1

6.4. Cyclic Program Execution

• Startup program: Call and execution of the


Startup-OBs (once, after PowerON, for example)

Start of the cycle monitoring time


Output
module
Writing the process image for outputs
(PIQ) in the output modules
CPU Cycle

Reading the input statuses from the input modules


and saving the statuses in the process image (PII)

Call and execution of the Program cycle OBs Input


module
(possible interruption by the call of other OBs for events,
such as, time-of-day interrupt, hardware interrupts etc.)

Restart
When you switch on or switch from STOP --> RUN, the CPU carries out a complete restart
whereby the programmed Startup-OBs are executed. During restart, the operating system deletes
all non-retentive memory bits and, after the Startup-OBs have been executed, it starts the cycle
monitoring time. (The Startup-OBs are dealt with in the chapter "Organization Blocks")

Cyclic Program Execution


Cyclic program execution occurs in an endless loop. After the execution of a program cycle is
completed, the execution of the next cycle occurs automatically. In every program cycle, the CPU
carries out the following steps.
• Transfer the output statuses from the process image for outputs to the output modules.
• Scan the statuses of the input signals and update the process image for inputs.
• Execute the instructions of the user program. This happens mainly with the process images,
not with the input and output modules directly.

Cycle Time and Cycle Monitoring Time


The time that the CPU requires for the execution of the complete program cycle, is the cycle time
which is monitored for time by the CPU operating system. If the cycle time exceeds the cycle
monitoring time defined in the CPU properties (Chapter Devices and Networks), the "Time-
Error-Interrupt-OB" is called. If this is not configured or if the cycle monitoring time is double, the
CPU goes into the STOP state.

Using the Process Image or Deselecting it for Individual Modules


In the properties of the modules you can select whether the input values are to be automatically
adopted in the PII or whether the output values are to be automatically written with values from
the PIQ (at the beginning of the cycle), only if a certain OB is executed or never.

TIA-PRO1 - Binary Operations 1


6-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.5. Linear Program

Linear Program Block-structured Program Structured Program

OB_
Cycle
Dealt with in the chapter
Dealt with in the chapter
“Functions and
“Program Bocks”
Function Blocks”

All instructions are found


in one block (in a
“Program cycle OB”)

Linear Program
The entire program is found in one continuous program block (Program cycle OB) which is
automatically called by the system. This model resembles a hard-wired relay control that was
replaced by an automation system (programmable logic controller). The CPU processes the
individual instructions one after the other.

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-11
SIMATIC TIA Portal Programming 1

6.6. Programming

Display Favorites
On/Off

Open Block
In the Program blocks folder there is a Program-Cycle-OB which can be opened by double-
clicking in the instruction section.

Programming
The instructions within a block can be programmed as follows:
• 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
instruction in the Favorites or the Instructions catalog
• by selecting (highlighting) the location in the program and the relevant shortcut (for
information on the possible shortcuts see Options > Settings > Keyboard shortcuts)
Operands can be entered with an absolute or a symbolic address. If the tag table is highlighted
(not opened!) in the Project tree, tags (variables) can also be pulled from the Details view to the
appropriate location in the program using drag & drop.

Favorites
Frequently used elements, functions and instructions are available in the Favorites which can be
expanded individually from the Instructions catalog using drag & drop.

TIA-PRO1 - Binary Operations 1


6-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.6.1. Networks

Insert / Delete Open / Close


new network all networks

Free comments Network Comments


On / Off On / Off
Show the tag
information
On / Off

Networks
A block can be divided into individual networks which makes it easier to follow and gives you a
better understanding of the program.
Each network can be given a network label and a comment. Within the networks, the individual
instructions can be clarified with instruction comments and the comments of the tags/variables
used can be displayed via the “Tag information” button.

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-13
SIMATIC TIA Portal Programming 1

6.6.2. Absolute and Symbolic Addressing

Absolute and Symbolic Addressing


All global tags/variables (such as, inputs, outputs, memory bits) have both an absolute and a
symbolic address. You can define which is to be displayed or with which is to be programmed
(see picture).
When you use a symbolic address (for example, "K_Left") which has not yet been assigned an
absolute address, you can save the block but you cannot compile it and download it into the
controller.
When you use an absolute address (for example, M16.2), it is automatically assigned a symbolic
default address (for example, "Tag_1") which you can change (later on).

Properties
If a block or the PLC tag table is open in the working area and a tag is selected (highlighted)
there, then all details are displayed in the "Properties" tab in the Inspector window.

TIA-PRO1 - Binary Operations 1


6-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.6.3. Using a PLC Tag as an Operand

Automatic
symbol selection

Using a Tag as Operand


During programming, the name of the tag or the address can be entered. When the symbolic
name or the address is input, the Autocompletion automatically appears from which you can
select the tag. Furthermore, you can use the Details view to adopt the tag using drag & drop.

Autocompletion
When operands are selected, after the first letter of the symbolic operand name has been
entered, a selection of all the operands whose name start with the entered letter and are of the
corresponding data type is displayed. All the operands that are valid for this block are displayed.
These are all global tags (also those that are declared in data blocks), local variables (temporary
and static) as well as the parameters of the block.

You can also filter directly according to the type of tag, as required:
• Begin with # to only select from local tags of the current block interface,
• Begin with " to only have global tags displayed,
• Begin with % to have all tags filtered according to absolute addresses displayed,

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-15
SIMATIC TIA Portal Programming 1

6.6.4. Renaming / Rewiring PLC Tags

Renaming and Rewiring Tags


Tags can be renamed or rewired as shown in the picture using the Blocks Editor. The changes
are immediately adopted in the PLC tag table and affect the entire program.
Tags can also be renamed and rewired directly in the PLC tag table.

• Rename:
Change the tag name, while the absolute address remains unchanged.
• Rewire:
Change the associated absolute address, while the name remains unchanged.

TIA-PRO1 - Binary Operations 1


6-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.6.5. Defining (Declaring) Tags while Programming

Defining (Declaring) Tags while Programming


If unknown tags are used during programming, they can be defined later-on via the context menu
of the network.
In the “Define tag” dialog, the [Local Temp] temporary memory area (Section) is always
suggested. When you change the area, the next free address is suggested.

Advantage:
In the dialog that appears, only addresses which have not been used so far are suggested. In this
way errors are avoided, for example, such as the use of bits which belong to an already used
word (overlapping accesses).

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-17
SIMATIC TIA Portal Programming 1

6.6.6. Closing / Saving / Rejecting a Block

CLOSE project and with that the block


(save or reject all changes)

SAVE project and with


that the block
(all changes !!)

CLOSE the block


(no saving, no rejection)

Closing a Block
By clicking on the symbol in the title bar, the block is merely closed. Changes are neither
rejected nor are they saved on the hard drive!

Saving a Block
By using "Save project" the entire project, and with that also the block, is saved on the hard drive.
All changes made to the project are saved.

Rejecting a Block
It is possible to reject block changes using the function Undo or by closing the entire project
without saving. All changes made in the project are rejected.

TIA-PRO1 - Binary Operations 1


6-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.6.7. Compiling a Program

Program Compilation
A delta compilation is always carried out via the "Compile" button, that is, only the changes to the
object selected (highlighted) in the Project tree are compiled. By selecting the Program blocks
folder, all modified objects (blocks) within the folder are compiled.
Via the context menu in the Project tree, you can select whether only changes or the entire
software is to be compiled.
The status of the compilation is displayed in the Inspector window "Info -> Compile". If errors
occurred during compilation, you can jump directly from the error entry to the error location by
double-clicking on it.

Note:
The menu items Software (rebuild all) and Software (rebuild all blocks) currently have the same
meaning.
Software (reset memory reserve) is not yet relevant in this chapter.

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-19
SIMATIC TIA Portal Programming 1

6.6.8. Downloading a Program into the CPU

Downloading a Program:
Program (Software) includes the blocks of the user program. The first time you download, they
are completely loaded. In subsequent downloads, only the software changes are loaded.
However, all changes are always downloaded, that is, the offline program and the online program
are always the same after the download.

Note:
In the context menu of the device (CPU) there is also the menu item “Software (all)” in which all
blocks are loaded even if these have already been downloaded to the CPU. You have to make
sure, however, that the CPU is stopped in this case.

TIA-PRO1 - Binary Operations 1


6-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.6.9. Monitoring a Block

Monitor Block
On / Off

Monitor
The test function Monitor is used to track the program execution within a block. The statuses or
contents of the operands used in the block at the time of program execution are displayed on the
monitor.
You can only monitor if there is an online connection to the CPU and the offline program is
identical to the online program.
In test mode, the statuses of the operands and LAD / FBD elements are represented by different
colors.
Examples:
• Status fulfilled  "Element is represented with a green color"
• Status not fulfilled  "Element is represented with a blue color"

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-21
SIMATIC TIA Portal Programming 1

6.7. Exercise 1: Renaming Main OB

1xR

Task
You are to rename the Organization block.

What to Do
1. Open the "Program blocks" folder.
2. Open the context menu of the block "Main" by right-clicking on it.
3. Select the menu item "Rename".
4. Give the block the symbolic name "OB_Cycle".
5. Save your project.

TIA-PRO1 - Binary Operations 1


6-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.7.1. Exercise 2: Programming the Jog Mode

Task
You are to program the Jog mode of the conveyor as shown in the picture.

What to Do
1. Program an AND logic operation by dragging a "Normaly open contact" and a "Normaly
closed contact" from the Favorites into the network using drag & drop.
2. Program an "Assignment" by dragging it from the "Instructions" Task Card to the AND logic
operation using drag & drop as shown above.
3. At the first input of the AND logic operation enter the input "S_Right" (I 0.2) as operand (you
can enter the symbol as well as the absolute address). Do the same for "S_Left" (I 0.3).
4. In the Project tree, select (do not open!) the tag table "Conveyor" and drag the tag "K_Right"
(Q3.5) from the "Details view" as operand above the assignment.
5. Give the network a title.
6. Add a new network and there program an appropriate logic operation for jogging the conveyor
to the left.
7. Close the Organization block.
8. Save your project.

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-23
SIMATIC TIA Portal Programming 1

6.7.2. Exercise 3: Compiling the Program and Downloading it into the CPU

3. Save project
2. Download program

1. Compile program

Task
You are to compile and download the program and save the project.

What to Do
1. Select the "Program blocks" folder.
2. Compile your program by means of the "Compile" button in the toolbar.
3. Download your program by means of the "Download" button in the toolbar.
4. Save your project.

TIA-PRO1 - Binary Operations 1


6-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

6.7.3. Exercise 4: Monitoring the Program

Monitor Block
On / Off

Task
You are to monitor the program online.

What to Do
1. Open "OB_Cycle".
2. Monitor the block (the program) by means of the "Monitor On/Off" button.
3. Activate the switches "S_Left" and "S_Right" on your training case.

TIA-PRO1 - Binary Operations 1


Training Document, V14.01.01 6-25
SIMATIC TIA Portal Programming 1

Contents 8
8. Binary Operations .................................................................................................. 8-2
8.1. Task Description: The Conveyor Model as Distribution Conveyor with Manual and
Automatic Mode .................................................................................................................... 8-3
8.2. Set, Reset ............................................................................................................................. 8-4
8.2.1. Flip Flops............................................................................................................................... 8-5
8.3. Task Description: Expanding the "FC_Mode" Function ........................................................ 8-6
8.3.1. Exercise 1: Programming the "FC_Mode" Block Expansion ................................................ 8-7
8.4. Task Description: Parts Transportation in Automatic Mode ................................................. 8-8
8.4.1. Multiple Assignment .............................................................................................................. 8-9
8.4.2. Exercise 2: Expanding "FC_Conveyor" (Automatic Mode) ................................................. 8-10
8.5. Task Description: Parts Transportation THROUGH the Light Barrier ................................ 8-11
8.5.1. Signal Edge Evaluation ....................................................................................................... 8-12
8.5.2. Exercise 3: Integrating an Edge Evaluation in "FC_Conveyor" .......................................... 8-14
8.6. Task Description: Controlling the Indicator Lights, Commissioning "FC_Signal" ............... 8-15
8.6.1. Exercise 4: Writing/Correcting "FC_Signal" and Commissioning It .................................... 8-16
8.7. Additional Exercise: Optimizing "FC_Mode" ....................................................................... 8-17
8.8. Additional Information ......................................................................................................... 8-18
8.8.1. Jump Instructions JMP, JMPN, RET................................................................................... 8-19

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-1
SIMATIC TIA Portal Programming 1

8. Binary Operations

At the end of the chapter the participant will …

… be familiar with the instructions Set, Reset and will be able to


apply them

… know what needs to be considered for a multiple assignment

… know how edges are evaluated

… be familiar with jump instructions as well as absolute and


conditional block aborts

TIA-PRO1 - Binary Operations 2


8-2 Training Documents, V14.01.01
SIMATIC TIA Portal Programming 1

8.1. Task Description: The Conveyor Model


as Distribution Conveyor with Manual and Automatic Mode

DI DO
Operation OFF
I 0.0
"S_OperationOFF" (NC)

I 0.1 Operation ON Operation Q0.1


"S_OperationON" "P_Operation" "B_Bay1" "B_Bay2" "B_LB"
(I 3.5) (I 3.6) (I 3.0)

I 0.2 Jog right


"S_Right"

"K_Left"
I 0.3 Jog left "K_Right"
(Q 3.6)
"S_Left" (Q 3.5)

"S_Bay1" "S_Bay2"
(I 3.1) (I 3.2)
"P_Bay1" "P_Bay2"
(Q 3.1) (Q 3.2)

Function Description
The distribution conveyor is used to transport parts from Bay 1 or 2 to the light barrier bay. The
Operation (Simulator LED "P_Operation", Q0.1) can be switched on and switched off (Manual /
Automatic mode) via the simulator switch "S_OperationON" (I0.1) and "S_OperationOFF" (I 0.0,
NC).
• In Manual mode, switched off "P_Operation" (Q0.1)…
…the distribution conveyor can be jogged to the right via the simulator switch "S_Right" (I 0.2)
and jogged to the left via the simulator switch "S_Left" (I 0.3).
• In Automatic mode, switched on "P_Operation" (Q0.1)…
... parts are transported from Bay 1 or 2 up to, or, through the light barrier. For this, the part must
be placed on the conveyor at exactly one of the two bays and the associated bay pushbutton
pressed.
The indicator lights at Bays 1 and 2 show...
... a constant light when a new part may be placed on the conveyor (distribution conveyor is
stopped and both proximity sensors are free)
... a 1Hz flashing light at the bay where a part is detected by the associated proximity sensor,
however, only as long as the conveyor has not yet been started (if parts are placed on the
conveyor at both proximity sensors, neither indicator light must light up)
... a 2Hz flashing light as long as the distribution conveyor is running.
The indicator light at the light barrier bay shows a 2Hz flashing light as long as the distribution
conveyor is running.

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-3
SIMATIC TIA Portal Programming 1

8.2. Set, Reset


FBD LAD

Changing the
Changing the operation
operation

Set
If the result of a logic operation (RLO), that is, result of scan = "1", the specified operand is
assigned Status '1'; for RLO / result of scan = "0", the status of the operand remains unchanged.

Reset
If the RLO, that is, result of scan = "1" the specified operand is assigned Status ' 0'; otherwise the
status of the operand remains unchanged.

Note
In addition to the SET and RESET functions, the graphic above also shows the methodology to
change an elements attributs without deleting and inserting a new element type. Simply highlight
the element and click the small red "array" in the right corner of the element. Available changes
are shown in a drop down menue.

TIA-PRO1 - Binary Operations 2


8-4 Training Documents, V14.01.01
SIMATIC TIA Portal Programming 1

8.2.1. Flip Flops

Dominant Reset Dominant Set

Memory Function "Flip Flop"


A flip flop has a Set input and a Reset input. The operand is set (TRUE) or reset (FALSE),
depending at which input the scan condition is fulfilled.

Priority
If the scan condition at both inputs is fulfilled simultaneously, then the priority of the operation
decides whether the operand is set or reset. For that reason, there are different symbols for the
Dominant Set and Dominant Reset memory functions in LAD and FBD. (The last scan always has
priority, Set for "RS" and Reset for "SR").

Note
With a CPU restart, all outputs are reset. That is, they are overwritten with Status '0'.

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-5
SIMATIC TIA Portal Programming 1

8.3. Task Description: Expanding the "FC_Mode" Function

DI DO
I 0.0 Operation OFF
"S_OperationOFF" (NC)

I 0.1 Operation ON Operation Q0.1


"S_OperationON" "P_Operation"

I 0.2 Jog right


"S_Right"

I 0.3 Jog left


"S_Left"

Task Description
The "FC_Mode" function is to be changed in such a way that the output "P_Operation" is not
assigned via the input "S_OperationON" but set by the input (NO) "S_OperationON" and reset via
the input (NC) "S_OperationOFF".

TIA-PRO1 - Binary Operations 2


8-6 Training Documents, V14.01.01
SIMATIC TIA Portal Programming 1

8.3.1. Exercise 1: Programming the "FC_Mode" Block Expansion

Task
In "FC_Mode" you are to change the code in the operating mode section for the distribution
conveyor:
The operation, that is, the indicator light "P_Operation" (simulator LED Q0.1) is switched on via
the simulator switch "S_OperationON“ (I 0.1) and is switched off via the simulator switch
"S_OperationOFF" (I 0.0, NC).

What to Do
1. Open the "FC_Mode" block.
2. Delete the assignment programmed in the last chapter.
3. Open the "Instructions" Task Card and drag the instructions shown in the picture into the
block using drag & drop.
4. Link the input for ‘Set’ with the variable "S_OperationON" and the ‘Reset’ input with the
variable "S_OperationOFF".
5. Since NC contacts are used to switch off systems for safety reasons (interruption-safe), the
input "S_OperationOFF" must be negated.
6. Above the instruction, specify "P_Operation" as the operand.
7. Save, compile, download and test your newly programmed function.

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-7
SIMATIC TIA Portal Programming 1

8.4. Task Description: Parts Transportation in Automatic Mode

Conv. Start Transport Phase Conv. Stop

"B_Bay1"
(I 3.5)

"S_Bay1"
(I 3.1)

"B_Bay2"
(I 3.6)

"S_Bay2"
(I 3.2)

"B_LB"
(I 3.0)

"K_Right"
(Q3.5)

Task Description:
When "P_Operation" (Q0.1) is switched on, parts are to be transported from Bay 1 or Bay 2 into
the light barrier "B_LB" (I 3.0). The precondition is that a part is only placed on the conveyor at
one of the two bays. If parts are placed on the conveyor at both bays, no transport sequence can
be started.
• The conveyor motor "K_Right" (Q3.5) is started when
− at Bay 1 the proximity sensor "B_Bay1" (I 3.5) is occupied AND at Bay 2 the proximity
sensor "B_Bay2" (I 3.6) is NOT occupied AND the pushbutton at Bay 1 "S_Bay1" (I 3.1) is
pressed
OR
− at Bay 2 the proximity sensor "B_Bay2" (I 3.6) is occupied AND at Bay 1 the proximity
sensor "B_Bay1" (I 3.5) is NOT occupied AND the pushbutton at Bay 2 "S_Bay2" (I 3.2) is
pressed.
• The conveyor motor "K_Right" (Q3.5) is stopped when
− the part has reached the light barrier "B_LB" (I 3.0)
OR
− "P_Operation" (Q0.1) is switched off.

TIA-PRO1 - Binary Operations 2


8-8 Training Documents, V14.01.01
SIMATIC TIA Portal Programming 1

8.4.1. Multiple Assignment

Caution: The value last written for each


output in the Program cycle is ultimately
written in the real output of the peripheral

Process image Multiple assignment Process image


for inputs in the user program for outputs
IB 0 QB 0
IB 1 1 QB 1
IB 2 1 QB 2 0
: :
: :
: 2
:
0

CPU memory area CPU memory area

Process Images
For the storage of all digital input and output statuses, the CPU has reserved memory areas: the
process image for inputs (PII) and the process image for outputs (PIQ). During program
execution, the CPU accesses these memory areas exclusively. It does not access the digital input
and output modules directly.

"Classic Error": Double Assignment


If an output is assigned a status in several locations in the program, then only the status that was
assigned last is transferred to the particular output module. As a rule, these types of double
assignments are programming errors.

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-9
SIMATIC TIA Portal Programming 1

8.4.2. Exercise 2: Expanding "FC_Conveyor" (Automatic Mode)

Network x Memory byte Jog conveyor motor RIGHT in Manual mode (Operation OFF)

"M_JogRight"
Conditions for (M16.2) Memory byte for
jogging RIGHT jogging RIGHT
= when "P_Operation" OFF

Network y Memory byte Conveyor motor RIGHT in Automatic mode (Operation ON)

Conditions for "M_AutoRight"


Memory byte Conv. motor RIGHT (M16.4)

S Memory byte for


Switch on
Conveyor motor RIGHT
when "P_Operation" ON
Switch off R

Network z Control Conveyor motor RIGHT

"M_JogRight" >=1 "K_Right"


(M16.2) Conveyor motor RIGHT
(Q3.5)

"M_AutoRight" =
(M16.4)

Task
You are to expand the "FC_Conveyor" block with the previously described functions.

Solution Notes
The output to move the distribution conveyor to the right "K_Right" (Q3.5) must now be controlled
given the following two conditions:
Either when "P_Operation" (Q0.1) is switched off for Jogging RIGHT (in the picture Network x)
OR when "P_Operation" (Q0.1) is switched on under the conditions described in the Task
Description (in the picture Network y).
If, in both Network x and y, the result of logic operation of the conditions were each directly
assigned to the output "K_Right" (Q 3.5), an error in the form of a double assignment would
occur. Jogging the motor RIGHT in manual mode (Network x) would no longer function, since the
status assigned to the output here would then be overwritten in Network y.
The problem can be solved by programming a memory bit for each condition or by first assigning
the results of the logic operations to a memory bit each in both Network x and y. These are then
used in the Network to control the conveyor motor.

What to Do
1. Open the "FC_Conveyor" block.
2. Program the required functions in new networks (see graphic above and the graphic at the
previous page). Use the memory bits shown in the picture and provide them with the symbols
shown.
3. Modify the already existing network for jogging to the right as described in the solution notes.
4. Download the expanded block into the CPU and check the program function.
5. Save your project.

TIA-PRO1 - Binary Operations 2


8-10 Training Documents, V14.01.01
SIMATIC TIA Portal Programming 1

8.5. Task Description:


Parts Transportation THROUGH the Light Barrier

Conv. Start Transport Phase Conv. Stop

Part within
light barrier
Start condition
for transports

"B_LB"
(I 3.0)

"K_Right"
(Q3.5)
Up to now NEW

Function Up to Now in FC_Conveyor


When "P_Operation" (Q0.1 = '0') is switched off, you can jog the conveyor motor "K_Right" (Q3.5)
using the simulator switches "S_Left" (I 0.3) and "S_Right" (I 0.2).
When "P_Operation" (Q0.1) is switched on, the conveyor motor "K_Right" (Q 3.5) is switched on
when a part is placed on the conveyor exactly in front of one of the proximity sensors of Bay 1 or
2, and the occupied bay’s pushbutton is pressed.
The conveyor motor "K_Right" (Q3.5) is stopped when the part has reached the light barrier or
"P_Operation" (Q0.1) is switched off.

Task Description:
The function of "FC_Conveyor" to control the conveyor motor when "P_Operation" (Q0.1) is
switched on is to remain fundamentally unchanged. However, the conveyor motor is only to stop
when the part has passed through the light barrier.

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-11
SIMATIC TIA Portal Programming 1

8.5.1. Signal Edge Evaluation

FBD LAD

"S_OperationON"
!!!
"S_OperationOFF"

"P_Operation"

"M_1CycleTRUE"
OB OB OB
Cycle Cycle Cycle

Scanning the Operand for Positive (–|P|– ) or Negative (–|N|– ) Signal Edge
With a signal edge evaluation, it is possible to detect whether the status of an individual operand
(in the example "S_OperationON") has changed from '0' to '1' (rising or positive edge) or from '1'
to '0' (falling or negative edge). If this is the case the instruction supplies RLO '1' as the result,
which can be further logically linked (in the example as Set condition) or can be assigned to
another operand (for example, a memory bit) as status. In the following cycle, the instruction then
once again supplies '0' as the result even if "S_OperationON" still is status '1'.
The instruction compares the current status of the operand "S_OperationON" with its status in the
previous program cycle. This status is stored in a so-called edge memory bit (in the example
"M_PosEdge"). It must be ensured that the status of this edge memory bit is not overwritten
elsewhere in the program. For each edge evaluation, a separate edge memory bit must be used
accordingly, even then when the same operand (in the example "S_OperationON") is evaluated
again, for example, in another block!
As well, the edge is assigned to a pulse memory bit (M_1CycleTRUE) in the example. This has
the advantage that the edge of the operand is only scanned once in the program. If, in the further
course of the program, the edge of the operand must once again be evaluated, no further edge
memory bit is required but rather the status of the pulse memory bit can be scanned.

TIA-PRO1 - Binary Operations 2


8-12 Training Documents, V14.01.01
SIMATIC TIA Portal Programming 1

8.5.1.1. RLO Edge Evaluation

FBD LAD

"B_LB"

"K_Right"

& -RLO

"M_ImpPos"
OB1
OB1
Cycle
Cycle
"M_ImpNeg" OB1
OB1 Cycle
Cycle

RLO Edge Evaluation (P_TRIG, N_TRIG)


With an RLO edge evaluation, it is possible to detect whether the status of an individual operand
or the result of a logic operation has changed from '0' to '1' (rising or positive edge) or from '1' to
'0' (falling or negative edge). If this is the case, both edge evaluations supply the result RLO '1' to
their output for the duration of one cycle. In the following cycle, the instructions then once again
supply RLO '0' as the result even if the status or the RLO of the operand or the logic operation
has not changed.
The instructions compare the current status of the operand or the result of a logic operation with
its status in the previous program cycle which is stored in a so-called edge memory bit for this (in
the example, "M_EdgePos" or "M_EdgeNeg). It must be ensured that the status of this edge
memory bit is not overwritten elsewhere in the program. For each edge evaluation, a separate
edge memory bit must be used accordingly, even then when the same operand is evaluated
again, for example, in another block!

About the examples in the picture:


• For the instructions P_TRIG and N_TRIG, the result, that is, the RLO of the edge evaluation
is available on the right at the output. It can be further logically linked or assigned to an
operand (in the example, it is assigned to the operand "M_ImpPos" or "M_ImpNeg).

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-13
SIMATIC TIA Portal Programming 1

8.5.2. Exercise 3: Integrating an Edge Evaluation in "FC_Conveyor"

Conv. Start Transport Phase Conv. Stop

Part within
light barrier
Start condition
for transports

"B_LB"
(I 3.0)

"K_Right"
(Q3.5)
Up to now NEW

Task:
When "P_Operation" (Q0.1 = '1') is switched on, the parts are to be transported from Bay 1 or 2
THROUGH the light barrier.

What to Do:
1. Program the necessary changes in "FC_Conveyor", by now linking the result of the edge
evaluation as the reset condition of the memory byte "M_AutoRight" (memory byte for
conveyor motor RIGHT) instead of the light barrier signal "B_LB" (I 3.0) itself. For the
necessary edge evaluation of the light barrier signal use the memory byte "M_AuxLB" (M16.0)
as an edge memory bit.
2. Download the modified "FC_Conveyor" block into the CPU and check the program function.

TIA-PRO1 - Binary Operations 2


8-14 Training Documents, V14.01.01
SIMATIC TIA Portal Programming 1

8.6. Task Description: Controlling the Indicator Lights,


Commissioning "FC_Signal"

"B_Bay1" "B_Bay2"
(I 3.5) (I 3.6)

"P_Bay1" "P_Bay2" "P_BayLB"


(Q3.1) (Q3.2) (Q3.4)
Constant light: A new part can be placed
2Hz flashing light:
1Hz flashing light: Conveyor can be started Caution, conveyor motor
is running
2Hz flashing light: Caution, conveyor motor is running

Task Description
When "P_Operation" (Q0.1) is switched on, the indicator lights "P_Bay1" (Q3.1) and "P_Bay2"
(Q3.2) are to be controlled as follows:
• They show
− a constant light when a new part may be placed on the conveyor (distribution conveyor is
stopped and both proximity sensors are free)
− a 1Hz flashing light at the bay where a part is detected by the associated proximity sensor,
however, only as long as the conveyor has not yet been started (if parts are placed on the
conveyor at both proximity sensors, neither indicator light must light up)
− a 2Hz flashing light as long as the distribution conveyor is running
• The indicator light at the light barrier bay "P_BayLB" (Q3.4) shows a 2Hz flashing light as long
as the conveyor motor is running.
The described functions are already partially programmed in the "FC_Signal" block which is
stored in the "PRO1_Lib" global library. The block is to be commissioned and completed by you
in the next exercise.

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-15
SIMATIC TIA Portal Programming 1

8.6.1. Exercise 4: Writing/Correcting "FC_Signal" and Commissioning It

Task
You are to either program the "FC_Signal" block yourself or you are to copy it from the
"PRO1_Lib" global library into the project, and then commission and complete it.

What to Do
Create the new "FC_Signal" block and program the required functions or:
1. Using drag & drop, copy the "FC_Signal" block into the "Program blocks" folder from the
"PRO1_Lib" global library (as shown in the picture).
2. Complete the block so that the indicator lights "P_Bay1" (Q3.1) and "P_Bay2" (Q3.2) show
the required signals. (The indicator light "P_BayLB" is already programmed.)
3. Program the call of "FC_Signal" in "OB_Cycle".
4. Download all modified blocks into the CPU and test the program function.
5. Save your project.

Note:
The completely programmed blocks can be found in the library in the folder "Chapter 08 > ready".

TIA-PRO1 - Binary Operations 2


8-16 Training Documents, V14.01.01
SIMATIC TIA Portal Programming 1

8.7. Additional Exercise: Optimizing "FC_Mode"

OLD: without edge evaluation


"S_OperationON"
(I 0.1)

"S_OperationOFF"
(I 0.0, NC)

"P_Operation"
(Q0.1)

NEW: with edge evaluation


"S_OperationON"
(I 0.1)

"S_OperationOFF"
(I 0.0, NC)

"P_Operation"
(Q0.1)

Function Up to Now of "FC_Mode"


"P_Operation" (Q0.1) is switched on with the simulator switch "S_OperationON" (I 0.1) and
switched off with the simulator switch "S_OperationOFF" (I 0.0, NC). If you activate both switches
simultaneously, the operation remains switched off or is switched off if currently on. If, however,
both switches are activated and the OFF switch is let go while the ON switch is activated, the
operation switches back on without the ON switch having to be activated again (see picture,
upper function diagram "OLD: without edge evaluation").

Task:
You are to expand the functionality of "FC_Mode" using edge evaluation so that the ON switch
must be activated every time the operation is switched on (see picture, lower function diagram
"NEW: with edge evaluation"). The criteria for switching on the system is no longer to be the
activated ON switch or its "1" signal, but the function of activating or the "positive edge" of the ON
switch signal.

What to Do:
1. In the set condition for "P_Operation" (Q0.1), insert an edge evaluation of the switch
"S_OperationON" (I 0.1). For the edge evaluation, use the memory byte "M_AuxOpON"
(M15.1) as edge memory bit.
2. Download the modified "FC_Mode" into the CPU and check whether it fulfils the desired
functions!

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-17
SIMATIC TIA Portal Programming 1

8.8. Additional Information

Note
The following pages contain either further information or are for reference to complete a topic.
For more in-depth study we offer advanced courses and self-learning mediums.

TIA-PRO1 - Binary Operations 2


8-18 Training Documents, V14.01.01
SIMATIC TIA Portal Programming 1

8.8.1. Jump Instructions JMP, JMPN, RET

Jump if RLO='1' Jump if RLO='0'

Jump Instructions JMP and JMPN


With the jump instructions JMP and JMPN, the linear execution of the program can be interrupted
within a block and continued in another network. With the jump instruction, a Label is specified
which also identifies the target network. The specified label must be located in the same block
and be unique. Each label can be jumped to from several locations. The jump can take place in
networks with higher (forwards) or lower numbers (backwards).
• JMP:
If RLO ='1', the jump into the target network is executed; if RLO ='0', the jump is not executed
and the linear program execution continues.
• JMPN:
If RLO ='0', the jump into the target network is executed; if RLO ='1', the jump is not executed
and the linear program execution continues.

End Block Execution RET


With the instruction RET the program execution of the entire block is ended. If the input of the
instruction is assigned then this is a “Conditional block end” and only leads to a block abort when
the scan is fulfilled.
Each block has an "ENO" enable output through which the information as to whether the block
was executed without error can be communicated to the calling block. With the help of the RET
function, the "ENO" enable output can be written.
• Ret (RLO = the result of logic operation. The calling block is supplied the signal status "1"
since the RET instruction, as conditional instruction, is only executed when the condition is
TRUE.)
• Ret True or Ret False (The respective value of the constants, TRUE or FALSE, is supplied to
the calling program block.)
• Ret Value (The value of the Boolean variable <Operand>, which is specified above the
instruction, is supplied to the calling program block.)

TIA-PRO1 - Binary Operations 2


Training Document, V14.01.01 8-19
SIMATIC TIA Portal Programming 1

Contents 10
10. Digital Operations ................................................................................................ 10-2
10.1. Task Description: Counting the Transported Parts and Timed Monitoring of the
Transportation ..................................................................................................................... 10-3
10.1.1. Acquiring, Processing and Outputting Data ........................................................................ 10-4
10.1.2. Integer (INT, 16-Bit Integer) Data Type .............................................................................. 10-5
10.1.2.1. Double Integer (DINT, 32-Bit Integer) Data Type ............................................................... 10-6
10.1.3. REAL and LREAL (Floating-point Number) Data Type ...................................................... 10-7
10.1.4. Data Types and Display Formats........................................................................................ 10-8
10.2. Task Description: Counting the Transported Parts using Addition in "FB_CountADD"...... 10-9
10.2.1. Basic Mathematical Functions: Addition ........................................................................... 10-10
10.2.1.1. CALCULATE Box .............................................................................................................. 10-11
10.2.2. Comparison Operations .................................................................................................... 10-12
10.2.3. Value Assignment of a Variable ........................................................................................ 10-13
10.2.4. Programming All Instructions using Empty Box ................................................................ 10-14
10.2.5. Exercise 1: Counting the Transported Parts using Addition in "FB_CountADD".............. 10-15
10.2.6. Exercise 2: Calling "FB_CountADD" ................................................................................. 10-16
10.3. Task Description: Timed Monitoring of the Transport Sequences and Counting
Parts using IEC Functions ................................................................................................ 10-17
10.3.1. IEC Timer .......................................................................................................................... 10-18
10.3.2. IEC Timer TON (ON Delay) Pulse Diagram ..................................................................... 10-19
10.3.3. Exercise 3: Programming the Timed Monitoring of the Transports in "FC_Fault" ............ 10-20
10.4. IEC Counters: CTU, CTD, CTUD...................................................................................... 10-21
10.4.1. IEC Counters UP/DOWN: Inputs ...................................................................................... 10-22
10.4.2. IEC Counters UP/DOWN: Outputs ................................................................................... 10-23
10.4.3. Exercise 4: Counting the Transported Parts using an IEC Counter ................................. 10-24
10.4.4. Exercise 5: Replacing the "FB_CountADD" Call with the "FB_Count" Call ...................... 10-25
10.5. Additional Exercise 6: Counting the Conveyor Faults by Expanding "FC_Fault" ............. 10-26
10.5.1.1. Additional Exercise 7: Timely Lock-out of the Conveyor Motor Jogging .......................... 10-27
10.6. Additional Information ....................................................................................................... 10-28
10.6.1. Comparator Operations: IN_RANGE, OUT_RANGE ....................................................... 10-29
10.6.2. Digital Logic Operations .................................................................................................... 10-30
10.6.2.1. Application Example: Digital Edge Evaluation .................................................................. 10-31
10.6.3. SIMATIC-Timer ................................................................................................................. 10-32
10.6.3.1. SIMATIC-Counter ............................................................................................................. 10-33
10.6.4. Value Ranges of Various Number Formats ...................................................................... 10-34

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-1
SIMATIC TIA Portal Programming 1

10. Digital Operations

At the end of the chapter the participant will …

… be familiar with the structure of the data types INT, DINT,


REAL and LREAL

… be familiar with various presentation types

… be able to use basic mathematical operations

… be familiar with comparison functions

… be familiar with the MOVE function for value assignment

… be familiar with the different counter and timer functions

… be able to use and program counter and timer functions

TIA-PRO1 - Digital Operations


10-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.1. Task Description: Counting the Transported Parts


and Time Monitoring of the Transportation

DI DO
I 0.0 Operation OFF
"S_OperationOFF" (NC)
"B_Bay1" "B_Bay2" "B_LB"
(I 3.5) (I 3.6) (I 3.0)
I 0.1 Operation ON Operation Q 0.1
"S_OperationON" "P_Operation"

I 0.2 Jog right


"K_Left"
"S_Right" "K_Right"
(Q 3.6)
(Q 3.5)

I 0.3 Jog left


"S_Left"

"S_Bay1" "S_Bay2" "S_BayLB"


(I 3.1) (I 3.2) (I 3.4)
"P_Bay1" "P_Bay2" "P_BayLB"
(Q 3.1) (Q 3.2) (Q 3.4)
Acknowledge fault Fault
I 0.7 "S_Acknowledge" "P_Fault" Q0.7
2Hz flashing light during transportation
and
2Hz flashing light for 1Hz flashing light
conveyor fault when ACT quantity = SETPOINT quantity (=3)

Function Up Till Now


When "P_Operation" (Q0.1) is switched on, parts are transported from Bay 1 or Bay 2 through the
light barrier. The transport sequence starts as soon as a part is placed on Bay 1 or Bay 2 and the
associated bay’s pushbutton is pressed and it ends as soon as the part has passed the light
barrier.

Task Description
• When "P_Operation" (Q0.1) is switched on, the transported parts are to be counted as soon
as they have passed through the "B_LB" (I 3.0) light barrier ("B_LB" 0  1). The number of
transported parts (ACTUAL quantity) is to be counted.
• The counter can be acknowledged (reset to 0) via the pushbutton "S_BayLB" (I 3.4). When
"P_Operation" (Q0.1) is switched on, the ACTUAL quantity is also reset to 0.
• The indicator light "P_BayLB" (Q3.4) shows a 1Hz flashing light when the actual quantity has
reached the setpoint quantity of 3 (= a new part must not be placed on the conveyor -> lock-
out in "FC_Signal") and no further transport sequence can be started (-> lock-out in
"FC_Conveyor"), and a 2Hz flashing light during parts transportation.
• Furthermore the time, that is required for the transport of a workpiece from Bay 1 and Bay 2
until it is through the light barrier, is measured.
• If the time it takes to transport exceeds 6 seconds, the conveyor is stopped and this is
indicated at the output "P_Fault" (Q0.7) with a 1Hz flashing light.
• Only after this error is acknowledged with "S_Acknowledge" (I 0.7) can a new part be
transported.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-3
SIMATIC TIA Portal Programming 1

10.1.1. Acquiring, Processing and Outputting Data

Operator Panel: Simulator:


Operating Pushbuttons
+ monitoring /Switches,
processes LEDs,
Voltmeter,
Potentiometer

DI DO AI

Control
unit:
(e.g. S7-1500)
Processing
the values

e.g. PROFINET

Field devices

Binary/Digital Processing
True logic control systems are recognizable in the fact that they exclusively process binary data.
The performance of today‘s control computer, as well as tasks in the areas of data processing,
quality control, among others, has increased the importance of digital data processing using
PLCs. Digital process variables can be found in all areas of open-loop control - such as in
connected devices for process operating and monitoring or in the control of field devices.

Operating and Monitoring


The goal of process monitoring is to provide the operator with up-to-the-minute information about
the working machine or system quickly, concisely and clearly as well as the opportunity to
intervene, control and influence the process. Depending on the type of device connected,
different number formats for the coding of data are used to transmit data between devices and
PLC, as well as for storing and processing data in the PLC.

Field Devices
Today as well, field devices that acquire process data or that control the process are supplied
directly with digital variables through field bus systems.

TIA-PRO1 - Digital Operations


10-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.1.2. Integer (INT, 16-Bit Integer) Data Type

Display Formats:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: + 662 BIN.: 2# 0 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0 HEX: 16# 0 2 9 6 Octal: 8# 1 2 2 6


9 0
+2 7 6x8 =6
Sign 2 0 1
+2
4 6 x 16 = 6 2 x 8 = 16
positive 2 1 2
numbers +2 1 9 x 16 = 144 2 x 8 = 128
+2 2
2 x 16 = 512
3
1x8 = 512
+ 662 662 662

without without
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
sign sign
DEC: - 662 BIN.: 2# 1 1 1 1 1 1 0 1 0 1 1 0 1 0 1 0 HEX:16# F D 6 A Octal: 8# 1 7 6 5 5 2
15 0
-2 14 2x8 =2
Sign +2 13 1
5 x2 8 = 40
negative +2 12 0
10 x 16 = 10 5 x 8 = 320
numbers +2 11 1
6 x 16 = 96 6x8 =
3
3072
+2 10 2 4
28672
8 6
+2 +2 +2 5 13 x 16 = 3328 7x8 =
5
3
+2 +2 +2
1 3
15 x 16 = 61440 1x8 = 32768
Representation as
twos complement - 662 64874 64874

Integer (16-Bit) Data Type


An Integer data type value is a whole number value, that is, a value without a decimal point.
SIMATIC S7 stores Integer data type values with sign in 16 bit code. This results in a value range
from -32768 to +32767. As well, SIMATIC S7 provides arithmetic operations for processing
Integer values.

Decimal
STEP7 uses the Decimal display format, that is, with sign and without explicit format description,
to specify the constants of the Integer data type. The use of constant Integer values in the Binary,
Hexadecimal, Octal display formats is possible in principle, but because of the poor legibility, they
are more or less not suitable.

Binary
In a digital computer system, all values are stored in a binary-coded form. Only the digits 0 and 1
are available in the binary number system. Base 2 of this number system results from the number
of available digits. Accordingly, the value of every bit of a binary number results from a power of
Base 2. This is also expressed in the format specification 2#.... .
Negative values are represented as binary numbers in twos complement. In this representation,
15
the most significant bit (bit no. 15 for the Integer data type) has the value -2 . Since this value is
greater than the sum of all residual values, this bit also has the sign information. That is, if this bit
= 0, then the value is positive; if the bit is = 1, then the value is negative. The conversion of a
binary number into a decimal number is made by adding the values of the bits that have a 1 (see
picture).

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-5
SIMATIC TIA Portal Programming 1

10.1.2.1. Double Integer (DINT, 32-Bit Integer) Data Type

Display Formats:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: +540809 BIN.: 2# 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1

Sign
positive
numbers

HEX: 16# 0 0 0 8 4 0 8 9
(without sign)

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

DEC: -540809 BIN.: 2# 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1

Sign
negative
numbers

Representation as Octal: 8# 3 7 7 7 5 7 3 7 5 6 7
twos complement
(without sign)

Double Integer (32-Bit Integer)


SIMATIC S7 stores Double Integer data type values with sign as 32 bit code. This results in the
value range from -2147483648 to +2147483648.

Hexadecimal
The hexadecimal number system provides 16 different digits (0 to 9 and A to F). This results in
Base 16 of this numbers system. Accordingly, the value of every bit of a hexadecimal number
results from a power of Base 16. Hexadecimal numbers are specified with 16# for identifying the
basic numbering system. The number of specifiable bits is variable from 1 to 16. The digits A to F
correspond to the decimal values 10 to 15. The value 15 is the last value that can be binary-
coded - without sign - with 4 bits. Out of this correlation, the simple conversion of a binary number
into a hexadecimal number and vice versa can be obtained. In this way, four binary bits each can
easily make up one digit of a hexadecimal number.

Octal Number
The octal number system provides 8 different digits (0 to 7). This results in Base 8 of this
numbers system. Accordingly, the value of every bit of an octal number results from a power of
Base 8. Octal numbers are specified with 8# for identifying the basic numbering system. The
value 7 is the value that can be binary-coded - without sign - with 3 bits. In this way, three binary
bits each can make up one digit of an octal number.

TIA-PRO1 - Digital Operations


10-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.1.3. REAL and LREAL (Floating-point Number) Data Type

General format of a Real number (32 Bit) = (Sign) • (x.f) • (2e-127)

Example: 0.75

Sign e = Exponent (8 Bit) f = Mantissa (23 Bit)

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
27 26 25 24 23 22 21 20 2-1 2-2 2-3 2-4 ..... 2-23

Real no. = +1.5 * 2 126-127 = 0.75

General format of an LReal number (64 Bit) = (Sign) • (x.f) • (2e-1023)

Sign e = Exponent (11 Bit) f = Mantissa (52 Bit)

63 62 ……………………………….. 52 51…………………………………………………………………………………………………………..…………….…0

210………………....20 2-1………………………………………………………………..…2-52

Real/LReal
The previously described INT and DINT data types are used to store whole number values with
sign. Accordingly, only operations that supply a whole number value as the result can be
performed with these values. In cases where analog process variables such as voltage, current,
and temperature etc., have to be processed, it becomes necessary to use Real values (real
numbers, "decimal numbers"). In order to be able to represent such values, binary digits have to
be defined whose value is less than 1 (power of base 2 with negative exponent).

Format
In order to be able to form the greatest possible value range within a defined memory capacity,
you must be able to select the decimal point position as required. Early on, IEEE defined a format
for floating-point numbers. This format was laid down in IEC 61131 and was included in STEP 7.
This format makes it easy to process a variable decimal point position. . In the binary code of a 32
Bit floating-point number, a portion of the binary digits contain the mantissa (23 Bit) and the rest
contain the exponent (8 Bit) and the sign bit of the floating-point number. A 64 Bit floating-point
number also has the sign bit; however, the exponent is 11 Bit and the mantissa 52 Bit.
After you enter a constant real value (for example: 0.75), the Editor automatically makes a
conversion to scientific notation (for example: 7.5000e-001).

Application
Floating-point numbers are used for "analog value processing", among other things. A great
advantage of floating-point numbers is in the number of operations possible with such numbers.
These include, in addition to the standard operations such as: +, -, * , / also instructions such as
sin, cos, exp, ln, etc, that are used mainly in closed-loop control algorithms.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-7
SIMATIC TIA Portal Programming 1

10.1.4. Data Types and Display Formats

Invalid value !!!


"accessed in between"

Display Formats
Different display formats can be selected in both the "Monitor / Modify Variables" and the "Monitor
(Block)" test functions to display variables or register contents. Basically, every variable can be
monitored with several display format options. Depending on the variable’s data type, it becomes
apparent that monitoring with the appropriate display format makes more sense.
• BOOL: Display a single bit (only possible for a variable of the BOOL data type)
• BIN: Display the individual bits of a variable (makes sense for variables of the BYTE,
WORD, DWORD, LWORD data types)
• HEX, BCD: Display the contents of a variable as a hexadecimal number, or, a BCD
number (makes sense for variables of the BYTE, WORD, DWORD, LWORD data types)
• DEC: Display the contents of a variable as decimal number (not BCD!) without sign
(makes sense for variables of the USINT, UINT, UDINT, ULINT data types)
• DEC+/-: Display the contents of a variable as decimal number (not BCD!) with sign (makes
sense for variables of the SINT, INT, DINT, LINT data types)
• FLOATING Point: Display the contents of a variable as floating-point number (makes sense
for variables of the REAL, LREAL data types)
• and others…

Addressing
The SIMATIC S7 memory is universally byte-oriented. Accordingly, memory word MW 20, for
example, contains the memory bytes MB 20 (high byte) and MB 21 (low byte, see picture), the
memory double-word MD 80, the memory bytes MB 80, 81, 82 and 83.
For absolute accesses to variables (such as, with MD 82), you must make sure that the
dimension of the access (here MD...) as well as the address (always equal to the address of the
high byte, here 82) is correct. Through an inadvertent "accessing in between", an invalid value
would be loaded (such as, with MW 83, see picture). Such errors can be avoided with the
symbolic addressing of variables.

TIA-PRO1 - Digital Operations


10-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.2. Task Description: Counting the Transported Parts using


Addition in "FB_CountADD"

"B_Bay1" "B_Bay2" With positive edge, increase Actual


(I 3.5) (I 3.6) "B_LB"
(I 3.0) quantity by ‘1’

"K_Right"
(Q 3.5)

"S_Bay2" "S_BayLB"
"S_Bay1"
(I 3.2) (I 3.4)
"P_Bay1" (I 3.1)
"P_BayLB"
(Q 3.1) "P_Bay2" (Q 3.4)
(Q 3.2)
2Hz flashing light during transportation
and
1Hz flashing light when ACT = SETP (=3)

Task Description
• When "P_Operation" (Q0.1) is switched on, the transported parts are to be counted as soon
as they have passed the light barrier "B_LB" (I 3.0) ("B_LB" 0->1).
• When the maximum quantity is reached, it is displayed via the LED "P_Bay_LB" (Q3.4) and
further transport is no longer possible.
• As long as no transport is possible, the LEDs at the Bays 1 and 2 are dark and thus also
signal that no transport is possible.
• The counter can be acknowledged (reset to 0) at any time via the pushbutton "S_BayLB"
(I 3.4). When "P_Operation" (Q0.1) is switched on, the ACTUAL quantity is also reset to 0.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-9
SIMATIC TIA Portal Programming 1

10.2.1. Basic Mathematical Functions: Addition

1xR

Arithmetic Operations
There is a series of arithmetic operations available for the processing of variables of the
arithmetic data types, such as, integer (INT), double integer (DINT) and real (REAL).

Inputs and Outputs of the LAD/FBD Elements:


• EN (enable)
The execution of the operation can be determined as follows via the EN input:
− EN is not connected: The operation is always (regardless of the RLO) executed
− Logic operation at EN is fulfilled (RLO = 1): The operation is executed
− Logic operation at EN is not fulfilled (RLO = 0): the operation is not executed
• IN1 / IN2
The arithmetic calculation is applied to the values delivered to IN1 and IN2 and the result is
output to OUT.
• ENO (enable output)
(You can activate and deactivate the generation of the ENO output via the context menu.
Caution: The setting is valid for all further functions that are inserted into the project.)

If ENO is activated, it can accept the following values:


− ENO = 0 since the actual parameter at the EN input has the value FALSE
 OUT is not written (the variable delivered to OUT is not written, that is, it keeps its
original value)
− ENO = 0 because an error has occurred
 OUT contains an invalid value (the variable delivered to OUT is overwritten with an
invalid value)
− ENO = 1 (instruction was executed without error):
 OUT contains result (the variable delivered to OUT is overwritten with the result)

TIA-PRO1 - Digital Operations


10-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.2.1.1. CALCULATE Box

Calculate Box
With the Calculate Box, calculations can be combined which contain several different math
operations.
The implicit data type conversion is available at the inputs and outputs of the box and a check
can be made through the ENO output as to whether errors occurred in the calculation, such as,
overflows in the type conversions or the math operations, or, that the result of the calculate box is
error-free.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-11
SIMATIC TIA Portal Programming 1

10.2.2. Comparison Operations

Comparison Function
With the comparison instructions, the following pairs of numerical values can be compared:
• all variations of integers
• all variations of floating-point numbers (Real = IEEE floating-point numbers)
• all variations of TIME data types

If the result of the comparison is "true", then the output of the operation is "1", otherwise it is "0".
The input IN1 is compared with IN2 according to the selected type of comparison:
• == IN1 is equal to IN2
• <> IN1 is not equal to IN2
• > IN1 is greater than IN2
• < IN1 is less than IN2
• >= IN1 is greater than or equal to IN2
• <= IN1 is less than or equal to IN2.

TIA-PRO1 - Digital Operations


10-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.2.3. Value Assignment of a Variable

Parameter Data type Memory area Description


EN BOOL I, Q, M, D, L Enable input

ENO BOOL I, Q, M, D, L Enable output

All elementary data I, Q, M, D, L or constant Source value


IN types, DTL,
STRUCT, ARRAY

All elementary data I, Q, M, D, L Destination address


OUT1 types, DTL,
STRUCT, ARRAY

MOVE
You use the "MOVE" instruction to transfer the content of the operand at the IN input to the
operand at the OUT1 output.
The operation is only executed if the signal status at the enable input EN is "1" or is not assigned.
In this case and with error-free transfer, the ENO output also has signal status "1".

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-13
SIMATIC TIA Portal Programming 1

10.2.4. Programming Instructions using Empty Box

Select the
instruction

Select the
data type

Programming an Instruction using "Empty Box"


An instruction can also be programmed in the so-called "Empty box". The empty box is first pulled
from the "Instructions" task card using drag & drop, or it is pulled from the “Favorites” onto the
network. Then at the empty box, you select which instruction is to be used with which data type.

TIA-PRO1 - Digital Operations


10-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.2.5. Exercise 1: Counting the Transported Parts


using Addition in "FB_CountADD"

Setpoint quantity

Task
• When "P_Operation" (Q0.1) is switched on, the transported parts are to be counted as soon
as they have passed the light barrier "B_LB" (I 3.0) ("B_LB" 0->1). The number of transported
parts (ACTUAL quantity) is to be recorded with a counter and stored in the static variable
#ACT.
• When the setpoint quantity (constant value 3) is reached, then no new transport sequence
can take place which is also visible on the LEDs "P_Bay1" and "P_Bay2".
• The counter can be acknowledged (reset to 0) at any time via the pushbutton "S_BayLB"
(I 3.4). When the operation is switched on, that is, with a positive edge at "P_Operation"
(Q0.1), the ACTUAL quantity is also reset to 0.
What to Do:
1. Create the new function block "FB_CountADD".
2. Declare the necessary parameters and variables:

Input: - LB BOOL, Light barrier signal


- Reset BOOL, Reset the actuel no. of parts to 0
- Operation BOOL, Operation mode
Output: - ActSetp BOOL, the actual no. of parts has reached the
setpoint value
Static: - PosEdgeLB BOOL, auxiliary bit for the edge evaluation of the
Light barrier signal
- PosEdgeOp BOOL, auxiliary bit for the edge evaluation of the
Operation mode signal
- Act UINT, actuel no.of transported parts
Constant: - const_Setp UINT, setpoint no.of parts to be transported

3. Program the new "FB_CountADD" block with the appropriate arithmetic operations and don’t
use any global variables (tags) to do so. For the edge evaluation of the light barrier, use the
static variable #PosEdgeLB and save the current quantity of the transported parts in the static
variable #ACT.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-15
SIMATIC TIA Portal Programming 1

10.2.6. Exercise 2: Calling "FB_CountADD"

Drag & Drop

Task
You are to call the "FB_CountADD" block and assign it the relevant parameters.

What to Do:
1. In OB_Cycle, call the new "FB_CountADD" block.
2. Supply the formal parameters with the relevant actual parameters. (see picture)
3. Modify the blocks "FC_Conveyor" and "FC_Signal" in such a way that when the quantity of 3
is reached, it is no longer possible to transport a part, the LEDs of Bays 1 and 2 are switched
off and the LED at the light barrier bay flashes with a 1 Hz frequency. For this, use the global
variable "M_ActSetp"
4. Compile and save your project and check that it functions correctly.

TIA-PRO1 - Digital Operations


10-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.3. Task Description: Timed Monitoring of the Transport Sequences


and Counting Parts using IEC Functions

DI DO
I 0.0 Operation OFF
"S_OperationOFF" (NC)

I 0.1 Operation ON Operation Q0.1


"S_Operation" "P_Operation"

I 0.2 Jog right


"S_Right" "K_Right"
(Q 3.5)
I 0.3 Jog left
"S_Left"

1Hz flashing light when


Setpoint quantity reached
Acknowledge fault Fault
I 0.7 "S_Acknowledge" "P_Fault" Q0.7

2Hz flashing light for


conveyor fault

Task Description
1. The automatic transport sequences are to be monitored for time with the help of an IEC
function. The monitoring is to function as follows:
o If a transport sequence takes longer than the 6 second monitoring time, there is a fault and
the conveyor motor is automatically switched off.
o A fault is displayed with a 2Hz flashing light on the simulator LED "P_Fault" (Q0.7).
o A fault can be acknowledged via the simulator switch "S_Acknowledge" (I 0.7).
o As long as there is an unacknowledged fault, the indicator lights "P_Bay1" (Q3.1) and
"P_Bay2" (Q3.2) are dark and no new transport sequence can be started.
2. The counting of the transported parts is to be implemented with an IEC function.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-17
SIMATIC TIA Portal Programming 1

10.3.1. IEC Timer

Data Block
In addition to internally required variables, the timer function also stores the current already
expired time in a data block which must be specified when programming the timer function. The
specified data block is automatically generated by the Editor with exactly the internal structure
that the timer function requires. The user has no further programming effort with this data block
other than having to download it into the CPU.

Input Variable "PT"


The variable PT of the time function can be of the type Time or LTime.

Data Type TIME


The contents of a variable or constant of the data type TIME is interpreted as an integer number
in milliseconds and stored in the memory as a 32-bit integer with sign. The representation
contains information for days (d), hours (h), minutes (m), seconds (s) and milliseconds (ms).

Value range: T#-24d20h31m23s648ms to T#+24d20h31m23s647ms

Data Type LTIME


The contents of an operand of the data type LTIME is interpreted as nanoseconds. The
representation contains information for days (d), hours (h), minutes (m), seconds (s), milliseconds
(ms), microseconds (us) and nanoseconds (ns).

Value range: -106751d 23h 47m 16s 854ms 775us 808ns


to
+106751d 23h 47m 16s 854ms 775us 807ns

TIA-PRO1 - Digital Operations


10-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.3.2. IEC Timer TON (ON Delay) Pulse Diagram

TON
The timer function TON (Timer on delay, "ON Delay") is started with a rising edge at input IN. So
that the time expires, RLO must continue to be '1'. The timer function supplies a '1' signal at
output Q, as soon as the specified time (variable or constant of data type TIME or LTIME) at input
PT has expired and as long as the start signal at input IN still exists. The already expired time can
be queried at output ET by passing a variable of data type TIME or LTIME.

Parameter Data type Memory area Description


IN BOOL I, Q, M, D, L Start input

I, Q, M, D, L or Duration by which the rising edge at


PT TIME
constant input IN is delayed

Q BOOL I, Q, M, D, L Output that is delayed by the time PT

ET TIME I, Q, M, D, L Expired time

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-19
SIMATIC TIA Portal Programming 1

10.3.3. Exercise 3:
Programming the Time Monitoring of the Transports in "FC_Fault"

Drag & Drop

Task
The automatic transport sequences are to be monitored for time as previously described. If a
transport sequence takes longer than 6 seconds, the conveyor motor is automatically switched off
and the fault is displayed with a 2Hz flashing light on the simulator LED "P_Fault" (Q0.7). As long
as a fault is not acknowledged "S_Acknowledge" (I 0.7) no new transport sequence can be
started.

What to Do
1. In the PLC tag table "My_Tags", declare the user constant "const_maxTime" of the data type
Time with the value T#6s as shown in the picture.
2. Expand the "FC_Fault" block with the necessary functions:
− At input IN, program the relevant start conditions
(the timer must be started when an automatic transport sequence starts)
− Pass the data block "iDB_IEC_Timer_1" as the instance-DB to the IEC timer function TON
and as a time duration, the user constant "const_maxTime" (see picture).
− In case the maximum transportation time is exceeded, set the memory bit "M_ConvFault"
(M17.0), in order to be able to further logically link it in other blocks later on.
3. In the "FC_Conveyor" block, program the required switching off the conveyor motor when
there is a conveyor fault.
4. In "FC_Signal", program the 2Hz flashing of the simulator LED "P_Fault" (Q0.7) and the lock-
outs of the indicator lights "P_Bay1" (Q3.1) and "P_Bay2" (Q3.2) when a fault exists.
5. Download all modified blocks into the CPU, check the program function.
6. Save your project.

TIA-PRO1 - Digital Operations


10-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.4. IEC Counters: CTU, CTD, CTUD

Counters
Counters are used to count events, record quantities, etc. There are up counters and down
counters as well as counters that can count in both directions.

Value Range of a Counter


The count or value range of a counter depends on its data type (see picture) which is always an
integer. The various selectable Integer data types merely differentiate themselves in their value
range and thus determine the count range of the counter.

Instance Data Block


In addition to internally required variables, the counter also stores its current counter value in a
so-called instance data block which must be specified when programming a counter. The
specified instance data block is automatically generated by the Editor with exactly the internal
structure that the counter requires. The user has no further programming effort with this data
block other than having to download it into the CPU.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-21
SIMATIC TIA Portal Programming 1

10.4.1. IEC Counters UP/DOWN: Inputs

Parameter Declaration Data type Memory area Description


CU Input BOOL I, Q, M, D, L Count up input
CD Input BOOL I, Q, M, D, L Count down input
R Input BOOL I, Q, M, D, L Reset input

LD Input BOOL I, Q, M, D, L Load input

Integers I, Q, M, D, L or Value to which the output QU is


PV Input (INT) constant set. / Value to which the output CV
is set when LD = 1.

Input CU and CD
With a positive edge at input CU, the current count is increased by one; with a positive edge at
input CD, the current count is decreased by 1. This means that the user doesn’t have to program
an edge evaluation.
If a positive edge is detected at both inputs simultaneously or in the same cycle, the current count
remains unchanged. If the upper or lower limit of the specified data type is reached, the count is
no longer increased or decreased for a positive edge at CU or CD.

Input R
The input R acts statically, that is, as long as RLO '1' is at input R, the count is set to 0 and rising
edges or RLO '1' at the inputs CU, CD and LOAD have no effect on the current count.

Input LD (Load, only for down counters)


The input LD acts statically, that is, as long as RLO '1' is at input LOAD, the current count is set to
the value that is passed to the input PV, and positive edges at the inputs CU and CD have no
effect on the count.

Input PV
The value to which the count is to be set must be passed to the input PV as long as RLO '1' is at
input LD. The variable or constant passed to the input must be compatible with the data type of
the counter.

TIA-PRO1 - Digital Operations


10-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.4.2. IEC Counters UP/DOWN: Outputs

Parameter Declaration Data type Memory area Description


BOOL I, Q, M, D, L Current count value greater than
QU Output
or equal to the value at input "PV"
BOOL I, Q, M, D, L Current count value less than or
QD Output
equal to "0"
Integers I, Q, M, D, L Current count value
CV Output (INT)

Output QU
The current status of the up counter can be checked at the output QU. As long as the current
count is greater than or equal to the value of the parameter PV, the output QU has Status '1',
otherwise, Status '0'.

Output QD (Only for down counters)


The current status of the down counter can be checked at the output QD. As long as the current
count is less than or equal to zero, the output QD has Status "1", otherwise, Status '0'.

Output CV
The current count is output at output CV. The variable passed to the output must be compatible
with the data type of the counter.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-23
SIMATIC TIA Portal Programming 1

10.4.3. Exercise 4: Counting the Transported Parts using an IEC Counter

Setpoint quantity: INPUT

Task
• When "P_Operation" (Q0.1) is switched on, the transported parts are to be counted as soon
as they have passed the light barrier "B_LB" (I 3.0) ("B_LB" 0->1). The number of transported
parts (ACTUAL quantity) is to be recorded with a counter and stored in the static variable
#ACT.
• When the setpoint quantity (constant value 3) is reached, then no new transport sequence
can take place which is also visible on the LEDs "P_Bay1" and "P_Bay2".
• The counter can be acknowledged (reset to 0) at any time via the pushbutton "S_BayLB"
(I 3.4). When the operation is switched on, that is, with a positive edge at "P_Operation"
(Q0.1), the ACTUAL quantity is also reset to 0.
What to Do:
4. Create the new function block "FB_Count".
5. Declare the necessary parameters and variables:

Input: - LB BOOL, Light barrier signal


- Reset BOOL, Reset the actuel no. of parts to 0
- Operation BOOL, Operation mode
Output: - ActSetp BOOL, the actual no. of parts has reached the
setpoint value
Static: - PosEdgeLB BOOL, auxiliary bit for the edge evaluation of the
Light barrier signal
- PosEdgeOp BOOL, auxiliary bit for the edge evaluation of the
Operation mode signal
- Act UINT, actuel no.of transported parts
Constant: - const_Setp UINT, setpoint no.of parts to be transported

6. Program the new "FB_CountADD" block with the appropriate arithmetic operations and don’t
use any global variables (tags) to do so. For the edge evaluation of the light barrier, use the
static variable #PosEdgeLB and save the current quantity of the transported parts in the static
variable #ACT.

TIA-PRO1 - Digital Operations


10-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.4.4. Exercise 5: Replacing the "FB_CountADD" Call with the "FB_Count" Call

What to Do
1. In the tag table "My_Tags", create a new tag "const_Setp" of the type UINT and give it the
value ‘3’.
2. Replace the call of "FB_CountADD" with the call of "FB_Count".
For this use the function "Changing the block call" in which the actual parameters are
adopted.
3. Create a new instance (iDB_FB_Count) for the block calls by right-clicking on the call of the
FB and then selecting the context menu item "Change instance…".
4. Interconnect the new input formal parameter "Setp" with the new global constant "const_Setp"
5. Download all modified blocks into the CPU and check the program function.
6. Save your project.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-25
SIMATIC TIA Portal Programming 1

10.5. Additional Exercise 6: Counting the Conveyor Faults


by Expanding "FC_Fault"

"M_ConvFault"
(M 17.0)

3
Fault 2
Counter
1
0

"P_Operation"
(Q0.1)

Function Up Until Now


When "P_Operation" (Q0.1) is switched on, the transport sequences are monitored for time. If a
transport sequence takes longer than the monitoring time of 6 seconds, there is a conveyor fault
and the conveyor motor is automatically switched off (logically linked in "FC_Conveyor").

Task:
When "P_Operation" (Q0.1) is switched on, the conveyor faults are to be counted. After 3
conveyor faults have occurred, "P_Operation" (Q0.1) is to be switched off for safety reasons. To
start a new transport sequence, the fault (as already programmed) must be acknowledged and
"P_Operation" (Q0.1) must be switched on once again.

What to Do:
1. In "FC_Fault in a new network, program the counting of the conveyor faults. The counter
counts up ‘1’ every time a conveyor fault occurs ("M_ConvFault" (M17.0) = “1“).
2. In "FC_Fault", pass the value at counter output Q to any memory bit you like.
3. In "FC_Mode", program the switching off (reset) of "P_Operation" (Q0.1) after three conveyor
faults. For this, use the memory bit to which you passed the counter output Q in "FC_Fault".
4. Download all modified blocks into the CPU and check the program function.
5. Save your project.

TIA-PRO1 - Digital Operations


10-26 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.5.1.1. Additional Exercise 7: Timely Lock-out of the Conveyor Motor Jogging

Lock-out
time LEFT

"S_Right"
(I 0.2)

"K_Right"
(Q3.5)

Lock-out
RIGHT
TOF Timer R

"S_Left"
(I 0.3)
Lock-out
time RIGHT
"K_Left"
(Q3.6)

Lock-out
LEFT
TOF Timer L

Function Up Until Now


When the indicator light of "P_Operation" (Q0.1) is switched off, the conveyor motor can be
jogged to the RIGHT and LEFT using the simulator switches "S_Right" (I 0.2) and "S_Left"
(I 0.3).

Task:
In order to avoid too great a load change, it should only be possible to jog the conveyor motor in
the opposite direction after it has been jogged to the RIGHT or to the LEFT after a lock-out time
of 2 seconds (see picture). If, for example, the motor has been jogged to the RIGHT, then it can
only be jogged back to the LEFT after the lock-out time of 2 seconds has expired.

What to Do:
1. In "FC_Conveyor", program two TOF timers (Off Delay) as the lock-out timers RIGHT and
LEFT and assign one memory bit each to the Timer result Q.
2. Gate these memory bits to the jog conditions.
3. Download the modified "FC_Conveyor" into the CPU and check the program function.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-27
SIMATIC TIA Portal Programming 1

10.6. Additional Information

TIA-PRO1 - Digital Operations


10-28 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.6.1. Comparator Operations: IN_RANGE, OUT_RANGE

100 500
IN_RANGE

OUT_RANGE

IN_RANGE
You can use the "Value within range" instruction to determine if the value at the VAL input is
within a specific value range. You specify the limits of the value range with the MIN and MAX
inputs (parameters). If the value at the VAL input fulfills the comparison MIN <= VAL or VAL <=
MAX, the box output has the signal status "1". If the comparison is not fulfilled, the box output has
the signal status "0".
The comparison function can only be executed if the values to be compared are of the same data
type.

OUT_RANGE
You can use the "Value outside range" instruction to determine if the value at the VAL input is
outside of a specific value range. You specify the limits of the value range with the MIN and MAX
inputs (parameters). If the value at the VAL input fulfills the comparison MIN > VAL or VAL >
MAX, the box output has signal status "1". If the comparison is not fulfilled, the box output has the
signal status "0".
The comparison function can only be executed if the values to be compared are of the same data
type.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-29
SIMATIC TIA Portal Programming 1

10.6.2. Digital Logic Operations

IW0 = AND OR XOR


15 0
0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0
MW10 acc. to “AND” 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0

W#16#5F2A = MW10 acc. to “OR” 0 1 0 1 1 1 1 1 0 0 1 1 1 0 1 0

0 1 0 1 1 1 1 1 0 0 1 0 1 0 1 0 MW10 acc. to “XOR” 0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 0

AND
The "AND" instruction gates (combines) the two digital values at inputs IN1 and IN2 bit-by-bit in
accordance with the AND truth table. The result of the AND operation is stored at output OUT.
The instruction is executed when EN = 1.
Example: Masking out the 4th decade of the thumbwheel buttons:
IW2= = 0100 0100 1100 0100
W#16#0FFF = 0000 1111 1111 1111
MW30 = 0000 0100 1100 0100

OR
The "Or" instruction gates (combines) the two digital values at inputs IN1 and IN2 bit-by-bit in
accordance with the OR truth table. The result of the OR operation is stored at output OUT. The
instruction is executed when EN = 1.
Example: Setting bit 0 in MW32:
MW32 = 0100 0010 0110 1010
W#16#0001 = 0000 0000 0000 0001
MW32 = 0100 0010 0110 1011

XOR
The "Exclusive OR" instruction gates (combines) the two digital values at inputs IN1 and IN2 bit-
by-bit in accordance with the XOR truth table. The result of the XOR operation is stored at output
OUT. The instruction is executed when EN=1.
Example: Detecting signal changes in IW0:
IW0 = 0100 0100 1100 1010
MW28 = 0110 0010 1011 1001
MW24 = 0010 0110 0111 0011

TIA-PRO1 - Digital Operations


10-30 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.6.2.1. Application Example: Digital Edge Evaluation

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-31
SIMATIC TIA Portal Programming 1

10.6.3. SIMATIC-Timer

max. time 2h 46min 30s


smallest time base: 10ms

ON Delay
SIMATIC Timer

S5Time

For reasons of compatibility to STEP5, you have the possibility of using SIMATIC-Timers in an
S7-1500. These timers are global. During the Start, the accuracy of the value range and what
kind of timer it is (ON Delay, OFF Delay etc.) is defined.

SIMATIC-Timers have the following system properties:


• They are assigned to a fixed number,
• They cannot be used repeatedly,
• The time frame lies between 0.01 and 9.99, 0.1 and 99.9, 1 and 999 or 10 and 9990s
• The accuracy depends on the selected time frame 10ms, 100ms, 1s or 10s

Note
In the time-cell (in the picture T1 of the memory area Timer), the operating system reduces the
time value in an interval (time frame) defined by the time base by one unit respectively until the
time value equals "0". The reduction occurs asynchronous to the user program. Consequently,
the resulting time is maximally up to one time interval of the time base shorter than the desired
time value.

TIA-PRO1 - Digital Operations


10-32 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

10.6.3.1. SIMATIC-Counter

Value range only 0 to 999

SIMATIC
Counter Count UpDown

Value in BCD

Just as with SIMATIC-Timers, SIMATIC-Counters can also be used for reasons of compatibility to
STEP5. The counters are also global.

SIMATIC-Counters have the following system properties:


• They are assigned to a fixed number,
• They cannot be used repeatedly,
• The value range lies between 0 and max. 999

Note
If you use an SIMATIC-Counter, then only use it in one location in the program, in order to avoid
count errors.

TIA-PRO1 - Digital Operations


Training Document, V14.01.01 10-33
SIMATIC TIA Portal Programming 1

10.6.4. Value Ranges of Various Number Formats

Format 1 Bit 1 Byte 1 WORD 1 DWORD 1 LWORD

2#0 to 2#0 to 2#1111_1111_1111_


2#0 2#0 to 2#0 to
2#1111_1111_ 1111_1111_1111_1111_1111_
Binary number or 2#1111_ 2#1111_1111
1111_1111_1111_ 1111_1111_1111_1111_1111_
2#1 111 _ 1111_1111
1111_1111_1111 1111_1111_1111

8#0
8#0 to 8#0 to 8#0 to 8#0 to 8#1_777_777_
Octal number or
8#377 8#177_777 8#37_777_777_777 777_777_777_777_777
8#1

Hexadecimal 16#0 to
16#0 or 16#0 to 16#0 to 16#0 to
number (BCD each 16#FF
16#1 16#FFFF 16#FFFF_FFFF 16#FFFF_FFFF_FFFF_FFFF
digit only 0-9) BCD

-128 to -32 768 to -2 147 483 648 to -9 223 372 036 854 775 808 to
Decimal number 0 or 1
+127 +32 767 +2 147 483 648 +9 223 372 036 854 775 807

Decimal number 0 to 0 to 0 to 0 to
0 or 1
without sign 255 65 535 4 294 967 295 18 446 744 073 709 551 615

-3.402823e+38 -1.7976931348623158e+308
to to
Real number -1.175495e-38 -2.2250738585072014e-308
(Floating-point / / / ±0,0 ±0.0
number) +1.175495e-38 +2.2250738585072014e-308
t0 to
+3.402823e+38 +1.7976931348623158e+308

TIA-PRO1 - Digital Operations


10-34 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

Contents 11
11. Data Blocks ........................................................................................................... 11-2
11.1. Data Blocks and their Usage .............................................................................................. 11-3
11.2. Meaning of Variables and Data Types ................................................................................ 11-4
11.2.1. Overview: Data Types in STEP 7 ....................................................................................... 11-5
11.2.1.1. Complex Data Types 1 ....................................................................................................... 11-6
11.2.1.2. Complex Data Types 2 ....................................................................................................... 11-8
11.3. Creating a Global Data Block.............................................................................................. 11-9
11.3.1. Editing a Data Block .......................................................................................................... 11-10
11.3.2. Default, Start and Monitor Values ..................................................................................... 11-11
11.3.3. Retentiveness, Download DB into the CPU / Upload from the CPU ................................ 11-12
11.3.3.1. Downloading Changed Data Blocks into the CPU ............................................................ 11-13
11.3.4. Snapshot, Setpoint, Start Value ........................................................................................ 11-14
11.3.4.1. Initializing Setpoints Online ............................................................................................... 11-15
11.3.4.2. Changing the Snapshot / Start Value of Several / All Data Blocks ................................... 11-16
11.3.5. Copy & Paste from / to Microsoft Excel ............................................................................ 11-17
11.4. Exercise 1: Creating Data Block "DB_OP" ....................................................................... 11-18
11.4.1. Exercise 2: Adjusting "FB_Count" and Updating the Call ................................................. 11-19
11.4.2. Exercise 3: Using DB Variables as Actual Parameters .................................................... 11-20
11.5. Additional Information ....................................................................................................... 11-21
11.5.1. Example of a Variable of the Data Type ARRAY.............................................................. 11-22
11.5.2. Example of a Variable of the Data Type STRUCTURE .................................................... 11-23
11.5.3. PLC Data Type.................................................................................................................. 11-24
11.5.4. Functions RD_SYS_T and RD_LOC_T ............................................................................ 11-25

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-1
SIMATIC TIA Portal Programming 1

11. Data Blocks

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

... understand the purpose of global data blocks

... be familiar with complex data types

... be able to create and edit global data blocks and use them in the program

… be familiar with the possibilities for addressing data block variables

… be able to monitor and initialize a data block

… be familiar with the difference between default values, start values,


monitoring values, setpoints and snapshots

TIA-PRO1 - Data Blocks


11-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.1. Data Blocks and their Usage

Data blocks contain variables for storing user data and accordingly occupy memory space in the
work memory of the CPU.

Area of Application
You can use data blocks in different ways, depending on their contents. You differentiate
between:
• Global data blocks: These contain information that all the code (logic) blocks in the user
program can access. Often, global data blocks are also used as an interface to HMI devices
(operating and monitoring devices).
• Instance data blocks: These are always assigned to a particular FB. The data of these
instance DBs should only be processed by the associated FB.

Creating DBs
Global DBs are created either with the Program Editor or according to a previously created PLC
data type. Instance data blocks are generated by the Editor according to a function block.

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-3
SIMATIC TIA Portal Programming 1

11.2. Meaning of Variables and Data Types

Variables represent the abstraction of reality and


permit you to save and later continue to process values.

By declaring a variable, the following


properties are defined:
 Symbolic name
 Memory area
 Validity range
 Data type

Actual_speed: REAL
The data type establishes:
 The possible value range Set_speed: REAL
(e.g. INT: -32 768 to +32 767)
 The permitted instructions
Fault: BOOL
(e.g. math instructions: +I, -I)
 How the bits in the memory are to be interpreted
(integer; hexadecimal number; floating-point Enable: BOOL
number; etc.)

The Meaning of Variables


Next to commands, variables are the most important elements of a programming system. Their
task is to save values in a program so that they can be further processed at a later time. The
value of a variable can be saved "anywhere" in the PLC memory.
The data represents an abstraction of reality in which irrelevant properties of objects are ignored.

Data Types
It is often quite difficult to decide how data is to be represented and the available possibilities
quite often restrict the choice. On the one hand, the object properties the data describe must be
correctly reflected. On the other hand, it must also be possible to carry out the instructions
necessary for process with the data.
The data type determines which values are accepted by data and which instructions can be
carried out with these values.
The data type uniquely defines
• the possible value range
• the permitted instructions
• how the bit pattern is to be interpreted

TIA-PRO1 - Data Blocks


11-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.2.1. Overview: Data Types in STEP 7

Type Data types


Elementary Binary number BOOL
Data types Bit sequences BYTE; WORD; DWORD; LWORD
Integers SINT; USINT; INT; UNIT; DINT; UDINT; LINT ULINT
Floating-point REAL; LREAL
numbers
Timers S5TIME; TIME; LTIME
DATE; TIME_OF_DAY; LTIME_OF_DAY;
Date, Time-of-day
LDT(DATE_AND_LTIME);
Characters CHAR; WCHAR

Complex Date, Time-of-day DT(DATE_AND_TIME); DTL;


Data types Character string STRING; WSTRING
Array ARRAY […] of <Datatype>
Anonymous STRUCT
Structure
User-defined PLC-data type (User Defined Data Type)

Elementary Data Types


Elementary data types are predefined in accordance with IEC 61131-3. They always have a
length less than or equal to 64 bits.

Complex Data Types


Complex data types contain data structures that can be made up of elementary and/or complex
data types. Complex data types can be used for the declaration of variables only in global data
blocks and within blocks for the declaration of local variables (TEMP, STAT) as well as
parameters (IN, OUT and INOUT).

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-5
SIMATIC TIA Portal Programming 1

11.2.1.1. Complex Data Types 1

Data type Length (Bits) S7-1200 S7-1500 Example

DT
(DATE_AND_TIME) 64 DT#2008-10-25-08:12:34.567

DTL 96 DTL#1976-12-16-20:30:20.250

8*
STRING (Number of ´This is a String´
characters+2)
max. 254 characters in ASCII format

WSTRING 16 *
WSTRING#´STRING in UNICODE format´
(Wide Character (Number of
String) characters+2)
Up to 16382 characters in Unicode format

DT
The data type DATE_AND_TIME represents a point in time consisting of the date and the time-
of-day. Instead of DATE_AND_TIME, the abbreviation DT can also be used.

Byte Contents Range of values


0 to 99 (Years 1990 to 2089)
BCD#90 = 1990
0 Year …
BCD#0 = 2000

BCD#89 = 2089
1 Month BCD#0 to BCD#12
2 Day BCD#0 to BCD#31
3 Hour BCD#0 to BCD#23
4 Minute BCD#0 to BCD#59
5 Second BCD#0 to BCD#59
6 The two most significant digits of MSEC BCD#0 to BCD#999
7 (4MSB) 1) The lease significant digit of MSEC BCD#0 to BCD#9
BCD#1 to BCD#7
BCD#1 = Sunday
7 (4MSB) 2) Weekday

BCD#7 = Saturday

TIA-PRO1 - Data Blocks


11-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

DTL
The data type DTL has a length of 12 bytes and, like LDT, stores information on date and time-
of-day precise to the nanosecond since 1.1.1970, only in a pre-defined structure.
Advantage: the individual values (day, hour, etc.) are easier to read out.

Byte Component Data type Range of values


0-1 Year UINT 1970 to 2554
2 Month USINT 1 to 12
3 Day USINT 1 to 31
1 (Sunday) to 7 (Saturday)
4 Weekday USINT
The weekday is not considered in the value entry.
5 Hour USINT 0 to 23
6 Minute USINT 0 to 59
7 Second USINT 0 to 59
8 -11 Nanosecond UDINT 0 to 999 999 999

STRING
The data type STRING stores several ASCII characters of the data type CHAR in a character
string with a maximum of 254 characters.

WSTRING
The data type WSTRING (Wide Character String) stores several Unicode characters of the data
type WCHAR in a character string with a maximum of 16382 characters.

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-7
SIMATIC TIA Portal Programming 1

11.2.1.2. Complex Data Types 2

Length S7- S7-


Data type Example
(Bits) 1200 1500

User-
ARRAY Measured values: ARRAY[1..20] of INT;
defined

Motor: STRUCT
ACT-Speed : REAL;
User- Set-Speed : UINT;
STRUCT
defined Fault : BOOL;
Enable : BOOL;
END_STRUCT

Define Use
(in data blocks and
(in the PLC-data types folder)
interfaces)

PLC-Data type User- PLC-DT1 : STRUCT Motor1 : PLC-DT1;


(UDT) defined Speed : REAL; Motor2 : PLC-DT1;
Enable : BOOL; Motor3 : PLC-DT1;
Fault : BOOL;
END_STRUCT :

Arrays and Structures consist of groups of elementary or complex data types.


They enable you to create data types suitable for your task with which you can structure large
quantities of data and process it symbolically.

ARRAY and STRUCT


ARRAYs and Structures can only be declared within global data blocks and as parameters or
local variables of code blocks.

PLC-Data Type (User-defined Data Type)


User-defined data types represent self-defined structures. This structure is stored in the PLC data
types and can be used as a "template" in another variable‘s data type.

TIA-PRO1 - Data Blocks


11-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.3. Creating a Global Data Block

Creating a Global Data Block


(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
is to be used:
• Global-DB for saving global data or for creating global variables
• Instance-DB or "private memory" for a user function block or a particular "instruction", behind
which a function block (FB) is also ultimately hidden

"Optimized Block Access" Attribute


Data blocks can be created with the attribute "Optimized block access":
• In S7-1200, these data blocks are created memory-optimized, that is, the variables are stored
in sequence so that fill bytes, through the changing, successive creating of variables of the
dimensions bit, byte word and double-word, are no longer required.
• In S7-1500, these data blocks are created access-optimized taking the S7 machine code into
consideration, so that – regardless of the memory requirements of the variables – the access
times to these are minimized.
Optimized Block Access see: TIA Portal Information Center > Documentation > Manuals
>Control Technology > Programming Guideline for an optimal programming of SIMATIC S7-
1200/1500 controllers

"Only Store in Load Memory" Attribute


This attribute means that in downloading into the CPU, the data block is only loaded into the load
memory of the CPU and from there is not automatically adopted in the work memory.

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-9
SIMATIC TIA Portal Programming 1

11.3.1. Editing a Data Block

Insert / Add new tag


Reset Start values to default values Save window settings
Update interface

1xR

Retentiveness for
not-optimized DBs
Absolute
can only be set for
addresses of tags
the entire DB,
for not-optimized
for optimized DBs it
DBs
can be set variable-
by-variable

Minimize / Maximize
Structures / Arrays

Offset
The offset denotes the absolute address of a variable within a DB. In the STEP7 program, the
use of the symbolic address or name is preferable since it is easier to read and less prone to
errors than the absolute addressing.
The absolute addresses of variables within the data block are not displayed for optimized blocks
and can also not be read out.

Retentiveness
For not-optimized blocks, the retentive behavior cannot be defined for the individual variables, but
always only for all variables or the entire data block.
When "Retain" is activated, the monitoring values are retained in the CPU until the data block is
initialized.
When "Retain" is not activated, the monitoring values in the work memory are overwritten with the
start values from the load memory after every STOP - RUN - transition (by PG, mode selector
switch or Power OFF->ON) of the CPU.

TIA-PRO1 - Data Blocks


11-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.3.2. Default, Start and Monitor Values

Current value of variable in the CPU (online)

Snapshot of current value (offline)

Start value of variable

Default start value

Default Value
Default values cannot be edited within global data blocks, only within PLC data types (the default
values of structure elements) and within FBs (the default values of parameters and static
variables).
If, within a global DB, a variable of the data type Structure is declared according to the PLC data
type x, the default values edited in the PLC data type are then displayed (as not editable) in the
data block and adopted as (editable) start values.
Within an FB, their default values also have to be specified in the declaration of parameters and
static variables. In the instance DBs of the FB, these default values are then displayed (as not
editable) and adopted as (editable) start values.

Start Value
In declaring a variable, the default value of a variable is automatically adopted as a start value;
however, this value can be overwritten at any time and downloaded into the controller. After a
data block was loaded into the CPU the first time, the CPU starts the program execution with
exactly this value. For all non-retentive variables, this value is written in the Monitor value with
every STOP-RUN-transition or for with an initialization; for retentive variables, only for a re-
initialization.

Monitoring Value
The monitoring value of a variable is the current value that the variable presently has in the work
memory of the CPU.

Snapshot
The value "Snapshot" is a monitoring value for an already passed point in time x, at which the
current monitoring values are read out of the CPU and stored offline as the values of the
"Snapshot".

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-11
SIMATIC TIA Portal Programming 1

11.3.3. Retentiveness, Download DB into the CPU / Upload from the CPU

"Download"
DB Load Memory Work Memory
DB DB
Default value STEP 7
Default values & Start value Monitor value Program
(with data types)

Start values

(Snapshot)

"Upload"

"Download" (to Device)


In downloading a data block from the PG into the CPU, the default values and start values as well
as the data types of the variables are transferred into the load memory of the CPU. From the load
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.

"Upload" (from Device)


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
"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".

Retentiveness (Retain)
With retentive variables, the "monitor values" (actual values) are retained after a CPU restart.
Non-retentive variables occupy work memory but no retentive memory and are thus reset to the
start values from the load memory with every CPU restart (PowerOffOn or after every STOP
- RUN).

TIA-PRO1 - Data Blocks


11-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.3.3.1. Downloading Changed Data Blocks into the CPU

Start value changed Structural change:


and
Name
DB downloaded
change:
in CPU No
initialization Download DB in CPU
is only possible with
re-initialization

Initialization
of all tags
Restart
carried out
Initialization
of non-retentive
tags

Downloading Data Blocks with Re-initialization


No matter whether a DB was created with standard or optimized block access, a change of start
values is not a structural change. Therefore, it can be done and downloaded into the CPU without
a re-initialization of the data block variables (tags) being necessary.
On the other hand, after structural changes, it is only possible to download the data block by re-
initializing all tags.
Structural changes are:
• Name changes (since synonymous with deleting a variable (tag) and creating a new one)
• Changes to the retentive behavior
• Adding / removing tags

DB Re-initialization during Restart


No matter whether a DB is created with standard or optimized block access, all monitor values of
non-retentive tags are overwritten with their start values when the CPU is restarted.

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-13
SIMATIC TIA Portal Programming 1

11.3.4. Snapshot, Setpoint, Start Value

Load Snapshot as Monitor values / Actual values

Snapshot of the Monitor values / Actual values

Insert new variable without losing actual values

Monitor On/Off (Block)

Apply snapshots as start values (All or Initialize variables


only setpoints) (All or only setpoints)

Snapshot

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

Copy Snapshot to Start Values

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

snapshots selected in the Setpoint column) or the button (for all snapshots). The next time
this DB is transferred, these values are applied as start value (no structural change of the DB -> a
download without re-initialization is possible).

Adjusting Actual Values

Furthermore, the entire DB can be initialized with the button and all values selected in the
Setpoint column can be initialized with the button.

TIA-PRO1 - Data Blocks


11-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.3.4.1. Initializing Setpoints Online

Initialize
3
Setpoints

Monitor
1
Block

Define
2
Setpoints

Initializing Setpoints in the Online Program


All variables that are checkmarked as "Setpoint" can be initialized online in the CPU. Online, the
monitor values are overwritten with the start values. The CPU remains in "RUN". The changed
monitor values are applied once at the next cycle control point. This applies for retentive as well
as for non-retentive variables. The program execution then continues with the new variable
values. Prerequisite is an online connection to the CPU, the structure of the data block is identical
online and offline and one or more variables are checkmarked as "Setpoint".

What to Do:
1. Open the global data block or instance data block and establish an online connection by
monitoring it.
2. In the "Setpoint" column, checkmark the variables whose monitor values are to be overwritten
with the start values in the CPU.
3. Click on the "Initialize Setpoints" button in order to initialize the variables checked as
"Setpoints".

Note:
For global data blocks, the "Setpoints" checkmark can only be set and reset for those variables
which have not been declared according to PLC-data type, without having to reload the block. For
variables that are declared according to PLC-data type, the "Setpoint" checkmark must be made
in the PLC-data type and then the DB has to be reloaded.
For instance data blocks, only the static variables can be initialized with "Initialize Setpoints".

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-15
SIMATIC TIA Portal Programming 1

11.3.4.2. Changing the Snapshot / Start Value of Several / All Data Blocks

Snapshot of Several / All Data Blocks


Just as a snapshot can be made, written back, the DB initialized and snapshots copied into the
start values for an individual data block, this can also be done for several or all blocks.

TIA-PRO1 - Data Blocks


11-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.3.5. Copy & Paste from / to Microsoft Excel

Copy & Paste to Excel

Copy & Paste from and to Excel


The Windows Copy & Paste function can be used to easily copy individual or several variables
from a data block to Excel to further process it/them there and then to copy it/them back from
Excel to the data block.

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-17
SIMATIC TIA Portal Programming 1

11.4. Exercise 1: Creating Data Block "DB_OP"

Task:
You are to create the data block "DB_OP" with the variables (tags) shown in the picture. The
variables are to be used in the STEP7 program and are also to serve as an interface to the
touchpanel.

What to Do:
1. Create the new "DB_OP" as a Global DB.
2. Declare the variables as shown in the picture above. Give the variable "SetpNo" the Start
value 3.
3. Save your project.

TIA-PRO1 - Data Blocks


11-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.4.1. Exercise 2: Adjusting "FB_Count" and Updating the Call

Function Up Until Now:


The transported parts are counted in "FB_Count" as soon as they have passed the light barrier.
The current count, that is, the actual quantity is stored in the static variable #Act and the setpoint
quantity is preset with constant 3 in the program.
If the actual quantity has reached the setpoint quantity, it is indicated on the conveyor model
indicator light "P_BayLB" (Q3.4) with a 1Hz flashing light and no new transport sequence can be
started. By acknowledging this signal with the conveyor model pushbutton "S_BayLB" (I 3.4), the
static variable #Act is overwritten with 0 and further transport sequences can be started.

Task
The function of "FB_Count" remains unchanged, however, the actual quantity is no longer to be
stored in the static variable #Act and the setpoint quantity is no longer to be preset with constant
3. Instead, the data block variables (tags) "DB_OP".ActNo and "DB_OP".SetpNo are to be used.

What to Do:
1. Change the static variable #Act into an InOut parameter of the same data type (UINT) and
save the function block.
2. Open the Organization block "OB_Cycle".
3. Update the call of "FB_Count". For this, open the context menu by right-clicking on the call of
"FB_Count" and activating the function "Update block call".
4. Confirm the dialog "Interface synchronization" with "OK".

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-19
SIMATIC TIA Portal Programming 1

11.4.2. Exercise 3: Using DB Variables as Actual Parameters

Split Editor

Task
You are to supply the formal parameters #Setp and #Act with the data block variables "ActNo"
and "SetpNo" of the data block "DB_OP".

What to Do:
1. Split the working area using the "Split Editor" button.
2. In one area open the data block "DB_OB" and in the other the organization block "OB_Cycle".
3. Supply the formal parameters #Setp and #Act with the data block variables "ActNo" and
"SetpNo" of the data block "DB_OP" using drag & drop.
4. Compile and save your project.
5. Monitor the "DB_OP" data block while you transport parts in Automatic mode and increase
the ACT quantity.

TIA-PRO1 - Data Blocks


11-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.5. Additional Information

Note
The following pages contain either further information or are for reference to complete a
topic.
For more in-depth study we offer advanced courses and self-learning mediums.

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-21
SIMATIC TIA Portal Programming 1

11.5.1. Example of a Variable of the Data Type ARRAY

Array [0..9] of LREAL with the name "Value"


(10 elements of the data type LREAL)

Array
An array consists of several elements of the same data type. In the picture above, you can see
the array "Value" with 10 elements of the data type LREAL. Later, various measured values are
to be stored in this array.

Declaring an Array in the DB


The data type of an array is called "ARRAY[n..m]". The first element (n) and the last element (m)
are specified in the square brackets. In the example, [0..9] means 10 elements, whereby the first
element is addressed with the index [0] and the last with the index [9]. Instead of [0..9] you could,
for example, define [20..29]. This only influences the access to the elements.

TIA-PRO1 - Data Blocks


11-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.5.2. Example of a Variable of the Data Type STRUCTURE

Structure with the name "Motor":


(several elements with different data types)

Structure
The picture shows an example of a structure named "Motor". The structure consists of several
elements of different data types. The individual elements of a structure can be elementary or
complex data types.
The access to the individual elements of a structure contains the structure name and the name of
the element. This makes the program easier to read.
Example: accessing individual elements of a structure:
• "Test-DB".Motor.Status
• " Test-DB".Motor.Drive
"Test-DB" is the symbol name of the data block which contains the structure. After the symbol
name, (separated by a dot) the structure name is specified. After the structure name (separated
by a dot) an element name of the structure follows.

Declaring a Structure in the DB


As a keyword for a structure, "STRUCT" is used. The end of the structure is automatically
identified with "END_STRUCT". A name is defined for the structure (in the example: "Motor").

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-23
SIMATIC TIA Portal Programming 1

11.5.3. PLC Data Type

Structure created once can always be re-used

PLC Data Types


PLC data types are data types defined by you that are used as templates for declaring
parameters and variables of complex data types (e.g. structure variables). PLC data types are
created and stored in the PLC data types folder, and contain a data structure that is made up of
elementary and/or complex data types. In the declaration of a variable according to PLC data
type, a structure variable is created whose inner data structure is defined by the PLC data type.
PLC data types can be used for the declaration of variables in global data blocks and within
blocks for the declaration of local variables (TEMP, STAT) as well as parameters (IN, OUT and
INOUT).

TIA-PRO1 - Data Blocks


11-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

11.5.4. Functions RD_SYS_T and RD_LOC_T

Data type
can be set

In the Task Card Instructions > Extended instructions > Date and time-of-day you will find
functions and instructions that are intended specifically for the handling of Date / time data types.
Here you will find functions with which, for example, times can be linked, compared, written, read
out etc., with one another.

RD_SYS_T
You use this instruction to read the current date and the current time-of-day (module time) of the
CPU clock.

RD_LOC_T
You use this instruction to read the current local time from the CPU clock and output this at the
output OUT. To display the local time, the information about time zone as well as the start of
daylight saving time and standard time which you set during the configuration of the CPU clock is
used.

TIA-PRO1 - Data Blocks


Training Document, V14.01.01 11-25
SIMATIC TIA Portal Programming 1

Contents 14
14. Distributed I/O....................................................................................................... 14-2
14.1. Task Description: Operating the Conveyor Model via the ET200SP Distributed I/O.......... 14-3
14.2. Distributed I/O Systems ...................................................................................................... 14-4
14.2.1. ET 200SP ............................................................................................................................ 14-5
14.2.1.1. ET 200SP: Configuration and Maximum Number of Modules ............................................ 14-6
14.2.2. ET 200 MP .......................................................................................................................... 14-7
14.2.2.1. ET 200MP: Configuration and Maximum Number of Modules ........................................... 14-8
14.2.3. Overview: Distributed Signal Modules ................................................................................ 14-9
14.3. Fieldbus Systems for SIMATIC S7 ................................................................................... 14-10
14.3.1. Identification of Distributed I/O Devices ............................................................................ 14-11
14.3.2. Components of the PROFINET Standard ......................................................................... 14-12
14.3.2.1. PROFINET IO Device Types ............................................................................................ 14-13
14.3.2.2. PROFINET Addresses ...................................................................................................... 14-14
14.3.2.3. PROFINET Communication Model ................................................................................... 14-15
14.4. Inserting and Networking Distributed I/O .......................................................................... 14-16
14.4.1. PROFINET IO Device ET 200SP: Assigning the IP Address and Device Name
OFFLINE ........................................................................................................................... 14-17
14.4.2. PROFINET IO Device ET 200SP: Assigning the Device Name ONLINE ........................ 14-18
14.5. Grouping Devices ............................................................................................................. 14-19
14.6. Task Description: Commissioning the ET 200SP ............................................................. 14-20
14.6.1. Exercise 1: ET 200SP: Reset to Factory Settings ............................................................ 14-21
14.6.2. Exercise 2: Reading-out the Firmware Version of the ET 200SP..................................... 14-22
14.6.3. Exercise 3: Offline Project: Adding the ET 200SP ............................................................ 14-23
14.6.4. Exercise 4: Networking the ET 200SP .............................................................................. 14-24
14.6.5. Exercise 5: Configuring and Parameterizing the ET 200SP ............................................. 14-25
14.6.6. Exercise 6: Setting the Channel Parameters of the Analog Modules ............................... 14-26
14.6.7. Exercise 7: ET 200SP: Assigning the IP Address / PROFINET Name OFFLINE ............ 14-27
14.6.8. Exercise 8: ET 200SP: Assigning the PROFINET Name ONLINE................................... 14-28
14.6.9. Exercise 9: Creating a New Device Group and Grouping Devices .................................. 14-29
14.6.10. Exercise 10: Compiling the Changes and Downloading them into the Device................. 14-30
14.6.11. Exercise 11: Adjusting the S7 Program via "Rewiring" ..................................................... 14-31
14.6.12. Exercise 12: Function Test with Conveyor Model via Distributed I/O ............................... 14-32
14.7. Additional Information ....................................................................................................... 14-33
14.7.1. Installing Distributed Peripheral Components Later On via GSD ..................................... 14-34

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-1
SIMATIC TIA Portal Programming 1

14. Distributed I/O

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

... be familiar with the various distributed I/O systems

… be familiar with the PROFINET and PROFIBUS bus


systems

... be able to explain the functional principle of PROFINET

... be able to configure, network and commission a distributed


PROFINET I/O station

TIA-PRO1 - Distributed I/O


14-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.1. Task Description: Operating the Conveyor Model


via the ET200SP Distributed I/O
DI DO

Operation
"P_Operation" Q0.1

DI DI DO AI AO

Initialization left
DI DO AI Q0.5
"P_InitLeft"

Initialization right
"P_InitRight" Q0.6

Acknowledge fault Conveyor fault


I 0.7 Q0.7
"S_Acknowledge" "P_Fault"

Industrial Ethernet

Task Description
• The conveyor model is no longer to be controlled via the DI/DO modules of the S7-1500
central device, but is to be controlled via the DI and DO modules of the distributed ET200SP
station.
• For this, the ET200SP must be networked with the central S7-1500 station via PROFINET
and the S7 program has to be adjusted.

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-3
SIMATIC TIA Portal Programming 1

14.2. Distributed I/O Systems

SIMATIC ET 200M SIMATIC ET 200MP


High functionality, S7-300 modules I/O modules in the S7-1500 design
…PROFIBUS or PROFINET (up to 12 …the multi-channel and multi-functional
modules per station) I/O of the S7-1500

SIMATIC ET 200S SIMATIC ET 200SP


Discretely modular and multi-functional Compact I/O modules for variable design
Hot Swapping and fixed wiring …the scalable I/O with largest
Installation up into Ex-Zone 2 portfolio and smallest space requirement

SIMATIC ET 200pro SIMATIC ET 200iSP


Modular and multi-functional: Power - Intrinsically safe (Ex i) and modular
modules, Motor starters, RFID modules, - Fail-safe modules (SIL3/Cat.4/PLe)
Fail-safe modules, CPU, Frequency - PROFIBUS
inverters
SIMATIC ET 200pro CPU SIMATIC ET 200SP CPU
… the power of the S7-1500 in the compact …the power of the S7-1500 in the
design of the ET 200pro compact design of the ET 200SP

SIMATIC ET 200AL SIMATIC ET 200eco and ET 200eco PN


I/O modules for IP65/67 Compact block I/O for IP65/66/67
…the robust I/O for the easiest assembly … for demanding applications
anywhere

TIA-PRO1 - Distributed I/O


14-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.2.1. ET 200SP

Matrix Code on the modules

DI DO AI AO
Color coding of the module class

Modular distributed I/O system

Smaller module size


● system-integrated power module
● high channel density (16-channel I/O modules)
● 50% smaller than ET 200S

Comprehensive performance spectrum


● stronger performance HS(high speed) modules
● PROFIenergy as integrated function

2d Matrix Code (Data Matrix)


This code is used for identifying modules and can be photographed or decoded by Smart
Phones, PDAs, and the like.
With the ET200SP modules, the code contains an Internet link to the product page of the
associated module.

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-5
SIMATIC TIA Portal Programming 1

14.2.1.1. ET 200SP: Configuration and Maximum Number of Modules

Maximum 64 modules including interface module

Diagnostic LEDs on every module

Measuring point

Bus termination
module (server
Load group 1
module)

Wiring with System-integrated power module


push-in terminals (different Base Units)
no separate power modules, since it is possible to
Spring opener supply voltage to the load and potential group using
a terminal block at every module

TIA-PRO1 - Distributed I/O


14-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.2.2. ET 200 MP

Modular distributed I/O system

S7-1500 modules can be used


● digital/analog modules, TM, CP/CM,
system power supplies (PS)
● high channel density
e.g. 32 DI or 32 DO per module

Comprehensive performance spectrum


● low channel costs due to high channel density
● fast response times
● module diagnostics

The ET200MP enables the distributed connection of S7-1500 series central I/O modules.
Connection is made using an interface module.

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-7
SIMATIC TIA Portal Programming 1

14.2.2.1. ET 200MP: Configuration and Maximum Number of Modules

● Maximum of 32 modules
→ 1st. module = system power supply (PS)
→ 2nd. module = interface modules
→ 3rd.-32nd. module = max. of any 30 I/O modules of the S7-1500

● Formation of load groups through additional voltage supplies


(similar to centralized configuration of S7-1500)

Maximum 32 modules including power modules and interface module

(optional)

TIA-PRO1 - Distributed I/O


14-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.2.3. Overview: Distributed Signal Modules

ET 200SP ET 200MP ET 200S ET 200M ET 200pro

DI/DQ

AI/AQ

F-DI/F-DQ

F-AI

The ET200SP and ET200MP product range will be expanded in the next years such that these
two product lines completely cover the applications of the ET200S and ET200M.
The ET200pro (interface modules for connection to PROFINET or PROFIBUS) in the degree of
protection IP65/67 for use directly at the machine will continue to be offered.

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-9
SIMATIC TIA Portal Programming 1

14.3. Fieldbus Systems for SIMATIC S7

PROFINET

... ...

PROFIBUS Most important selection criteria:


PROFINET PROFIBUS
Topology (wiring) Line, Star, Ring Line
Max. transmission speed 100Mbit/s 12Mbit/s
Max. cable length 100m ÷
Max. segment length ÷ 1000m
Max. number of segments ÷ 10
Max. number of devices/slaves
per segment 512 125
...

Fieldbus Systems for SIMATIC S7


To connect distributed I/Os, there are different bus systems.
The most important for SIMATIC S7 are:
• PROFINET
As the standard for communication applications at the field level it enables the connection of
distributed field devices via Industrial Ethernet.
The Industrial Ethernet network is a local area network (LAN) according to the international
Standard IEEE 802.3 (Ethernet) and is designed for the industrial sector. It enables open and
comprehensive network solutions with a high transmission performance.
• PROFIBUS
It is the bus system for local area networks (LANs) with only a few participants. Through its
fulfillment of requirements according to EN 50170, PROFIBUS ensures openness for the
connection of standard-conforming components of all manufacturers.
Due to the physical and communication-related differences of the two bus systems, there are
various criteria which are used for the selection of the most suitable bus system.

Cable Length, Segment Length


For PROFIBUS, a module line has to be reinforced after 100-1000m (depending on the
transmission speed used); otherwise, the maximum bus length is reached.
For PROFINET, every connected component takes over this function. For that reason, only the
cable length between two modules is relevant here.

TIA-PRO1 - Distributed I/O


14-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.3.1. Identification of Distributed I/O Devices

PROFIBUS - Slave

PROFINET PROFIBUS
I/O Controller Master

PROFIBUS
PROFIBUS Address: e.g. 19
→ Setting using DIP switch on the slave

PROFINET - I/O Device

Device name: e.g. ET 200SP


PROFINET → Assignment online with STEP7

Distributed I/O Devices


During start-up, the CPU searches the configured PNIO devices or DP slaves and parameterizes
these according to the loaded device configuration.
Both fieldbus systems use different methods for identifying I/O modules:
• PROFIBUS
The set PROFIBUS address is used to search for the configured DP slave.
The setting is typically made through the DIP switch on the slave.
• PROFINET
The assigned device name is used to search for the configured PNIO device.
The assignment of the device name (device initialization) is done from the STEP7
engineering through an online function.
The parameterized IP address is then assigned to the PNIO device by the PNIO controller
(CPU).

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-11
SIMATIC TIA Portal Programming 1

14.3.2. Components of the PROFINET Standard

PROFINET IO Integration of distributed field devices via Industrial Ethernet

PROFIdrive Applications profile for drives connected to PROFIBUS and


PROFINET

PROFIsafe Integration of fail-safe technology (fail-safe controllers


/ communication) in the PROFINET standard

PROFIenergy Coordinated and centrally controlled switch-off of power


consuming devices during break times

Process
Safety Real-Time
Communi-
PROFI- cation
energy
Distributed
PROFINET Field devices
IT-Standards
& Security
Motion
Network Control
Installation Distributed
Intelligence

PROFINET
It completely covers the requirements of automation. PROFINET brings together the expertise of
PROFIBUS and Industrial Ethernet. The utilization of the open standard, the easy handling and
the integration of existing parts of a system (e.g. a plant) determined the definition of PROFINET
right from the beginning.

PROFINET IO
With PROFINET IO, the integration of distributed field devices takes place directly on the
Ethernet. For that, the Master-Slave procedure from PROFIBUS DP is carried over into a
Provider-Consumer model. From the communication point of view, all devices on the Ethernet
have equal rights. Through the configuration, however, the field devices are assigned to a central
controller. The distributed I/O device reads-in the I/O signals and transfers them to the controller.
The controller processes them and transfers the outputs back to the distributed I/O device.

PROFIdrive
With PROFIdrive, very fast, clock-synchronous drive controls for high performance Motion Control
applications are implemented.

PROFIsafe
With PROFIsafe, the network infrastructure already existing for standard communication can also
be used at the same time for fail-safe communication. The existing bus protocols, such as,
PROFIBUS and PROFINET (so-called "black channel") are used to transport fail-safe data as
additional data (so-called PROFIsafe layer).

PROFIenergy
PROFIenergy permits a coordinated and centrally controlled switch off of power consuming
devices during break times. In this way, the process uses only the absolute necessary energy.
The process itself saves the majority of the energy, the PROFINET device itself only has a
savings potential of several watts. For PROFIenergy, this operating state is called "Pause".

TIA-PRO1 - Distributed I/O


14-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.3.2.1. PROFINET IO Device Types

PROFINET IO-Controller PROFINET IO- Ethernet


S7-400 Supervisor
S7-1200/1500 Switch

PG

PROFINET IO-Devices

S7-300 ET 200eco PN
ET 200S

Intelligent IO-Device Compact


(i-Device) IO-Device Modular
IO-Device

PROFINET IO-Controller
The IO-Controller (typically the PLC) establishes a logical connection to the connected IO-
Devices after Power-On and subsequently parameterizes these (module parameters, address,
etc.). (This corresponds to the function of a Class 1 Master in PROFIBUS).

PROFINET IO-Device
An IO-Device is a distributed IO device that is connected via PROFINET IO (this corresponds to
the function of a slave in PROFIBUS).
Differentiation is made for the following IO-Device types:
• Compact IO-Device: Fixed degree of expansion.
• Modular IO-Device: Variable degree of expansion; can be expanded or reduced as required.
• Intelligent IO-Device: A PLC is configured not as an IO-Controller but as an IO-Device and
provides a higher-level controller with I/O data.

IO-Supervisor
This can be a programming device (PG), personal computer (PC) or Human Machine Interface
(HMI) for commissioning or diagnostic purposes. (This corresponds to a Class 2 Master in
PROFIBUS).

Ethernet Switch
PROFINET is based on Ethernet. For that reason, switches are always used as "network
distributors". Every node is connected to a switch via a so-called "point-to-point" connection. This
is also referred to as a "Switched Ethernet". In most PROFINET devices, a 2 or multi-port
switch is already integrated so that it is very easy to establish a line structure (comparable to
PROFIBUS).

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-13
SIMATIC TIA Portal Programming 1

14.3.2.2. PROFINET Addresses

Device name: S7-CPU Device name: ET 200SP


IP address: 192.168.111.102 IP address: 192.168.111.104
MAC address: 08 00 06 01 74 10 MAC address: 08 00 06 01 74 20
Subnet mask: 255.255.255.0 Subnet mask: 255.255.255.0

PN/IE_1

Internet Protocol
The Internet Protocol (IP) is the basis for all TCP/IP networks. It creates the so-called datagrams
(data packets specially tailored to the Internet protocol) and handles their transport within the
local subnet or their "routing" (forwarding) to other subnets.

IP Addresses
IP addresses consist of 4 bytes. With the dot notation, each byte of the IP address is expressed
by a decimal number between 0 and 255. The four decimal numbers are separated from one
another through dots (see picture).

PROFINET Device Name


In PROFINET, each RT / IRT device must be assigned a unique device name that is retentively
stored in the device. A module exchange without PG/PC is made possible through the device
names.

MAC Address
Every Ethernet interface is assigned a fixed address by the manufacturer that is unique
worldwide. This address is referred to as the hardware or MAC address (Media Access Control).
It is stored on the network card and uniquely identifies the Ethernet interface in a local network.
Cooperation among the manufacturers ensures that the address is unique worldwide.

Subnet Mask
The subnet mask specifies which IP addresses in the local network can be accessed. It separates
the IP address into the network and device part.
Only IP addresses whose network part is the same can be accessed.
e.g.: Subnet mask = 255.255.255.0 and IP address = 192.168.111.10
accessible IP addresses: 192.168.111.1 to 192.168.111.254

TIA-PRO1 - Distributed I/O


14-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.3.2.3. PROFINET Communication Model

e.g. Read-out diagnostic data or


e.g. Call Web server
IT Applications PROFINET applications program download
on the CPU e.g. by means of a PG
 HTTP
 SNMP
1 Standard Process
 DHCP... data data
Data exchange between
IO-Controller and IO-Device

Real time
TCP/UDP

Internet Protocol (IP)


2 RT / IRT

Ethernet Protocol

PROFINET based on
Industrial Ethernet!

Real-time Channel
To be able to fulfill real-time requirements in automation, an optimized real-time communication
channel, the Realtime Channel (RT Channel), was specified in PROFINET. It uses Ethernet
(Layer 2) as a base.
The addressing of the data packets does not take place in this case via an IP address, rather by
means of the MAC addresses of the participating devices. Such a solution minimizes the
throughput times in the communications stack considerably and leads to an increase in
performance with regards to the updating rate of automation data.

IRT Channel
Isochronous Real-time (IRT) as a further development with the following features:
• Clock-synchronous data transmission
• Cycle times <1ms with jitter accuracy <1µs
• Typical field of application is Motion Control

IT Standards
The design of PROFINET WEB Integration focuses on commissioning and diagnostics. Access to
a PROFINET device from the Internet or Intranet is done with standard protocols (for example,
http). The data is transmitted in standard formats such as HTML or XML and can be presented
with standard browsers such as Opera or Internet Explorer.
This worldwide accessibility makes it easy for the application manufacturer to support the user
with commissioning, device diagnostics etc. Access to the data is done via Web servers which
are integrated in the modules.

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-15
SIMATIC TIA Portal Programming 1

14.4. Inserting and Networking Distributed I/O

Drag & Drop

Inserting Distributed I/O


PROFINET IO-Devices are added in the Network view. Here, you can insert the relevant devices
into the project by dragging & dropping them from the Hardware catalog. The correct Firmware
must also be selected here before the device is inserted.
The new device (ET 200SP) is stored in the "Ungrouped devices" folder.
Furthermore, there is a link to the ET 200SP in the "Unassigned devices" folder since it is not yet
assigned to a controller.

Networking Distributed I/O


After the ET200SP IO-Device is added, it must be assigned to an IO-Controller or networked with
a CPU. In case there are several CPUs in the network, a co-ordination or monitoring of the I/O
addresses by the IO-Controller and IO-Device can only be done through this unique assignment.
If the ET 200SP is assigned to a Controller, the link is stored in the "Distributed I/O" subfolder of
the Controller.
The actual device is still stored in the "Unassigned devices" folder.

I/O Modules
Just as for a CPU, the individual input and output modules can be configured and assigned
parameters in the Device view. For this, the device is selected and the Device view opened or in
the Device view, the relevant device is selected via the selection menu.

TIA-PRO1 - Distributed I/O


14-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.4.1. PROFINET IO Device ET 200SP:


Assigning the IP Address and Device Name OFFLINE

IP Address, Subnet Mask and PROFINET Device Name


For communication with the IO-Controller, a PROFINET device name must be assigned to the IO-
Device (ET200SP) OFFLINE. The IO-Controller then assigns the IO-Device a valid IP address. If
the IO-Device is assigned an IP address OFFLINE, this IP address is adopted. These parameters
are downloaded to the IO-Controller (CPU) with the programming device. The IO-Controller
(CPU) then transfers these and other parameters (such as, the I/O addresses) to the IO-Device
(ET200SP).

Attention:
Only the PROFINET device name is relevant for the transmission of the offline configuration into
the online device (Controller), not the IP address. The offline configured PROFINET device name
and the online existing PROFINET device name must match. If the IO-Device has a different
PROFINET device name or doesn’t have a name at all, the IO-Controller cannot transfer the
hardware configuration or the hardware parameter assignments to the IO-Device thus preventing
a PROFINET system startup.

Note:
The IP addresses can also be entered directly in the Network view in the graphic area. For this,

the IP addresses must be displayed with the button.

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-17
SIMATIC TIA Portal Programming 1

14.4.2. PROFINET IO Device ET 200SP: Assigning the Device Name ONLINE

offline
configured name

1xR

online
accessible device(s)

IP Address and PROFINET Device Name


The PROFINET device name of the IO-Device configured offline and the device name existing
online must match since the IO-Controller first checks the device names of the connected IO-
Devices and then assigns the configured IP addresses during system startup. If an IO-Device is
not accessible under its configured device name, the IO-Controller cannot establish a connection
to the IO-Device.
The IP address of the IO-Device configured offline and the address existing online do not have to
match. The PROFINET name is relevant for the downloading of the hardware configuration. If it
exists, the online existing IP address is overwritten with the offline configured IP address.

Ways of Assigning a Name Online


In principle, there are two ways of assigning a PROFINET device name to an IO-Device online:
Version 1 (safe, since there is no chance of typing errors)
The assignment of the device name is triggered from the device configuration of the IO-Device.
Device configuration of IO-Device  Right-click on the Interface module (Slot 0)  Assign device
name (see picture).
The advantage of this version is that the offline configured device name is adopted 1:1 and so no
typing errors can be made.
Version 2 (typing errors possible)
The assignment of the device name is triggered via "Online access":
Project tree  Online access  Ethernet interface  IO-Device  Online & diagnostics 
Functions  Assign name

TIA-PRO1 - Distributed I/O


14-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.5. Grouping Devices

The individual devices (distributed I/O as well) can all be stored directly in the project. For better
readability of the project, it is recommended to group the individual devices. For this, device
groups can be created in which the individual devices can be stored using drag & drop.

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-19
SIMATIC TIA Portal Programming 1

14.6. Task Description: Commissioning the ET 200SP

Task Description
The ET200SP distributed I/O station is to be commissioned since the conveyor model is later to
be controlled via its input and output modules.
For this, the ET200SP station must be configured, assigned parameters and networked with the
S7-1500 station in the offline project.
After compiling the new hardware configuration, it must be downloaded into the CPU. In the
function of an I/O Controller, the CPU then automatically undertakes the parameterization of the
ET200SP I/O-device.

TIA-PRO1 - Distributed I/O


14-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.6.1. Exercise 1: ET 200SP: Reset to Factory Settings

Task
All settings so far (IP address, subnet mask and PROFINET name) of the Interface module and
the memory card of the ET200SP station are to be deleted through a "Reset to factory settings".
In the following exercises, you will then transfer your own settings onto the ET200SP station.

What to Do:
1. Open the Online access and there select the interface that is connected to your training case.
2. Activate it by double-clicking on "Update accessible devices" and wait until the list is
completed. This is indicated by a green checkmark by the interface.
3. Open the ET200SP and there activate the function "Online & diagnostics" by double-clicking
on it.
4. In the "Online & diagnostics" window, open the menu "Functions > Reset to factory settings".
5. Start the "Reset" function and confirm the follow-up dialog with "Yes".
6. Close the "Online & diagnostics" window.
7. Check the success of the reset in the Inspector window under “INFO > General”. In addition,
after updating the accessible devices, you will find the ET 200SP in the list without an IP
address and without a device name.
8. Leave all windows open for the next exercise.

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-21
SIMATIC TIA Portal Programming 1

14.6.2. Exercise 2: Reading-out the Firmware Version of the ET 200SP

MAC address
of the ET 200SP

Temporary
IP address

Task
In the following exercises, in order to be able to configure an ET200SP in the offline project which
corresponds exactly to that of the training device, you now have to read out the Firmware version
of the ET200SP online.

Problem
Due to the previous "Reset to factory settings", the ET200SP now no longer has a PROFINET
device name nor an IP address, only a MAC address (see top picture). The Firmware version,
however, cannot be read out via the MAC address, since an IP address is required for this
diagnostic service.

What to Do
1. Open the ET200SP and, with a double-click, activate the "Online & diagnostics" function
and there check whether the ET200SP Firmware version is displayed in the menu
"Diagnostics -> General".
1 2. No Firmware version is displayed since the ET200SP doesn’t have an IP address. To
assign a temporary IP address, switch to the "Functions -> Assign IP address" menu.
There enter the temporary IP address as well as the subnet mask shown in the picture
and adopt the entry by clicking "Assign IP address" (see top picture)
3. In the Project tree, once again "Update" the list of "accessible devices".
4. In the device list, the ET200SP is now displayed as a device with Order number and IP
address. Once again activate "Online & diagnostics" (see bottom picture).
2 5. Make note of the Firmware version shown in the "Diagnostics -> General" tab.
6. Close the window and then, in the Project tree, the "Online access".

TIA-PRO1 - Distributed I/O


14-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.6.3. Exercise 3: Offline Project: Adding the ET 200SP

Task
An ET200SP is to be inserted into the project as a distributed I/O station.
PROFINET IO-Devices are added in the Network view. Here, you can insert the relevant devices
into the project by dragging & dropping them from the Hardware catalog.
The newly added ET200SP is stored in the Project tree in the "Ungrouped devices" folder and
since it initially is not assigned to any controller, a reference is entered in the "Unassigned
devices" folder.

What to Do
1. In the Project tree, open the "Hardware and Network editor" by double-clicking on it.
2. Open the Hardware catalog Task Card and there
Distributed I/O -> ET200SP -> Interface modules -> PROFINET -> IM155-6PN ST
3. Select the IM module used in your training device, open the Information window and there
select the previously read out Firmware version of your IM module.
4. Using drag & drop, drag the IM module into the "Hardware and Network editor" (see picture).

Leave all windows open because they are still needed for the next exercises!

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-23
SIMATIC TIA Portal Programming 1

14.6.4. Exercise 4: Networking the ET 200SP

Open / Close
tabular area

Task
After the ET200SP IO-Device is added, it must now be assigned to an IO-Controller or networked
with a CPU. In case there are several CPUs in the network, a co-ordination or monitoring of the
I/O addresses by the IO-Controller and IO-Device can only be done through this unique
assignment.

What to Do
1. In the "Hardware and Network editor", select the Network view and there click "Network" in
the menue bar.
2. Network the ET200SP with the CPU by connecting the Ethernet interface of the ET200SP
with the Ethernet interface of the CPU using drag & drop.
3. Select the newly created PROFINET IO system and, in the Inspector window under "I/O
communication", check the generated communication partners.

TIA-PRO1 - Distributed I/O


14-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

14.6.5. Exercise 5: Configuring and Parameterizing the ET 200SP

Task
The configuration of the ET200SP in the offline project must match exactly with the configuration
of your training device. Attention should be given in particular to the order numbers and versions
of the modules.
The ET200SP has digital and analog input and output modules to which the conveyor model is to
be connected in the following. The address assignment can be made in the Properties of the
individual module, or, as can be seen in the picture, in the "tabular area" of the "Device view".

What to Do
1. In the "Hardware and Network editor", select the "Device view" of the ET200SP.
2. In the Task Cards, open the "Hardware catalog".
3. Configure the ET200SP station according to your training device.
Make sure that a new potential group is opened with the AI module on Slot 4 and set this in
the Properties:

4. Open the tabular area of the "Device overview" (see picture) and, in the table, enter the I/O
addresses shown in the picture.
5. Save your project.

TIA-PRO1 - Distributed I/O


Training Document, V14.01.01 14-25
SIMATIC TIA Portal Programming 1

Contents 9
9. Functions and Function Blocks ............................................................................ 9-2
9.1. Task Description: Fault Evaluation with Parameter-assignable Blocks ............................... 9-3
9.2. Structured Programming ....................................................................................................... 9-4
9.2.1. Modular and Re-usable Blocks ............................................................................................. 9-5
9.2.2. Local and Global Operands .................................................................................................. 9-6
9.3. Solution with Parameter-assignable Block ........................................................................... 9-7
9.3.1. Declaration of Formal Parameters ........................................................................................ 9-8
9.3.2. Editing a Parameter-assignable Block .................................................................................. 9-9
9.4. Local, Temporary Variables ................................................................................................ 9-10
9.4.1. Local Data Stack ................................................................................................................. 9-11
9.5. Calling a Parameter-assignable Block ................................................................................ 9-12
9.6. Task Description: Fault Evaluation by means of a Function (FC) ...................................... 9-13
9.6.1. Fault Evaluation .................................................................................................................. 9-14
9.6.2. Exercise 1: Creating the "FC_FaultEvaluation" Function ................................................... 9-15
9.6.3. Exercise 2: Calling and Parameterizing "FC_FaultEvaluation" .......................................... 9-16
9.7. Task Description: Fault Evaluation by means of a Function Block (FB) ............................ 9-17
9.7.1. Instantiating Function Blocks .............................................................................................. 9-18
9.7.2. FB - Declaration Section ..................................................................................................... 9-19
9.7.3. Generating Instance Data Blocks ....................................................................................... 9-20
9.8. Changing the Block Call...................................................................................................... 9-21
9.9. Exercise 3: Creating the Function Block "FB_FaultEvaluation".......................................... 9-22
9.9.1. Exercise 4: Calling and Parameterizing "FB_FaultEvaluation" ........................................... 9-23
9.10. Adding Block Parameters Later On .................................................................................... 9-24
9.10.1. Removing Block Parameters Later On ............................................................................... 9-25
9.10.2. Manually Updating a Block Call .......................................................................................... 9-26
9.11. Additional Information ......................................................................................................... 9-27
9.11.1. Compiling Individual / All Changed Blocks ......................................................................... 9-28
9.11.2. Global and Local Tags ........................................................................................................ 9-29

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-1
SIMATIC TIA Portal Programming 1

9. Functions and Function Blocks

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

... be familiar with the purpose of parameter-assignable blocks

… be familiar with the declaration section of a block

… be familiar with the purpose of temporary variables

... be familiar with the purpose of static variables

… know what a structured programming is

... be able to program parameter-assignable functions and function


blocks and their calls

TIA-PRO1 - Functions and Function Blocks


9-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.1. Task Description: Fault Evaluation


with Parameter-assignable Blocks

"FC_Fault"

Network 1

Fault 1
"FC_FaultEvaluation"
"P_Fault1" Q 0.2  "P_Fault1" (Q0.2)
Fault 2
Q 0.3
"P_Fault2"
Network 2
Fault1 Fault 3
I 0.4 "P_Fault3" Q 0.4 "FB_FaultEvaluation"
"S_Fault1"
 "P_Fault2" (Q0.3)
Fault2
I 0.5
"S_Fault2" DBx
Fault3 Network 3
I 0.6
"S_Fault3"
"FB_FaultEvaluation"
Acknowledge fault
I 0.7
″S_Acknowledge″  "P_Fault3" (Q0.4)
DBy

Task Description
Independent of the conveyor model functions so far, 3 different faults are to be evaluated as
follows.
If a fault is triggered at the simulator inputs "S_Fault1" (I 0.4) to "S_Fault3" (I 0.6), the associated
simulator LEDs "P_Fault1" (Q0.2) to "P_Fault3" (Q0.4) begin to flash.
A group acknowledgement for all faults takes place using the simulator input "S_Acknowledge"
(I 0.7). If the fault still exists after acknowledgement, the LED changes to constant light; if the fault
no longer exists, the LED goes dark.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-3
SIMATIC TIA Portal Programming 1

9.2. Structured Programming

Block-structured
Linear Program Structured Program
Program

Recipe A
Pump
Recipe B
OB_ OB_ OB_
Cycle Cycle Cycle
Mixer Outlet

Outlet

The instructions for the Re-usable functions are programmed in


All instructions are found individual functions are found in individual blocks.
in one block (in a individual blocks. OB_Cycle OB_Cycle or other blocks call these
“Program cycle OB”) calls these blocks one after the blocks and pass on the relevant data.
other.

Linear Program
The entire program is found in one continuous program block (Program cycle OB) which is
automatically called by the system. This model resembles a hard-wired relay control that was
replaced by an automation system (programmable logic controller). The CPU processes the
individual instructions one after the other.

Block-structured Program
The program is divided into blocks, whereby every block only contains the program for solving a
partial task. Further structuring through networks is possible within a block. You can generate
network templates for networks of the same type. Normally, a cyclically called Organization block
contains instructions which call the other blocks in a defined sequence.

Structured Program
A structured program contains parameter-assignable blocks that are set up in such a way that
they can be used universally. When a parameter-assignable block is called, it is passed current
parameters (for example, the specific addresses of inputs and outputs as well as parameter
values).
Example:
− A "pump block" contains instructions for the control of a pump.
− The program blocks, which are responsible for the control of special pumps, call the "pump
block" and provide it with information about which pump is to be controlled with which
parameters.

TIA-PRO1 - Functions and Function Blocks


9-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.2.1. Modular and Re-usable Blocks

"DB_Motor" "DB_Controller"
Modularization of the entire task:
"FB_ "FB_
• Partial tasks are solved in separate "TON"
Motor" Modulator"
programs or blocks "OB_
Cycle_A"
• Parameter assignment enables flexible
"DB_Valves"
usage
"FB_ "FC_
"BLKMOV"
• Example: Drilling cycle with changeable Valve" Limit"
depth

Re-usability of blocks: "OB_Cycle_B"


"DB_Motor"

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


required "DB_Motor" Decl. Name Type
in Start BOOL
 Restrictions: "FB_Motor"
in Stop BOOL
out Motor_ON BOOL
Start Motor_ON
• No access to global operands out Speed INT
Stop Speed stat Speed_old INT
• Communication only via the parameter temp Calc_1 INT
:
list :
A #Start

Modularization of the Entire Task


Abstraction is the basis for solving complex problems, in which we concentrate on the
fundamental aspects of a program in every abstraction level and ignore all the details that are not
essential. Abstraction helps us to divide complex tasks into partial tasks which can then be solved
on their own.

Parameter-assignable (Re-usable) Blocks


STEP7 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
data for solving the partial problems are stored. STEP7 blocks such as functions (FC) and
function blocks (FB) can be assigned parameters so that the concepts of structured programming
can be implemented with them. This means:
• Blocks for solving partial tasks implement their own data management with the help of local
variables.
• Blocks communicate with the "outside world", that is, with the sensors and actuators of the
process control or with other blocks of the user program, exclusively through their block
parameters. No access to global operands such as inputs, outputs, memory bits or variables
in DBs can be made from within the statement section of blocks.

Advantages
• The blocks for the partial tasks can be created and tested independent of one another.
• Blocks can be called as often as is required in different locations with different parameter
sets, that is, they can be reused.
• "Re-usable" blocks for special tasks can be delivered in pre-designed libraries.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-5
SIMATIC TIA Portal Programming 1

9.2.2. Local and Global Operands

Global Operands Local Operands


(valid in the entire program) (only valid in one block)
Formal Parameters (Input, Output, InOut)
• PII / PIQ • interface for data exchange between calling and called block
• temporary storage in the L-stack for FCs or storage in the IDB for FBs
• can be used in FCs / FBs
• I / O peripherals

Temporary Variables (Temp)


• Memory bits • are overwritten after the block is executed
• temporary storage in the local data stack (L-stack)
• Variables in DBs • can be used in OBs / FCs / FBs
(Chapter Data Blocks)
Static Variables (Static)
• retain their value after the block is executed
• S5-Timers and • permanent storage in instance data block (IDB)
Counters • can only be declared in FBs
(not forS7-1200)
Constants (Constant)
• Constants • read-only as well as only symbolic access
• no memory usage
• can be used in OBs / FCs / FBs

Global Operands
Global operands are valid throughout the entire S7 program. Accordingly, every code (logic) block
(OB, FC, FB) can access these operands.
Global operands include inputs, outputs, memory bits, SIMATIC timers, SIMATIC counters,
constants and variables which are declared in global data blocks (Chapter: Data Blocks).

Local Operands
Local operands are only valid in the block in which they were declared in the declaration part.
Accordingly, only this block can access them.
• Formal Parameters
Formal parameters form the interface between the calling and the called block (FC, FB).
They are used to realize a data exchange between the calling and the called block.
• Temporary Variables
Temporary variables can be declared in every code (logic) block (OB, FC, FB) and are
managed in the local data stack of the CPU. Accordingly, they only retain their values while
the block is being executed. For that reason, it is important that in the current cycle, a write
access must have taken place on the temporary variable in the block before a read access
can take place. They are, for example, unsuitable as auxiliary variables for edge evaluations
or to store quantities. They are, in fact, used to store intermediate results, such as, for
complex calculations or format conversions.
• Static Variables
Static variables can only be declared in FBs and are stored in the associated instance data
block. Accordingly, these variables retain their value even after the FB is executed.
• Constants
Constants are fixed values which have a read-only access and which do not take up any
memory space.

TIA-PRO1 - Functions and Function Blocks


9-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.3. Solution with Parameter-assignable Block

Solution with non- Solution with parameter-assignable block


parameter-assignable block
Program in the Function Call of Function (e. g. OB_Cycle)
FC_FaultEvaluation
I 0.4 Fault

I 0.7 Acknowledge Q 0.2


Display
M 10.3 FlashFreq

M 17.1 Memory

M 17.2 EdgeMemory

Formal parameters

Actual parameters

Application
You can program parameter-assignable blocks for frequently recurring program functions. This
has the following advantages:
• The program only has to be created once, which significantly reduces programming effort.
• The block is only stored in the user memory once, which significantly reduces the amount of
memory used.
• The block or the functionality implemented with the block can be called as often as you like,
each time with different operands. For this, the formal parameters (input, output, or in/out
parameters) are supplied with different actual parameters every time they are called.

Program Execution
When the block is executed, the formal parameters are replaced with the actual parameters
passed during the call.
If, as in the example, during the call of the block, the memory byte M17.1 is passed as the actual
parameter for the formal parameter #Memory, then, at runtime, the memory byte M17.1 is set or
reset and its signal status is scanned etc.

Parameter-assignability
You can program FC or FB blocks as parameter-assignable. You cannot program organization
blocks as parameter-assignable since they are called by the operating system and so the call
cannot be programmed and also no actual parameters can be specified.

Our Example
Even if the function is required repeatedly in the system, you only have to program
“FC_FaultEvaluation” once as parameter-assignable.
“FC_FaultEvaluation” is then called several times for the different fault evaluations and is
assigned a different actual operand each time.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-7
SIMATIC TIA Portal Programming 1

9.3.1. Declaration of Formal Parameters

Type of Parameter Declaration Use Graphic Display

Input parameter Input Read only To the left of the block box
Output parameter Output Write only To the right of the block box
In/Out parameter InOut Read / Write To the left of the block box

Inputs

Output

InOuts

Return

Formal Operands
Before you can create the program in the parameter-assignable block, you have to define the
formal parameters in the declaration part.

Type of Parameter
In the table in the picture, you can see the three possible types of parameters and their use.
Please note that formal operands that have a reading and a writing access have to be declared
as ‘In/Out’ parameters.

Interface
The Input, Output and InOut parameters as well as the Return parameter form the interface of a
block. The Return parameter is an additional Output parameter and, defined according to IEC
61131-3, the Return value of the function. The Return parameter only exists for FCs. If it has the
data type VOID, it is not used and also does not appear as a parameter when the function is
called.
The variables Temp and Constant are – even though they are listed in the declaration section of
the interface – not components of the block interface, since they do not become visible when the
block is called.

Example:
The picture shows the declaration section, that is, the interface of a block. Since the formal
parameters #Memory and #EdgeMemory are to be accessed both reading and writing (see next
page), they are declared as InOut parameters.

Caution!
The declared formal parameters (Input, Output, InOut and Return) of a block are its
interface to the "outside". That is, they are "visible" or relevant to other blocks that call
this block. If the interface of a block is changed by deleting or adding formal parameters
later on, then the calls of the modified block have to be updated or corrected in all calling
blocks.

TIA-PRO1 - Functions and Function Blocks


9-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.3.2. Editing a Parameter-assignable Block

Notes
It doesn‘t matter whether the names of the formal parameters are written with capital or small
letters. The "#" character in front of the name is automatically inserted by the PG. The character
is used to indicate that the parameter is a local operand that was defined in the variable (tag)
declaration table of this block.
It is possible, that when you write the program in KOP or FUP, that the name is not completely
displayed in one line. This depends on how you have customized the settings in the Program
Editor:
OptionsSettingsPLC programmingLAD/FBDOperand fieldMaximum width

Symbols
1. If you use a symbolic name when you edit a block, the Editor first of all searches through the
interface of the block. If the symbolic name is there, the symbol with # in front of it is accepted
in the program as a local operand.
2. If a symbol cannot be found as a local operand, the Editor searches through the PLC tags for
the global symbol. If the symbol is found there, the symbol is placed in quotation marks and is
accepted in the program as a global operand.
3. If you specified the same symbolic name globally (in the PLC tags) as well as locally (in the
variable (tag) declaration table) the Editor will always insert the local operand.
If, however, you want to work with the global symbol, you must select the relevant operand
when you make the entry, place the symbol name in quotation marks or change it later on.

Drag & Drop


Just as with global operands (for example, from the PLC tags) local operands can be dragged
into the program part of the Editor from the block interface using drag & drop and placed in the
desired position there.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-9
SIMATIC TIA Portal Programming 1

9.4. Local, Temporary Variables

1. Declaration

2. Assignment

3. Scan

Declaration
The variables are also defined in the declaration part of the block. The name of the variable and
the data type must be specified.

Access
With optimized blocks, all temporary variables are initialized with 0 at the beginning of block
execution.
With not-optimized blocks, all temporary variables have an undefined value at the beginning of
block execution. When working with temporary variables, you must therefore make sure that the
variable is first of all assigned a defined value before it is scanned.
In the example, the result of the Addition is assigned to the temporary variable #inRe before it is
then scanned during the Multiplication. (The arithmetic operations are dealt with in the chapter
“Digital Operations”.)

Note
Operands that begin with the # special character are local operands (parameters or local
variables) that must be declared in the declaration part of the block. Local operands are only valid
and usable in the block in which they were declared.
The Program Editor automatically inserts the # character.

TIA-PRO1 - Functions and Function Blocks


9-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.4.1. Local Data Stack

Operating system

OB 1 2 FC 17 3 FC 20 Event 1 2 3 4 5 6 7

with temp. 4 with temp.


variables variables
Usage of
the Local FC20
5 FC30
FC 30 data stack
7 FC17 FC17 FC17 FC17 FC17
6 with temp. OB 1 OB 1 OB 1 OB 1 OB 1 OB 1 OB 1
variables

Total Usage of the Local Data Stack (L-Stack)


For every program execution level or priority class (such as, OB 1 with all blocks that are called in
it), a separate local data stack is reserved. That is, a segment of defined size is reserved on the L
stack of the CPU (allocation or reservation of memory space).
The local variables/operands of OB 1 as well as the local, temporary variables of the blocks (FCs
and FBs) called in or by OB 1 are stored in this local data stack.
You can use the "Reference Data" tool to display the "Program Structure" to see to what extent
an S7 program puts a burden on the local data stack. (The reference data and where they are
displayed is dealt with in the chapter "Troubleshooting".)

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-11
SIMATIC TIA Portal Programming 1

9.5. Calling a Parameter-assignable Block

Block Call
A block can be called by dragging it from the "Program blocks" folder & dropping (inserting) it in
the statement (code) part of the calling block.

Note
When a parameter-assignable function (FC) is called, an actual parameter must be passed for
every formal parameter.
Exception:
In the graphic programming languages LAD and FBD, the assignment of the EN and ENO
parameters, which are automatically added by the Editor, is optional.

Parameter Assignment
All global and local operands whose data type corresponds to the formal parameters of the called
block can be passed as actual parameters.
The actual parameters can be passed with an absolute address or with a symbolic name - as
declared in the PLC tags or in the declaration part of the calling block.

Passing On of Parameters
Basically, a “passing on of parameters” is also possible. That is, formal parameters of the calling
block are passed on as actual parameters to the called block. For parameters of complex data
types (see chapter “Data Blocks”) this is however only possible with limitations.

TIA-PRO1 - Functions and Function Blocks


9-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.6. Task Description:


Fault Evaluation by means of a Function (FC)

"FC_Fault"

Network 1

Fault 1 "FC_FaultEvaluation"
Q 0.2
"P_Fault1"  "P_Fault1" (Q0.2)
Fault 2 Q 0.3
"P_Fault2"
Network 2
Fault1
I 0.4
"S_Fault1"
"FC_FaultEvaluation"
 "P_Fault2" (Q0.3)
I 0.5
Fault2
"S_Fault2"

I 0.6

I 0.7
Acknowledge fault
″S_Acknowledge″

Task Description
If a fault is triggered at the inputs I 0.4 "S_Fault1" or I 0.5 "S_Fault2", the associated LED Q0.2
"P_Fault1" or Q0.3 "P_Fault2" begins to flash.
The input I 0.7 "S_Acknowledge" is a group acknowledgement for all faults. If the fault still exists
after acknowledgement, the LED changes to constant light; if the fault no longer exists, the LED
goes dark.
First, an "FC_Fault" is to be created. Then, the required function is to be programmed in the
parameter-assignable "FC_FaultEvaluation" which is to be called twice in "FC_Fault" for the
evaluation of the two faults.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-13
SIMATIC TIA Portal Programming 1

9.6.1. Fault Evaluation

Task

FaultInput

Acknowledge

StoredFault

Display

Solution Suggestion
Stored_Fault
StoredFault
FaultInput SR Flash_Freq
FlashFreq Display
P_TRIG
S Q
EdgeMemory
Edge_Memory Acknowledge R

StoredFault
Stored_Fault Fault_Input
FaultInput

Task
Faults that occur are to be displayed by an indicator light on the operator console. When there is
a signal change from 0  1 at the input, the output shows a 2Hz flashing light.
After the fault is acknowledged but still exists, the output (light) switches to a constant light. When
the fault no longer exists, the light at the output goes dark.

Solution Suggestion
An edge evaluation of the fault (FaultInput) is required since the message buffer (StoredFault)
would otherwise immediately be set again after an acknowledgement (Acknowledge) and a still
existing fault, thus making the display (Display) flash once more.
When an acknowledgement (Acknowledge) has not yet occurred, that is, the message buffer
(StoredFault) still exists, the upper AND logic operation with the linked flash frequency
(FlashFreq) causes the display (Display) to flash.
When acknowledgement has already occurred (Acknowledge) and therefore the message buffer
(StoredFault) no longer exists, but the fault input (FaultInput) still exists, the lower AND logic
operation causes a constant light at the display (Display).

TIA-PRO1 - Functions and Function Blocks


9-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.6.2. Exercise 1: Creating the "FC_FaultEvaluation" Function

Task
You are to create the program for the fault evaluation in the parameter-assignable
"FC_FaultEvaluation".

What to Do
1. Insert the "FC_FaultEvaluation" block in the "Program blocks" folder.
2. Declare the formal parameters as shown in the picture.
3. Create the program as shown in the picture.
4. Save the block.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-15
SIMATIC TIA Portal Programming 1

9.6.3. Exercise 2: Calling and Parameterizing "FC_FaultEvaluation"

Fault 1
"P_Fault1" Q 0.2

Fault 2
Q 0.3
"P_Fault2"

Fault1
I 0.4
"S_Fault1"

Fault2
I 0.5
"S_Fault2"

I 0.6

Acknowledge fault
I 0.7
″S_Acknowledge″

Task
You are to create the new block "FC_Fault" which will process the fault handling and fault
evaluation in later exercises.
In the new blocks, 2 faults from the process (signals of the two simulator switches) are to be
evaluated. For this, the previously programmed "FC_FaultEvaluation" must be called twice.

What to Do
1. Create the new "FC_Fault" block.
2. In "FC_Fault", program the two calls of the previously created "FC_FaultEvaluation" block as
shown in the picture.
3. Call "FC_Fault" in "OB_Cycle".
4. Save the change and transfer the program into the CPU.
5. Check your program to see whether it fulfills the described functions for fault evaluation.

Note
The MB 10 memory byte was already parameterized as a clock memory byte in the device
configuration.
The "Clock_2Hz" (M10.3) memory bit has a flashing frequency of 2Hz and was already created
as a PLC tag.

TIA-PRO1 - Functions and Function Blocks


9-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.7. Task Description: Fault Evaluation by means of a


Function Block (FB)

"FC_Fault"

Network 1

Fault 1
"FC_FaultEvaluation"
"P_Fault1" Q 0.2  "P_Fault1" (Q0.2)
Fault 2
Q 0.3
"P_Fault2"
Network 2
Fault1 Fault 3
I 0.4 "P_Fault3" Q 0.4 "FB_FaultEvaluation"
"S_Fault1"
 "P_Fault2" (Q0.3)
Fault2
I 0.5
"S_Fault2" DBx
Fault3 Network 3
I 0.6
"S_Fault3"
"FB_FaultEvaluation"
Acknowledge fault
I 0.7
″S_Acknowledge″  "P_Fault3" (Q0.4)
DBy

Task Description
The previously described fault evaluation is now to be implemented with an FB instead of an FC.
This offers the advantage that for the internally required edge evaluation of the fault and as stored
fault, the FB doesn’t have to be passed any global operands from outside since local, static
variables can be used.
Fault 1 is to continue to be evaluated by the already existing "FC_FaultEvaluation". The
evaluation of Fault 2 and 3 is to be carried out by the "FB_FaultEvaluation" which is now to be
created.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-17
SIMATIC TIA Portal Programming 1

9.7.1. Instantiating Function Blocks

Special Features
Unlike functions (FCs), function blocks (FBs) have a (recall) memory. That means that a local
data block is assigned to the function block. This data block is known as an instance data block.
When you call an FB, you must also specify the Instance-DB which is then automatically used as
an instance for this FB call.
An instance DB is used to save static variables, among other things. These local variables can
only be used in the FB, in whose declaration table they were declared. When the block is exited,
they are retained.

FB Advantages
• For the FC programming, the user must search for free memory areas and maintain them
himself. The static variables of an FB, on the other hand, are maintained by the STEP 7
software.
• The known danger of memory bit double assignments in FC programming is avoided with the
use of static variables.
• Instead of the InOut formal parameters "StoredFault" and "EdgeMemory" of the
"FC_FaultEvaluation", static variables are used in the "FB_FaultEvaluation". This makes the
block call simpler since the two formal parameters are dropped.

TIA-PRO1 - Functions and Function Blocks


9-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.7.2. FB - Declaration Section

Instance_DB

Input
Output
InOut
Static

L - Stack
Temp

Parameters
When the function block is called, the values of the actual parameters are stored in the instance
data block. If no actual parameter was assigned to one of these formal parameters in a block call,
then the last value stored in the instance DB for this parameter is used in the program execution.
One exception are InOut parameters whose data types are not elementary. These must be
assigned since the values of the actual parameters are not stored in the instance DB but rather
the information about the storage location of the actual parameter.
Just as for a function, different actual parameters can be passed for each FB call. When the
function block is exited, the data is retained in the instance data block.

Static Variables
Unlike functions, function blocks additionally have "static variables" (Static). These variables form
the memory of the FB. They are not stored in the L-Stack but also in their own instance data
block.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-19
SIMATIC TIA Portal Programming 1

9.7.3. Generating Instance Data Blocks

Automatically generating an Manually creating an instance DB


instance DB during the FB call

Generating
There are two ways of generating an instance data block:
• Create a new block (data block) and select "Function block XY" as Type.
• For an FB call, the user specifies with which instance DB the FB is to work.
A dialog automatically opens in which the symbolic name and, if desired, a manual number of
the instance DB can be preset.
Already existing instance data blocks can also be selected here.

Caution!
If you modify the FB (by adding additional parameters or static variables), you must then
also generate the instance DB again.

TIA-PRO1 - Functions and Function Blocks


9-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.8. Changing the Block Call

Existing actual parameters


are adopted

In order to replace the call of a block with another block call, a selection list of all FCs and FBs
can be opened at the calling point by double-clicking on the name of the already called block.
Advantage:
If both blocks have the same formal parameters, then they retain their actual parameters and all
formal parameters do not have to be supplied with new actual parameters.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-21
SIMATIC TIA Portal Programming 1

9.9. Exercise 3: Creating the Function Block "FB_FaultEvaluation"

Task
You are to create the new "FB_FaultEvaluation" block for the subsequent evaluation of Fault 2
and 3.

What to Do
1. Insert the new "FB_FaultEvaluation" block.
2. Declare the formal parameters and the static variables of the block as shown in the picture.
For this, you can copy the required variables from the already programmed
"FC_FaultEvaluation".
3. Program "FB_FaultEvaluation". For this, you can copy the required program parts from the
already programmed "FC_FaultEvaluation".
4. Save the block and download it into the CPU.

TIA-PRO1 - Functions and Function Blocks


9-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.9.1. Exercise 4: Calling and Parameterizing "FB_FaultEvaluation"

Fault 1
"P_Fault1" Q 0.2

Fault 2
Q 0.3
"P_Fault2"
Fault1 Fault 3
I 0.4 "S_Fault1" "P_Fault3" Q 0.4

Fault2
I 0.5 "S_Fault2"

Fault3
I 0.6
"S_Fault3"

Acknowledge fault
I 0.7
″S_Acknowledge″

Task
The evaluation of the old Fault 2 (programmed up until now through the call of
"FC_FaultEvaluation") and the evaluation of the new Fault 3 is to be implemented with the newly
created "FB_FaultEvaluation".
For this, the parameter-assignable block "FB_FaultEvaluation" must be called twice in
"FC_Fault", each time with a different instance data block.

What to Do
1. In "FC_Fault", replace the second call of "FC_FaultEvaluation" with the call of
"FB_FaultEvaluation".
2. Generate the instance data block "iDB_FB_FaultEvaluation_2" and specify it as the instance
for the programmed call of "FB_FaultEvaluation".

You can generate a new instance via the context menu item of the call (right-click on the
Block call > "Create instance") or you create a new block (data block of the type
"FB_FaultEvaluation") and insert it using drag & drop.
3. Program the second call of "FB_FaultEvaluation" - as shown in the picture - in a new network
and let the Editor generate the instance "iDB_FB_FaultEvaluation_3".
4. Save the modified "FC_Fault".
5. Download the entire program into the CPU and check the program function.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-23
SIMATIC TIA Portal Programming 1

9.10. Adding Block Parameters Later On

Automatic update of the


block call during
compiling

Problem
If you have to adjust or supplement the interfaces or the code of individual blocks during or after
program creation, it can lead to time stamp conflicts. Time stamp conflicts can, in turn, lead to
block inconsistencies between calling and called blocks or reference blocks and thus to a high
degree of correction effort.
If block parameters are added later on to a block already called in the program, you also have to
update the calls of the block in other blocks.
• Automatic Update
Time stamp conflicts are also detected when the entire user program is compiled and in case
of added parameters, affected block calls are automatically updated.
For functions, the added formal parameter must still be assigned before downloading into the
CPU, since this is a "Must Assign".
For function blocks, the default value from the associated instance DB is used when the
formal parameter is not assigned ("Can Assign").

• Manual Update
See 9.10.2 Manually Updating a Block Call

TIA-PRO1 - Functions and Function Blocks


9-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.10.1. Removing Block Parameters Later On

(Options > Settings > PLC programming >


General > Compilation)
Function “Delete actual parameters on interface
update” is activated?
YES

NO

If block parameters are deleted (removed) later on from a block already called in the program,
you also have to update the calls of the block in the calling blocks.
• Automatic Update
Attention/Caution: If the deleted formal parameters have already been assigned with actual
parameters, then this automatic update only occurs if the function "Delete actual parameters
on interface update" is activated under Options > Settings > PLC-programming > General >
Compilation.

• Manual Update
See 9.10.2 Manually Updating a Block Call

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-25
SIMATIC TIA Portal Programming 1

9.10.2. Manually Updating a Block Call

1xR

Manual Update
In the open, calling block, the inconsistent calls of a block are highlighted in red. By right-
clicking the inconsistent call, the function "Update" can be selected in the context menu. A
window then appears in which the old (faulty) and the new block call (in the picture without the
parameter "LEDTest") are displayed. For function blocks, the associated instance DB is
subsequently regenerated.

TIA-PRO1 - Functions and Function Blocks


9-26 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.11. Additional Information

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-27
SIMATIC TIA Portal Programming 1

9.11.1. Compiling Individual / All Changed Blocks

OB1

FB1

FB2
FB2

All changed blocks In : Bool1


compiled:
FB2 call in FB1
updated

OB1

FB1

FB2
Only FB2 compiled:
FB2
FB2 call in FB1
not yet updated In : Bool1

Compile  Software (Only Changes):


If one individual block is selected in the Project tree or if a compilation is triggered through the
button shown to the left when a block is open, only this single block is compiled (if it was
changed). The disadvantage of compiling one individual block is that interface conflicts in the
calling blocks caused by interface changes are not corrected.
If several blocks are selected or a block group, only those blocks modified since the last
compilation are compiled (delta compilation).
If the "Program blocks" folder is selected, the delta compilation for the entire program is carried
out.

Compile  Software (Rebuild All Blocks)/ or Rebuild All):


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

Compile  Reset Memory Reserve:


Note: What a memory reserve is, is dealt with in Programming 2.
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
memory reserve and integrated in the regular part of the data block.

Compilation Results
The status of the compilation is hierarchically displayed in the Inspector window "Info -> Compile".
If errors occurred during compilation, you can jump directly to the error location by double-clicking
on the error entry.

TIA-PRO1 - Functions and Function Blocks


9-28 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

9.11.2. Global and Local Tags

Global Tags Local Tags

• Valid throughout the entire CPU, • Are only valid in the block in which
i.e. all blocks have access they have been declared (defined)
Validity range
• The name of the tag must be • The name of the tag must be unique
unique within the entire CPU within the block

• Inputs • Temporary variables


• Outputs (in all code (logic) blocks)
Operands • Memory bits
• Tags in data blocks • Static variables
• SIMATIC Timers / Counters (only in function blocks)

Location of • PLC tag table


• Declaration part of the block
declaration • Global data blocks (Chap. 11)

• Presented in quotation marks • Presented preceded by #


Presentation Example: "Max" Example: #Max

Validity Range of Tags


Tags that are declared in the PLC tag table or in a global data block can be addressed by all CPU
program blocks. For that reason, these tags are called global tags.
Tags and parameters that are declared in the declaration part of a code (logic) block are local
operands; they can only be used in the statement part of the same block.

TIA-PRO1 - Functions and Function Blocks


Training Document, V14.01.01 9-29
SIMATIC TIA Portal Programming 1

Contents 13
13. Organization Blocks ............................................................................................. 13-2
13.1. Types of Program Blocks .................................................................................................... 13-3
13.1.1. Organization Blocks of the S7-1500 ................................................................................... 13-4
13.2. S7-1500 Start and Cyclic Sequence ................................................................................... 13-5
13.2.1. Interrupting the Cyclic Program .......................................................................................... 13-6
13.2.2. Process Image Partitions .................................................................................................... 13-7
13.3. Creating a New OB ............................................................................................................. 13-8
13.3.1. OB Start Information using "OB_Startup" as an Example .................................................. 13-9
13.4. Time-of-Day Interrupt OB.................................................................................................. 13-10
13.4.1. Starting the Time-delay Interrupt OB ................................................................................ 13-11
13.4.2. Executing Cyclic Interrupt OBs ......................................................................................... 13-12
13.4.2.1. Phase Offset for "Cyclic interrupt" OBs ............................................................................ 13-13
13.4.3. Hardware Interrupt ............................................................................................................ 13-14
13.5. Task Description ............................................................................................................... 13-15
13.5.1. Exercise 1: Preparing the Startup Initialization ................................................................. 13-16
13.5.2. Exercise 2: Initializing Transport using Startup and Programming the Time-delay
Interrupt OB....................................................................................................................... 13-17
13.6. Additional Task Description .............................................................................................. 13-18
13.6.1. Additional Exercise 3: Preparing for the Initialization Expansion...................................... 13-19
13.6.2. Additional Exercise 4: Initialization to the Left/Right ......................................................... 13-20
13.6.3. Additional Exercise 5: Displaying the Initialization ............................................................ 13-21
13.7. Additional Information ....................................................................................................... 13-22
13.7.1. S7-1200/1500: Global Error Handling with Asynchronous Error OBs .............................. 13-23
13.7.2. S7-1200/1500: Global Error Handling with Synchronous Error OBs ................................ 13-24
13.7.3. OB Priorities and System Reaction .................................................................................. 13-25

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-1
SIMATIC TIA Portal Programming 1

13. Organization Blocks

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

... be familiar with the different types of organization blocks

... understand the principle of interrupt processing

... be familiar with the meaning of process image partitions

... be able to interpret the start information of OBs

… be able to use startup and time-delay interrupt OBs

TIA-PRO1 - Organization Blocks


13-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.1. Types of Organization Blocks

FC
FB

Hardware OpSys FC
Instance
Cyclic Cyclic OBs

FC
Global
Interrupt processing Startup Startup OBs

Time Time-of-day OBs FC Global

Hardware Interrupt OBs FB


FC

Instance
Diagnostic Error OBs
FC

Organization Blocks (OBs)


Organization blocks (OBs) form the interface between the operating system and the user
program. The organization blocks are called event-driven by the operating system.
The events can be cyclic, the STOP-RUN transition, time-dependent, hardware-dependent or an
error.
If one of the events occurs, then the relevant OB is called if it is loaded and if its priority is greater
than that of the OB currently being processed.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-3
SIMATIC TIA Portal Programming 1

13.1.1. Organization Blocks of the S7-1500

Startup

Startup
(OB100, >=123)

Cyclic Event-driven
Periodic
program program execution
execution program execution
Interrupt OBs Error OBs

Time-of-day interrupts Time-delay interrupts Diagnostic error int.


Program cycle
(OB10...17, >=123) (OB20…23, >=123) (OB80, 82, 83, 86)
(OB1, >=123)
Cyclic interrupts Hardware interrupts Programming error
(OB30...38, >=123) (OB40...47, >=123) (OB121, 122)

Synchronous cycles
(OB61…64, >=123)

Motion Control interrupts


(OB91, 92)

Startup Program
After voltage recovery, or a change of operating mode (through the CPU‘s mode selector or
through PG operation), a startup program is carried out in the Startup OBs before the cyclic
program execution. In these Startup OBs you can, for example, carry out a pre-assignment of
communication connections or initializations.

Cyclic Program Execution


The program stored in the Program Cycle OBs is executed in a continuous loop. With this cyclic
program execution, the reaction time results from the execution time for the CPU’s 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 minimum of one
time and a maximum of two times the cycle time.

Periodic Program Execution


This makes it possible to interrupt the cyclic program execution at fixed intervals. With the Cyclic
Interrupt OBs, an organization block (for example OB35) is executed after an adjustable time
base (for example, every 100ms) has expired. In these blocks, for example, closed-loop control
blocks with their sampling time are called. With the Time-of-day Interrupt OBs, an OB which could
carry out a data backup, for example, is executed at a specific time, for example, every day at
17:00 hours (5 p.m.).

Event-driven Program Execution


Hardware interrupts are used to quickly react to process events. After an event occurs, the cycle
is immediately interrupted and an interrupt program is executed. With Time-delay Interrupt OBs, a
freely definable event can be reacted to with a time-delay; with the Error OBs, the user can
influence the behavior of the controller in case there is an error.

TIA-PRO1 - Organization Blocks


13-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.2. S7-1500 Start and Cyclic Sequence

CPU in STOP state or Power OFF:


All digital outputs are switched off (safe state)

Start

Re-initialization of process images, of non-retentive


M, T, C and of non-retentive variables in DBs

Execution of Startup OBs (if they exist)

Enable outputs

Output process image for outputs (PIQ)


C
Y
C Read-in process image for inputs (PII)
L
E Execute Program cycle OBs

General
Before the CPU begins with the execution of the cyclic user program, a startup program is
executed.
In the startup program, initialization variables can be set by programming Startup OBs
accordingly.

Warm Restart
The S7-1500 carries out a so-called warm restart in which the process images (PII, PIQ) and all
non-retentive memory bits, timers and counters are deleted. Non-retentive DBs are reset to the
start values of the load memory and retentive memory bits, timers and counters as well as
retentive DB-contents are retained.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-5
SIMATIC TIA Portal Programming 1

13.2.1. Interrupting the Cyclic Program

Write PIQ

Read PII

Hardware OpSys Begin


"OB_ProgCycle"
interruption
Begin
"OB_Diag_Int"
End
Resume

Interrupt processing
"OB_ProgCycle"
. interruption
Begin
"OB_Cyclic_Int"
Begin
"OB_Diag_Int"
End

.
Resume
"OB_Cyclic_Int"
End
Begin
"OB_Cyclic_Int"
End
Resume
"OB_ProgCycle"
End

Priority "OB_ProgCycle" <Priority "OB_Cyclic_Int" < Priority "OB_Diag_Int"

OB Calls
Organization blocks (OBs) form the interface between the CPU’s operating system and the user
program.
Organization blocks are called exclusively by the operating system. There are various start
events (time-of-day interrupts, hardware interrupts - see picture) that each lead to the start of their
associated organization block.

Interrupting the Cyclic Program


When the operating system calls another OB, it interrupts the cyclic program execution because a
“Program Cycle”-OB has the lowest priority. Any other OB can therefore interrupt the main
program and execute its own program. Afterwards, the “Program Cycle”-OB resumes execution
at the point of interruption.

Priorities
The S7-1500 CPUs support the priorities 1 (lowest priority) to 26 (highest priority).
The OBs are executed on a purely priority-driven basis. This means that when several OB
requests exist at the same time, the OB with the highest priority is executed first. When an event
occurs that has a higher priority than the currently active OB, this OB is interrupted. Events of the
same priority are executed in the order that they occur.
If this is also the same, for example for Startup OBs, then the OBs are executed according to
their number.

TIA-PRO1 - Organization Blocks


13-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.2.2. Process Image Partitions

Cycle OB
Process image for inputs and outputs

Program execution

Process image for inputs and outputs


Program execution OB “Cyclic interrupt”
Process image partition 1 for inputs

Addresses with setting Program execution OB “Hardware interrupt”


Process image partition 2 for inputs
Program execution
Adressen mit Einstellung
Process image partition 2 for outputs
Resume program execution
Process image partition 1 for outputs
Resume program execution
Process image for inputs and outputs Adressen
Addresses
mitwith
Einstellung
setting

Program execution Cycle OB

Process Image for Inputs and Outputs


For reasons of access speed and the consistency of the status of individual inputs throughout the
entire cycle, a copy is stored in the process image for inputs (PII) which is accessed during
program execution. The writing of outputs occurs in the process image for outputs (PIQ). The
statuses of outputs stored here are written into the actual outputs at the beginning of every cycle.
The inputs and outputs of an S7-1500 are automatically made available in the process image for
inputs and outputs as long as this is not changed in the settings of the individual blocks.
Under the Properties of the module > General > Input…/Output… > I/O addresses, “Automatic
update” (“Automatische Aktualisierung”) is set in Organization block and Process image.

Process Image Partition (PIP)


Inputs and outputs which are not used in the cyclic program, that is, not in every cycle, do not
have to be updated with the process image at the beginning of every cycle. For that reason, there
are the process image partitions which in turn can be assigned to individual organization blocks. If
an OB is executed which has a PIP assigned to it, then the inputs of the associated PIP are read-
in at the beginning and at the end, the statuses of the outputs of the PIP are written in the
relevant peripherals. If a process image partition is not assigned to any organization block, then
the update of this PIP must be done with the help of instructions.

Updating a Process Image Partition in the User Program


Each PIP can be updated in the user program with special instructions. For this, the instructions
"UPDAT_PI" for updating inputs and "UPDAT_PO" for updating outputs is used.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-7
SIMATIC TIA Portal Programming 1

13.3. Creating a new OB

Create new OB
When creating an organization block, the type of event is first of all selected. In addition, the
number and the name can be changed. By default, new OBs are created with the attribute
"Optimized block access" with the result that only reduced start information is available in the OBs
(see next page). In the Properties of the OB, the behavior can be individually set depending on
the type.

TIA-PRO1 - Organization Blocks


13-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.3.1. OB Start Information using "OB_Startup" as an Example

RD_SINFO

Only if necessary, read out start


information

Start Information for Not Optimized Block Access


When the operating system calls organization blocks, the user is provided with OB-specific start
information on the local data stack.
This start information has a length of 20 bytes and is available after the OB starts execution.
The start information as well as their absolute L-stack addresses is only completely available for
those OBs where the block attribute "Optimized block access" is not activated (as shown in the
picture).
In order to avoid errors, the structure of the standard declaration section should not be changed
by the user. Following the standard declaration section, the user can declare further, additional
temporary variables.

Start Information for Optimized Block Access


The start information of an organization block with optimized block access is limited to the
essentials and is passed by means of input parameters. If necessary, the start information, with
the exception of the date and time, can be read out by means of the function “RD-SINFO”.

Variables
An explanation of the meaning of the variables can be found in the online help.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-9
SIMATIC TIA Portal Programming 1

13.4. Time-of-Day Interrupt OB

Repetition interval

Call date and time of


day

Time-of-Day Interrupts
Time-of-day interrupts are used for executing a certain program called in OB 10 (as an example)
either once only at a certain time or periodically (every minute, hourly, daily, weekly, monthly,
yearly) starting at that time.

Note
In addition, the time-of-day interrupts can be controlled at runtime with the following instructions
(Task Card Instructions "Extended instructions -> Interrupts > Time-of-day interrupt"):
• "SET_TINT" Set start date, time and period
• "SET_TINTL" Set start date, time and period
• "CAN_TINT" Cancel time-of-day interrupt
• "ACT_TINT" Activate time-of-day interrupt
• "QRY_TINT" Query time-of-day interrupt

TIA-PRO1 - Organization Blocks


13-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.4.1. Starting the Time-delay Interrupt OB

Number or constant
name of the time-delay
interrupt
(not the symbol name of
the OB)

Delay time

Variable value (2 bytes) which is passed


with the start event information to the
time-delay interrupt OB

Time-Delay Interrupts
Time-delay interrupt OBs are used in order to be able to react to freely definable events after a
time delay. With the function “SRT_DINT”, you define which time-delay interrupt after expiration
of which time is to be called by the operating system. With the help of the input parameter
“SIGN”, a value in the size of a word can be passed to the time-delay interrupt OB.

Caution:
As the actual parameter of the formal parameter “OB_NR”, the OB number or the constant name
of the OB must be specified. The symbol name of the OB to be called is not acceptable.
You will wind the constant name in the Properties of the OB under “General > Constant name”.

Note
In addition to the instruction “RSD_DINT”, there are also other instructions in the Task Card
Instructions under "Extended instructions -> Interrupts > Time delay instruction":
• “CAN_DINT” Cancel time delay interrupt
• “QRY_DINT” Query status of time delay interrupt

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-11
SIMATIC TIA Portal Programming 1

13.4.2. Executing Cyclic Interrupt OBs

RUN OB35 OB35 OB35


Interval Interval
Interval time
time time

OB1 OB1 O B1 OB1 OB1 OB1 OB1 O B1

Cycle time Cycle time Cycle time

Cyclic Interrupt
With a Cyclic interrupt OB, a block can be executed at fixed time intervals. The S7-1500 offers
the OB 35, for example, as a Cyclic interrupt OB. The default setting for its call interval is
100000μs; the selectable range is from 500μs to 60000000μs (60sec).

Interval Time
You must make sure that the interval you specify is longer than the time required for execution.
The operating system calls the “Cyclic interrupt” OB at the specified time. If the “Cyclic interrupt”
OB is still active at this time, the operating system calls the “Time error interrupt” (OB 80).

Note
Cyclic interrupts can also be controlled and queried at runtime with "Extended instructions" (Task
Card Instructions "Extended instructions -> Interrupts > Cyclic interrupt"):
• “SET_CINT” Set cyclic interrupt parameters
• “QRY_CINT” Query cyclic interrupt parameters

TIA-PRO1 - Organization Blocks


13-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.4.2.1. Phase Offset for "Cyclic interrupt" OBs

Cyclic interrupt

100 ms 100 ms 100 ms 100 ms 100 ms

CPU start Cyclic interrupt_1

200 ms 200 ms 200 ms

Phase offset
200µs

Example for the Use of a Phase Offset


Two “Cyclic interrupt” OBs are required in the program:
“Cyclic interrupt”
“Cyclic interrupt_1”
For the OB “Cyclic interrupt” and for the OB “Cyclic interrupt_1”, a time period of 100 ms was set.
After the time period of 100 ms has expired, both “Cyclic interrupt” OBs are given their starting
time. However, in order to execute the OBs with a time lag, a phase offset is configured for one of
the two OBs.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-13
SIMATIC TIA Portal Programming 1

13.4.3. Hardware Interrupt

Analog input module

+27648
Upper limit value 2
Upper limit value 1

Lower limit value 1


Lower limit value 2
0

Hardware Interrupt
The program execution of a “Hardware interrupt” OB is started as soon as a certain event occurs.
Hardware interrupts can be triggered by various module-specific signals:
For parameter-assignable signal modules (DI, DO, AI, AO) you specify which signal is to trigger
the hardware interrupt in the Properties of the modules.

Example
In configuring an analog input module, suitable limit values were specified in the above example.
If the measured value then exceeds this limit, an interrupt is triggered on the CPU which causes
the program to be interrupted and the OB “Hardware interrupt” to be called for execution.

TIA-PRO1 - Organization Blocks


13-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.5. Task Description

Initialization of the operation through


5-second movement to the right

Task Description
In order to prevent parts being on the transport conveyor after switch on or warm restart, the
conveyor is to move to the right for 5 seconds when there is a STOP-RUN transition.
For this, the conveyor is started with the help of a Startup OB during startup and is stopped again
with the help of a Time-delay interrupt OB which is called after 5 seconds.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-15
SIMATIC TIA Portal Programming 1

13.5.1. Exercise 1: Preparing the Startup Initialization

Task
So that the conveyor moves to the right after starting, a variable is required which has the Status
True during the initialization time.

What to Do
1. Insert the new data block "DB_Memory" and declare the variable “Init_Right”.
2. Link the variable "DB_Memory".Init_Right in “FC_Conveyor” as an additional OR-condition for
transport conveyor movement to the right.
3. Save your project.

TIA-PRO1 - Organization Blocks


13-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.5.2. Exercise 2: Initializing Transport


using Startup and Programming the Time-delay Interrupt OB

Number or
constant name of the
OB

Task
The new variable "DB_Memory".Init_Right must be set in a Startup OB and reset in a Time-delay
interrupt OB after 5 seconds.

What to Do
1. Insert the new organization blocks "OB_Startup_1" of the type Startup and "OB_Time delay
interrupt_1" of the type Time-delay interrupt.
2. In the OB "OB_Startup_1", make an assignment to the variable "DB_Memory".Init_Right so
that it is assigned the value TRUE.
3. In a further network, call the function “SRT_DINT” and declare it so that the OB "Time delay
interrupt_1" is started after 5 seconds.
Caution: The parameter OB_NR only accepts the OB number or the constant name of the
OB not the symbol name.
4. In order to be able to supply the parameters SIGN and RET_VAL with actual parameters,
declare the relevant temporary variables “#Startinfo” (WORD) and “#ret_V” (INT).
5. In "OB_Time delay interrupt_1", reset the variable "DB_Memory".Init_Right.
6. Save, compile and download your project.
7. Test the new function.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-17
SIMATIC TIA Portal Programming 1

13.6. Additional Task Description

If the system was switched off in


DI DO Automatic mode, initialization to the
If the system was switched off in
Operation OFF right
I 0.0 Manual mode, initialization to the
"S_OperationOFF" (NC)
left

I 0.1 Operation ON Operation


Q0.1
"S_OperationON" "P_Operation"

I 0.2 Jog right


"S_Right"

I 0.3 Jog left


"S_Left"

Initialization left Q0.5


"P_InitLeft"

Initialization right
Q0.6
Initialization display with
"P_InitRight" 2Hz flashing light

Acknowledge fault Conveyor fault


I 0.7 "S_Acknowledge" "P_Fault" Q0.7

Task Description
When switching on the system, the initialization is to depend on the operating status at the time
when the system was switched off. If the system had the operating status Operation ON
(Automatic) when it was switched off, then the transport conveyor is to move to the right. If the
system had the operating status Operation OFF (Manual), when it was switched off, then the
initialization movement is to the left. In addition, the relevant initialization movement is signaled
with a 2Hz flashing light at the LEDs Q0.5 “P_InitLeft” and Q0.6 “P_InitRight”.
In order to achieve this, the operating mode must be stored as retentive.

TIA-PRO1 - Organization Blocks


13-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.6.1. Additional Exercise 3: Preparing for the Initialization Expansion

Task
You are to declare a variable for the movement to the left and assign it as a condition for a
movement to the left. Furthermore, a retentive variable is required for the operating mode.

What to Do
1. In "DB_Memory", declare two new variables “Init_Left” and “Operation”.
2. Give the variable “Operation” the property “Retentive”.
3. In "FC_Conveyor", insert a new OR logic operation for the control of the output “K_Left” and
as a further condition give the variable "DB_Memory".Init_Left a TRUE signal.
4. For the operating mode in "FC_Mode", set the variable "DB_Memory".Operation instead of
the output “P_Operation”.
5. To signalize the operating mode in "FC_Signal", assign the status of the variable
"DB_Memory".Operation to the output “P_Operation”.
6. Save the program modifications.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-19
SIMATIC TIA Portal Programming 1

13.6.2. Additional Exercise 4: Initialization to the Left/Right

What to Do
In the Startup OB, after evaluating the variable "DB_Memory".Operation, the variable
"DB_Memory".Init_Right or "DB_Memory".Init_Left is assigned the value TRUE.
Furthermore, the character ‘L’ for left or ‘R’ for right is written in the temporary variable #Startinfo.
The call of "OB_Time delay interrupt_1" remains unchanged. However, after evaluating the input
parameter #Sign, the variables "DB_Memory".Operation and "DB_Memory".Init_Right or
"DB_Memory".Init_Left are reset in this.

Solution Hints
1. In "OP_Startup_1", assign the variable "DB_Memory".Init_Left the value TRUE and write the
CHAR value ‘L’ in the variable #Startinfo when the variable "DB_Memory".Operation has the
status FALSE.
2. Change the assignment of the variable "DB_Memory".Init_Right so that it only gets the value
TRUE when the variable "DB_Memory".Operation has the status TRUE. Additionally in this
case, the CHAR value ‘R’ is written in the variable #Startinfo.
3. The call of the function “SRT_DINT” remains unchanged.
4. Reset the variable "DB_Memory".Init_Left in "OB_Time delay interrupt_1" when the CHAR
value ‘L’ is passed with the input parameter #Sign.
5. If the CHAR value ‘R’ is passed with the parameter #Sign, then the variables
"DB_Memory".Operation and "DB_Memory".Init_Right are reset.
6. Save the program modifications.

TIA-PRO1 - Organization Blocks


13-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.6.3. Additional Exercise 5: Displaying the Initialization

Task
The current initialization is to be displayed on the relevant LED “P_InitLeft” or “P_InitRight” with a
2Hz flashing light.

What to Do:
1. Open the function "FC_Signal" and insert two new networks.
2. With an AND instruction, interconnect the variable "DB_Memory".Init_Left and the clock
memory “Clock_2Hz” and assign the result to the output Q0.5.
3. Give the output Q0.5 the symbol name “P_InitLeft”.
4. Repeat the logic operation with the variable "DB_Memory".Init_Right and “Clock_2Hz” for the
output Q0.6 and give it the symbol name “P_InitRight”
5. Save, compile and download the program modifications.
6. Test the new function.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-21
SIMATIC TIA Portal Programming 1

13.7. Additional Information

TIA-PRO1 - Organization Blocks


13-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.7.1. S7-1200/1500: Global Error Handling with Asynchronous Error OBs

Type of Error Example Error OB Priority

Time Error:
Max. allowed cycle time
exceeded once Exceeding the
System reaction with OB:RUN max. allowed cycle time,
without OB: STOP OB 80 22
delayed call
Max. allowed cycle time of a time OB
exceeded by more than double
System reaction with OB:STOP

Diagnostic Interrupt Wire break at diagnostics-capable


OB 82 Can be set: 2..26
System reaction w/o OB: RUN module, power supply error

Remove / Insert Interrupt Remove / Insert a module OB 83 Can be set: 2..26


System reaction w/o OB: RUN

Rack Failure Failure of a DP-Slave Can be set: 2..26


System reaction w/o OB: RUN or an IO-Device OB 86

All events lead to an entry in the diagnostics buffer

Asynchronous Errors
Asynchronous errors occur asynchronous (independent) to the program execution and
accordingly cannot be assigned to a defined program location.

Time Errors
They occur when the current cycle time exceeds the cycle monitoring time set in the Properties of
the CPU.

Diagnostic Interrupts
They are triggered by diagnostics-capable modules, such as, analog modules in case of a fault
(for example, wire break).

Remove/Insert Interrupts
These interrupts are triggered when modules are removed or inserted. When a module is
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.

Rack Failure
A rack failure is detected with the failure of a rack, a subnet or a station of distributed I/O.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-23
SIMATIC TIA Portal Programming 1

13.7.2. S7-1200/1500: Global Error Handling with Synchronous Error OBs

Type of Error Example OB Priority

S7-1200
Programming error Access to non-existing DB no OB
Access error Direct access to non-existing exists
System reaction w/o OB: RUN or defective I/O module

Programming error OB 121


Access to non-existing DB
System reaction w/o OB: STOP (only S7-1500)

S7-1500 Can be set:


2..26
Access error Direct access to non-existing OB 122
System reaction w/o OB: RUN or defective I/O module (only S7-1500)

All errors lead to an entry in the diagnostic buffer

Synchronous Errors
Synchronous errors occur synchronously (dependent) to the program execution and accordingly
can be assigned to a defined program location.
With a programming error, OB121 is called; with an access error, OB122. If, in case of an error,
the appropriate synchronous error OB does not exist in the CPU, the CPU switches to the STOP
state.

S7-1500:
You can set the priority of the synchronous error OBs from 2 to 26. The register contents that the
interrupted block has used are not available in the error OB and cannot be manipulated by means
of system functions.

TIA-PRO1 - Organization Blocks


13-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

13.7.3. OB Priorities and System Reaction

Varying amounts of OBs can be created for every OB type. Numbers that are smaller than 123
are permanently assigned to certain OBs and numbers that are larger / equal to 123 are freely
selectable.

TIA-PRO1 - Organization Blocks


Training Document, V14.01.01 13-25
SIMATIC TIA Portal Programming 1

Contents 15
15. Troubleshooting ................................................................................................... 15-3
15.1. Categories of Errors ............................................................................................................ 15-4
15.2. STEP 7 - Test Functions, Overview .................................................................................... 15-5
15.3. Overview Window ............................................................................................................... 15-6
15.3.1. Global Search / Find and Replace in the Editor.................................................................. 15-7
15.4. Detailed Information in the Overview of Addresses ............................................................ 15-8
15.5. System Diagnostics - Overview .......................................................................................... 15-9
15.6. Status LEDs ...................................................................................................................... 15-10
15.6.1. Status LEDs of the S7-1500 CPU ..................................................................................... 15-10
15.6.2. Status LEDs of the Central DI/DO Modules of the S7-1500 CPU .................................... 15-11
15.7. Hardware Diagnostics ....................................................................................................... 15-12
15.8. Online & Diagnostics: General .......................................................................................... 15-13
15.8.1. Online & Diagnostics: CPU Diagnostics Buffer................................................................. 15-14
15.8.2. CPU Diagnostics Buffer: Interpreting Error Messages ..................................................... 15-15
15.8.3. CPU Diagnostics Buffer: Opening a Faulty Block ............................................................. 15-16
15.9. Call Hierarchy (Block Stack) ............................................................................................. 15-17
15.9.1. Exercise 1: Creating a Program Backup Copy in the Project Library ............................... 15-18
15.9.2. Exercise 2: Copying the Faulty Program .......................................................................... 15-19
15.9.3. Exercise 3: STOP Troubleshooting Worksheet ................................................................ 15-20
15.10. Monitor Block (Block Status) ............................................................................................. 15-21
15.10.1. Monitor Block: Modify Tags............................................................................................... 15-22
15.10.2. Monitoring Structures ........................................................................................................ 15-23
15.10.3. Monitor Block: Trigger Conditions / Call Environment ...................................................... 15-24
15.11. Monitor / Modify Variables (Tags): Watch Tables ............................................................. 15-25
15.11.1. Monitor / Modify Variables (Tags): Trigger Points ............................................................ 15-26
15.11.2. Enable Peripheral Outputs (in planning for S7-1500) ....................................................... 15-27
15.11.3. Force Variables (Tags) ..................................................................................................... 15-28
15.12. Reference Data: Cross-references of Tags ...................................................................... 15-29
15.12.1. Reference Data: Cross-references / Show Overlapping Accesses .................................. 15-30
15.12.2. Reference Data: Cross-references of a Variable (Tag) in the Block Editor ...................... 15-31
15.12.3. Go To…............................................................................................................................. 15-32
15.12.4. Reference data: Assignment I/Q/M/T/C ............................................................................ 15-33
15.12.5. Reference Data: Call Structure ......................................................................................... 15-34
15.12.6. Reference Data: Dependency Structure ........................................................................... 15-35
15.13. Resources ......................................................................................................................... 15-36
15.14. Reference Projects ........................................................................................................... 15-37
15.15. Compare (1) - Offline / Online ........................................................................................... 15-38
15.15.1. Compare (2) – Block Detailed Comparison ...................................................................... 15-39
15.15.2. Compare (3) - Software Offline / Offline ........................................................................... 15-40
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-1
SIMATIC TIA Portal Programming 1

15.15.3. Compare (4) - Hardware Offline / Offline .......................................................................... 15-41


15.16. Exercise 4: Testing the Motor Jog .................................................................................... 15-42
15.17. Exercise 5: Entering the Setpoint Quantity ....................................................................... 15-43
15.18. Exercise 6: Testing the Evaluation of Fault 3 ................................................................... 15-44
15.19. TRACE Analyzer Function ................................................................................................ 15-45
15.19.1. Configuring a TRACE - Signals and Sampling ................................................................. 15-46
15.19.2. Configuring a TRACE – Trigger and Saving Measurement on Device............................. 15-47
15.19.3. Downloading a TRACE into the CPU and Activating It ..................................................... 15-48
15.19.4. Evaluating, Saving, Exporting a TRACE in STEP7 .......................................................... 15-49
15.19.5. Trace Task Card ............................................................................................................... 15-50
15.20. Task Description: Creating, Looking at and Saving a TRACE ......................................... 15-51
15.20.1. Exercise 7: Creating a Cyclic Interrupt OB for the Recording Level ................................. 15-52
15.20.2. Exercise 8: Creating, Looking at and Saving a TRACE ................................................... 15-53
15.21. Additional Information ....................................................................................................... 15-55
15.21.1. Diagnostic Information about the SIMATIC Memory Card ............................................... 15-56
15.21.2. Reading-out the Checksum .............................................................................................. 15-57

TIA-PRO1 - Troubleshooting
15-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15. Troubleshooting

At the end of the chapter the participant will…

… be familiar with the search functions

... be familiar with the possibilities of troubleshooting

… be familiar with the possibilities of project analysis

… be able to apply troubleshooting functions for STOP


troubleshooting and to be able to use them for error
correction

... be able to apply troubleshooting functions for searching for


logical errors and to be able to use them for error correction

… be able to use the Trace analysis function

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-3
SIMATIC TIA Portal Programming 1

15.1. Categories of Errors

Errors Detected by the System


• Acquiring, evaluating and indicating
errors within a PLC
• Module failure
• Short-circuit in signal cables
• Scan time overrun
• Programming error (accessing a
non-existent block)

Functional Errors
• Desired function is either not executed at all
or is not correctly executed

• Process fault (sensor/actuator, cable defective )


• Logical programming error
(not detected during creation and
commissioning)

Monitoring Functions
Diagnosis is important in the operating phase of a system or machine. Diagnosis usually occurs
when a problem (disturbance) leads to standstill or to the incorrect functioning of the system or
machine. Due to the costs associated with downtimes or faulty functions, the associated cause of
the disturbance has to be found quickly and then eliminated.

Categories of Errors
Errors that occur can be divided into two categories, depending on whether or not they are
detected by the PLC:
• Errors that are detected by the PLC’s operating system and that normally lead to the Stop
state of the CPU.
• Functional errors, that is, the CPU executes the program as usual, but the desired function is
either not executed at all or it is executed incorrectly. The search for these types of errors is
much more difficult, as a rule, since the cause of the error is initially hard to determine.
Possible causes could be:
• A logical programming error (software error) that was not detected during creation and
commissioning of the user program and probably occurs only on extremely rare occasions.
• A process fault that was triggered by the faulty functioning of components directly associated
with the process control, such as cables to sensors/actuators or by a defect in the
sensor/actuator itself.

TIA-PRO1 - Troubleshooting
15-4 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.2. STEP 7 - Test Functions, Overview

Errors Detected by the System Functional Errors


General rule: CPU in Run General rule: CPU in RUN

• Programming error (w/o OB121): STOP


• Process fault (e.g. wire break)
• Access error (w/o OB122): RUN • Logical programming error
• Asynchronous error (w/o OB82, 83, 86): RUN (e.g. double assignment)

• Monitor and Modify Variables


• Online & Diagnostics
→ Watch and Force tables
- Diagnostics buffer,
• Monitor Blocks (Block Status)
• Task Card "Testing"
→ Monitor in the Blocks editor
- Call hierarchy/Block stack
- with call environment
- Local data stack (in planning stage)
• Tools
• Diagnose Modules
- Cross references
- Diagnostic status (all modules)
- Assignment list (I/Q/M/T/C)

• "Trace" analyzer function


in planning for S7-1200/1500 • Program/Block comparison
• Set breakpoints

Test Functions
There are various STEP 7 test functions for troubleshooting, depending on the type of error
caused:
• when CPU in STOP
For errors that are detected by the system, the test functions Diagnostics buffer, Call
hierarchy/Block stack, Local data stack and Hardware diagnostics give detailed information
on the cause of the error and the location of the interruption. By programming Error OBs,
information on the error that occurred can be evaluated by program and the transition of the
CPU into the STOP state can be prevented. If the CPU has stopped, the use of the test
functions Monitor / Modify Variable and Monitor Blocks makes little sense since the CPU
neither reads nor outputs process images while in the STOP state, and also no longer
executes the program.
• when CPU in RUN
Vice versa, it makes little sense, as a rule, to use test functions such as Local data stack for
troubleshooting when the CPU is in RUN, since program execution has not been interrupted
and the system does not provide any information on the error that occurred. The Module
Information test function merely provides general information on the CPU‘s operating status
or on errors that occurred in the past. Functional errors can be diagnosed as follows:
− Process Fault (such as a wiring error)
Wiring test of the inputs: Monitor Variable
Wiring test of the outputs: Enable Peripheral Outputs (only for CPU-STOP)
− Logical Programming Errors (such as a double assignment)
All test functions listed, with the exception of Enable Peripheral Outputs, can be used for
searching for logical program errors.
− Force: Forced control of operands regardless of the program logic
− Breakpoints: Program execution in single steps

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-5
SIMATIC TIA Portal Programming 1

15.3. Overview Window

Show subordinate
elements

Look at, compare, edit, shift, etc., the contents of the selected
folders of the Project tree

The Overview window is used to supplement the Project tree. The Overview window displays the
contents of the folder currently selected in the Project tree.
As well, you can carry out the following actions in the Overview window:
• Open objects
• Display and edit Properties of objects in the Inspector window
• Rename objects
• Call object-specific actions via the Context menu
• Compare objects
• Carry out different object operations, such as, insert objects from the library using drag &
drop, shifting, copying, inserting and deleting objects

It is possible to compare the contents of two folders or objects. To do so, the View can be split.
Beyond that, it is possible to shift objects between the two split windows using drag & drop.

TIA-PRO1 - Troubleshooting
15-6 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.3.1. Global Search / Find and Replace in the Editor

Enter search text for


global search

Find and replace in


the Editor

Limit search
Result

Within the TIA Portal, you can use the following search possibilities:
• Search entire project (toolbar or CTRL+F when the focus is not in the editor (working) area)
• Find and replace within an editor (‘Tasks’ task card > Find and replace)
• Search the Hardware catalog

Search Entire Project


You can search the entire project for a specific text. For this, there is a Search editor available in
which you can, for example, narrow down the search. The objects which contain the searched-for
text are presented clearly in a table. You can open each object from the Search editor in order to
look at the relevant location.
The Global Search (Search in project) can be started by means of CTRL+F (when the
focus/selection is not in the editor (working) area), or, via the Context menu of the project name,
or, via the menu bar, or, via the menu Edit > Search in project.
If the focus is in an editor, then the function “Find and replace” is started with the key combination
CTRL+F.

Search and Replace within an Editor (CTRL+F when the focus is in the editor (working) area)
It is possible to search for texts within an editor. The search function finds all texts within the
currently opened editor which contain the search term. The results are selected one after the
other in the opened editor.
Furthermore, you have the following possibilities:
• Refine the search through additional options
• Replace found text

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-7
SIMATIC TIA Portal Programming 1

15.4. Detailed Information in the Overview of Addresses

In menu ‘Overview of addresses’ in the Properties of the CPU, an entire overview of addresses
with central and distributed I/O can be displayed.

TIA-PRO1 - Troubleshooting
15-8 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.5. System Diagnostics - Overview

CPU diagnostics detects CPU I/O module


a system error
CPU diagnostics detects Diagnostic Diagnostics-
errors in the user program interrupt capable module
detects an
error and
generates a
diagnostic
Error Diagnostics interrupt
OB buffer

System Diagnostics
All those monitoring functions that deal with the correct functioning of the components of an
automation system are grouped together under System Diagnostics. All S7-CPUs have an
intelligent diagnostics system. The acquisition of diagnostic data by the system diagnostics does
not have to be programmed. It is integrated in the operating system of the CPU and in other
diagnostics-capable modules and runs automatically. The CPU (temporarily) stores errors that
occur in the diagnostics buffer and thus enables a fast and targeted error diagnosis by service
personnel, even for sporadically occurring errors.

System Reaction
The operating system takes the following actions when it detects an error or a STOP event, such
as an operating mode change (RUN  STOP):
• A message on the cause and the effect of the occurring error is entered in the diagnostics
buffer, complete with the date and time. The diagnostics buffer is a FIFO (circular) buffer on
the CPU module for storing error events. The size of the diagnostics buffer depends on the
CPU. In the FIFO buffer structure, the most recently entered message overwrites the oldest
diagnostics buffer entry. A CPU Memory Reset cannot delete the diagnostics buffer.
• The Error OB associated with this error is called. This gives the user the opportunity of
carrying out an own error handling.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-9
SIMATIC TIA Portal Programming 1

15.6. Status LEDs


15.6.1. Status LEDs of the S7-1500 CPU

CPU defective; RUN/STOP LED


Memory Card defective
CPU in RUN mode
CPU in startup (transition from STOP→RUN)
CPU in STOP mode
CPU Reset or Firmware Update running

ERROR LED

Program error, system error or diagnostic problem exists

MAINT LED

Maintenance request of an I/O module exists


Firmware Update successfully completed

TIA-PRO1 - Troubleshooting
15-10 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.6.2. Status LEDs of the Central DI/DO Modules of the S7-1500 CPU

Module defective
RUN LED

Module ready for operation


Module running, but has no valid parameter assignment

ERROR LED

Module error or diagnostic problem exists

Channel status

Channel error exists;


e.g. wire break, short-circuit ...
DI/DO 1-Status of channel
AI/AO Channel is parameterized and OK

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-11
SIMATIC TIA Portal Programming 1

15.7. Hardware Diagnostics

1xR

Diagnosing Hardware
To use this function you must open the "Device configuration" and establish an online connection.
The online view of the hardware gives information about the status or operating status of the
modules. You can see that there is diagnostic information for a module when you see the
diagnostic symbols that indicate the status of the associated module or the operating status of the
CPU.
In the example shown, the analog input module (slot 4) has triggered a diagnostic interrupt. As a
result, the CPU has gone into the STOP mode.
Both modules have been given symbols accordingly. Via the Context menu of the CPU and
subsequent starting of "Online & diagnostics", the CPU’s diagnostic buffer is output; for the
analog module, the associated diagnostic data (see picture).

Symbol Meanings

TIA-PRO1 - Troubleshooting
15-12 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.8. Online & Diagnostics: General

Online & diagnostics

Online and Diagnostics


The Module Information function reads the most important data from the directly connected
module. You will find additional information in the individual tabs:
• General: Among other things, the module designation, hardware and firmware versions
• Diagnostic status: Current status of the module
• Diagnostics buffer: It contains all diagnostic events in the order they occurred. In the display,
all events are listed in plain language and in the order they occurred.
• Cycle time: Displays the selected minimum time and monitoring time as well as displaying the
shortest, the longest and the current cycle time.
• Memory: Information about the entire size, how many bytes are used (occupied) and how
many are free in the Load memory, Code work-memory, Data work-memory, and Retain
memory.
• Display: General information about the Display used (Article number, Firmware etc.)

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-13
SIMATIC TIA Portal Programming 1

15.8.1. Online & Diagnostics: CPU Diagnostics Buffer

Diagnostics Buffer
The diagnostics buffer is a buffered memory area on the CPU organized as a circular buffer.
It contains all diagnostics events (error messages, diagnostic interrupts, startup information etc.)
of the CPU in the order in which they occurred. The highest entry is the last event to occur.
All events can be displayed on the programming device in plain language and in the order in
which they occurred.
The size of the diagnostics buffer depends on the CPU. As well, not all of the diagnostics
buffer is buffered with PowerOFF (only a part is retentive).

• Number of entries, 1000 to 3200


• Of that, 500 to 1000 retentive

Details on Event
Some additional information is also provided for the selected event in the "Details on event" box:
• Event name and number,
• Additional information depending on the event, such as, the address of the instruction that
caused the event etc.

TIA-PRO1 - Troubleshooting
15-14 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.8.2. CPU Diagnostics Buffer: Interpreting Error Messages

Interpreting the Diagnostics Buffer


To interpret the diagnostics buffer, you have to look at the events that belong together in the
sequence in which they occurred, in other words, from bottom to top:
For orientation:
• In our example, a WARM RESTART was performed before the most recent error occurred
(events no.4 and 5).

Entries in the Diagnostics Buffer


The last error that occurred after this warm restart leads to the following entries in the diagnostics
buffer:
• Event No. 3:
DB 98 not loaded, access in FC15

Details on event:
− DB 98 not loaded, access in FC15
(DB does not exist on the CPU)
− affects OB1 execution
(FC15 is called in the cyclic program)
• Event No. 2:
Programming error (OB start event)
(if it exists, the operating system calls an OB for a programming error)

Details on event
− CPU changes to STOP mode
− no OB processing
(because the programming error OB121 was not programmed)
• Event No. 1:
− CPU changes to STOP mode

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-15
SIMATIC TIA Portal Programming 1

15.8.3. CPU Diagnostics Buffer: Opening a Faulty Block

Opening a Block
For synchronous errors, that is, for errors that were triggered by a faulty instruction in the user
program, you can open the block in which the interruption occurred by clicking on the "Open in
editor" button.
If the SCL or STL language is selected, the cursor is positioned directly in front of the instruction
that caused the interruption. In LAD/FBD, the network causing the interruption is highlighted. In
the example shown, an attempt is made to access a data block which does not exist.

TIA-PRO1 - Troubleshooting
15-16 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.9. Call Hierarchy (Block Stack)

Call Hierarchy
The “Call hierarchy” gives you the information in which call path the block is opened.
If the block was opened from the diagnostic buffer via the button “Open in editor”, then by looking
at the entry in the Call hierarchy, you can see in which path the error occurred.
You can open the calling block by clicking on the relevant (appropriate) Link.

Note:
If the CPU is in "STOP" mode, the current block stack at the time of the STOP transition can be
read out via the call hierarchy. The block stack lists all blocks whose execution was not
completed at the moment when the CPU went into "STOP". The blocks are listed in the order in
which the execution was started.
With an existing online connection, open any block for this and switch into the Task Card “Test” >
Call hierarchy.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-17
SIMATIC TIA Portal Programming 1

15.9.1. Exercise 1: Creating a Program Backup Copy in the Project Library

Task
You are to make a backup copy of your own program and the associated tags in the Project
library of your project "MyProject2" since you will be working with a prepared faulty program
afterwards.

What to Do
1. In the "Libraries", open the Project library.
2. Select all S7 blocks of the CPU program and copy them into your Project library using drag &
drop.
3. Select all tag tables and copy them into your Project library using drag & drop.
4. Save your project and with that also the Project library.

Note:
If you would like to copy several objects combined as one object into the library, then highlight the
objects, select "Copy" in the Context menu or press CTRL+C. Then, in the library, in the Context
menu of the Master copies folder, you will find the command "Paste as a single master copy".
Combined objects can also only be copied together into a project/device.

TIA-PRO1 - Troubleshooting
15-18 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.9.2. Exercise 2: Copying the Faulty Program

Task
You are to copy a prepared program from the "PRO1_Lib" Global library into your own project.

What to Do
1. In your project, delete all S7 blocks and all PLC tag tables.
2. In the task card Libraries, open the "Global library" PRO1_Lib
<Drive>:\02_Archives\TIA_Portal \TIA-PRO1\PRO1_Lib
3. Using drag & drop, copy the blocks "Program blocks" and the PLC tag tables "tag tables" into
your project (see picture).
4. Download all blocks of the faulty program into the CPU by selecting the CPU in the Project
tree and then clicking on the Download button.
5. Carry out a CPU restart.
6. Save your project.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-19
SIMATIC TIA Portal Programming 1

15.9.3. Exercise 3: STOP Troubleshooting Worksheet


Task
The faulty program contains one STOP error which if now to be corrected by you. If the CPU
remains in RUN after error correction and subsequent restart, the exercise has been successfully
completed.
In addition to the error (STOP error) detected by the system, the program also contains logical
errors (RUN errors) so that the correct functioning of the program is still not established even
after the STOP error is eliminated. The logical errors will be eliminated in the next exercises.

What to Do
Please note that after every STOP error correction, a CPU restart must be carried out. If the CPU
once again goes into the STOP mode after the restart, a further STOP error exists or/that is, the
error is not eliminated.
During error correction, answer the following questions on the error that occurs:

• STOP error determined:

− Interrupted block: …………………………………..…………………………….......................….

− Error ................………………………………………..................................................................

− Correction: (old instruction -> new instruction)

− ……….……………………………………………………......................…………….............…….

TIA-PRO1 - Troubleshooting
15-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.10. Monitor Block (Block Status)

Monitor block
On / Off

Online values are


being updated

Area of Use
The Monitor Block test function is used to be able to follow the program execution within a block.
For this, the states or contents of the operands used in the block at the time of program execution
are displayed on the screen. You can activate (switch on) the "Monitor" ("Block Status") test mode
for the block which is currently open in the LAD/STL/FBD Editor by clicking the Glasses icon.
At the beginning of the test function, it is insignificant whether the block to be monitored is opened
online or offline in the Editor. Should, however, the block opened offline not match the block
saved online in the CPU, you first either have to open the block saved online or load the block
opened offline into the CPU and then monitor it.
In the test mode, the states of the operands and LAD / FBD elements are displayed in different
colors. You define these by selecting the menu option Options  Settings:
Examples:
• Status fulfilled  "Element is displayed in green"
• Status not fulfilled  "Element is displayed in blue"

Notes
The monitoring values are only active when the CPU is in RUN mode and the instructions to be
monitored are being processed!
This is indicated by the progress bar “Online values are being updated” in the upper right corner
of the block.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-21
SIMATIC TIA Portal Programming 1

15.10.1. Monitor Block: Modify Tags

Modify Tags
When the "Monitor block" test function is activated, it is possible to modify tags to status '0' or '1'.
The assignment of the status occurs once. When you use tags that are not Boolean, you can
modify via the menu item "Modify operand…".
If the tag, whose status was changed, is not overwritten by the program, the tag remains at the
assigned status. If, for example, an output is modified to status '1' and this tag is not overwritten
by the program, the output remains switched on or to status '1'.

TIA-PRO1 - Troubleshooting
15-22 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.10.2. Monitoring Structures

Monitor
Structures

For INOUT parameters


Input value and
Output value

Rules for Monitoring Structures (S7-1200/1500)


When monitoring structures, the values of a structured PLC tag are displayed in the Inspector
window  Diagnostics  Monitor value, with the following exception:
• Structures, whose elements have adjustable retentive properties, cannot be monitored.
In order to display the Monitor values for a structure, you must first of all activate the monitoring
via the Context menu.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-23
SIMATIC TIA Portal Programming 1

15.10.3. Monitor Block: Trigger Conditions / Call Environment

Function
The call conditions for blocks and for breakpoints can be defined. Thereby it is determined under
which conditions the program status of a block is displayed or the program execution is
interrupted at a breakpoint. The following conditions can be selected:
• Instance data block
The program status of a function block is only displayed when the function block is called with
the selected instance data block.
• Call path
The program status of a block is only displayed when the block is called by a specific block or
from a specific path.

TIA-PRO1 - Troubleshooting
15-24 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.11. Monitor / Modify Variables (Tags): Watch Tables

Area of Use
The "Monitor/Modify Variables (Tags)" test function is used to monitor and / or modify variables
(tags) in any format you choose. For this, the desired variables are entered in a watch table. With
the exception of block-local, temporary variables, you can monitor and/or modify all variables
(tags) or operands.
You can choose the columns displayed in the Watch table via the menu ‘View’. The columns
have the following meanings:
• Name: symbolic name of the variable (tag)
• Address: absolute address of the variable (tag).
• Symbol comment: comment on the variable (tag) displayed
• Display format: a data format you can choose per mouse click (such as binary or decimal), in
which the contents of the variable (tag) is displayed
• Monitor value: variable (tag) value in the selected status format
• Modify value: value to be assigned to the variable (tag)

Watch Table
You can choose any name for the Watch table. Saved Watch tables can be reused to monitor
and modify so that a renewed input of the variables to be monitored is no longer necessary.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-25
SIMATIC TIA Portal Programming 1

15.11.1. Monitor / Modify Variables (Tags): Trigger Points

PII

Trigger point
"Beginning of
Scan Cycle"
once / by trigger by Trigger / once
modify variables monitor variables
show / hide all show / hide all enable peripheral outputs
modify columns trigger columns (disable output disables OD)
(CPU must be in STOP mode)
cyclic
program
execution
Trigger point
"Transition
to STOP"

Trigger point
"End of
Scan Cycle"

PIQ

Trigger Points
Through the "Monitor with trigger or Modify with trigger" columns, you can define the trigger
points for monitoring and modifying. The "Trigger Point for Monitoring" specifies when the values
of the variables being monitored are to be updated on the screen. The "Trigger Point for
Modifying" specifies when the given modify values are to be assigned to the variables being
modified.

Trigger Condition
In the “Monitor with trigger” column you can specify whether the values are to be updated on the
screen once only when the trigger point is reached or permanently (when the trigger point is
reached).
In the “Modify with trigger” column you can specify whether the given modify values are to be
assigned to the variables being modified once only or permanently (every time the trigger point is
reached).

Area of Use
The following tests, among others, can be implemented with the appropriate selection of trigger
points and conditions:
• Wiring test of the inputs:
Monitor variables, Trigger point: Start of scan cycle, Trigger condition: Permanent
• Simulate input states (user specified, independent of process):
Modify variables, Trigger point: Start of scan cycle, Trigger condition: Permanent
• Differentiation between hardware / software errors (an actuator that should be activated in the
process is not controlled)
Monitor variables, in order to monitor the relevant output, Trigger point: End of scan cycle,
Trigger condition: Permanent
(output state = ´1´ > program logic OK > process error (hardware)
(output state = ´0´ > program logic error (such as double assignment)
• Control Outputs (independent of the program logic)
Modify variables, Trigger point: End of scan cycle, Trigger condition: Permanent

TIA-PRO1 - Troubleshooting
15-26 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.11.2. Enable Peripheral Outputs (in planning for S7-1500)

Modify Enable peripheral S7-1500 S7-1200


once only outputs

The Function "Enable Peripheral Outputs" (S71500 in Planning)


The "Enable Peripheral Outputs" function is used to check the functioning of the output modules,
the wiring of the digital output modules or it can be used to continue to control actuators in the
process even though the CPU finds itself in the STOP state because of an error that has
occurred.
The "Enable Peripheral Outputs" function cancels the output disable of the peripheral outputs
(PQ), which enables you to control the outputs in spite of the CPU‘s STOP state.

Conditions
• The CPU must be in STOP mode
• A Force task must not be active in the CPU
• The Watch table must be displayed in "extended mode", in other words, displayed with trigger
columns
• The peripheral outputs to be enabled are to be specified byte by byte, word by word or
double-word by double-word with the suffix :P (for peripheral)
• After the peripheral outputs have been enabled, the modify values can be activated via the
"Modify once only" button (not via "Modify with trigger").

Note
When changing the CPU’s operating status from STOP to RUN or STARTUP, Enable Peripheral
Outputs is deactivated and a message pops up.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-27
SIMATIC TIA Portal Programming 1

15.11.3. Force Variables (Tags)

Force active Deactivate Force

Function and Area of Use


With Force, you can overwrite variables (tags) with any values you like, independent of the user
program. Only one "Force Values" window can be open at a time for a CPU.
With the S7-300, you can only force the inputs and outputs in the process image; with the S7-400
you can also force memory bits and peripherals.
With the S7-1500/1200, the peripherals of the inputs and outputs can be forced.

Notes on Forcing
Before your start the "Force" function, you should make sure that no one else is carrying out this
function at the same time on the same CPU.
A force task can only be canceled through an explicit "stop forcing" [deactivating the icon] (not via
Edit  Undo!). Closing the Force table or exiting the application does not cancel the force task on
the CPU.

TIA-PRO1 - Troubleshooting
15-28 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.12. Reference Data: Cross-references of Tags

Check overlapping
accesses

Show overlapping
access

Add new object

Introduction
The cross-references list offers an overview of the use of operands and variables (tags) within the
user program. From the cross-references list, you can jump directly to the point of use.
The cross-references list contains the following information:
• Which operand is used in which block with which instruction,
• Which tag is used in which HMI screen,
• Which block is called by which other block
As part of the project documentation, the cross-references supply a comprehensive overview of
all operands, memory areas, blocks, variables (tags) and screens used.

Views
There are two views of the cross-references list which differentiate themselves by which objects
are displayed in the first column:
• Used by:
Displays the referenced objects
Here, the Reference location where the object is used are displayed.
• Used:
Displays the referencing objects.
Here, the users of the object are displayed.
The associated tooltips give further information on the respective objects.

Show Unused
This is a list of tags which are declared in the PLC tag table but are not used in the S7 user
program.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-29
SIMATIC TIA Portal Programming 1

15.12.1. Reference Data: Cross-references / Show Overlapping Accesses

Check overlapping
accesses

Show overlapping
access

With the help of the “Check overlapping accesses” button, you can check whether overlapping
accesses exist for one of the variables (tags).
If this is the case, they can be displayed in a separate table with the help of the “Show
overlapping accesses” button.

TIA-PRO1 - Troubleshooting
15-30 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.12.2. Reference Data: Cross-references of a Variable (Tag) in the Block Editor

Introduction
In the Inspector window, the cross-reference information for a selected object is displayed in the
tabs "Info > Cross-references". In this tab, you will see at which Reference locations and from
which other objects every selected object is used.
In the Inspector window, even those blocks that only exist online are displayed in the Cross-
references.

Structure
The cross-reference information is displayed in tabular form in the Inspector window. Each
column contains specific detailed information on the selected object and its use.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-31
SIMATIC TIA Portal Programming 1

15.12.3. Go To…

Point of use in the


current block

1xR

Syntax error

Declaration of
operand

Input Output in the


Device view

TIA-PRO1 - Troubleshooting
15-32 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.12.4. Reference data: Assignment I/Q/M/T/C

Assignment I/Q/M/T/C
The assignment list for I/Q/M/T/C is opened via "Right-click on the relevant device -> Assignment
list" or via the menu "Tools > Assignment list".
This assignment list gives you an overview of which bit is used from which byte of the memory
areas input (I), output (Q) and memory bit (M) and which SIMATIC timers and counters are used.
The type of use (reading or writing) is not displayed.
The memory areas inputs (I), outputs (Q) and memory bits (M) are displayed byte-by-byte in
lines.
• The bits identified with a small diamond, that is, binary operands (in the picture, for example, I
4.0 or M 16.4) are used explicitly in the program.
• The fields of the individual bits which have a gray background identify byte, word, double-
word or long word operands that are used in the user program. The operand dimension (byte,
word, double-word or long word) comes from the vertical line in one of the columns "B" (Byte),
"W" (Word), "DWORD" (Double word) and "LWORD" (Long word).
• Bits that are marked with both a diamond and a gray background field are used explicitly as a
binary operand in the user program and are used via a byte, word, double-word or long word
operand.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-33
SIMATIC TIA Portal Programming 1

15.12.5. Reference Data: Call Structure

Update view

Display: must be
compiled

Call Structure
The call structure is opened via "Right-click on the relevant device -> Call structure" or via the
menu "Tools > Call structure " and describes the call hierarchy of the blocks within an S7
program.
It gives an overview of:
• The blocks used
• Jumps to the points of use of the blocks
• Dependencies between the blocks
• Local data requirements of the blocks
• Status of the blocks

TIA-PRO1 - Troubleshooting
15-34 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.12.6. Reference Data: Dependency Structure

Consistency check

Interface declaration
(to UDT_WeightStore)

Dependency Structure
The display of the dependency structure is opened via the menu "Tools > Dependency structure"
and with it you get a list of blocks used in the user program. In the first level (to the very left) is the
respective block and indented underneath it are the blocks which call this block or use it.
The dependency structure also shows the status of the individual blocks through the use of
symbols. Objects which cause a time stamp conflict and which can lead to an inconsistency in the
program are identified with different symbols.
The dependency structure represents an extension of the cross-references list for objects.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-35
SIMATIC TIA Portal Programming 1

15.13. Resources

Size of the SMC

The Resources is opened via the menu "Tools > Resources" and shows you which (how much)
memory area is used by which objects in the CPU.

Note
Display of the ‘Used’ Load memory in the CPU
Please note that the sum of the used load memory cannot be exactly determined if not all blocks
have been compiled.
In this case, a “>” placed in front of the sum indicates that the value for the used memory area
could be larger than displayed since blocks that are not compiled are not taken into account for
the total formation.

TIA-PRO1 - Troubleshooting
15-36 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.14. Reference Projects

Open and close


Reference project

Reference Projects
In addition to the user project, a write-protected Reference Project (see picture, all project
elements have a grey background) can be opened via the menu "View". Several elements (for
example, Program blocks) can be opened in the editor but they cannot be changed.
Similar to the Libraries, all project elements can be copied from the Reference Project into the
user project.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-37
SIMATIC TIA Portal Programming 1

15.15. Compare (1) - Offline / Online

Start detailed Execute


comparison actions
Display further
comparison criteria

Choose
synchronization
action

Types of Comparison
In principle, there are two different types of comparison:
Online/Offline comparison:
• The objects in the project are compared with the objects of the relevant device. For this, an
online connection to the device is necessary.
Offline/Offline comparison:
• Either the objects of two devices within a project or from different projects are compared.

Symbols of the Result Display


The result of the comparison is presented by means of symbols.
The following table shows the symbols for the comparison results of an Online/Offline
comparison:

Symbol Meaning
Folder contains objects whose online and offline versions are different
Comparison result is unknown
Online and offline versions of the object are identical
Online and offline versions of the object are different
Object only exists offline
Object only exists online

TIA-PRO1 - Troubleshooting
15-38 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.15.1. Compare (2) – Block Detailed Comparison

Position on previous/next
difference

Detailed Comparison
Through the detailed comparison you can identify exactly those locations that are different in the
online and offline version of a block. The following identifiers are used:
• Lines in which there are differences are highlighted in grey.
• Different operands and operations are highlighted in green.
• When the number of networks is different, pseudo networks are inserted so that a
synchronized representation of identical networks is possible. These pseudo networks are
highlighted in grey and contain the text "No corresponding network was found" in the title-bar
of the network. Pseudo networks cannot be processed.
• If the sequence of the networks is mixed up, pseudo networks are inserted at the appropriate
locations. These pseudo networks are highlighted in grey and contain the text "The networks
are not synchronized" in the title-bar of the network. The pseudo network also contains a link
"Go to network <No>", through which you can navigate to the associated network.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-39
SIMATIC TIA Portal Programming 1

15.15.2. Compare (3) - Software Offline / Offline

Compare
Manual / Automatic

Device from
Reference project

Offline / Offline Software Comparison:


• Objects of two devices within a project,
• Blocks of two devices within a project,
• Blocks in one device,
• Objects from different projects,
• Blocks from different projects,

For this, you can switch between

automatic and manual comparison using a mouse click.

Automatic Comparison:
Blocks and objects of the same type and the same name are compared

Manual Comparison:
You can select which blocks are to be compared. That way, it is possible to compare all blocks.

TIA-PRO1 - Troubleshooting
15-40 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.15.3. Compare (4) - Hardware Offline / Offline

Offline / Offline Hardware Comparison:


In addition, it is possible to compare the hardware between two devices or modules in one
device.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-41
SIMATIC TIA Portal Programming 1

15.16. Exercise 4: Testing the Motor Jog

Split editor (working


area) horizontally

!!!

Task
The function "Jog conveyor motor" does not work. The combined use of the PG functions
"Monitor block" and "Watch table" (monitor tags [variables]) indicates that there must be a double
assignment at output "K_Right" (Q4.5). The task now is to find all instructions in the entire user
program that write-access this output.

What to Do:
1. Carry out a CPU restart.
2. On the touchpanel, switch off the "Plant".
3. Open the "FC_Conveyor" block and activate the "Monitor" test function.
4. In the Project tree, under "Watch and force tables" create a new Watch table and in it monitor
the output "K_Right" (Q4.5).
5. Display the Blocks Editor with the opened "FC_Conveyor" and the Watch table one below the
other by splitting the working area (see picture).
6. Interpret the different status displays of the two test functions.
7. Localize the double assignment at output "K_Right" (Q4.5) with the help of the reference data,
correct the error and save the change.
8. Download all modified blocks into the CPU and check the how the program functions.

TIA-PRO1 - Troubleshooting
15-42 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.17. Exercise 5: Entering the Setpoint Quantity

Task
In the search for this logical error, you are to use the test function Cross-references.

Function Test
Check whether you can enter/change the setpoint quantity of the parts to be transported. Should
this not work, correct the error.

What to Do:
1. Try to change the setpoint quantity on the touchpanel.
2. In the project, in the Touchpanel device, open the “Conveyor” screen, highlight the input field
“Setpoint quantity” and display the Cross-references in the Inspector window.
Note: via the menu item “Cross-reference information” in the context menu of the input field,
you can open the Cross-references in the Inspector window.
3. Switch to the connected PLC tags by clicking the link in the “Address” column.
4. Find a “write” or “read + write” access in the “Access” column.
5. Now you jump to where the tag is used in the PLC by clicking the relevant link in the
“Reference location” column.
6. You will see that the tag “DB_OP”.SetpNo was assigned as actual parameter to the formal
parameter “Act” for the call of "FB_Count" and the tag “DB_OP”.ActNo to the formal
parameter “Setp”.
7. Correct the parameterization of "FB_Count".
8. Save your project, download the modified program and once again test the entry of the
setpoint quantity.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-43
SIMATIC TIA Portal Programming 1

15.18. Exercise 6: Testing the Evaluation of Fault 3

Task
In the search for the last logical error, you are to use the test function ‘Monitor block with trigger’
on a certain block call.
Check whether the occurrence of Faults 2 and 3 (switches I 0.5 and I 0.6 on the simulator) is
displayed on the simulator LEDs "P_Fault2"(Q0.3) and "P_Fault3" (Q0.4) with a flashing light, and
whether, after acknowledging with the simulator pushbutton "S_Acknowledge" (I 0.7), the flashing
light of the individual faults switches to a constant light.

What to Do
1. To troubleshoot why no flashing light is displayed after Fault 3 occurs, first of all monitor
"FB_FaultEvaluation" with the test function "Monitor block".
You will see that the static variable #StoredFault is controlled when Fault 2 exists, however,
not for Fault 3. The cause of this lies in the fact that you are monitoring the execution of
"FB_FaultEvaluation" for the evaluation of Fault 2 or the first FB call in "FC_Fault".
2. Change the call environment as shown in the picture in such a way that you specifically
monitor the execution of "FB_FaultEvaluation" for the evaluation of Fault 3.
3. In monitoring the second block call you will see that the status of the input parameter
#FlashFreq does not change to 2Hz flashing frequency as expected.
4. Since the parameter in the block is not overwritten, the input parameter must be assigned
incorrectly or not assigned at all for the call of the function block.
5. Correct the error and once again monitor the evaluation of Fault 3.
6. Download all modified blocks into the CPU and check the function.
7. Save your project.

TIA-PRO1 - Troubleshooting
15-44 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.19. TRACE Analyzer Function

internal Flash

separate CPU memory

"Trace" Analyzer Function


The value-over-time of one or several CPU tags (max. 16) can be stored in a TRACE. In STEP7,
a TRACE recording can be presented graphically.
The number of Traces depends on the CPU.
Depending on the CPU, internal TRACE memories with 512 Kbyte each are available.
• S7-1200 2x TRACE (FW ≥ V4.0)
• Up to S7-1517 4x TRACE, S7-1518 8x TRACE
• A maximum of 16 Trace signals or CPU tags (variables) can be recorded per Trace.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-45
SIMATIC TIA Portal Programming 1

15.19.1. Configuring a TRACE - Signals and Sampling

Trace – Signals
All global PLC tags (variables) of an elementary data type can be recorded.

Trace – Sampling and – Recording Duration


Here, you define how often or in which intervals the Trace signals are to be recorded. From these
sampling intervals and the data type or the dimension of the Trace signals you get the maximum
duration of a Trace recording since the memory space available for the recording is limited.
• Maximum memory space per Trace: 512 Kbytes – 30 bytes (for internal management) =
524,258 bytes
Each sample is saved with a time stamp (8 bytes). This results in a…
• number of bytes per sample = 8 bytes + number of bytes of a sample
(for Boolean Trace signals, the number of bytes of a measured value is 1 byte)
• Example: Trace with 1x INT variable and a sampling interval of 100ms
− Trace signal of the data type INT -> 8+2 bytes/sample -> 52,425 possible samples
− Sampling interval = 100ms -> 10 samples per second
− -> maximum recording duration: 52425 samples / 10 samples per second = 5242 seconds

TIA-PRO1 - Troubleshooting
15-46 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.19.2. Configuring a TRACE – Trigger and Saving Measurement on Device

Triggering the Trace Recording


Activating the Trace recording starts the measurement and recording of the Trace signals,
however, not the permanent saving of values since these are merely only temporarily saved in a
ring buffer which is continuously overwritten with new values. Only when the configured trigger
event is fulfilled, are the temporarily saved values permanently saved and no longer overwritten
with new values, whereby the trigger event is dependent on the data type of the trigger variable
The Trace recording ends as soon as the maximum recording duration configured in Trace
Sampling is reached.
By defining a pre-trigger, you determine how many of the samples recorded before the trigger
event occurs are to remain stored.

Measurement on Device (Memory Card)


Completed measurements can be stored on the memory card in order to start a new
measurement. In the item "Measurements on device", you can define if several and, if yes, how
many measurements are to be made. In addition, you define whether the oldest measurement is
to be deleted when the set number of measurements is reached or whether no more
measurements are to be made.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-47
SIMATIC TIA Portal Programming 1

15.19.3. Downloading a TRACE into the CPU and Activating It

Down/Up load Trace Observe Activate / Stop Delete Trace Automatically


in CPU / in Project Trace recording from the device repeat recording

Transfer Trace Configuration to Device / Add Trace Configuration from the Device to Trace
Configurations

After the Trace has been configured offline, that is, in the project, the configuration must be
downloaded into the CPU, since it is not the engineering tool that executed the Trace but the
CPU.
Only Trace configurations that exist online in the CPU can be uploaded from the CPU into the
project.

Observe Trace
Observe Trace displays the status of a Trace on the CPU:
• inactive (Trace already loaded in the CPU, but not yet activated)
• wait for trigger (Trace activated in the CPU, but trigger event not yet fulfilled)
• recording running (Trace activated in the CPU and recording running)
• recording completed (Trace activated in the CPU and recording already completed)

Activate Recording / Deactivate Recording


The Trace is activated with "Activate recording", that means that the measuring and recording of
the Trace signals is started immediately, even if the possibly configured trigger event is not yet
fulfilled. The recorded values are continuously displayed and stored in a ring buffer which is
continuously overwritten with new values. Only when the trigger event is fulfilled, are the recorded
values no longer overwritten and remain saved. As of this time, the recording is still continued
until the maximum recording duration is reached.
Through "Deactivate recording", a Trace with the status "Wait for trigger" is deactivated (stopped)
or an already running recording is aborted.

TIA-PRO1 - Troubleshooting
15-48 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.19.4. Evaluating, Saving, Exporting a TRACE in STEP7

Export Trace configuration and Measurement


with the settings of the current view

Add to measurements
(offline)

Measurements on device
(memory card)

Combine measurements

View and Evaluate Trace


When an online connection exists, the Trace recording currently saved in the CPU is displayed in
the Diagram view of the Trace editor.
You will find the measurements stored on the memory card in the "Measurements on device"
folder.
Trace recordings saved offline in the project can be looked at by double-clicking on the Trace
recordings saved in the Project tree in the "Measurements" folder.
Furthermore, in the "Combined measurements" folder, measurements can be simultaneously
evaluated and compared.

Save Trace in Project


With this function, Traces saved online in the CPU can be uploaded into the offline project (Add to
measurements). A Trace can only be saved in the project when it is full or the recording has been
stopped.

Trace Configuration
This function exports the configuration of a Trace which can then be imported into other projects.
(TTCRX-file)

Trace Measurement:
This function exports a Trace recording in CSV-format which can then be further processed with
MS Excel, for example, or, in TTRCRX-format which can be imported into a TIA project.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-49
SIMATIC TIA Portal Programming 1

15.19.5. Trace Task Card

Measuring cursor

Snapshots

"Measuring Cursor" Pane


The "Measuring cursor" pane shows the position of the measuring cursor in the graph and the
values at the intersections.

"Snapshots" Pane
The "Snapshots" pane enables the saving and restoring of different views of a measurement.
A snapshot is created from the current view in the "Diagram" tab. The snapshots are saved in the
measurement with the project.

TIA-PRO1 - Troubleshooting
15-50 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.20. Task Description: Creating, Looking at and Saving a TRACE

TRACE

Task Description
The values of Slider 1 and 2 are to be recorded for 10 seconds. The recordings each begin when
"P_Operation" (Q0.1) is switched on and are automatically repeated three times. Then, the
measurements are to be saved in the project.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-51
SIMATIC TIA Portal Programming 1

15.20.1. Exercise 7: Creating a Cyclic Interrupt OB for the Recording Level

Task
You are to add a cyclic interrupt OB to the program for a regular sampling.

What to Do
1. Start the function “Add new block” in the Program blocks folder.
2. Select the block type “OB” and the start event “Cycle interrupt”.
3. Change the Cycle time to 1000µs.
4. Confirm the selection and save your project.

TIA-PRO1 - Troubleshooting
15-52 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.20.2. Exercise 8: Creating, Looking at and Saving a TRACE

Task
You are to create a Trace configuration with the following properties:
• The Trace signals are to be the variables "S_Slider1" (IW10) and "S_Slider2" (IW30).
• The variables are to be sampled every 0.5 seconds.
• The Trace is to have a recording duration of 10 seconds.
• The trigger condition is a rising edge at the operand "P_Operation".
• The recordings are to begin 1 second before the trigger event.
• After the recording is activated, three measurements are to be recorded and then the
recordings are to be stopped.

Continued on the next page

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-53
SIMATIC TIA Portal Programming 1

What to Do
1. Create the new trace "Slider" and configure it as shown below.

2. Download the trace into the CPU.


3. Activate the recording of the trace and monitor it.
4. Save the measurements in the "Measurements" folder.
5. Save your project.

TIA-PRO1 - Troubleshooting
15-54 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.21. Additional Information

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-55
SIMATIC TIA Portal Programming 1

15.21.1. Diagnostic Information about the SIMATIC Memory Card

Checking the “Aging” (service life) of the SIMATIC Memory Card

CPU Properties

max. delete and write cycles, see Entry ID: 109482591

Diagnostics Setting CPU


Generation of a diagnostic entry when a service life ‘aging’ defined by you is exceeded (in
percent of the guaranteed write/read cycles)
Optic display on the CPU via the Maintenance-LED

Note:
See FAQ: 109482591 – “How long is the service life of a 32 GB memory card with the S7-1500
when the minimum number of delete/write procedures is 50,000?”

TIA-PRO1 - Troubleshooting
15-56 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1

15.21.2. Reading-out the Checksum

Standard blocks, safety


blocks or text lists

The checksum is generated with every compilation when a


change was detected.

Generating the Checksum


During compilation, PLC programs automatically receive a unique checksum. If, during the next
compilation, it is determined that the PLC program was changed, the program receives a new
checksum. If the PLC program has not changed and is nevertheless recompiled, the checksum
remains the same.
Even when changes are carried out and then are undone, the checksum remains unchanged.

Downloading the Checksum


The checksum is downloaded into the CPU along with the PLC program and is available in the
online program. Blocks which are generated or modified during runtime (for example,
"WRIT_DBL", "CREAT_DB" and "DELETE_DB") do not change the checksum. When it is
uploaded from the CPU, the checksum is not adopted in the offline project since it is automatically
regenerated with the next compilation.

Evaluating the Checksum


The checksum is displayed in the CPU Properties (Properties > General > Checksums). From
there, you can manually adopt them in your documents. In order to read out the checksum in the
program at runtime, the extended instruction "GetChecksum" is available.

TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-57

You might also like