Tia Portal Basic
Tia Portal Basic
S7 – 1500
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
2. System Overview
... be familiar with the SIMATIC Memory Card as well as the S7-1500
Display
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.
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.
Advanced Controller
Software
SIMATIC S7-1500
Controller
SIMATIC
S7-1500
Distributed
Controller
Application complexity
Depending on the complexity, different controllers from S7-1200 to S7-1500 can be used.
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.
Standard
Fail-safe
Compact
High
availability
Different functions
Different
Technology functions T-CPU
T-CPU
DI/DQ
AI/AQ
F-DI/F-DQ
F-AI
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
...
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)
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.
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.
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.
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.
...
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
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.
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.
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
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).
Release latch
Entriegelungslasche
4 jumper links
can be inserted
Wiring position
Wiring position
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!
The available Display languages are the available user-interface languages of STEP7.
Operation
Current main
menu item
After choosing the menu item
Edit setting
Selected
submenu item Accept change
Discard change
Editable
submenu item
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
…)
An Alarm exists
SIMATIC Memory Card in the S7-1200: SIMATIC Memory Card in the S7-1500:
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).
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.
5. Change the time (of day) of the CPU, the IP address of the Interface X1, and format the
memory card.
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.
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”.
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.
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).
PS CPU SM SM SM SM CP SM FM IM
DI DO AI AO
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
… be able to use online functions to start and stop the CPU and
to reset it to factory settings
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.
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
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.
2 3
1. Online access or
Accessible devices 1
(Project or Portal view)
2. Select interface for the
search
Cycle Time:
"Shortest", "Current" and "Longest" are the cycle times since the last CPU restart
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).
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.
Caution: If the CPU and Display have to be updated, first the Display and then
the CPU.
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
System memory
Force 1
jobs 2 Code working memory
internal Flash
4.5.2. SIMATIC S7-1200/1500: Memory Concept for CPU Reset to Factory Settings
Force 1
jobs 2 Code working memory
internal Flash
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).
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
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.
Connection configuration
Device configuration
and
module parameter
assignment
Topology configuration
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
Graphic area
Tabular area
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.
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
Project view
Portal view
Manual: “SIMATIC S7-1500 / ET 200MP Software: “TIA Selection Tool” (online or offline)
Automation system In a nutshell”
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.
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.
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.
PLC tags
A PLC tag is automatically created for each available system or clock memory bit.
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.
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.
• 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.
1xR
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.
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.
4.8.5. Compiling the Hardware / Software and Downloading it into the CPU
1xR 1xR
Status / Error
information
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".
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.
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.
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.
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.)
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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:
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.
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.
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.
Change pane
mode
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
5. PLC Tags
A tag...
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)
Data Types
The data type determines which values are accepted by data and which instructions can be
carried out with these values.
…
e.g. %M1.7 Value range only 0..999
Max. accuracy >=10ms
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.
LWORD 64 LW#16#5F52DE8B
Numeric SINT 50
8
Data Types USINT 20
INT -23
16
UINT 64530
LREAL 64 LREAL#-1.0e-5
LINT LINT#1543258759
64
ULINT ULINT#154316159
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)
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
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).
CHAR, WCHAR
The data type CHAR (8 bits) represents a character in ASCII representation and WCHAR (16
bits) a character in Unicode format.
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)
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.
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.
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.
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.
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).
!!!
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.
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
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.
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.
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.
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".
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.
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.
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
Operation ON Operation
I 0.1
″S_OperationON″ ″P_Operation″ Q 0.1
"FC_Conveyor"
Blocks/Instructions Properties
- User interface
Organization block (OB) - Graduated priorities (0 to 27)
- Specific start information in temporary variables
System instruction without - Instruction without memory stored in the CPU’s operating system and
instance callable by the user
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).
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.
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.
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”
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.
Operating system
DB DB
Cycle
Time OB_Cycle FC FB
Process Organization
blocks
FB FC
Error(s)
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")
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.
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
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.
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.
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.
DI DO
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!).
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.
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.
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.
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.
1xR
Task
You are to check the Properties of the OB1 block as shown in the picture, and, if necessary,
correct them.
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.
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.
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.
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.
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
6. Binary Operations 1
... be able to carry out a program test with the “Monitor (block)” function
"OB_Cycle"
6.2. Assignment
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.
NO activated
contact yes 1 “Yes” “No”
LAD: 1 LAD: 0
NC activated no
contact 0 FBD: “No” FBD: “Yes”
0 1
not
activated yes 1 “Yes” “No”
1 0
FBD LAD
AND
Change the
Scan
Change the
Operation
FBD
OR
Negation
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”.
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
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
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.
FBD
LAD
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'.
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.
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")
OB_
Cycle
Dealt with in the chapter
Dealt with in the chapter
“Functions and
“Program Bocks”
Function Blocks”
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.
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.
6.6.1. Networks
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.
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.
Automatic
symbol selection
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,
• Rename:
Change the tag name, while the absolute address remains unchanged.
• Rewire:
Change the associated absolute address, while the name remains unchanged.
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).
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.
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.
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.
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"
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.
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.
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.
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.
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
8. Binary Operations
DI DO
Operation OFF
I 0.0
"S_OperationOFF" (NC)
"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.
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.
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'.
DI DO
I 0.0 Operation OFF
"S_OperationOFF" (NC)
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".
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.
"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.
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.
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)
"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.
Part within
light barrier
Start condition
for transports
"B_LB"
(I 3.0)
"K_Right"
(Q3.5)
Up to now NEW
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.
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.
FBD LAD
"B_LB"
"K_Right"
& -RLO
"M_ImpPos"
OB1
OB1
Cycle
Cycle
"M_ImpNeg" OB1
OB1 Cycle
Cycle
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.
"B_Bay1" "B_Bay2"
(I 3.5) (I 3.6)
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.
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".
"S_OperationOFF"
(I 0.0, NC)
"P_Operation"
(Q0.1)
"S_OperationOFF"
(I 0.0, NC)
"P_Operation"
(Q0.1)
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!
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.
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
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"
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.
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.
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.
Display Formats:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
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
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).
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
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
Sign
negative
numbers
Representation as Octal: 8# 3 7 7 7 5 7 3 7 5 6 7
twos complement
(without sign)
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.
Example: 0.75
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
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.
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.
"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.
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).
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.
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.
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".
Select the
instruction
Select the
data type
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:
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.
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.
DI DO
I 0.0 Operation OFF
"S_OperationOFF" (NC)
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.
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.
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.
10.3.3. Exercise 3:
Programming the Time Monitoring of the Transports in "FC_Fault"
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.
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.
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 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.
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 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.
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:
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.
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.
"M_ConvFault"
(M 17.0)
3
Fault 2
Counter
1
0
"P_Operation"
(Q0.1)
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.
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
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.
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.
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
10.6.3. SIMATIC-Timer
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.
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.
10.6.3.1. SIMATIC-Counter
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.
Note
If you use an SIMATIC-Counter, then only use it in one location in the program, in order to avoid
count errors.
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
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
... be able to create and edit global data blocks and use them in the program
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.
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.)
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
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.
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.
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.
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)
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.
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".
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"
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 (PowerOffOn or after every STOP
- RUN).
Initialization
of all tags
Restart
carried out
Initialization
of non-retentive
tags
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.
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).
Furthermore, the entire DB can be initialized with the button and all values selected in the
Setpoint column can be initialized with the button.
Initialize
3
Setpoints
Monitor
1
Block
Define
2
Setpoints
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".
11.3.4.2. Changing the Snapshot / Start Value of Several / All Data Blocks
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.
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".
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.
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.
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.
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.
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.
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
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
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.
14.2.1. ET 200SP
DI DO AI AO
Color coding of the module class
Measuring point
Bus termination
module (server
Load group 1
module)
14.2.2. ET 200 MP
The ET200MP enables the distributed connection of S7-1500 series central I/O modules.
Connection is made using an interface module.
● 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
(optional)
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.
PROFINET
... ...
PROFIBUS - Slave
PROFINET PROFIBUS
I/O Controller Master
PROFIBUS
PROFIBUS Address: e.g. 19
→ Setting using DIP switch on the slave
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".
PG
PROFINET IO-Devices
S7-300 ET 200eco PN
ET 200S
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).
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).
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
Real time
TCP/UDP
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.
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.
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,
offline
configured name
1xR
online
accessible device(s)
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.
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.
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.
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".
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!
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.
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.
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
"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.
Block-structured
Linear Program Structured Program
Program
Recipe A
Pump
Recipe B
OB_ OB_ OB_
Cycle Cycle Cycle
Mixer Outlet
Outlet
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.
"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
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.
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.
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.
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.
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:
OptionsSettingsPLC programmingLAD/FBDOperand fieldMaximum 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.
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.
Operating system
OB 1 2 FC 17 3 FC 20 Event 1 2 3 4 5 6 7
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.
"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.
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).
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.
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.
"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.
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.
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.
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.
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.
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.
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.
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
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
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.
OB1
FB1
FB2
FB2
OB1
FB1
FB2
Only FB2 compiled:
FB2
FB2 call in FB1
not yet updated In : Bool1
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.
• 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
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
FC
FB
Hardware OpSys FC
Instance
Cyclic Cyclic OBs
FC
Global
Interrupt processing Startup Startup OBs
Instance
Diagnostic Error OBs
FC
Startup
Startup
(OB100, >=123)
Cyclic Event-driven
Periodic
program program execution
execution program execution
Interrupt OBs Error OBs
Synchronous cycles
(OB61…64, >=123)
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.
Start
Enable outputs
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.
Write PIQ
Read PII
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
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.
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.
Cycle OB
Process image for inputs and outputs
Program execution
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.
RD_SINFO
Variables
An explanation of the meaning of the variables can be found in the online help.
Repetition interval
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
Number or constant
name of the time-delay
interrupt
(not the symbol name of
the OB)
Delay time
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
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
Cyclic interrupt
Phase offset
200µs
+27648
Upper limit value 2
Upper limit value 1
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.
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.
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.
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.
Initialization right
Q0.6
Initialization display with
"P_InitRight" 2Hz flashing light
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.
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.
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.
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.
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
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.
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
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.
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.
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
TIA-PRO1 - Troubleshooting
15-2 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1
15. Troubleshooting
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-3
SIMATIC TIA Portal Programming 1
Functional Errors
• Desired function is either not executed at all
or is not correctly executed
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
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
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
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 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
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
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
ERROR LED
MAINT LED
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
ERROR LED
Channel status
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-11
SIMATIC TIA Portal Programming 1
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
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-13
SIMATIC TIA Portal Programming 1
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).
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
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
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
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
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
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
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:
− Error ................………………………………………..................................................................
− ……….……………………………………………………......................…………….............…….
TIA-PRO1 - Troubleshooting
15-20 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1
Monitor block
On / Off
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
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
Monitor
Structures
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-23
SIMATIC TIA Portal Programming 1
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
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
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
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
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
Check overlapping
accesses
Show overlapping
access
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
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
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…
1xR
Syntax error
Declaration of
operand
TIA-PRO1 - Troubleshooting
15-32 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1
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
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
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
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
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
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.
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
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
Compare
Manual / Automatic
Device from
Reference project
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
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-41
SIMATIC TIA Portal Programming 1
!!!
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
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
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
internal Flash
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-45
SIMATIC TIA Portal Programming 1
Trace – Signals
All global PLC tags (variables) of an elementary data type can be recorded.
TIA-PRO1 - Troubleshooting
15-46 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-47
SIMATIC TIA Portal Programming 1
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)
TIA-PRO1 - Troubleshooting
15-48 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1
Add to measurements
(offline)
Measurements on device
(memory card)
Combine measurements
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
Measuring cursor
Snapshots
"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
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
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
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.
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.
TIA-PRO1 - Troubleshooting
15-54 Training Document, V14.01.01
SIMATIC TIA Portal Programming 1
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-55
SIMATIC TIA Portal Programming 1
CPU Properties
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
TIA-PRO1 - Troubleshooting
Training Document, V14.01.01 15-57