STEP 7 - Programming With STEP 7
STEP 7 - Programming With STEP 7
______________
______________
Introducing the Product and
1
Installing the Software
______________
2
SIMATIC Installation
______________
Working Out the Automation
3
Concept
Programming with STEP 7
______________
Basics of Designing a
4
Program Structure
______________
5
Startup and Operation
Function Manual
______________
Setting Up and Editing the
6
Project
______________
Editing Projects with
7
Different Versions of STEP 7
______________
8
Defining Symbols
______________
Creating Blocks and
9
Libraries
______________
Basics of Creating Logic
10
Blocks
Configuring Messages 16
Controlling and Monitoring
SIMATIC Variables 17
Establishing an Online
Programming with STEP 7 Connection and Making CPU 18
Settings
Diagnostics 23
Appendix 26
04/2017
A5E41552389-AA
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
indicates that minor personal injury can result if proper precautions are not taken.
NOTICE
indicates that property damage can result if proper precautions are not taken.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will
be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to
property damage.
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation, in particular its warning notices and safety instructions.
Qualified personnel are those who, based on their training and experience, are capable of identifying risks and
avoiding potential hazards when working with these products/systems.
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended
or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of Siemens AG. The remaining trademarks in this publication
may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software
described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the
information in this publication is reviewed regularly and any necessary corrections are included in subsequent
editions.
Purpose
This manual provides a complete overview of programming with STEP 7. It is designed to support
you when installing and commissioning the software. It explains how to proceed when creating
programs and describes the components of user programs.
The manual is intended for people who are involved in carrying out control tasks using STEP 7 and
SIMATIC S7 automation systems.
We recommend that you familiarize yourself with the examples in the manual "Working with
STEP 7 V5.5, Getting Started." These examples provide an easy introduction to the topic
"Programming with STEP 7".
Online Help
The manual is complemented by an online help which is integrated in the software.
This online help is intended to provide you with detailed support when using the software.
The help system is integrated in the software via a number of interfaces:
• There are several menu commands which you can select in the Help menu:
The Contents command opens the index for the Help on STEP 7.
• Using Help provides detailed instructions on using the online help.
The context-sensitive help offers information on the current context, for example, an open dialog
box or an active window. You can open the contextsensitive help by clicking the "Help" button or by
pressing F1.
• The status bar offers another form of context-sensitive help. It displays a short explanation for
each menu command when the mouse pointer is positioned on the menu command.
• A brief explanation is also displayed for each icon in the toolbar when the mouse pointer is
positioned on the icon for a short time.
If you prefer to read the information from the online help in printed format, you can print out
individual help topics, books, or the entire online help.
This manual, as well as the manuals "Configuring Hardware and Communication Connections
STEP 7", "Modifiying the System During Operation via CiR" and "Automation System S7-400H -
Fault-Tolerant Systems" is an extract from the HTML-based Help on STEP 7. For detailed
procedures please refer to the STEP 7 help. As the manuals and the online help share an almost
identical structure, it is easy to switch between the manuals and the online help.
You can find the electronic manuals after installing STEP 7 via the Windows Start menu: Start >
SIMATIC > Documentation.
Further Support
If you have any technical questions, please get in touch with your Siemens representative or
responsible agent.
You will find your contact person at:
http://www.siemens.com/automation/partner
You will find a guide to the technical documentation offered for the individual SIMATIC Products
and Systems at:
http://www.siemens.com/simatic-tech-doku-portal
The online catalog and order system is found under:
http://mall.automation.siemens.com/
Training Centers
Siemens offers a number of training courses to familiarize you with the SIMATIC S7 automation
system. Please contact your regional training center or our central training center in
D 90026 Nuremberg, Germany for details:
Internet: http://www.sitrain.com
Technical Support
You can reach the Technical Support for all Industry Automation and Drive Technology products
• Via the Web formula for the Support Request
http://www.siemens.com/automation/support-request Additional information about our Technical
Support can be found on the Internet pages http://www.siemens.com/automation/service
Security Information:
Siemens provides products and solutions with industrial security functions that support the secure
operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is necessary to
implement - and continuously maintain - a holistic, state-of-the-art industrial security concept.
Siemens' products and solutions only form one element of such a concept.
Customer is responsible to prevent unauthorized access to its plants, systems, machines and
networks. Systems, machines and components should only be connected to the enterprise network
or the internet if and to the extent necessary and with appropriate security measures (e.g. use of
firewalls and network segmentation) in place.
Additionally, Siemens' guidance on appropriate security measures should be taken into account.
For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.
Siemens' products and solutions undergo continuous development to make them more secure.
Siemens strongly recommends to apply product updates as soon as available and to always use
the latest product versions. Use of product versions that are no longer supported, and failure to
apply latest updates may increase customer's exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed
under
http://www.siemens.com/industrialsecurity.
What is STEP 7?
STEP 7 is the standard software package used for configuring and programming SIMATIC
programmable logic controllers. It is part of the SIMATIC industry software. There are the following
versions of the STEP 7 Standard package:
• STEP 7 Micro/DOS and STEP 7 Micro/Win for simpler stand-alone applications on the
SIMATIC S7-200.
• STEP 7 for applications on SIMATIC S7-300/S7-400 with a wider range of functions:
- Can be extended as an option by the software products in the SIMATIC Industry Software
(see also Extended Uses of the STEP 7 Standard Package)
- Opportunity of assigning parameters to function modules and communications processors
- Forcing and multicomputing mode
- Global data communication
- Event-driven data transfer using communication function blocks
- Configuring connections
STEP 7 is the subject of this documentation, STEP 7 Micro is described in the "STEP 7
Micro/DOS" documentation.
Basic Tasks
When you create an automation solution with STEP 7, there are a series of basic tasks. The
following figure shows the tasks that need to be performed for most projects and assigns them to a
basic procedure. It refers you to the relevant chapter thus giving you the opportunity of moving
through the manual to find task-related information.
Alternative Procedures
As shown in the figure above, you have two alternative procedures:
• You can configure the hardware first and then program the blocks.
• You can, however, program the blocks first without configuring the hardware. This is
recommended for service and maintenance work, for example, to integrate programmed blocks
into in an existing project.
• Configure messages
You create block-related messages, for example, with their texts and attributes. Using the
transfer program you transfer the message configuration data created to the operator interface
system database (for example, SIMATIC WinCC, SIMATIC ProTool), see also Configuring
Messages.
• Configure operator control and monitoring variables
You create operator control and monitoring variables once in STEP 7 and assign them the
required attributes. Using the transfer program you transfer the operator control and monitoring
variables created to the database of the operator interface system WinCC (see also
Configuring Variables for Operator Control and Monitoring).
• Download programs to the programmable controller
After all configuration, parameter assignment, and programming tasks are completed, you can
download your entire user program or individual blocks from it to the programmable controller
(programmable module for your hardware solution). (See also Requirements for Downloading.)
The CPU already contains the operating system.
• Test programs
For testing you can either display the values of variables from your user program or a CPU,
assign values to the variables, or create a variable table for the variables that you want to
display or modify (see also Introduction to Testing with the Variable Table).
• Monitor operation, diagnose hardware
You determine the cause of a module fault by displaying online information about a module.
You determine the causes for errors in user program processing with the help of the diagnostic
buffer and the stack contents. You can also check whether a user program can run on a
particular CPU (see also Hardware Diagnostics and Displaying Module Information).
• Document the plant
After you have created a project/plant, it makes sense to produce clear documentation of the
project data to make further editing of the project and any service activities easier (see also
Printing Project Documentation). DOCPRO, the optional tool for creating and managing plant
documentation, allows you to structure the project data, put it into wiring manual form, and print
it out in a common format.
Specialized Topics
When you create an automation solution there are a number of special topics that may be of
interest to you:
• Multicomputing - Synchronous Operation of Several CPUs (see also Multicomputing -
Synchronous Operation of Several CPUs)
• More than One User Working in a Project (see also More than One User Editing Projects)
Standards Used
The SIMATIC programming languages integrated in STEP 7 are compliant with EN 61131-3. The
standard package matches the graphic and object oriented operating philosophy of Windows and
runs under the operating systems MS Windows 7 Ultimate, Professional und Enterprise (64-bit),
MS Windows 10 Pro and Enterprise (64-bit) as well as MS Windows Server 2008 R2 SP1, 2012 R2
und 2016 (each 64-bit).
Applications in STEP 7
The STEP 7 Standard package provides a series of applications (tools) within the software:
You do not need to open the tools separately; they are started automatically when you select the
corresponding function or open an object.
SIMATIC Manager
The SIMATIC Manager manages all the data that belong to an automation project. The tools
needed to edit the selected data are started automatically by the SIMATIC Manager.
Symbol Editor
With the Symbol Editor you manage all the shared symbols. The following functions are available:
• Setting symbolic names and comments for the process signals (inputs/outputs), bit memory,
and blocks
• Sort functions
• Import/export to/from other Windows programs
The symbol table created with this tool is available to all the other tools. Any changes to the
properties of a symbol are therefore recognized automatically by all tools.
Diagnosing Hardware
These functions provide you with an overview of the status of the programmable controller. An
overview can display symbols to show whether every module has a fault or not. A double-click on
the faulty module displays detailed information about the fault. The scope of this information
depends on the individual module:
• Display general information about the module (for example, order number, version, name) and
the status of the module (for example, faulty)
• Display the module faults (for example, channel fault) for the central I/O and DP slaves
• Display messages from the diagnostic buffer
Programming Languages
The programming languages Ladder Logic, Statement List, and Function Block Diagram for S7-300
and S7-400 are an integral part of the standard package.
• Ladder Logic (or LAD) is a graphic representation of the STEP 7 programming language. Its
syntax for the instructions is similar to a relay ladder logic diagram: Ladder allows you to track
the power flow between power rails as it passes through various contacts, complex elements,
and output coils.
• Statement List (or STL) is a textual representation of the STEP 7 programming language,
similar to machine code. If a program is written in Statement List, the individual instructions
correspond to the steps with which the CPU executes the program. To make programming
easier, Statement List has been extended to include some highlevel language constructions
(such as structured data access and block parameters).
• Function Block Diagram (FBD) is a graphic representation of the STEP 7 programming
language and uses the logic boxes familiar from Boolean algebra to represent the logic.
Complex functions (for example, math functions) can be represented directly in conjunction
with the logic boxes.
Other programming languages are available as optional packages.
Hardware Configuration
You use this tool to configure and assign parameters to the hardware of an automation project. The
following functions are available:
• To configure the programmable controller you select racks from an electronic catalog and
arrange the selected modules in the required slots in the racks.
• Configuring the distributed I/O is identical to the configuration of the central I/O.
• In the course of assigning parameters to the CPU you can set properties such as startup
behavior and scan cycle time monitoring guided by menus. Multicomputing is supported. The
data entered are stored in system data blocks.
• In the course of assigning parameters to the modules, all the parameters you can set are set
using dialog boxes. There are no settings to be made using DIP switches. The assignment of
parameters to the modules is done automatically during startup of the CPU. This means, for
example, that a module can be exchanged without assigning new parameters.
• Assigning parameters to function modules (FMs) and communications processors (CPs) is also
done within the Hardware Configuration tool in exactly the same way as for the other modules.
Module-specific dialog boxes and rules exist for every FM and CP (included in the scope of the
FM/CP function package). The system prevents incorrect entries by only offering valid options
in the dialog boxes.
Operating systems
• The operating systems MS Windows 10 Pro and Enterprise MS Windows Server 2012 and MS
Windows Server 2016 are supported as of STEP 7 V5.6. You can find more detailed
information on this in the accompanying file "Readme.rtf".
System Diagnostics
• As of STEP 7 V5.6, you can read out security events for CPU 410-5H as of firmware version
V8.2 and save them on your PG/PC via the "Save Security Events" dialog box.
• In STEP 7 V5.6, the "Process Objects" tab of the module status is renamed to "SEC" (SEC
means System Expansion Card.), and further properties are dsplayed for the license status.
SIMATIC Manager
• As of STEP 7 V5.6, the number of selected objects is shown in the status bar.
S7-300
S7-400
Engineering Tools
• Borland C/C++
1)
• CFC +
• DOCPRO +
• HARDPRO +
1)
• S7-GRAPH +
• S7-HiGraph +
• S7-PDIAG +
• S7-PLCSIM +
• S7-SCL +
• TeleService +
Runtime Software
• Fuzzy Control +
• Modular PID Control +
• • PRODAVE MPI +
• PC-DDE-Server +
• Standard PID Control +
Human Machine Interface
• ProAgent
• SIMATIC ProTool
• SIMATIC ProTool/Lite
• SIMATIC WinCC
o = absolutely required
+ = optional
1)
= recommended as of S7-400
Engineering Tools are task-oriented tools that can be used to extend the standard package.
Engineering Tools include:
• High-level languages for programmers
• Graphic languages for technical staff
• Supplementary software for diagnostics, simulation, remote maintenance, plant documentation
etc.
High-Level Languages
The following languages are available as optional packages for use in programming the SIMATIC
S7-300/S7400 programmable logic controllers:
• S7 GRAPH is a programming language used to program sequential controls (steps and
transitions). In this language, the process sequence is divided into steps. The steps contain
actions to control the outputs. The transition from one step to another is controlled by switching
conditions.
• S7 HiGraph is a programming language used to describe asynchronous, nonsequential
processes in the form of state graphs. To do this, the plant is broken down into individual
functional units which can each take on different states. The functional units can be
synchronized by exchanging messages between the graphs.
• S7 SCL is a high-level text-based language to EN 61131-3 (IEC 1131-3). It contains language
constructs similar to those found in the programming languages C and Pascal. S7 SCL is
therefore particularly suitable for users familiar with highlevel language programming. S7 SCL
can be used, for example, to program complex or frequently recurring functions.
Graphic Language
CFC for S7 is a programming language for interconnecting functions graphically. These functions
cover a wide range of simple logic operations through to complex controls and control circuits. A
large number of such function blocks are available in the form of blocks in a library. You program
by copying the blocks into a chart and interconnecting the blocks with connecting lines.
Supplementary Software
• With DOCPRO you can organize all configuration data created under STEP 7 into wiring
manuals. These wiring manuals make it easy to manage the configuration data and allow the
information to be prepared for printing according to specific standards.
• HARDPRO is the hardware configuration system for S7-300 with user support for large-scale
configuration of complex automation tasks.
• You can use S7 PLCSIM (S7 only) to simulate S7 programmable controllers connected to the
programming device or PC for purposes of testing.
• S7 PDIAG (S7 only) allows standardized configuration of process diagnostics for SIMATIC S7-
300/S7-400. Process diagnostics let you detect faults and faulty states of PLC I/O (for example,
limit switch not reached).
• TeleService is a solution providing functions for online programming and servicing of remote
S7 PLCs via the telecommunications network with your PG/PC.
Runtime software provides ready-to-use solutions you can call in user program and is directly
implemented in the automation solution. It includes:
• Controllers for SIMATIC S7, for example, standard, modular and fuzzy logic control
• Tools for linking the programmable controllers with Windows applications
Human Machine Interface (HMI) is a software especially designed for operator control and
monitoring in SIMATIC.
• The open process visualization systems SIMATIC WinCC and SIMATIC WinCC flexible are
basic systems that are not restricted to specific industrial sectors or technology and provide all
the important operator control and monitoring functions.
• SIMATIC ProTool and SIMATIC ProTool/Lite are modern tools for configuring SIMATIC
operator panels (OPs).
• ProAgent is a diagnostics software that acquires information on the location and cause of
errors in plants and machinery and thus offers fast and aimed process diagnostics.
Licenses
Licenses are required to use STEP 7 program packages whose legal use is protected by licenses.
A license gives the user a legal right to use the product. Evidence of this right is provided by the
following:
• The CoL (Certificate of License), and
• The license key
License Keys
The license key is the technical representation (an electronic "license stamp") of a license to use
software.
SIEMENS AG issues a license key for all of its software that is protected by a license. When the
computer has been started, such software can only be used in accordance with the applicable
license and terms of use after the presence of a valid license key has been verified.
Notes
• You can use the standard software without a license key to familiarize yourself with the user
interface and functions.
• However, a license is required and necessary for full, unrestricted use of the STEP 7 software
in accordance with the license agreement
• If you have not installed the license key, you will be prompted to do so at regular intervals.
License Keys can be stored and transferred among various types of storage devices as follows:
• On license key diskettes or USB memory stick
• On the local hard disk
• On network hard disk
If software products for which no license is available are installed, you can then determine which
license key is needed and order it as required.
For further information on obtaining and using license keys, please refer to the online help for the
Automation License Manager.
Types of Licenses
The following different types of application-oriented user licenses are available for software
products from Siemens AG. The actual behavior of the software is determined by which type
license key is installed for it. The type of use can be found on the accompanying Certificate of
License.
The Automation License Manager is installed by means of an MSI setup process. The installation
software for the Automation License Manager is included on the STEP 7 product DVD.
You can install the Automation License Manager at the same time you install STEP 7 or at a later
time.
.
Notes
For detailed information on how to install the Automation License Manager, please refer to the current
Readme file
The online help for the Automation License Manager contains all the information you need on the function and
handling of License Keys.
Notes
• You can use the standard software without a license key to familiarize yourself with the user
interface and functions.
• However, a license is required and necessary for full, unrestricted use of the STEP 7 software
in accordance with the license agreement
If you have not installed the license key, you will be prompted to do so at regular intervals.
Notes
In Windows XP/Server 2003, license keys will only be operational if they are installed on a local hard disk and
have write-access status.
Floating licenses can also be used within a network ("remote" use).
! Caution
Please note the information on handling license keys that is available in the online help on the
Automation License Manager and also in the STEP 7 Readme file on the installation DVD. If you
do not follow these guidelines, the license keys may be irretrievably lost.
To access online help for the Automation License Manager, press F1 for context-sensitive help or
select the Help > Help on License Manager menu command.
This help section contains all the information you need on the function and handling of license
keys.
Note
Siemens programming devices are shipped with the STEP 7 software on the hard disk ready for
installation.
Installation requirements
• Operating system:
MS Windows 7 Professional and Enterprise (standard installation).
• Basic hardware:
Programming device or PC with:
• Pentium processor (600 MHz)
• At least 512 MB RAM.
• Color monitor, keyboard and mouse, all of which are supported by Microsoft Windows
A programming device (PG) is a PC with a special compact design for industrial use. It is fully
equipped for programming SIMATIC PLCs.
• Hard disk space:
Refer to the Readme file for information on required hard disk space.
• MPI interface (optional):
An MPI interface is only required to interconnect the PG/PC and the PLC if you want to use it
for communication with the PLC under STEP 7.
In this case you require:
• A PC USB adapter that is connected to the communications port of your device, or
• An MPI module (for example, CP 5611) that is installed in your device.
Note
Refer to the information on STEP 7 installation in the Readme file and the "List of SIMATIC
Software Packages compatible to the versions of the standard STEP 7 software package."
The readme file and the compatibility list is found, for example under MS Windows 7 via the Start
menu, under Start > All Programs > Siemens Automation > Documentation.
ID Number
You will be prompted during setup to enter an ID number (found on the Software Product
Certificate or on your license key storage medium).
Flash-File Systems
In the dialog box for assigning memory card parameters, you can select to install a flashfile
system.
The flashfile system is required, for example under SIMATIC M7 when you write individual files to
an EPROM memory card without changing other contents of the Memory Card.
If you are using a suitable programming device (PG 720/PG 740/PG 760, Field PG and Power PG)
or external prommer and you want to use this function, install the flashfile system.
Here you configure the communication between the PG/PC and the PLC. During installation, you
are displayed a dialog for assigning parameters to the PG/PC interface. You can also open this
dialog box after installation, by calling the program "Setting PG/PC Interface" in the STEP 7
program group. This enables you to modify the interface parameters at a later time, independently
of the installation.
Basic Procedure
To operate an interface, you will require the following:
• Configurations in the operating system
• A suitable interface configuration
If you are using a PC with an MPI card or communications processors (CP), you should check the
interrupt and address assignments in the Windows "Control Panel" to ensure that there are no
interrupt conflicts and no address areas overlap.
In Windows 2000, Windows XP and Server 2003, the ISA component MPI-ISA card is no longer
supported and therefore no longer offered for installation.
In order to make it easier to assign parameters to the programming device/PC interface, a dialog
box will display a selection list of default basic parameter sets (interface configurations).
Changes will also be necessary if conflicts with other settings arise (for example, interrupt or
address assignments). In this case, make the appropriate changes with the hardware recognition
and Control Panel in Windows (see below).
! Caution
Do not remove any "TCP/IP" parameters from your interface configuration.
This could cause malfunctioning of other applications.
Including users in the user groups "Siemens TIA Engineer" and "Network Configuration
Operators"
Enter the local users who can access STEP 7 with their login in the "Siemens TIA Engineer" group.
Follow the steps below:
1. Open the Control Panel in Windows and select "User Accounts".
2. In the navigation window, select the entry "Manage User Accounts."
3. In the "Advanced" tab, select the "Advanced" entry in the "Advanced User Management"
section.
4. In the navigation window, select the entry "Local Users and Groups > Users". All users are
displayed in the data window.
5. Using the context menu, open the "New User" and create an account with the same login for
every user that needs to access STEP 7.
6. Select the "Properties" context menu command for each user you create.
7. In the dialog box that opens, select the "Member of" and the click the "Add..." button.
8. In the "Select Groups" dialog, enter the user group "Siemens TIA Engineer" in the "Enter the
object names to select" box and confirm with "OK".
9. Follow the same procedure for the users to be included in the "Network Configuration
Operators" user group.
As each group is divided into smaller tasks, the tasks required for controlling that part of the
process become less complicated.
In our example of an industrial blending process you can identify four distinct areas (see table
below). In this example, the area for ingredient A contains the same equipment as the area for
ingredient B.
Agitator Motor
The agitator motor mixes ingredient A with ingredient B in the mixing tank.
• Rating: 100 kW (134 hp) at 1200 rpm
The agitator motor is controlled (start/stop) from an operator station located near the mixing tank. The
number of starts is counted for maintenance purposes. Both the counters and the display can be reset with
one button.
The following conditions must be satisfied for the pumps to operate:
• The tank level sensor is not signaling "Tank below minimum."
• The drain valve of the mixing tank is closed.
• The emergency off is not activated.
The pumps are switched off if the following condition is satisfied:
• The tachometer does not indicate that the rated speed has been reached within 10 seconds of starting
the motor.
Drain Valve
The drain valve allows the mixture to drain (using gravity feed) to the next stage in the process. The valve
has a solenoid with a spring return.
• If the solenoid is activated, the outlet valve is opened.
• If the solenoid is deactivated, the outlet valve is closed.
The outlet valve is controlled (open/close) from an operator station.
The drain valve can be opened under the following conditions:
• The agitator motor is off.
• The tank level sensor is not signaling "Tank empty."
• The emergency off is not activated.
The pumps are switched off if the following condition is satisfied:
• The tank level sensor is indicating "Tank empty."
The console also includes display lamps for the devices that require maintenance after a certain
number of starts and the emergency off switch with which the process can be stopped immediately.
The console also has a reset button for the maintenance display of the three motors. Using this,
you can turn off the maintenance display lamps for the motors due for maintenance and reset the
corresponding counters to 0.
Operating System
Every CPU comes with an integrated operating system that organizes all CPU functions and
sequences not associated with a specific control task. The tasks of the operating system include
the following:
• Handling restart (warm start) and hot restart
• Update of the process image table of the inputs and output of the process image table of the
outputs
• Calling the user program
• Acquisition of interrupt information and calling interrupt OBs
• Recognition of errors and error handling
• Management of the memory areas
• Communication with programming devices and other communication partners
You can influence CPU reactions in certain areas by modifying the operating system parameters
(operating system default settings).
User Program
You create the user program and download it to the CPU. It contains all the functions required to
process your specific automation task. The tasks of the user program include:
• Specifying the conditions for a restart (warm start) and hot restart on the CPU (for example,
initializing signals with a particular value)
• Processing process data (for example, generating logical links of binary signals, fetching and
evaluating analog signals, specifying binary signals for output, output of analog values)
• Reaction to interrupts
• Handling disturbances in the normal program cycle.
Block Types
There are several different types of blocks you can use within an S7 user program:
OBs, FBs, SFBs, FCs, and SFCs contain sections of the program and are therefore also known as
logic blocks. The permitted number of blocks per block type and the permitted length of the blocks
is CPU-specific.
Organization blocks (OBs) represent the interface between the operating system and the user
program. Called by the operating system, they control cyclic and interruptdriven program
execution, startup behavior of the PLC and error handling. You can program the organization
blocks to determine CPU behavior.
2) The priority classes 27 and 28 are valid in the priority class model of the startup.
Local Data
When creating logic blocks (OBs, FCs, FBs), you can declare temporary local data. The local data
area on the CPU is divided among the priority classes.
On S7-400, you can change the amount of local data per priority class in the "priority classes"
parameter block using STEP 7.
Start Information of an OB
Every organization block has start information of 20 bytes of local data that the operating system
supplies when an OB is started. The start information specifies the start event of the OB, the date
and time of the OB start, errors that have occurred, and diagnostic events.
For example, OB40, a hardware interrupt OB, contains the address of the module that generated
the interrupt in its start information.
This means it is possible to process parts of the user program that do not have to be processed
cyclically only when needed. The user program can be divided up into "subroutines" and distributed
among different organization blocks. If the user program is to react to an important signal that
occurs relatively seldom (for example, a limit value sensor for measuring the level in a tank reports
that the maximum level has been reached), the subroutine that is to be processed when the signal
is output can be located in an OB whose processing is event-driven.
For the user program to function, the blocks that make up the user program must be called. This is
done using special STEP 7 instructions, the block calls, that can only be programmed and started
in logic blocks.
Putting these rules into practice for the example in the figure produces the following sequence for
creating the blocks:
FC1 > FB1 + instance DB1 > DB1 > SFC1 > FB2 + instance DB2 > OB1
Note
If the nesting is too deep (too many levels), the local data stack may overflow (Also refer to Local
Data Stack).
Block Calls
The following figure shows the sequence of a block call within a user program. The program calls
the second block whose instructions are then executed completely. Once the second or called
block has been executed, execution of the interrupted block that made the call is resumed at the
instruction following the block call.
Before you program a block, you must specify which data will be used by your program, in other
words, you must declare the variables of the block.
Note
OUT parameters must be described for each block call.
Note
The operating system resets the instances of SFB3 "TP" when a cold restart is performed. If you
want to initialize instances of this SFB after a cold restart, you must call up the relevant instances
of the SFB with PT = 0 ms via OB100. You can do this, for example, by performing an initialization
routine in the blocks which contain instances of the SFB.
Process Images
So that the CPU has a consistent image of the process signals during cyclic program processing,
the CPU does not address the input (I) and output (Q) address areas directly on the I/O modules
but rather accesses an internal memory area of the CPU that contains an image of the inputs and
outputs.
Interrupts
Cyclic program processing can be interrupted by the following:
• An interrupt
• A STOP command (mode selector, menu option on the programming device, SFC46 STP,
SFB20 STOP)
• A power outage
• The occurrence of a fault or program error
Communication Load
You can use the CPU parameter "Scan Cycle Load from Communication" to control within a given
framework the duration of communication processes that always increase the scan cycle time.
Examples of communication processes include transmitting data to another CPU by means of MPI
or loading blocks by means of a programming device.
Test functions with a programming device are barely influenced by this parameter. However, you
can increase the scan cycle time considerably. In the process mode, you can limit the time set for
test functions (S7-300 only).
At the same time, the OB1 scan cycle time is also influenced by asynchronous events (such as
hardware interrupts or cyclic interrupts). From a statistical point of view, even more asynchronous
events occur within an OB1 scan cycle because of the extension of the scan cycle time by the
communication portion. This causes an additional increase in the OB1 scan cycle. This increase
depends on how many events occur per OB1 scan cycle and on the duration of event processing.
Example 2 (additional asynchronous events considered):
For a pure OB1 execution time of 500 ms, a communication load of 50% can result in an actual
scan cycle time of up to 1000 ms (provided that the CPU always has enough communication jobs
to process). If, parallel to this, a cyclic interrupt with 20 ms processing time is executed every 100
ms, this cyclic interrupt would extend the scan cycle by a total of 5*20 ms = 100 ms without
communication load. That is, the actual scan cycle time would be 600 ms. Because a cyclic
interrupt also interrupts communication, it affects the scan cycle time by 10 * 20 ms with 50%
communication load. That is, in this case, the actual scan cycle time amounts to 1200 ms instead
of 1000 ms.
Note
Check the effects of changing the value of the "Scan Cycle Load from Communication" parameter while the
system is running.
The communication load must be taken into account when setting the minimum scan cycle time; otherwise
time errors will occur.
Recommendations
• Where possible, apply the default value.
• Increase this value only if you are using the CPU primarily for communication purposes and
your user program is not time critical.
• In all other cases, only reduce the value.
• Set the process mode (S7-300 only), and limit the time needed there for test functions.
Application
An FC contains a program section that is always executed when the FC is called by a different
logic block. You can use functions for the following purposes:
• To return a function value to the calling block (example: math functions)
• To execute a technological function (example: single control function with a bit logic operation).
Caution
In this case, if no data are written to an OUTPUT parameter in an FC, the block may output random
values!
As the calling block's local data area which is reserved for the copy is not assigned to the OUTPUT
parameter, no data will be written to this area. It will therefore remain unchanged and the random
value stored at this location will be output, because local data are not automatically set to "0" by
default, for example.
Note
Although the OUTPUT parameters of an FB or the INOUT parameters of an FC and FB will not
output random values (the old output value - or input value as output value - is going to be
maintained even if no data are written to the parameter) you should still observe the points above
in order to avoid unintentional processing of "old" values.
Note
To avoid errors when working with FBs, read Permitted Data Types when Transferring Parameters
in the Appendix.
Application
An FB contains a program that is always executed when the FB is called by a different logic block.
Function blocks make it much easier to program frequently occurring, complex functions.
Data Type
Variable Elementary Data Type Complex Data Type Parameter Type
Input No parameter required No parameter required Actual parameter required
Output No parameter required No parameter required Actual parameter required
In/out No parameter required Actual parameter required −
Data Type
Variable Elementary Data Type Complex Data Type Parameter Type
Input Initial value permitted Initial value permitted −
Output Initial value permitted Initial value permitted −
In/out Initial value permitted − −
Static Initial value permitted Initial value permitted −
Temporary − − −
Creating an Instance DB
Before you create an instance data block, the corresponding FB must already exist. You specify
the number of the FB when you create the instance data block.
In this example, FB22 does not need its own instance data block, since its instance data are saved
in the instance data block of the calling FB.
Preprogrammed Blocks
You do not need to program every function yourself. S7 CPUs provide you with preprogrammed
blocks that you can call in your user program.
Further information can be found in the reference help on system blocks and system functions
(Jumps to Language Descriptions and Help on Blocks and System Attributes).
System Functions
A system function is a preprogrammed function that is integrated on the S7 CPU. You can call the
SFC in your program. SFCs are part of the operating system and are not loaded as part of the
program. Like FCs, SFCs are blocks "without memory."
S7 CPUs provide SFCs for the following functions:
• Copying and block functions
• Checking the program
• Handling the clock and runtime meters
• Transferring data sets
• Transferring events from a CPU to all other CPUs in multicomputing mode
• Handling timeofday and timedelay interrupts
• Handling synchronous errors, interrupts, and asynchronous errors
• Information on static and dynamic system data, for example, diagnostics
• Process image updating and bit field processing
• Addressing modules
• Distributed I/O
• Global data communication
• Communication via nonconfigured connections
• Generating blockrelated messages
Additional Information
For more detailed information about SFBs and SFCs, refer to the "System Software for S7-300 and
S7-400, System and Standard Functions" Reference Manual. The "S7-300 Programmable
Controller, Hardware and Installation Manual" and "S7-400 Programmable Controller Module
Specifications Reference Manual" explain which SFBs and SFCs are available.
If... Then...
you move the time ahead and one or more OB80 is started and the TimeOfDay interrupts that
TimeOfDay interrupts were skipped, were skipped are entered in the start information of
OB80.
you have not deactivated the skipped TimeOfDay the skipped TimeOfDay interrupts are no longer
interrupts in OB80, executed.
you have not deactivated the skipped TimeOfDay the first skipped TimeOfDay interrupt is executed,
interrupts in OB80, the other skipped TimeOfDay interrupts are
ignored.
you move the time back, the start events for the the execution of the TimeOfDay interrupt is
TimeOfDay interrupts occur again, repeated with S7-300-CPUs
and not
repeated for S7-400-CPUs and CPU 318.
Startup Types
There are three distinct types of startup:
• Hot restart (not in S7-300 and S7-400H)
• Restart (warm restart)
• Cold restart
The following table shows which OB the operating system calls in each startup type.
Startup Program
You can specify the conditions for starting up your CPU (initialization values for RUN, startup
values for I/O modules) by writing your program for the startup in the organization blocks OB100 for
restart (warm restart), OB101 for hot restart, or OB102 for cold restart.
There are no restrictions to the length of the startup program and no time limit since the cycle
monitoring is not active. Timedriven or interruptdriven execution is not possible in the startup
program. During the startup, all digital outputs have the signal state 0.
Monitoring Times
To make sure that the programmable controller starts up without errors, you can select the
following monitoring times:
• The maximum permitted time for transferring parameters to the modules
• The maximum permitted time for the modules to signal that they are ready for operation after
power up
• On S7-400 CPUs, the maximum time of an interruption during which a hot restart is permitted.
Once the monitoring times expire, the CPU either changes to STOP, or only a restart (warm
restart) is possible.
Programming OB90
The run time of OB90 is not monitored by the CPU operating system so that you can program
loops of any length in OB90. Ensure that the data you use in the background program are
consistent by observing the following when programming:
• The reset events of OB90 (see the "System Software for S7-300 and S7-400, System and
Standard Functions" Reference Manual)
• The process image update asynchronous to OB90.
Types of Errors
The errors that can be detected by the S7 CPUs and to which you can react with the help of
organization blocks can be divided into two basic categories:
• Synchronous errors: these errors can be assigned to a specific part of the user program. The
error occurs during the execution of a particular instruction. If the corresponding synchronous
error OB is not loaded, the CPU changes to STOP mode when the error occurs.
• Asynchronous errors: these errors cannot be directly assigned to the user program being
executed. These are priority class errors, faults on the programmable logic controller (for
example, a defective module), or redundancy errors. If the corresponding asynchronous error
OB is not loaded, the CPU changes to STOP mode when the error occurs (exceptions: OB70,
OB72, OB81, OB 87).
The following table shows the types of errors that can occur, divided up into the categories of the
error OBs.
Note
If you want interrupts to be ignored, it is more effective to disable them using an SFC, rather than
to download an empty OB (with the contents BE).
When you start Windows, you will find an icon for the SIMATIC Manager, the starting point for
the STEP 7 software on the Windows interface.
The quickest method to start STEP 7 is to position the cursor on the icon and doubleclick. The
window containing the SIMATIC Manager is then opened. From here you can access all the
functions you have installed for the standard package and any optional packages.
Alternatively you can also start the SIMATIC Manager via the "Start" button in the taskbar of the
operating system. You will find the entry under "Simatic".
Note
You will find more information about standard Windows operation and options in your Windows
user's guide or in the online help of your Windows operating system.
SIMATIC Manager
The SIMATIC Manager is the basic application for configuring and programming. You can perform
the following functions in the SIMATIC Manager:
• Set up projects
• Configure and assign parameters to hardware
• Configure hardware networks
• Program blocks
• Debug and commission your programs
Access to the various functions is designed to be object oriented, and intuitive and easy to learn.
You can work with the SIMATIC Manager in one of two ways:
• Offline, without a programmable controller connected
• Online, with a programmable controller connected
Note the relevant safety notices in each case.
Example of Parameters:
/e F:\SIEMENS\STEP7\S7proj\MyConfig\MyConfig.s7p /keep
/o "1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1"
/h T00112001;129;T00116001;1;T00116101;16e /keep
Important: If the path contains blanks, it must be placed within quotation marks.
Online Help
The online help system provides you with information at the point where you can use it most
efficiently. You can use the online help to access information quickly and directly without having to
search through manuals. You will find the following types of information in the online help:
• Contents: offers a number of different ways of displaying help information
• Contextsensitive Help (F1 key): with the F1 key you access information on the object you
just selected with the mouse or on the active dialog box or window
• Introduction: gives a brief introduction to the use, the main features, and the functional scope
of an application
• Getting Started: summarizes the basic steps you need to execute to get started with the
application
• Using Help: provides a description of ways of finding specific information in the online help
• About: provides information on the current version of the application
Via the Help menu you can also access topics which relate to the current dialog situation from
every window.
• Project Object
• Station Object
• S7 Program Object
• Source File Folder Object
• Block Folder Object
Objects as Folders
A folder (directory) can contain other folders or objects. These are displayed when you open the
folder.
The project represents the entirety of all the data and programs in an automation solution, and is
located at the top of an object hierarchy.
Project Object
Station Object
Programmable Module Object
S7 Program Object
Source File Folder Object
Block Folder Object
A library can contain S7 programs and is used to store blocks. A library is located at the top of an
object hierarchy.
• Library Object
• S7 Program Object
• Source File Folder Object
• Block Folder Object
• Project Object
• Station Object
• Programmable Module Object
• S7 Program Object
• Project Object
• Station Object
• Programmable Module Object
• S7 Program Object
• Source File Folder Object
• Block Folder Object
Program
A S7 program folder contains software for S7 CPU modules or software for non-CPU modules (for
example, programmable CP or FM modules).
• Project Object
• Station Object
• Programmable Module Object
• S7 Program Object
• Source File Folder Object
• Block Folder Object
Block folder • Other functions can be found under Block Folder Object
A block folder of an offline view can contain: logic blocks (OB, FB, FC, SFB, SFC), data blocks
(DB), user-defined data types (UDT) and variable tables. The system data object represents
system data blocks.
The block folder of an online view contains the executable program parts that have been
downloaded to the programmable controller.
• Project Object
• Station Object
• S7 Program Object
• Source File Folder Object
• Block Folder Object
• Project Object
• Station Object
• S7 Program Object
• Source File Folder Object
• Block Folder Object
You can create programs without having configured a SIMATIC station beforehand. This means
that you can initially work independently of the module and module settings you intend to program.
Creating an S7 Program
1. Open the relevant project using the menu command File > Open or activate the project
window.
2. Select the project in the project window of the offline view.
3. Select the menu commands Insert > Program > S7 Program.
The S7 program is added and arranged directly below the project in the project window. It
contains a folder for the blocks and an empty symbol table. You can now create and program
blocks.
Note
When deleting stations or programmable modules, you will be asked if you also want to delete the
program contained within. If you choose not to delete the program, it will be attached directly below
the project as a program without a station.
Continue ...
Below we describe the basic actions for editing objects. Please pay proper attention to this topic, as
all subsequent topics will be based on these basic operations.
Toolbar
The toolbar contains icons (or tool buttons) which provide shortcuts to frequently used and
currently available menu bar commands available with a single mouse click. A brief description of
the function of the respective button is displayed together with additional information in the status
bar when you position the cursor briefly on the button.
If access to a button is not possible in the current configuration, the button is grayed out.
Status Bar
The status bar displays contextspecific information.
The names of the tab cards are shown on tabs along the top edge of the dialog box. To bring a
particular tab card to the foreground, you simply click on its tab.
Some basic processing steps are the same for all objects and do not depend on the object type.
These standard handling sequences are summarized here. This knowledge of standard procedures
is required to move on to other sections in the manual.
The usual sequence of steps when handling objects is:
• Create an object
• Select an object
• Perform actions with the object (for example, copy, delete).
Creating Objects
The STEP 7 wizard "New Project" offers support with creating a new project and inserting objects.
Use the menu command File > "New Project" Wizard to open the wizard. In the dialog boxes
displayed you can set the structure of your project and then have the wizard create the project for
you.
If you do not wish to use the wizard, you can create projects and libraries using the menu
command File > New. These objects form the starting point of an object hierarchy. You can create
all other objects in the hierarchy using the commands in the Insert menu, provided they are not
created automatically. The exception to this are the modules in a SIMATIC station which are
created when you configure the hardware or by using the "New Project" wizard.
Opening Objects
There are a number of ways to open an object in the detailed view:
• Double-click on the object icon
• Select the object and then the menu command Edit > Open Object. This only works for
objects that are not folders.
Once you have opened an object, you can create or change its contents.
When you open an object that does not contain other objects, its contents are represented by a
suitable software component in a new window for editing purposes. You cannot change objects
whose contents are already being used elsewhere.
Note
Exception: Stations appear as folders for programmable modules (when you double-click them)
and for the station configuration. If you double-click the "Hardware" object, the application for
configuring hardware is started. Selecting the station and selecting the menu command Edit >
Open Object has the same effect.
For example, in order to display the special object properties of a block for operator control and
monitoring, the block must be marked as being relevant for operator control and monitoring,
meaning that the system attribute "s7_m_c" must be set to the value "true" in the "Attributes" tab of
the block properties.
Note
Properties of the "System Data" folder and the "Hardware" object cannot be displayed or changed.
You cannot write in the dialog boxes for object properties of a read-only project. In this case, the input boxes
are grayed out.
If you display the properties of programmable modules, you cannot edit the displayed parameters for reasons
of consistency. To edit the parameters you must open the "Configuring Hardware" application.
If you change the settings for objects on the programming device (for example, the configuration data of a
module), they are not yet effective in the target system, because the system data blocks in which the settings
are saved have to be in the target system.
If you load an entire user program, the system data blocks are also automatically transferred. If you change
the settings after having loaded the program, you can reload the "System data" object in order to transfer the
settings to the target system.
It is strongly recommended to edit the folders exclusively with STEP 7, since they can be physically structured
in a different way than you see in the SIMATIC Manager.
Note
The connection table in the "Connections" folder cannot be copied. Note that when you copy lists of
operator-relevant texts, only those languages installed in the destination object are accepted.
Renaming Objects
The SIMATIC Manager assigns standard names to some new objects. These names are generally
formed from the type of object (if a number of objects of this type can be created in the same
folder) and a number.
For example, the first S7 program will be named "S7 Program(1)", the second "S7 Program(2)" etc.
The symbol table is simply called "Symbols" as it can only exist once in each folder.
You can change the names of most objects and assign them names which are more relevant to
their content.
With projects, the directory names in the path must not have more than 8 characters. Otherwise,
there may be problems when archiving.
You can change the name of an object directly or using the object properties.
Directly:
When you slowly click twice on the name of a selected object, a frame appears around the text.
You can then edit the name using the keyboard.
Using the menu:
Select the required object in the project window and select the menu command Edit > Rename. A
frame appears around the text. You can then edit the name using the keyboard.
If you are not allowed to change the name:
If you are not allowed to change the name of an object, the input field is shown in gray in the dialog
box, the current name is displayed, and text entries are not possible.
Note
If you move the mouse pointer out of the name box while editing the name and execute another
action (for example, select a menu command), the edit procedure is terminated. The changed
name is accepted and entered if it is allowed.
Moving Objects
With the SIMATIC Manager you can move objects from one folder to another even if the
destination is in another project. When you move a folder its contents are all moved as well.
Note
You cannot move the following objects:
• Connections
• System data blocks (SIB) in the online view
• System functions (SFC) and system function blocks (SFB) in the online view
Sorting Objects
You can sort objects in the detailed view (menu command View > Details) according to their
attributes. To do this, click on the corresponding header of the required attribute. When you click
again, the sort order is reversed. Blocks of one type are sorted according to their numerical order,
for example, FB1, FB2, FB11, FB12, FB21, FC1.
Deleting Objects
You can delete folders and objects. If you delete a folder, all the objects contained in it are also
deleted.
You cannot undo the delete procedure. If you are not sure whether you really no longer need an
object, it is better to archive the whole project first.
Note
You cannot delete the following objects:
• Connections
• System data blocks (SIB) in the online view
• System functions (SFC) and system function blocks (SFB) in the online view
Selecting objects in a dialog box (browser) is an action which you will need regularly for a large
number of different edit steps.
The SIMATIC Manager can save the contents of windows (that is, the projects and libraries open),
and the layout of the windows.
• Using the menu command Options > Customize, you define whether the window contents
and layout are to be saved at the end of a session. At the start of the next session, these
window contents and layout are restored. In the open projects, the cursor is positioned on the
last folder selected.
• Using the menu command Window > Save Settings you save the current window contents
and the window arrangement.
• Using the menu command Window > Restore Settings you restore the window contents and
layout that you saved with the menu command Window > Save Settings. In the open projects,
the cursor is positioned on the last folder selected.
Note
The window contents of online projects, the contents of the "Accessible Nodes" window, and the
contents of the "S7 Memory Card" window are not saved.
Any passwords you may have entered for access to programmable controllers (S7-300/S7-400) are
not saved at the end of a session.
To cascade all the displayed windows one behind the other, select one of the following options:
• Select the menu command Window > Arrange > Cascade.
• Press the key combination SHIFT + F5.
To arrange all the displayed windows from top to bottom on the screen, select the menu command
Window > Arrange > Horizontally.
To arrange all the displayed windows from left to right on the screen, select the menu command
Window > Arrange > Vertically.
The STEP 7 applications have a feature which enables you to save the current window
arrangement and restore it at a later stage. You can make the setting using the menu command
Options > Customize in the "General" tab.
What Is Saved?
When you save the window layout the following information is recorded:
• Position of the main window
• Opened projects and libraries and their respective window positions
• Order of any cascaded windows
Note
The window content of online projects, the content of the "Accessible Nodes" window, and the
content of the "S7 Memory Card" window are not saved.
Note
When you restore a window, only the part of the hierarchy containing the object that was selected when the
window arrangement was saved is displayed in detail.
Every menu command can be selected by typing a key combination with the ALT key.
Press the following keys in the order shown:
• ALT key
• The letter underlined in the menu name you require (for example, ALT, F for the menu "File" - if
the menu "File" is included in the menu bar). The menu is opened.
• The letter underlined in the menu command you require (for example, N for the menu
command "New"). If the menu command has a submenu, the submenu is also opened.
Proceed as above until you have selected the whole menu command by typing the relevant
letters.
Once you have entered the last letter in the key combination, the menu command is executed.
Examples:
Menu Command Key Combination
File > Archive ALT, F, A
Window > Arrange > Cascade ALT, W, A, C
Command Shortcut
New (File Menu) CTRL+N
Open (File Menu) CTRL+O
Save as ("File" Menu) CTRL+S
Print > Object Table ("File" Menu) CTRL+P
Print > Object Content ("File" Menu) CTRL+ALT+P
Exit ("File" Menu) ALT+F4
Cut ("Edit" Menu) CTRL+X
Copy ("Edit" Menu) CTRL+C
Paste ("Edit" Menu) CTRL+V
Delete ("Edit" Menu) DEL
Select All ("Edit" Menu) CTRL+A
Rename ("Edit" Menu) F2
Object Properties ("Edit" Menu) ALT+RETURN
Open Object ("Edit" Menu) CTRL+ALT+O
Compile ("Edit" Menu) CTRL+B
Download (PLC Menu) CTRL+L
Diagnostics/Setting CTRL+D
> Module Status ("PLC" Menu)
Diagnostics/Setting CTRL+I
> Operating Mode ("PLC" Menu)
Update ("View" Menu) F5
Updates the status display of the visible CPUs in the online view CTRL+F5
Customize ("Options" Menu) CTRL+ALT+E
Reference Data > Show ("Options" Menu) CTRL+ALT+R
Arrange > Cascade (Window Menu) SHIFT+F5
Arrange > Horizontally (Window Menu) SHIFT+F2
Arrange > Vertically (Window Menu) SHIFT+F3
ContextSensitive Help (Help Menu) F1
(If there is a current context, for
example, a selected menu command,
the relevant help topic is opened.
Otherwise the help contents page is
displayed.)
To Press
move to the menu bar F10
move to the pop-up menu SHIFT+F10
move to the menu that contains the letter or number ALT+underlined character in a menu title
underlined which you typed in
select the menu command whose underlined letter Underlined character in the menu command
or number corresponds to the letter you have typed
move one menu command to the left LEFT ARROW
move one menu command to the right RIGHT ARROW
move one menu command up UP ARROW
move one menu command down DOWN ARROW
activate the selected menu command ENTER
deselect the menu name or close the open menu ESC
and return to the text
To move Press
one line up or one character to the left in a text UP ARROW
consisting of only one line
one line down or one character to the right in a text DOWN ARROW
consisting of only one line
one character to the right RIGHT ARROW
one character to the left LEFT ARROW
one word to the right CTRL+RIGHT ARROW
one word to the left CTRL+LEFT ARROW
to the beginning of the line HOME
to the end of the line END
to the previous screen PAGE UP
to the next screen PAGE DOWN
to the beginning of the text CTRL+HOME
to the end of the text CTRL+END
To move Press
One row up UP ARROW
One row down DOWN ARROW
One character or cell to the left RIGHT ARROW
One character or cell to the right LEFT ARROW
To the beginning of the row CTRL+RIGHT ARROW
To the end of the row CTRL+LEFT ARROW
To the beginning of the cell HOME
To the end of the cell END
To the previous screen PAGE-UP
To the next screen PAGE-DOWN
To the beginning of the table CTRL+HOME
To the end of the table CTRL+END
In the symbol table only: to the "Symbol" column SHIFT+HOME
In the symbol table only: to the "Comment" column SHIFT+END
To Press
move from one input box to the next (from left to TAB
right and from top to bottom)
move one input box in the reverse direction SHIFT+TAB
move to the input box or option that contains the ALT+underlined character in a menu title
letter or number underlined which you typed in
select in a list of options an arrow key
open a list of options ALT+DOWN ARROW
select or deselect an item in a list SPACEBAR
confirm the entries and close the dialog box ("OK" ENTER
button)
close the dialog box without saving the changes ESC
("Cancel" button)
To Press
open the Help F1
(If there is a current context, for example, a
selected menu command, the relevant help topic
is opened. Otherwise the help contents page is
displayed.)
activate the question mark symbol for context-sensitive SHIFT+F1
help
close the Help window and return to the application ALT+F4
To Press
toggle between the panes in a window F6
return to the previous pane, if there is no dockable Shift+F6
window
toggle between the document window and a dockable Shift+F6
window in the document (for example, variable
declaration window).
If there are no dockable windows, you can use this key
combination to return to the previous pane.
toggle between document windows Ctrl+F6
return to the previous document window Shift+Ctrl+F6
toggle between non-document windows (application Alt+F6
framework and dockable windows in the application
framework;
when you return to the framework, this key combination
activates the document window that was last active)
return to the previous non-document window Shift+Alt+F6
Data are stored in a project in object form. The objects in a project are arranged in a tree structure
(project hierarchy). The display of the hierarchy in the project window is similar to that of the
Windows Explorer. Only the object icons have a different appearance.
The top end of the project hierarchy is structured as follows:
1. 1st Level: Project
2. 2nd Level: Subnets, stations, or S7 programs
3. 3rd Level: depends on the object in level 2.
Project Window
The project window is split into two halves. The left half shows the tree structure of the project. The
right half shows the objects that are contained in the object open in the left half in the selected view
(large symbols, small symbols, list, or details).
Click in the left half of the window on the box containing a plus sign to display the full tree structure
of the project. The resulting structure will look something like the following figure.
At the top of the object hierarchy is the object "S7_Pro1" as the icon for the whole project. It can be
used to display the project properties and serves as a folder for networks (for configuring
networks), stations (for configuring the hardware), and for S7 programs (for creating software). The
objects in the project are displayed in the right half of the project window when you select the
project icon. The objects at the top of this type of object hierarchy (libraries as well as projects)
form the starting point in dialog boxes used to select objects.
Project View
You can display the project structure for the data available on the programming device in the
component view "offline" and for the data available on the programmable control system in the
component view "online" in project windows.
An additional view you can set is available if the respective optional package is installed: the plant
view.
Note
Configuring hardware and networks can only be done in the "offline" view.
PC with STEP 7 and PC with STEP 7 and PC with STEP 7 (no SIMATIC
SIMATIC Logon SIMATIC Logon Logon present)
1. The user logs on using The project with access The user opens the access-
SIMATIC Logon with a user protection is opened by protected project by entering the
name and password. another user. project password.
2. The project with access Editing of the project is possible,
protection is opened. however without the functions of
SIMATIC Logon.
3. The project is edited. The project is edited. After closing and reopening the
project, users must authenticate
themselves again with the project
password.
4. Closing the project does not Closing the project does not
mean logging off in SIMATIC mean logging off in SIMATIC
Logon. Logon.
5. The user must log off with
Options > SIMATIC Logon
Services > "Log Off" button.
Note
To disable access protection, you must be authorized in SIMATIC Logon as project administrator.
The first time you enable access protection, the project format is changed. You will receive a message
indicating that the modified project can no longer be edited with older STEP 7 versions.
The Options > Access Protection >Remove Access Protection and Change Log function allows the
project or the library to be used with a STEP 7 version lower than V5.4. You do, however, lose the information
on the users that are allowed access to this project or library and all change logs.
The user currently logged on is displayed in the status bar of the SIMATIC Manager.
The currently logged on Logon user who enables access protection is entered as the project administrator and
is requested to assign the project password the first time access protection is enabled.
To open an access protected project, you must be authenticated in SIMATIC Logon as project administrator or
project user or you must know the password.
Remember that a logged-on user is entered in the project as project administrator when a project is opened
with the project password.
If the project/library access protection is active, the icon has a red key. If the multiproject only contains
projects/libraries with active access protection, the icon also has a red key.
If the project/library access protection is disabled, the icon has a white key. If the multiproject contains
projects/libraries both with active and deactivated access protection or projects/libraries with deactivated
access protection, the icon is also displayed with a white key.
Note
The Options > Access Protection >Remove Access Protection and Change Log function allows the
project or the library to be used with a STEP 7 version lower than V5.4. You do, however, lose the information
on the users that are allowed access to this project or library and all change logs.
To use this function, you must be authenticated in SIMATIC Logon as project administrator and access
protection must be enabled for this project.
Project Language
The project language is the language that is set in the Window Control Panel when a project is first
created. Once chosen, this project language cannot be changed. However, with the "language-
neutral" setting it is still possible to open a project on computers with other language settings in
Windows. Before changing the project language to "language-neutral", make sure that only
characters from the English-language character set (ASCII characters 0x2a - 0x7f) were previously
used in the project when entering text.
To find out the project language for a project or a library, select the Edit > Object Properties menu
command. In the dialog box that is then displayed you can also select the "Can be opened under
any Windows language setting (language-neutral)" option.
STEP 7 Language
The STEP 7 language is the one that you set in the SIMATIC Manager by using the Options >
Customize menu command. This language is the one use for interface elements, menu command,
dialog boxes and error messages in STEP 7.
If you are using another Windows language such as German, English, French, Italian or Spanish,
you can ensure that the STEP 7 interface is correctly displayed by selecting English as the STEP
7 language.
Rules
If you will be editing your projects or libraries on computers that have different language settings,
be sure to observe the following "rules and regulations" to prevent incompatibilities or data
corruption from occurring when using a foreign-language character set:
• Install STEP 7 only in folders with names that contain the characters of the English character
set (ASCII characters 0x2a - 0x7f).
• Only use project names and project paths with names that contain the characters of the
English character set (ASCII characters 0x2a - 0x7f). For example, if you use German umlauts,
Cyrillic or Chinese characters, then the project can only be opened on computers that have a
compatible language setting in Windows.
• In multiprojects, only use projects and libraries with the same project language or those that
are identified as being language-neutral ones. The multiproject itself is language-neutral.
• When creating libraries, always make them language-neutral to ensure than they can be used
on computers with different Windows language settings. When assigning names to library
projects, entering comments, or creating symbol names, etc. be sure to only use ASCII
characters (0x2a - 0x7f) so that the libraries can be used without any problems.
• When importing/exporting hardware configurations or symbol tables, make sure that you only
import/export language-compatible files.
• In the names of user-defined attributes, use only characters from the English-language
character set (ASCII characters 0x2a - 0x7f).
• If, in an STL source, you are using characters that are not in the English character set (ASCII
characters 0x2a - 0x7f) for the TITLE, AUTHOR, FAMILY block properties, then place these
entries in single quote marks.
Notes
If you change or copy projects or libraries that were created on a computer that is identified as being
language-neutral with respect to the Windows language setting but is not compatible with the setting on the
computer currently being used, data corruption may occur if characters that are not contained in the English
character set (ASCII characters 0x2a - 0x7f) were used in the project or library.
For this reason, before editing "foreign" projects or libraries, make sure to check whether the Windows
language setting on your computer matches the project language.
If you export hardware configurations or symbol tables that are to be imported in another Windows language
setting, make sure that only characters from the English-language character set (ASCII characters 0x2a -
0x7f) were previously used and that no other language-specific characters such as German umlauts,
Japanese characters or Cyrillic characters are present.
Exported hardware configurations or symbol tables that contain language-specific characters such as German
umlauts, Japanese characters or Cyrillic characters may only be imported in the same Windows language
setting from which they were exported. This means that if you import older symbol tables that might contain
such language-specific characters, be sure to check the results carefully: the symbols must be unique, must
not contain any question marks or other incorrect characters, and must be plausible.
If symbol tables contain special characters that are not defined in ("known to") the current Windows language
setting, then the question marks or other incorrect characters now part of the symbol names may cause
problems and errors when sorting by names and comments.
Please note that with symbolic addressing the symbolic names must be written in quotation marks
("<Symbolic Name>").
Basic Procedure
To be able to enter text in foreign-language character sets in projects and libraries, proceed as
follows:
1. In the Windows Control Panel, set the language setting to the language desired.
2. Create a project.
3. Enter the text in foreign-language characters.
For project and libraries that were created before STEP 7 V5.3 SP2, the project language is "not
yet specified". In this case, you can select the Edit > Object Properties menu command to set the
project language to the language currently set in Windows. Before doing so, make sure that the
project does not contain any characters that are not defined in ("known to") the current Windows
language setting.
To construct a solution to your automation task using the framework of a project management, you
will need to create a new project. The new project is created in the directory you set for projects in
the "General" tab when you selected the menu command Options > Customize.
Note
The SIMATIC Manager allows names that are longer than eight characters. The name of the
project directory is, however, cut off to eight characters. Project names must therefore differ in their
first eight characters. The names are not case-sensitive.
You will find a step-by-step guide to creating a project under Creating a Project Manually or under
Creating a Project Using the Wizard.
Alternative Procedures
When editing a project, you are flexible as to the order in which you perform most of the tasks.
Once you have created a project, you can choose one of the following methods:
• First configure the hardware and then create the software for it, or
• Start by creating the software independent of any configured hardware.
In a project, the station represents the hardware structure of a programmable controller and
contains the data for configuring and assigning parameters to individual modules.
New projects created with the "New Project" wizard already contain a station. Otherwise you can
create the station using the menu command Insert > Station.
You can choose between the following stations:
• SIMATIC 300 station
• SIMATIC 400 station
• SIMATIC H station
• SIMATIC PC station
• PC/programming device
• SIMATIC S5
• Other stations, meaning non- SIMATIC S7 and SIMATIC S5
The station is inserted with a preset name (for example, SIMATIC 300 Station(1), SIMATIC 300
Station(2), etc.). You can replace the name of the stations with a relevant name, if you wish.
You will find a step-by-step guide to inserting a station under Inserting a Station.
Next Steps
Once you have created the hardware configuration, you can create the software for your
programmable modules (Also refer to Inserting a S7 Program).
The software for programmable modules is stored in object folders. For SIMATIC S7 modules this
object folder is called "S7 Program."
The following figure shows an example of an S7 program in a programmable module in a
SIMATIC 300 station.
Existing Components
An S7 program is created automatically for each programmable module as a container for the
software:
The following objects already exist in a newly created S7 program:
• Symbol table ("Symbols" object)
• "Blocks" folder for containing the first block
• "Source Files" folder for source files
Creating S7 Blocks
You want to create Statement List, Ladder Logic, or Function Block Diagram programs. To do this,
select the existing "Blocks" object and then select the menu command Insert > S7 Block. In the
submenu, you can select the type of block you want to create (such as a data block, Userdefined
Data Type (UDT), function, function block, organization block, or variable table).
You can now open the (empty) block and start entering the Statement List, Ladder Logic, or
Function Block Diagram program. You will find more information on this in Basic Procedure for
Creating Logic Blocks and in the Statement List, Ladder Logic, and Function Block Diagram
manuals.
Note
The object "System Data" (SDB) which may exist in a user program was created by the system.
You can open it, but you cannot make changes to it for reasons of consistency. It is used to make
changes to the configuration once you have loaded a program and to download the changes to the
programmable controller.
Opening a Project
To open an existing project, enter the menu command File > Open. Then select a project in the
dialog boxes that follow. The project window is then opened.
Note
If the project you require is not displayed in the project list, click on the "Browse" button. In the
browser you can then search for other projects and include any projects you find in the project list.
You can change the entries in the project list using the menu command File > Manage.
Copying a Project
You copy a project by saving it under another name using the menu command File > Save As.
You copy parts of a project such as stations, programs, blocks etc. using the menu command Edit
> Copy.
You will find a step-by-step guide to copying a project under Copying a Project and Copying Part of
a Project.
Deleting a Project
You delete a project using the menu command File > Delete.
You delete parts of a project such as stations, programs, blocks etc. using the menu command
Edit > Delete.
You will find a step-by-step guide to deleting a project under Deleting a Project and Deleting Part of
a Project.
If a project that you are editing contains objects that were created with another software package,
this software package is required to edit this project.
No matter what programming device you are using to work with multiprojects, projects or libraries,
STEP 7 assists you by showing you what software packages and versions are required to do so.
This information on the software packages required is complete under the following conditions:
• If the project (or all projects in a multiproject) or library was created in STEP 7 as of V5.2.
• If you yourself have checked the project for any software packages used in creating it. To do
this, first go to the SIMATIC Manager and select the project concerned. Then select the menu
command Edit > Object Properties. In the dialog box that is displayed, select the "Required
software packages" tab. The information in this tab will tell you whether you should check the
project for software packages.
STEP 7 offers the possibility of exporting text that has been created in a project in one language,
having it translated, re-importing it, and displaying it in the translated language.
The following text types can be managed in more than one language:
• Titles and comments
- Block titles and block comments (latter does not apply to PCS 7 projects)
- Network titles and network comments
- Line comments from STL programs
- Comments from symbol tables, variable declaration tables, user-defined data types, and
data blocks
- Comments, state names, and transition names in HiGraph programs
- Extensions of step names and step comments in S7-Graph programs
• Display texts
- Message texts generated by STEP 7, S7-Graph, S7-HiGraph, S7-PDIAG or ProTool
- System text libraries
- User-specific text libraries
- Operator-relevant texts
- User texts
Export
Exporting is done for all blocks and symbol tables located under the selected object. An export file
is created for each text type. This file contains a column for the source language and a column for
the target language. Text in the source language must not be changed.
Import
During import, the contents of the target-language columns (right-hand column) are integrated into
the project to which the selected object belongs. Only those translations whose source text
(exported text) matches an existing text in the "Source Language column are accepted.
Note
When you import the translated texts, these texts are replaced in the entire project. If, for example,
you have translated texts belonging to a certain CPU and these texts occur at other places in the
project, all the occurrences in the project will be replaced.
Changing Languages
When changing languages, you can choose from all the languages that were specified during
import into the selected project. The language change for "Title and Comments" is only applied to
the selected object. A language change for "Display Texts" is always applied to the complete
project.
Deleting a Language
When a language is deleted all the texts in this language are deleted from the internal database.
One language should always be available as a reference language in your project. This can, for
example, be your local language. This language should not be deleted. During exporting and
importing always specify this reference language as the source language. The target language can
be set as desired.
Reorganize
During reorganization, the language is changed to the language currently set. The currently set
language is the language that you selected as the "Language for future blocks". Reorganization
only affects titles and comments.
Comment Management
You can specify how comments for blocks should be managed in projects with texts being
managed in many languages.
Basic Procedure
S7-HiGraph
HiGraphStateName State name
HiGraphStateComment State comment
Editors in other optional packages (such as ProTool, WinCC, etc.) may have other application-
specific text types that are not described here.
Note
If the column for the target language has been overwritten with "512(32) $_Undefined," no target language
was specified when the file was exported. To obtain a better overview, you can replace this text with the target
language, for example, "9(1) English (US)" When importing the translated files, you must verify the proposed
target language and, if necessary, select the correct language.
You can hide text not to be displayed in the target language by entering the keyword $_hide. This does not
apply to comments on variables (InterfaceComment) and to symbols (SymbolComment).
Note
Export files may not be renamed.
Explanation
Regardless of its language, a text is used as the basis for the translation. If an identical text is used
for different terms in more than one language or more than once in one language, it can no longer
be uniquely identified and will thus not be translated.
Example:
Remedy
Rename the texts concerned in the exported file (in the example, a single German word must be
used instead of three different ones), and then re-import the texts.
Example
Before preparation (export file):
Prerequisite
There must be an existing translated export target.
Procedure
1. Copy the export files into the project folder for the new project to be translated.
2. Open the new project and export the text (menu command Options > Manage Multilingual
Texts > Export). Since the export target already exists, you will be asked whether the export
target should be extended or overwritten.
3. Click on the Add button.
4. Have the export files translated (only new text needs to be translated).
5. Then import the translated files.
Example:
6.7.3.1 What You Should Know About Micro Memory Cards (MMC)
Micro Memory Cards (MMC) are plug-in memory cards, for example, for a CPU 31xC or an IM
151/CPU (ET 200S). Their most distinguishing feature is the highly compact design.
A new memory concept has been introduced for MMCs. It is briefly described below.
Requirements
You can only store project data on an MMC if it is inserted in the slot of a suitable CPU or a
programming device (PG)/PC and there is an online connection established.
Be sure that the MMC has enough capacity to accommodate all the data to be stored on it.
Remedy
If you want to use the DP slave with new modules that are described in the *.GSD file:
• Delete the DP slave and configure it again. Then the DP slave is described completely by the
*.GSD file, not by the type file.
If you do not want to use any new modules that are described only in the *.GSD file:
• Under PROFIBUS-DP in the Hardware Catalog window, select the "Other FIELD
DEVICES/Compatible PROFIBUS-DP Slaves" folder. STEP 7 moves the "old" type files into
this folder when they are replaced by new *.GSD files. In this folder you will find the modules
with which you can expand the already configured DP slave.
Constellation after Replacement of Type Files by GSD Files in STEP 7 V5.1 Service Pack 4
As of STEP 7 V5.1, Service Pack 4, the type files have been either updated or largely replaced by
GSD files. This replacement only affects the catalog profiles supplied with STEP 7, not any catalog
profiles that you may have created yourself.
DP slaves whose properties were previously determined by type files and are now determined by
GSD files are still located in the same place in the hardware catalog.
The "old" type files were not deleted but moved to another place in the hardware catalog. They are
now located in the catalog folder "Other field devices\Compatible PROFIBUS DP slaves\...".
If you open the project with the appropriate STEP 7 version or with a compatible optional package,
all modules are displayed their standard way and there are no restrictions on editing.
>>>---Project data--->>>
Represented by "known", latest Represents the latest module as an
module "unknown" module
Absolute Addresses
An absolute address comprises an address identifier and a memory location (for example, Q 4.0,
I 1.1, M 2.0, FB21).
Symbolic Addresses
You can make your program easier to read and simplify troubleshooting if you assign symbolic
names to the absolute addresses.
STEP 7 can translate the symbolic names into the required absolute addresses automatically. If
you would prefer to access ARRAYs, STRUCTs, data blocks, local data, logic blocks, and user-
defined data types using symbolic names, you must first assign symbolic names to the absolute
addresses before you can address the data symbolically.
You can, for example, assign the symbolic name MOTOR_ON to the address Q 4.0 and then use
MOTOR_ON as an address in a program statement. Using symbolic addresses it is easier to
recognize to what extent the elements in the program match the components of your process
control project.
Note
Two consecutive underline characters (for example, MOTOR__ON) are not permitted in a symbolic
name (variable ID).
When you print out a block, the current screen representation with statement comments or symbol
comments is printed.
Note
Using the menu command View > Display > Symbolic Representation you can toggle the display
between the declared shared symbolic and the absolute addresses.
Note
Please be aware that the absolute block number is the determining factor when making block calls
("Call FC" or "Call FB, DB") for the logic block – even when symbolic address priority has been set!
Examples:
In the symbol table or in the program editor/block editor a spelling error in a name has to be
corrected. This applies to all names in the symbol table as well as to all the names of parameters,
variables or components that can be changed with the program editor/block editor.
Tracking Changes:
In the SIMATIC Manager, select the block folder and then select the menu command Edit > Check
Block Consistency. The "Check block consistency' function make the changes necessary in the
individual blocks.
Examples:
• The names of existing assignments in the symbol table are switched.
• Existing assignments in the symbol table are assigned new addresses.
• Variable names, parameter names or component names are switched in the program
editor/block editor.
Tracking Changes:
• In the SIMATIC Manager, select the block folder and then select the menu command Edit >
Check Block Consistency. The "Check block consistency" function makes the changes
necessary in the individual blocks.
Examples:
• You are creating new symbols for addresses used in the program.
• You are adding new variable or parameters to data blocks, UDTs or function blocks.
Tracking Changes:
In the SIMATIC Manager, select the block folder and then select the menu command Edit > Check
Block Consistency. The "Check block consistency' function make the changes necessary in the
individual blocks.
Validity
The symbol table is only valid for the module to which you link the program. If you want to use the
same symbols in a number of different CPUs, you yourself must ensure that the entries in the
various symbol tables all match up (for example, by copying the table).
Row
If the columns for "Special Object Properties" were hidden (the menu command View >
Columns O, M, C, R, CC was deselected), this symbol appears in the row if the row
concerned has at least one "Special Object Property" set for it.
"Status" Column
The symbol name or address is identical to another entry in the symbol table.
The symbol is still incomplete (the symbol name or the address is missing).
R/O/M/C/CC Columns
The columns R/O/M/CC show whether a symbol was assigned special object properties
(attributes):
• R (monitoring) means that error definitions for process diagnostics were created for the symbol
with the optional package S7-PDIAG (V5).
• O means that the symbol can be operated and monitored with WinCC.
• M means that a symbolrelated message (SCAN) was assigned to the symbol.
• C means that the symbol is assigned communication properties.
• CC means that the symbol can be quickly and directly monitored and controlled in the program
editor ('Control at Contact').
Click on the check box to enable or disable these "special object properties". You can also edit the
"special object properties" via Edit > Special Object Properties menu command
"Symbol" Column
The symbolic name must not be longer than 24 characters.
You cannot assign symbols in the symbol table for addresses in data blocks (DBD, DBW, DBB,
DBX). Their names are assigned in the data block declaration.
For organization blocks (OB) and some system function blocks (SFB) and system functions (SFC),
predefined symbol table entries already exist which you can import into the table when you edit the
symbol table of your S7 program. The import file is stored in the STEP 7 directory under
...\S7data\Symbol\Symbol.sdf.
"Address" Column
An address is the identifier for a particular memory area and memory location.
Example: Input I 12.1
The syntax of the address is checked as it is entered.
"Comment" Column
You can assign comments to all symbols. The combination of brief symbolic names and more
detailed comments makes creating programs more effective and makes your program
documentation more complete. A comment can be up to 80 characters in length.
Only one set of mnemonics can be used throughout a symbol table. Switching between SIMATIC
(German) and IEC (English) mnemonics must be done in the SIMATIC Manager using the menu
command Options > Customize in the "Language" tab.
Incomplete Symbols
It is also possible to store incomplete symbols. You can, for example, enter only the symbol name
first and then add the corresponding address at a later date. This means you can interrupt your
work on the symbol table at any time, save the interim result, and complete your work another time.
Incomplete symbols are identified in the "Status" column by the symbol. When you come to use
the symbol for creating software (without an error message appearing), you must have entered the
symbolic name, the address, and the data type.
To enter new symbols in the symbol table, position the cursor in the first empty row of the table and
fill out the cells. You can insert new rows before the current row in the symbol table using the menu
command Insert > Symbol. If the row before the cursor position already contains an address, you
will be supported when inserting new symbols by a presetting of the "Address" and "Data Type"
columns. The address is derived from the previous row; the default data type is entered as data
type.
You can copy and modify existing entries using the commands in the Edit menu. Save and then
close the symbol table. You can also save symbols which have not been completely defined.
When you enter the symbols, you should note the following points:
Column Note
Symbol The name must be unique within the whole symbol table. When you confirm the entry in
this field or exit the field, a non-unique symbol is marked. The symbol can contain up to 24
characters. Quotation marks (") are not permitted.
Address When you confirm the entry in this field or exit the field, a check is made as to whether the
address entered is allowed.
Data Type When you enter the address, this field is automatically assigned a default data type. If you
change this default, the program checks whether the new data type matches the address.
Comment You can enter comments here to briefly explain the functions of the symbols (max. 80
characters). Entering a comment is optional.
The procedure described below shows you how you can change symbols or define new symbols in
a dialog box while programming blocks without having to display the symbol table.
This procedure is useful if you only want to edit a single symbol. If you want to edit a number of
symbols, you should open the symbol table and work in it directly.
Entering Symbols
To enter new symbols in the symbol table, position the cursor in the first empty row of the table and
fill out the cells. You can insert new empty rows before the current row in the symbol table using
the menu command Insert > Symbol. You can copy and modify existing entries using the
commands in the Edit menu. Save and then close the symbol table. You can also save symbols
that have not been completely defined.
Sorting Symbols
The data records in the symbol table can be sorted alphabetically according to symbol, address,
data type, or comment.
You can change the way the table is sorted by using the menu command View > Sort to open a
dialog box and define the sorted view.
Filtering Symbols
You can use a filter to select a subset of the records in a symbol table.
Using the menu command View > Filter you open the "Filter" dialog box.
You can define criteria that the records must fulfill in order to be included in the filtered view. You
can filter according to:
• Symbol names, addresses, data types, comments
• Symbols with operator control and monitoring attribute, symbols with communication
properties, symbols for binary variables for messages (bit memory or process input)
• Symbols with the status "valid," "invalid (non-unique, incomplete)"
The individual criteria are linked by an AND operation. The filtered records start with the specified
strings.
If you want to know more about the options in the "Filter" dialog box, open the context-sensitive
online help by pressing F1.
Symbol definition based solely on a distinction between upper and lower case characters is now no
longer supported. Previously, for example, the following definition was possible in the symbol table:
Motor1 = I 0.0
motor1 = I 1.0
The symbols were distinguished on the basis of the case used for the first letter. This type of
differentiation carries with it a significant risk of confusion. The new definition eliminates this
possible source of errors.
Symbols which Differ from One Another Only in their Use of Upper and Lower Case Characters
Conflict:
If the symbol table has not yet been edited with the current version of the software, the first of the
non-unique symbols in the table is used when source files are compiled.
If the symbol table has already been edited, such symbols are invalid; this means that the symbols
are not displayed when blocks are opened and source files containing these symbols can no longer
be compiled without errors.
Remedy:
Check your symbol table for conflicts by opening the table and saving it again. This action enables
the non-unique symbols to be recognized. You can then display the non-unique symbols using the
filter "Non-Unique Symbols" and correct them. You should also correct any source files which
contain conflicts. You do not need to make any further changes to the blocks, as the current (now
conflict-free) version of the symbol table is automatically used or displayed when a block is opened.
Parameters which Differ from One Another Only in their Use of Upper and Lower Case
Characters
Conflict:
Source files containing such interfaces can no longer be compiled without errors. Blocks with such
interfaces can be opened, but access to the second of these parameters is no longer possible.
When you try to access the second parameter, the program automatically returns to the first
parameter when the block is saved.
Remedy:
To check which blocks contain such conflicts, it is advisable to generate a source file for all the
blocks of a program using the function "Generate Source File." If errors occur when you attempt to
compile the source file you have created, there must be a conflict.
Correct your source files by ensuring that the parameters are unique; for example, by means of the
"Find and Replace" function. Then compile the files again.
Symbols which Differ from Parameters Only in their Use of Upper and Lower Case Characters
Conflict:
If shared and local symbols in a source file only differ from one another in their use of upper and
lower case characters, and is no initial characters have been used to identify shared ("symbol
name") or local (#symbol name) symbols, the local symbol will always be used during compilation.
This results in a modified machine code.
Remedy:
In this case it is advisable to generate a new source file from all of the blocks. This will
automatically assign local and shared access with the corresponding initial characters and will
ensure that they are handled correctly during future compilation procedures.
You can export the current symbol table to a text file in order to be able to edit it with any text
editor.
You can also import tables created using another application into your symbol table and continue to
edit them there. The import function can be used, for example, to include in the symbol table
assignment lists created with STEP5/ST following conversion.
The file formats *.SDF, *.ASC, *.DIF, and *.SEQ are available to choose from.
The following file formats can be imported into or exported out from the symbol table:
• ASCII file format (ASC)
• Data Interchange Format (DIF)
You can open, edit, and save DIF files in Microsoft Excel.
• System Data Format (SDF)
You can open, edit, and save SDF files in Microsoft Access.
- To import and export data to and from the Microsoft Access application, use the SDF file
format.
- In Access, select the file format "Text (with delimiters)".
- Use the double inverted comma (") as the text delimiter.
- Use the comma (,) as the cell delimiter.
Header: the file header must contain the record types TABLE, VECTORS, TUPLES, and DATA in
the order specified. Before DATA, DIF files can contain further, optional record types. These are,
however, ignored by the Symbol Editor.
Data: in the data part, each entry consists of three parts: the ID for the Type (data type), a numeric
value, and an alphanumeric part.
You can open, edit, and save DIF files in Microsoft Excel. You should not use accents, umlauts, or
other special language characters.
To open an SDF file in Microsoft Access you should select the file format 'Text (with delimiter)'. Use
the double quotation mark (") as the text delimiter and the comma (,) as the field delimiter.
As of STEP 7 V5.3, you can now select and edit contiguous areas within a symbol table. This
means that you can copy and/or cut parts of one symbol table and insert them into another symbol
table or delete them as required.
This makes it easier to update symbol tables by quickly transferring data from one symbol table to
another.
Incremental Editors for the Programming Languages Ladder Logic (LAD), Function Block
Diagram (FBD), Statement List (STL), or S7-GRAPH
In the incremental input mode editors for Ladder, FBD, STL, and S7-GRAPH, you create blocks
that are stored in the user program. You should choose to use incremental input mode if you want
to check what you have entered immediately. This edit mode is particularly suitable for beginners.
In incremental input mode, the syntax of each line or element is checked immediately after it has
been entered. Any errors are indicated and must be corrected before completing the entry. Entries
with correct syntax are automatically compiled and stored in the user program.
Any symbols used must be defined before editing the statements. If certain symbols are not
available, the block can not be fully compiled; this inconsistent interim version can, however, be
saved.
Source Code (Text) Editors for the Programming Languages STL, S7 SCL, or S7 HiGraph
In source code editors, you create source code files for subsequent compilation to generate
blocks.
We recommend you use source code editing, as this is a highly efficient program editing and
monitoring method.
The source code of the program or block is edited in a text file and then compiled.
The text files (source files) are stored in the sources folder of your S7 program, for example, as an
STL source file or SCL source file. A source file can contain code for one or multiple blocks. The
STL and SCL text editors allow you to generate source code for OBs, FBs, FCs, DBs, and UDTs
(user-defined data types), though you can use them to create a complete user program. One such
text file may contain the complete program (that is, all blocks) for a CPU.
When you compile the source file, the corresponding blocks will be generated and written to the
user program. All symbols used must be defined before you can compile them. Data errors are not
reported until the respective compiler interprets the source file.
It is imperative for compilation to stay conform with the prescribed syntax of the programming
language. A syntax check is only performed on account of a user instruction or when the source file
is compiled into blocks.
If blocks contain no errors, you can switch between Ladder Logic, Function Block Diagram, or
Statement List format. Program parts that cannot be displayed in the target language are shown in
Statement List format.
Under STL, you can generate blocks from source files and vice versa.
The graphic programming language Ladder Logic (LAD) is based on the representation of circuit
diagrams. The elements of a circuit diagram, e.g. normally open contacts and normally closed
contacts, are combined to form networks. The code section of a logic block represents one or more
networks.
The programming language LAD is supplied with the standard STEP 7 software package.
Programs are created under LAD with an incremental editor.
The programming language Function Block Diagram (FBD) is based on graphic logic symbols also
known in Boolean algebra. Complex functions such as math functions can also be displayed
directly in combination with the logic boxes.
The programming language FBD is supplied with the standard STEP 7 software package.
The programming language STL is a text-based programming language with a structure similar to
machine code. Each statement represents a program processing operation of the CPU. Multiple
statements can be linked to form networks.
The programming language STL is supplied with the standard STEP 7 software package. With this
programming language, you can use incremental editors to edit S7 blocks and you can create and
compile STL program source files in a source code editor to generate blocks.
Example:
FUNCTION_BLOCK FB20
VAR_INPUT
ENDVAL: INT;
END_VAR
VAR_IN_OUT
IQ1 : REAL;
END_VAR
VAR
INDEX: INT;
END_VAR
BEGIN
CONTROL:=FALSE;
IQ1:= IQ1 * 2;
CONTROL = TRUE
END_IF
END_FOR;
END_FUNCTION_BLOCK
The graphic programming language S7-GRAPH is available as optional package. It allows you to
program sequential controls. This includes the creation of sequencers and the specification of
corresponding step contents and transitions. You program the contents of the steps in a special
programming language (similar to STL). Transitions are programmed in a Ladder Logic Editor (a
light version of LAD).
S7-GRAPH displays even complex sequences very clearly and makes programming and
troubleshooting more effective.
Blocks Created
With the S7-GRAPH editor you program the function block that contains the sequencer. A
corresponding instance DB contains the data for the sequencer, e.g. the FB parameters, step and
transition conditions. You can generate this instance DB automatically in the S7-GRAPH editor.
Source File
A text-based source file (GRAPH source file) can be generated from a function block created in S7-
GRAPH which can be interpreted by OPs or text-based displays for displaying the sequencer.
The graphic programming language S7 HiGraph is available as an optional package. It allows you
to program a number of the blocks in your program as status graphs. Here you split your system
into dedicated functional units which can acquire different states and you define the transition
conditions between states. You describe the actions assigned to the states and the conditions for
the transitions between the states in a zoom-type language similar to Statement List.
You create a graph for each functional unit that describes the response of this functional unit. The
plant graphs are gathered in graph groups. The graphs can communicate to synchronize functional
units.
The well arranged view of the status transitions of a functional unit allows systematic programming
and simplifies debugging. The difference between S7-GRAPH and S7-HiGraph is, that the latter
acquires only one state (in S7-GRAPH: "step") at any one time. The figure below shows how to
create graphs for functional units (example).
A graph group is stored in a HiGraph source file in the "Source" folder of the S7 program. This
source file is then compiled to generate S7 blocks for the user program.
Syntax and formal parameters are checked after the last entry was made in a graph (when the
working window is closed). Addresses and symbols are not checked until the source file is being
compiled.
The optional software package CFC (Continuous Function Chart) is a programming language used
to link complex functions graphically.
You use the programming language S7 CFC to link existing functions. You do not need to program
many standard functions yourself, instead you can use libraries containing standard blocks (for
example, for logic, math, control, and data processing functions). To use CFC you do not require
any detailed programming knowledge or specific knowledge of programmable control, and you can
concentrate on the technology used in your branch of industry.
The program created is stored in the form of CFC charts. These are stored in the "Charts" folder
beneath the S7 program. These charts are then compiled to form the S7 blocks for the user
program.
You may want to create blocks to be connected yourself, in which case you program them for
SIMATIC S7 with one of the S7 programming languages.
You can create the program for an S7 CPU in the form of:
• Blocks
• Source files
The folder "Blocks" is available under the S7 program for storing blocks.
This block folder contains the blocks you need to download to the S7 CPU for your automation
task. These loadable blocks include logic blocks (OBs, FBs, FCs) and data blocks (DB). An empty
organization block OB1 is automatically created with the block folder because you will always need
this block to execute your program in the S7 CPU.
The block folder also contains the following objects:
• The user-defined data types (UDT) you created. These make programming easier but are not
downloaded to the CPU.
• The variable tables (VAT) that you can create to monitor and modify variables for debugging
your program. Variable tables are not downloaded to the CPU.
• The object "System Data" (system data blocks) that contains the system information (system
configuration, system parameters). These system data blocks are created and supplied with
data when you configure the hardware.
• The system functions (SFC) and system function blocks (SFB) that you need to call in your
user program. You cannot edit the SFCs and SFBs yourself.
With the exception of the system data blocks (which can only be created and edited via the
configuration of the programmable logic controller), the blocks in the user program are all edited
using the respective editor. This editor is started automatically by double-clicking the respective
block.
Note
The blocks you programmed as source files and then compiled are also stored in the block folder.
Instead of entering all the data types singly or as a structure, you only need to specify "UDT20" as
the data type and STEP 7 automatically assigns the corresponding memory space.
Once you have created a UDT, you can use the UDT like a data type if, for example, you declare
the data type UDT200 for a variable in a DB (or in the variable declaration of an FB).
The following figure shows a DB with the variables process_data_1 with the data type UDT200.
You only specify UDT200 and process_data_1. The arrays shown in italics are created when you
compile the DB.
Note
If you call a block created in the S7-SCL programming language that contains a UDT parameter in
the program editor, this can result in a type conflict. You should therefore avoid using blocks
created in SCL if you use UDTs.
If, for example, you structure a UDT for a formula (for example, for blending colors), you can assign
this UDT to several DBs each containing different amounts.
The structure of the data block is determined by the UDT assigned to it.
You can more easily identify the blocks you created if you use block properties and you can also
protect these blocks from unauthorized changes.
You should edit the block properties when the block is open. In addition to the properties you can
edit, the properties dialog box also displays data for your information only: you cannot edit this
information.
The block properties and system attributes are also displayed in the SIMATIC Manager in the
object properties for a block. Here you can only edit the properties NAME, FAMILY, AUTHOR, and
VERSION.
You edit the object properties after you insert the block via the SIMATIC Manager. If a block was
created using one of the editors and not in the SIMATIC Manager, these entries (programming
language) are saved automatically in the object properties.
Note
The mnemonics you want to use to program your S7 blocks can be set in the SIMATIC Manager
using the menu command Options > Customize and the "Language" tab.
Property OB FB FC DB UDT
KNOW_HOW_PROTECT • • • • −
AUTHOR • • • • −
FAMILY • • • • −
NAME • • • • −
VERSION • • • • −
UNLINKED − − − • −
READ_ONLY − − − • −
Non-Retain − − − • −
Read-only block • • • • •
The KNOW_HOW_PROTECT property can be set in a source file when you program the block. It
is displayed in the "Block Properties" dialog box but cannot be changed.
9.3.5 Rewiring
To rewire:
1. Select the "Blocks" folder that contains the individual blocks you want to rewire in the SIMATIC
Manager.
2. Select the menu command Options > Rewire.
3. Enter the required replacements (old address/new address) in the table in the "Rewire" dialog
box.
4. Select the option "All addresses within the specified address area" if you want to rewire
address areas (BYTE, WORD, DWORD).
Example: You enter IW0 and IW4 as the address areas. The addresses I0.0 – I1.7 are then
rewired to the addresses I4.0 – I5.7. Addresses from the rewired area (for example, I0.1) can
then no longer be entered in the table individually.
5. Click the "OK" button.
This starts the rewire process. After rewiring is completed, you can specify in a dialog box whether
you want to see the info file on rewiring. This info file contains the address lists "Old address" and
"New address." The individual blocks are listed with the number of wiring processes that have been
carried out in each one.
When rewiring, the following should be noted:
• When you rewire (that is, rename) a block, the new block cannot currently exist. If the block
exists, the process is interrupted.
• When you rewire a function block (FB), the instance data block is automatically assigned to the
rewired FB. The instance DB does not change, that is, the DB number is retained.
Introduction
To compare blocks that are in different locations, you can start the block comparison process in
either of the following ways:
• Go to the SIMATIC Manager and select the Options > Compare Blocks menu command. In the
"Compare Blocks - Results" dialog box that is displayed, click the "Go to" button. The results of
the comparison will appear in the program editor (LAD/FBD/STL) in the "Comparison" tab
• Go to the program editor. Select the Options > Compare On-/Offline Partners menu command.
The following sections explain how the block-comparison process functions. In the following
discussion, a distinction is maintained between logic blocks (OBs, FBs, FCs) and data blocks
(DBs).
The effect of the "Including SDBs" option during an ONLINE/offline comparison of blocks in the
SIMATIC Manager is described in the section: Comparing System Data Blocks (SDBs)
Note
When comparing an offline block folder with an online one, only loadable block types (OB, FB, ...)
are compared. When comparing offline/online or Path1/Path2, all blocks included in a multiple
selection are compared, even if some of then are not loadable ones (i.e. variable tables or UDTs).
A description of the attributes can be found in the reference help on system attributes:
Jumps to Language Descriptions and Help on Blocks and System Attributes
Creating Libraries
You can create libraries just like projects using the menu command File > New. The new library is
created in the directory you set for libraries in the "General" tab when you selected the menu
command Options > Customize.
Note
The SIMATIC Manager allows names that are longer than eight characters. The name of the library
directory is, however, cut off to eight characters. Library names must therefore differ in their first
eight characters. The names are not case-sensitive. When this directory is opened in the Browser,
the full name is displayed again, but when browsing for the directory, only the shortened name
appears.
Note that you cannot use blocks from libraries of a new STEP 7 version in projects of an older
STEP 7 version.
Opening Libraries
To open an existing library, enter the menu command File > Open. Then select a library in the
dialog boxes that follow. The library window is then opened.
Note
If you cannot find the library you require in the library list, click the "Browse" button in the "Open"
dialog box. The standard Windows browser then displays the directory structure in which you can
search for the library.
Note that the name of the file always corresponds to the original name of the library when it was
created, meaning any name changes made in the SIMATIC Manager are not made at file level.
When you select a library it is added to the library list. You can change the entries in the library list
using the menu command File > Manage.
Copying Libraries
You copy a library by saving it under another name using the menu command File > Save As.
You copy parts of a library such as programs, blocks, source files etc. using the menu command
Edit > Copy.
Deleting a Library
You delete a library using the menu command File > Delete.
You delete parts of a library such as programs, blocks, source files etc. using the menu command
Edit > Delete.
The STEP 7 standard software package contains the following standard libraries
• System Function Blocks: System Function Blocks (SFBs) and System Functions (SFCs)
• S5-S7 Converting Blocks: Blocks for converting STEP 5 programs
• IEC Function Blocks: Blocks for IEC functions, e.g. for processing time and date information,
comparison operations, string processing and selecting the min./max. values
• Organization Blocks: Default organization blocks (OB)s
• PID Control Blocks: Function Blocks (FBs) for PID control
• Communication Blocks: Functions (FCs) and function blocks for SIMATICNET CPs.
• TI-S7 Converting Blocks: Standard functions for general use
• Miscellaneous Blocks: Blocks for time stamping and for TOD synchronization
When you install optional software packages, other libraries may be added.
Note
When you install STEP 7, the supplied libraries are always copied. If you edit these libraries, the
modified libraries will be overwritten with the originals when STEP 7 is installed again.
For this reason, you should copy the supplied libraries before making any changes and then only
edit the copies.
The window of the program editor is split into the following areas:
Tables
The "Program Elements" tab displays a table of the program elements you can insert into your
LAD, FBD or STL program. The "Call Structure" tab shows the call hierarchy of the blocks in the
current S7 program.
Variable Declaration
The variable declaration is split in to the sections "Variable Table" and "Variable Detail View".
Instructions
The instruction list shows the block code that is to be processed by the PLC. It consists of one or
several networks.
Details
The various tabs in the "Details" window provide functions, for example, for displaying error
messages, editing symbols, providing address information, controlling addresses, comparing
blocks and for editing error definitions for hardware diagnostics.
Logic blocks (OBs, FBs, FCs) consist of a variable declaration section, a code section as well as
their properties. When programming, you must edit the following three parts:
• Variable declaration: In the variable declaration you specify the parameters, system attributes
for parameters, and local block-specific variables.
• Code section: In the code section you program the block code to be processed by the
programmable controller. This consists of one or more networks. To create networks you can
use, for example, the programming languages Ladder Logic (LAD), Function Block Diagram
(FBD), or Statement List (STL).
• Block properties: The block properties contain additional information such as a time stamp or
path that is entered by the system. In addition, you can enter your own details such as name,
family, version, and author and you can assign system attributes for blocks.
In principle it does not matter in which order you edit the parts of a logic block. You can, of course,
also correct them and add to them.
Note
If you want to make use of symbols in the symbol table, you should first check that they are
complete and make any necessary corrections.
Before you start programming, you should make yourself familiar with the settings in the editor in
order to make it easier and more comfortable for you when programming.
Using the menu command Options > Customize you open a tabbed dialog box. In the various
tabs you can make the following default settings for programming blocks, e.g. in the "General" tab:
• The fonts (type and size) for text and tables.
• Whether you want symbols and comments to be displayed with a new block.
You can change the settings for language, comments, and symbols during editing using the
commands in the View >… menu.
You can change the colors used for highlighting, for example, networks or statement lines in the
"LAD/FBD" tab.
When editing a project, a common database is often used, meaning that a number of personnel
may want to access the same block or data source at the same time.
The read/write access rights are assigned as follows:
• Offline editing:
When you attempt to open a block/source file, a check is made to see whether you have 'write'
access to the object. If the block/source file is already open, you can only work with a copy. If
you then attempt to save the copy, the system queries whether you want to overwrite the
original or save the copy under a new name.
• Online editing:
When you open an online block via a configured connection, the corresponding offline block is
disabled, preventing it from being edited simultaneously.
The "Program elements" tab in the overview window provides LAD and FBD elements as well as
already declared multiple instances, pre-configured blocks and blocks from libraries. You can
access the tab via menu command View > Tables. You can also insert program elements in the
code section using the menu command Insert > Program Elements.
After you open a logic block, a window opens that contains in the upper section the variable table
and the variable detail view for the block as well as the instruction list in the lower section in which
you edit the actual block code.
In the variable detail view, you specify the local variables and the formal parameters for the block
as well as the system attributes for parameters. This has the following effects:
• During declaration, sufficient memory space is reserved for temporary variables in the local
data stack, and in the case of function blocks, for static variables in the instance DB to be
associated later.
• When setting input, output, and in/out parameters you also specify the "interface" for the call of
a block in the program.
• When you declare the variables in a function block, these variables (with the exception of the
temporary variables) also determine the data structure for every instance DB that is associated
with the function block.
• By setting system attributes you assign special properties, for example, for the configuration of
message and connection functions, for operator control and monitoring functions and the
process control configuration.
10.2.2 Interaction Between The Variable Detail View And The Instruction List
The variable declaration and instruction list of logic blocks are closely related, because for
programming the names specified in the variable declaration are used in the instruction list. All
changes in the variable declaration will therefore influence the entire instruction list.
Change to comments, faulty input of a new variable, change to an initial value, or deleting an
unused variable has no effect on the instruction list.
The variable declaration window consists of the overview of variables and of the variable detail
view.
After you have generated and opened a new code block, a default variable table is displayed. It
lists only the declaration types (in, out, in_out, stat, temp) permitted for the selected block, namely
in the prescribed order. You can edit the default variable declaration that is displayed after you
have generated a new OB.
Permitted data types of local data for the various block types are found under Assigning the Data
Typs To Local Data Of Code Blocks.
It is possible that you may want to or have to use a restricted number of data blocks for instance
data owing to the performance (for example, memory capacity) of the S7 CPUs you are using. If
other existing function blocks are called in an FB in your user program (call hierarchy of FBs), you
can call these other function blocks without their own (additional) instance data blocks.
Use the following solution:
• Include the function blocks you want to call as static variables in the variable declaration of the
calling function block.
• In this function block, call other function blocks without their own (additional) instance data
blocks.
• This concentrates the instance data in one instance data block, meaning you can use the
available number of data blocks more effectively.
The following example illustrates the solution described: FB2 and FB3 use the instance DB of the
function block FB1 from which they were called.
Only requirement: You must "tell" the calling function block which instances you are calling and
what (FB) type these instances are. These details must be entered in the declaration window of the
calling function block. The function block used must have at least one variable or parameter from
the data area (VAR_TEMP cannot be used).
Do not use multiple instance data blocks if online changes are expected while the CPU is running.
Surge-free reloading is only guaranteed when using instance data blocks.
Note
• You can also create multiple instances for system function blocks.
• If the function block was not created as being able to have multiple instances and you want it to
have this property, you can generate a source file from the function block in which you then
delete the block property CODE_VERSION1 and then compile the function block again.
1. Open the function block from which the subordinate function blocks are to be called.
2. Define a static variable in the variable declaration of the calling function block for each call of a
function block for whose instance you do not want to use an instance data block.
- In the variable table, select hierarchy level "STAT".
- Enter a name for the FB call in the "Name" column of the variable detail view
- Enter the function block you want to call in the "Data type" column as an absolute address
or with its symbolic name.
- You can enter any explanations required in the comment column.
In the code section you program the sequence for your logic block by entering the appropriate
statements in networks, depending on the programming language chosen. After a statement is
entered, the editor runs an immediate syntax check and displays any errors in red and italics.
The code section for a logic block generally comprises a number of networks that are made up of a
list of statements.
In a code section you can edit the block title, block comments, network title, network comments,
and statement lines within the networks.
Structure of the Code Section Using the STL Programming Language as an Example
You can edit the parts of the code section in any order. We recommend you proceed as follows
when you program a block for the first time:
You can make changes in either overwrite mode or insert mode. You switch between modes using
the INSERT key.
Using the menu command Insert > Symbol you can insert symbols in the code section of your
program. If the cursor is positioned at the beginning, the end, or within a string, the symbol is
already selected that starts with this string - if such a symbol exists. If you change the string, the
selection is updated in the list.
Separators for the beginning and end of a string are, for example, blank, period, colon. No
separators are interpreted within shared symbols.
To enter symbols, proceed as follows:
1. Enter the first letter of the required symbol in the program.
2. Press CTRL and J simultaneously to display a list of symbols. The first symbol starting with the
letter you entered is already selected.
3. Enter the symbol by pressing RETURN or select another symbol.
The symbol enclosed in quotation marks is then entered instead of the first letter.
In general the following applies: if the cursor is located at the beginning, the end, or within a string,
this string is replaced by the symbol enclosed in quotation marks when inserting a symbol.
1. Activate the comments with the menu command View > Display with > Comments (a check
mark is visible in front of the menu command).
2. Position the cursor in the gray field below the block name or below the network name by
clicking with the mouse. The gray comment field appears white and has a border.
3. Enter your comment in the open text box. You are allowed 64 Kbytes per block for block
comments and network comments.
4. Exit the text box by clicking with the mouse outside the text box, by pressing the TAB key, or
using the key combination SHIFT+TAB.
5. If you select the menu command View > Display with > Comments again, you can switch off
the comments again (the check mark disappears).
Comments make your user program easier to read and therefore make commissioning and
troubleshooting easier and more effective. They are an important part of the program
documentation and should certainly be made use of.
To assign network titles automatically, select menu command Options > Settings and click on the
option "Automatic Assignment of Network Title" in the "General" tab. The symbol comment of the
first address entered will then be applied as network title.
Note
You can also drag and drop the template from the tab to the editor window.
Errors in the code section are easy to recognize by their red color. To make it easier to navigate to
errors that lie outside the visible area on the screen, the editor offers two search functions Edit >
Go To > Previous Error/Next Error.
The search for errors goes beyond one network. This means that the whole code section is
searched and not just one network or the area currently visible on the screen.
If you activate the status bar using the menu command View > Status Bar, notes on the errors
found are displayed there.
You can also correct errors and make changes in overwrite mode. You toggle between insert mode
and overwrite mode using the INSERT key.
You will find a description of the Ladder Logic programming language representation in the "Ladder
Logic for S7-300/400 - Programming Blocks" manual or in the Ladder Logic online help.
A Ladder network can consist of a number of elements in several branches. All elements and
branches must be connected; the left power rail does not count as a connection (IEC 1131-3).
When programming in Ladder you must observe a number of guidelines. Error messages will
inform you of any errors you make.
Positioning Boxes
The starting point of the branch for a box connection must always be the left power rail. Logic
operations or other boxes can be present in the branch before the box.
Positioning Coils
Coils are positioned automatically at the right edge of the network where they form the end of a
branch.
Exceptions: Coils for midline outputs _/(#)_/ and positive _/(P)_/ or negative _/(N)_/ edge
evaluation cannot be placed either to the extreme left or the extreme right in a branch. Neither are
they permitted in parallel branches.
Some coils require a Boolean logic operation and some coils must not have a Boolean logic
operation.
• Coils which require Boolean logic:
- Output _/( ), set output _/(S), reset output _/(R)
- Midline output _/(#)_/, positive edge _/(P)_/, negative edge _/(N)_/
- All counter and timer coils
- Jump if Not _/(JMPN)
- Master Control Relay On _/(MCR<)
- Save RLO into BR Memory _/(SAVE)
- Return _/(RET)
• Coils which do not permit Boolean logic:
- Master Control Relay Activate _/(MCRA)
- Master Control Relay Deactivate _/(MCRD)
- Open Data Block _/(OPN)
- Master Control Relay Off _/(MCR>)
All other coils can either have Boolean logic operations or not.
Parallel Branches
• Draw OR branches from left to right.
• Parallel branches are opened downwards and closed upwards.
• A parallel branch is always opened after the selected Ladder element.
• A parallel branch is always closed after the selected Ladder element.
• To delete a parallel branch, delete all the elements in the branch. When the last element in the
branch is deleted, the branch is removed automatically.
Constants
Binary links cannot be assigned constants (i.e. TRUE or FALSE). Instead, use addresses of the
data type BOOL.
Short Circuit
No branches may be created which cause a short circuit. The following figure shows an example:
You will find a description of the programming language "FBD" in the "Function Block Diagram for
S7-300/400 - Programming Blocks" manual or in the FBD online help.
An FBD network can consist of a number of elements. All elements must be interconnected (IEC
1131-3).
When programming in FBD, you must observe a number of rules. Error messages will inform you
of any errors you make.
Positioning Boxes
You can add standard boxes (flip flops, counters, timers, math operations, etc.) to boxes with
binary logic operations (&, >=1, XOR). The exceptions to this rule are comparison boxes.
No separate logic operations with separate outputs can be programmed in a network. You can,
however, assign a number of assignments to a string of logic operations with the help of a branch.
The following figure shows a network with two assignments.
The following boxes can only be placed at the right edge of the logic string where they close the
string:
• Set counter value
• Assign parameters and count up, assign parameters and count down
• Assign pulse timer parameters and start, assign extended pulse timer parameters and start
• Assign on-delay/off-delay timer parameters and start
Some boxes require a Boolean logic operation and some boxes must not have a Boolean logic
operation.
Constants
Binary links cannot be assigned constants (i.e. TRUE or FALSE). Instead, use addresses of the
data type BOOL.
You will find a description of the Statement List programming language representation in the
"Statement List for S7-300/400 - Programming Blocks" manual or in the STL online help (Language
Descriptions).
When you enter statements in STL in incremental input mode, you must observe the following
basic guidelines:
• The order in which you program your blocks is important. Called blocks must be programmed
before calling blocks.
• A statement is made up of a label (optional), instruction, address, and comment (optional).
Example: M001: A I 1.0 //Comment
• Every statement has its own line.
• You can enter up to 999 networks in a block.
• Each network can have up to approximately 2000 lines. If you zoom in or out, you can enter
more or fewer lines accordingly.
• When entering instructions or absolute addresses, there is no distinction made between lower
and upper case.
You can also use the incremental Editor to modify the interfaces of offline blocks that have been
edited with STEP 7, version 5:
1. Make sure that all the blocks have been compiled with STEP 7, version 5. To do this, generate
a source file for all the blocks and compile it.
2. Modify the interface of the relevant block.
3. Now open all the calling blocks one after another - the corresponding calls are displayed in red.
4. Select the menu command Edit > Block Call > Update.
5. Generate the relevant instance data blocks again.
Note
• Interface changes to a block opened online may cause the CPU to go into STOP mode.
• Rewiring block calls
First modify the numbers of the called blocks and then execute the Rewire function to match up
the calls.
Note
You can also save blocks or source files beneath other projects or libraries in the SIMATIC Manager (by
dragging & dropping, for example).
You can only save blocks or complete user programs to a memory card in the SIMATIC Manager.
If problems occur when saving or compiling large blocks, you should reorganize the project. Use the menu
command File > Reorganize in the SIMATIC Manager to do this. Then try to save or compile again.
Declaration View
You use the declaration view if you want to:
• View or determine the data structure of shared data blocks,
• View the data structure of data blocks with an associated user-defined data type (UDT), or
• View the data structure of data blocks with an associated function block (FB).
The structure of data blocks that are associated with a function block or user-defined data type
cannot be modified. To modify them you must first modify the associated FB or UDT and then
create a new data block.
Data View
You use the data view if you want to modify data. You can only display, enter, or change the actual
value of each element in the data view. In the data view of data blocks, the elements of variables
with complex data types are listed individually with their full names.
Column Explanation
Address Displays the address that STEP 7 automatically assigns for the variable when you finish
entering a declaration.
Declaration This column is only displayed for instance data blocks. It shows you how the variables in
the variable declaration of the function block are declared:
• Input parameter (IN)
• Output parameter (OUT)
• In/out parameter (IN_OUT)
• Static data (STAT)
Name Enter the symbolic name you have to assign to each variable here.
Type Enter the data type you want to assign to the variable (BOOL, INT, WORD, ARRAY, etc.).
The variables can have elementary data types, complex data types, or user-defined data
types.
Initial Value Here you can enter the initial value if you do not want the software to use the default value
for the data type entered. All values must be compatible with the data type.
When you save a block for the first time, the initial value is used as the current value if you
have not explicitly defined actual values for the variables.
Please note: Initial values cannot be downloaded to the CPU.
Comment Enter a comment in this field helps to document the variables. The comment can have up
to 79 characters.
Column Explanation
Address Displays the address that STEP 7 automatically assigns for the variable.
Declaration This column is only displayed for instance data blocks. It shows you how the variables in
the variable declaration of the function block are declared:
• Input parameter (IN)
• Output parameter (OUT)
• In/out parameter (IN_OUT)
• Static data (STAT)
Name The symbolic name assigned in the variable declaration for the variable. You cannot edit
this field in the data view.
Type Displays the data type defined for the variable.
For shared data blocks, only the elementary data types are listed here because the
elements are listed individually in the data view for variables with complex or user-
defined data types.
For instance data blocks the parameter types are also displayed, for in/out parameters
(IN_OUT) with complex or user-defined data types, a pointer points to the data type in
the "Actual Value" column.
Initial Value The initial value that you entered for the variable if you do not want the software to use
the default value for the specified data type.
When you save a data block for the first time, the initial value is used as the current value
if you have not explicitly defined actual values for the variables.
Please note: Unlike with actual values, initial values cannot be downloaded to the CPU.
Actual Value Offline: The value that the variable had when the data block was opened or to which you
last changed it and saved it (even if you opened the data block online, this display is not
updated).
Online: The current value on opening the data block is displayed but not updated
automatically. To update the view, press F5.
You can edit this field if it does not belong to an in/out parameter (IN_OUT) with a
complex or user-defined data type. All values must be compatible with the data type.
Please note. Only current values can be downloaded to the CPU/
Comment The comment entered to document the variable. You cannot edit this field in the data
view.
If you open a data block which is not assigned to a user-defined data type or function block, you
can define its structure in the declaration view of the data block. With data blocks which are not
shared, the declaration view cannot be changed.
1. Open a shared data block, meaning a block which is not associated with a UDT or FB.
2. Display the declaration view of the data block if this view is not set already.
3. Define the structure by filling out the table displayed in accordance with the information below.
With data blocks which are not shared, the declaration view cannot be modified.
Column Explanation
Address Displays the address which STEP 7 automatically assigns for the variable when you finish
entering a declaration.
Name Enter the symbolic name you have to assign to each variable here.
Type Enter the data type you want to assign to the variable (BOOL, INT, WORD, ARRAY, etc.).
The variables can have elementary data types, complex data types, or user-defined data
types.
Initial Value Here you can enter the initial value if you do not want the software to use the default value
for the data type entered. All values must be compatible with the data type.
When you save a block for the first time, the initial value is used as the actual value if you
have not explicitly defined actual values for the variables.
Comment Entering an optional comment in this field helps to document the variable. The comment can
have up to 79 characters.
11.4.2 Entering and Displaying the Data Structure of Data Blocks Referencing an
FB (Instance DBs)
Input
When you associate a data block with a function block (instance DB), the variable declaration of
the function block defines the structure of the data block. Any changes can only be made in the
associated function block.
1. Open the associated function block (FB).
2. Edit the variable declaration of the function block.
3. Create the instance data block again.
Display
In the declaration view of the instance data block you can display how the variables in the function
block were declared.
1. Open the data block.
2. Display the declaration view of the data block if this view is not set already.
3. See below for more information on the table displayed.
With data blocks which are not shared, the declaration view cannot be changed.
Column Explanation
Address Displays the address which STEP 7 automatically assigns for the variable.
Declaration This column shows you how the variables in the variable declaration of the function block
are declared:
• Input parameter (IN)
• Output parameter (OUT)
• In/out parameter (IN_OUT)
• Static data (STAT)
The declared temporary local data of the function block are not in the instance data block.
Name The symbolic name assigned in the variable declaration of the function block.
Type Displays the data type assigned in the variable declaration of the function block. The
variables can have elementary data types, complex data types, or user-defined data types.
If additional function blocks are called within the function block for whose call static
variables have been declared, a function block or a system function block (SFB) can also
be specified here as the data type.
Initial Value The initial value that you entered for the variable in the variable declaration of the function
block if you do not want the software to use the default value.
When you save a data block for the first time, the initial value is used as the actual value if
you have not explicitly defined actual values for the variables.
Comment The comment entered in the variable declaration for the function block to document the
data element. You cannot edit this field.
Note
For data blocks that are assigned to a function block, you can only edit the actual values for the
variables. To enter actual values for the variables, you must be in the data view of data blocks.
Column Explanation
Address Displays the address which STEP 7 automatically assigns for the variable when you finish
entering a declaration.
Name Enter the symbolic name you have to assign to each variable here.
Type Enter the data type you want to assign to the variable (BOOL, INT, WORD, ARRAY, etc.).
The variables can have elementary data types, complex data types, or their own user-
defined data types.
Initial Value Here you can enter the initial value if you do not want the software to use the default value
for the data type entered. All values must be compatible with the data type.
When you save an instance of the user-defined data type (or a variable, or a data block)
for the first time, the initial value is used as the actual value if you have not explicitly
defined actual values for the variables.
Comment Entering a comment in this field helps to document the variables. The comment can have
up to 79 characters.
11.4.4 Entering and Displaying the Structure of Data Blocks Referencing a UDT
Input
When you assign a data block to a user-defined data type, the data structure of the user-defined
data type defines the structure of the data block. Any changes can only be made in the associated
user-defined data type.
1. Open the user-defined data type (UDT).
2. Edit the structure of the user-defined data type.
3. Create the data block again.
Display
You can only display how the variables were declared in the user-defined data type in the
declaration view of the data block.
1. Open the data block.
2. Display the declaration view of the data block if this view is not set already.
3. See below for more information on the table displayed.
The declaration view cannot be modified. Any changes can only be made in the associated user-
defined data type.
Column Explanation
Address Displays the address which STEP 7 automatically assigns for the variable.
Name The symbolic name assigned in the variable declaration of the user data type.
Type Displays the data types assigned in the variable declaration of the user-defined data
type. The variables can have elementary data types, complex data types, or user-defined
data types.
Initial Value The initial value that you entered for the variable in the user-defined data type if you do
not want the software to use the default value.
When you save a data block for the first time, the initial value is used as the actual value
if you have not explicitly defined actual values for the variables.
Comment The comment entered in the variable declaration for the user-defined data type to
document the data element.
Note
For data blocks that are assigned to a user-defined data type, you can only edit the actual values
for the variables. To enter actual values for the variables, you must be in the data view of data
blocks.
Editing actual values is only possible in the data view of data blocks.
1. If necessary, toggle to the table display in the data view using the menu command View >
Data View.
2. Enter the required actual values for the data elements in the fields of the column "Actual
Value." The actual values must be compatible with the data type of the data elements.
Any incorrect entries (for example, if an actual value entered is not compatible with the data type)
made during editing are recognized immediately and shown in red. These errors must be corrected
before saving the data block.
Note
Any changes to the data values are only retained once the data block has been saved.
Resetting data values is only possible in the data view of data blocks.
1. If necessary, toggle to the table display in the data view using the menu command View >
Data View.
2. Select the menu command Edit > Initialize Data Block to do this.
All variables are assigned their intended initial value again, meaning the actual values of all
variables are overwritten by their respective initial value.
Note
Any changes to the data values are only retained once the data block has been saved.
To enter newly created blocks or changed data values in data blocks in the programming device
database, you must save the respective block. The data are then written to the hard disk of the
programming device.
Note
• You can also save blocks or source files beneath other projects or libraries in the
SIMATIC Manager (by dragging & dropping, for example).
• You can only save blocks or complete user programs to a memory card in the
SIMATIC Manager.
• If problems occur when saving or compiling large blocks, you should reorganize the project.
Use the menu command File > Reorganize in the SIMATIC Manager to do this. Then try to
save or compile again.
Note
You can determine if blocks that have the system attribute "S7_techparam" by selecting a block in
the SIMATIC Manager, selecting the menu command Edit > Object Properties and then opening
the "Attributes" tab.
When you create blocks in STL source files you should note the following:
• Guidelines for Programming STL Source Files
• Syntax and Formats for Blocks in STL Source Files
• Structure of Blocks in STL Source Files
An STL source file consists mainly of continuous text. To enable the file to be compiled into blocks,
you must observe certain structures and syntax rules.
The following general guidelines apply to creating user programs as STL source files:
Topic Rule
Syntax The syntax of the STL statements is the same as in the incremental Statement List
editor. One exception to this is the CALL instruction.
CALL In a source file, you enter parameters in brackets. The individual parameters are
separated by a comma.
Example: FC call (one line)
CALL FC10 (param1 :=I0.0,param2 :=I0.1);
Example: FB call (one line)
CALL FB10, DB100 (para1 :=I0.0,para2 :=I0.1);
Note:
When calling a block, transfer the parameters in the defined order in the ASCII
Editor. Otherwise the comment assignment for these lines may not match in the STL
and source file views.
Upper/lower case The editor in this application is not case-sensitive, the exception to this being
system attributes and jump labels. When entering strings (data type STRING) you
must also observe upper and lower case.
Keywords are shown in upper case. When compiled, upper and lower case are not
observed; therefore you can enter keywords in upper or lower case or a mixture of
the two.
Semicolon Designate the end of every STL statement and every variable declaration with a
semicolon (;). You can enter more than one statement per line.
Double slash (//) Begin every comment with a double slash (//) and end the comment with RETURN
(or line feed).
For every block in the source file you must declare the required variables.
The variable declaration section comes before the code section of the block.
The variables must - if they are being used - be declared in the correct sequence for declaration
types. This means all variables of one declaration type are together.
For Ladder, Function Block Diagram, and Statement List you fill out a variable declaration table, but
here you have to work with the relevant keywords.
Note
• The variable symbol must start with a letter. You may not assign a symbolic name for a
variable that is the same as one of the reserved keywords.
• If variable symbols are identical in the local declarations and in the symbol table, you can code
local variables by placing # in front of the name and putting variables in the symbol table in
quotation marks. Otherwise, the block interprets the variable as a local variable.
System attributes can be assigned to blocks and parameters. They control the message
configuration and connection configuration, operator interface functions, and process control
configuration.
The system attributes for blocks can be checked or changed in incremental input mode using the
menu command File > Properties under the "Attributes" tab.
The system attributes for parameters can be checked or changed in incremental input mode using
the menu command Edit > Object Properties. The cursor must be positioned in the name field of
the parameter declaration.
You can more easily identify the blocks you created if you use block properties and you can also
protect these blocks from unauthorized changes.
The block properties can be checked or changed in incremental input mode using the menu
command File > Properties under the "General - Part 1" and "General - Part 2" tabs.
The other block properties can only be entered in the source file.
The following applies in source files:
• Block properties precede the variable declaration section.
• Each block property has a line of its own.
• The line ends with a semicolon.
• The block properties are specified using keywords.
• If you enter block properties, they must appear in the sequence shown in the Table of Block
Properties.
• The block properties valid for each block type are listed in the Assignment: Block Property to
Block Type.
Note
The block properties are also displayed in the SIMATIC Manager in the object properties for a
block. The properties AUTHOR, FAMILY, NAME, and VERSION can also be edited there.
The following table shows which block properties can be declared for which block types:
Property OB FB FC DB UDT
KNOW_HOW_PROTECT • • • • −
AUTHOR • • • • −
FAMILY • • • • −
NAME • • • • −
VERSION • • • • −
UNLINKED − − − • −
NON_RETAIN − − − • −
READ_ONLY − − − • −
A logic block is made up of the following sections, each of which is identified by the corresponding
keyword:
• Block start,
• identified by keyword and block number or block name, for example
- "ORGANIZATION_BLOCK OB1" for an organization block,
- "FUNCTION_BLOCK FB6" for a function block, or
- "FUNCTION FC1 : INT" for a function. With functions the function type is also specified.
This can be an elementary or complex data type (with the exception of ARRAY and
STRUCT) and defines the data type of the return value (RET_VAL). If no value is to be
returned, the keyword VOID is given.
• Optional block title introduced by the keyword "TITLE" (max. length of title: 64 characters)
• Additional comments, beginning with a double slash // at the start of the line
• Block properties (optional)
• Variable declaration section
• Code section, beginning with "BEGIN." The code section consists of one or more networks that
are identified by "NETWORK." You cannot enter a network number.
• Optional network for each network used, introduced by the keyword "TITLE =" (max. length of
title: 64 characters)
• Additional comments for each network, beginning with a double slash // at the start of the line
• Block end, identified by END_ORGANIZATION_BLOCK, END_FUNCTION_BLOCK, or
END_FUNCTION
• A blank must be placed between the block type and the block number. The symbolic block
name can be identified by quotation marks to ensure that the symbolic names of local variables
and names in the symbol table remain unique.
A data block consists of the following areas that are introduced by their respective keywords:
• Block start, identified by keyword and block number or block name, for example,
DATA_BLOCK DB26
• Reference to an associated UDT or function block (optional)
• Optional block title introduced by the keyword TITLE = (entries longer than 64 characters are
cut off)
• Optional block comment, beginning with a double slash //
• Block properties (optional)
• Variable declaration section (optional)
• Assignment section with default values, beginning with BEGIN (optional)
• Block end, identified by END_DATA_BLOCK
A user-defined data type consists of the following areas that are introduced by their respective
keywords:
• Block start, identified by keyword TYPE and number or name, for example, TYPE UDT20
• Structured data type
• Block end, identified by END_TYPE
When you enter a user-defined data type, you must ensure that user-defined data types precede
the blocks in which they are used.
The following table shows a brief list of the format for organization blocks in an STL source file:
Structure Description
"ORGANIZATION_BLOCK" ob_no or ob_no is the block number, for example: OB1;
ob_name ob_name is the symbolic name of the block as defined in the
symbol table
[TITLE= ] Block title (entries longer than 64 characters are cut off)
[Block comment] Comments can be entered after "//"
[System attributes for blocks] System attributes for blocks
[Block properties] Block properties
Variable declaration section Declaration of temporary variables
"BEGIN" Keyword to separate the variable declaration section from the
list of STL instructions
NETWORK Start of a network
[TITLE= ] Network title (max. 64 characters)
[Network comment] Comments can be entered after "//"
List of STL instructions Block instructions
"END_ORGANIZATION_BLOCK" Keyword to end organization block
The following table shows a brief list of the format for function blocks in an STL source file:
Structure Description
"FUNCTION_BLOCK" fb_no or fb_name fb_no is the block number, for example FB6;
fb_name is the symbolic name of the block as defined in the
symbol table
[TITLE= ] Block title (entries longer than 64 characters are cut off)
[Block comment] Comments can be entered after "//"
[System attributes for blocks] System attributes for blocks
[Block properties] Block properties
Variable declaration section Declaration of input, output, and in/out parameters, and
temporary or static variables
The declaration of the parameters may also contain the
declarations of the system attributes for parameters.
"BEGIN" Keyword to separate the variable declaration section from the
list of STL instructions
NETWORK Start of a network
[TITLE= ] Network title (max. 64 characters)
[Network comment] Comments can be entered after "//"
List of STL instructions Block instructions
"END_FUNCTION_BLOCK Keyword to end function block
The following table shows a brief list of the format for functions in an STL source file:
Structure Description
"FUNCTION" fc_no : fc_type or fc_no is the block number, for example FC5;
fc_name : fc_type fc_name is the symbolic name of the block as defined in the
symbol table;
The following table shows a brief list of the format for data blocks in an STL source file:
Structure Description
"DATA_BLOCK" db_no or db_name db_no is the block number, for example DB5;
db_name is the symbolic name of the block as defined in the
symbol table
[TITLE= ] Block title (entries longer than 64 characters are cut off)
[Block comment] Comments can be entered after "//"
[System attributes for blocks] System attributes for blocks
[Block properties] Block properties
Declaration section Instance DB: specifies UDT or FB to which the block relates
as block number or name according to the symbol table.
Global DB: specifies the variables with their data type and
start value (optional)
"BEGIN" Keyword to separate the declaration section from the list of
value assignments
[Assignment of current values] Variables can have specific current values assigned.
Individual variables either have constants assigned or a
reference is made to other blocks.
"END_DATA_BLOCK" Keyword to end data block
The source file must be created in the source file folder beneath the S7 program. You can create
source files in the SIMATIC Manager or the editor window.
Creating Source Files in the SIMATIC Manager
1. Open the appropriate "Source Files" folder by double-clicking on it.
2. To insert an STL source file select the menu command Insert > S7 Software > STL Source
File.
Creating Source Files in the Editor Window
1. Select the menu command File > New.
2. In the dialog box, select the source file folder of the same S7 program that contains the user
program with the blocks.
3. Enter a name for the new source file.
4. Confirm with "OK".
The source file is created under the name you entered and is displayed in a window for editing.
The programming language and editor with which a source file is edited can be set in the object
properties for the source file. This ensures that the correct editor and the correct programming
language are started when the source file is opened for editing. The STEP 7 Standard package
supports programming in STL source files.
Other programming languages are also available as optional packages. You can only select the
menu command to insert the source file if the corresponding software option is loaded on your
computer.
To edit an S7 source file, proceed as follows:
1. Open the appropriate "Source Files" folder by double-clicking on it.
2. Start the editor required for editing as follows:
- Double-click the required source file in the right half of the window.
- Select the required source file in the right half of the window and select the menu
command Edit > Open Object.
To improve readability of text in source files, select menu command Options > Settings and the
"Source Code" tab. Specify the font, font style and color for the various elements of the source
code.
For example, you can specify to display line numbers and to display keywords in upper case
letters.
Block templates for organization blocks (OB), function blocks (FB), functions (FC), data blocks
(DB), instance data blocks, data blocks with associated user-defined data types, and user-defined
data types (UDT) are available for programming in STL source files. The block templates make it
easier to enter blocks in your source file and to observe syntax and structure guidelines.
To insert a block template, proceed as follows:
1. Activate the window of the source file in which you want to insert a block template.
2. Position the cursor at the point in the file after which you want to insert the block template.
3. Select one of the menu commands Insert > Block Template > OB/FB/FC/DB/Instance DB/DB
Referencing UDT/UDT.
The block template is inserted in the file after the cursor position.
You can insert the contents of other source files into your STL source file.
Proceed as follows:
1. Activate the window of the source file in which you want to insert the contents of another
source file.
2. Position the cursor at the location in the file after which you want to insert the source file.
3. Select the menu command Insert > Object > File.
4. Select the required source file in the dialog box which appears.
The contents of the selected source file are inserted after the cursor position. Line feeds (carriage
returns) are retained.
13.5.6 Inserting Source Code from Existing Blocks in STL Source Files
You can insert the source code from other blocks into your STL source file which were created in
Ladder, Function Block Diagram, or Statement List. This is possible for organization blocks (OB),
function blocks (FB), functions (FC), data blocks (DB), and user-defined data types (UDT).
Proceed as follows:
1. Activate the window of the source file in which you want to insert a block.
2. Position the cursor at the location in the file after which you want to insert the source code from
the block.
3. Select the menu command Insert > Object > Block.
4. Select the required block in the dialog box which appears.
An equivalent source file is generated from the block. The contents of the source file are inserted
after the cursor position.
You can create and edit a source file with any ASCII editor, then import it into a project and compile
it into individual blocks using this application. To do this, you must import the source files into the
"Source Files" folder of the S7 program in whose S7 user program the blocks created during
compilation are to be stored.
To insert an external source file, proceed as follows:
1. Select the source file folder of the S7 program in which the external source files are to be
imported.
2. Select the menu command Insert > External Source File.
3. In the dialog box which appears, enter the source file you want to import.
The file name of the source file you are importing must have a valid file extension. STEP 7 uses
the file extension to determine the source file type. This means, for example, that STEP 7 creates
an STL source file when it imports a file with the extension .AWL. Valid file extensions are listed in
the dialog box under "File Type."
Note
You can also use the menu command Insert > External Source File to import source files you
created with STEP 7 version 1.
You can generate an STL source file which you can edit with any text editor from existing blocks.
The source file is generated in the source file folder of the S7 program.
To generate a source file from a block, proceed as follows:
1. In the program editor, select the menu command File > Generate Source File.
2. In the dialog box, select the source file folder in which you want to create the new source file.
3. Enter a name for the source file in the text box.
4. In the "Select STEP 7 Blocks" dialog box, select the block(s) which you want to generate as the
given source file. The selected blocks are displayed in the right list box.
5. Confirm with "OK."
One continuous STL source file is created from the selected blocks and is displayed in a window
for editing.
Note
If the object name does not have a file extension, a file extension derived from the file type is
added to the file name. For example, the STL source file "prog" is exported to the file "prog.awl."
If the object name already has a valid file extension, this is retained and not changed. For example,
the STL source file "prog.awl" is exported to the file "prog.awl."
If an object name has an invalid file extension (meaning a period is contained in the name), no file
extension is added.
You will find a list of valid file extensions in the "Export Source File" dialog box under "File type."
You can save an STL source file at any time in its current state. The program is not compiled and
no syntax check is run, meaning any errors are saved as well.
Syntax errors are detected and reported only when the source file is compiled or following a
consistency check.
Using the menu command File > Consistency Check you can display any syntax errors in the
STL source file. In contrast to compiling, no blocks are generated.
When the consistency check is completed, a dialog box is displayed showing you the total number
of errors found.
Any errors that are found are listed individually in the lower part of the window with a line reference.
Correct these errors before compiling the source file so that all the blocks can be created.
The active window for source files is split into two. The following errors are listed in the lower half:
• Errors found after compilation was initiated via menu command File > Compile.
• Errors found after a consistency check was initiated via menu command File > Consistency
Check.
To find the location of an error in a source file, position the cursor on the "Error" tab of the message
window. The faulty element is automatically highlighted in the code section and an error message
is output at the status bar.
Requirements
In order to be able to compile the program you created in a source file into blocks, the following
requirements must be fulfilled:
• Only source files which are stored in the "Source Files" folder beneath an S7 program can be
compiled.
• As well as the "Source Files" folder, a "Blocks" folder must also lie beneath the S7 program in
which the blocks created during compilation can be stored. The blocks programmed in the
source file are only created if the source file was compiled without error. If there are a number
of blocks programmed in a source file, only those which contain no errors are created. You can
then open these blocks, edit them, download them to the CPU, and debug them individually.
ORGANIZATION_BLOCK OB1
TITLE = Example for OB1 with different block calls
//The 3 networks show block calls
//with and without parameters
BEGIN
NETWORK
TITLE = Function call transferring parameters
// Parameter transfer in one line
CALL FC1 (param1 :=I0.0,param2 :=I0.1);
NETWORK
TITLE = Function block call
// transferring parameters
// Parameter transfer in more than one line
CALL Traffic light control , DB6 ( // Name of FB, instance data block
dur_g_p := S5T#10S, // Assign actual values to parameters
del_r_p := S5T#30S,
starter := TRUE,
t_dur_y_car := T 2,
t_dur_g_ped := T 3,
t_delay_y_car := T 4,
t_dur_r_car := T 5,
t_next_red_car := T 6,
r_car := "re_main", // Quotation marks show symbolic
y_car := "ye_main", // names entered in symbol table
g_car := "gr_main",
r_ped := "re_int",
g_ped := "gr_int");
NETWORK
TITLE = Function block call
// transferring parameters
// Parameter transfer in one line
CALL FB10, DB100 (para1 :=I0.0,para2 :=I0.1);
END_ORGANIZATION_BLOCK
AUTHOR Siemens
FAMILY Throughput check
NAME : INCR_ITEM_NOS
VERSION : 1.0
VAR_IN_OUT
ITEM_NOS : INT; // No. of items currently manufactured
END_VAR
BEGIN
NETWORK
TITLE = Increment number of items by 1
// As long as the current number of items lies below 1000,
// the counter can be increased by 1
L ITEM_NOS; L 1000; // Example for more than one
> I; JC ERR; // statement in a line.
L 0; T RET_VAL;
L ITEM_NOS; INC 1; T ITEM_NOS; BEU;
ERR: L -1;
T RET_VAL;
END_FUNCTION
AUTHOR : Siemens
FAMILY : Throughput check
NAME : INCR_ITEM_NOS
VERSION : 1.0
VAR_IN_OUT
ITEM_NOS {S7_visible := 'true'}: INT; // No. of items currently manufactured
//System attributes for parameters
END_VAR
BEGIN
NETWORK
TITLE = Increment number of items by 1
// As long as the current number of items lies below 1000,
// the counter can be increased by 1
L ITEM_NOS; L 1000; // Example for more than one
> I; JC ERR; // statement in a line.
L 0; T RET_VAL;
L ITEM_NOS; INC 1; T ITEM_NOS; BEU;
ERR: L -1;
T RET_VAL;
END_FUNCTION
FUNCTION_BLOCK FB6
TITLE = Simple traffic light switching
// Traffic light control of pedestrian crosswalk
// on main street
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
condition : BOOL := FALSE; // Condition red for cars
END_VAR
BEGIN
NETWORK
TITLE = Condition red for main street traffic
// After a minimum duration has passed, the request for green at the
// pedestrian crosswalk forms the condition red
// for main street traffic.
A(;
A #starter; // Request for green at pedestrian crosswalk and
A #t_next_r_car; // time between red phases up
O #condition; // Or condition for red
);
AN #t_dur_y_car; // And currently no red light
= #condition; // Condition red
NETWORK
TITLE = Green light for main street traffic
AN #condition; // No condition red for main street traffic
= #g_car; // GREEN for main street traffic
NETWORK
TITLE = Duration of yellow phase for cars
// Additional program required for controlling
// traffic lights
END_FUNCTION_BLOCK
FUNCTION_BLOCK FB10
VAR_INPUT
para1 : bool;
para2: bool;
end_var
begin
end_function_block
data_block db10
FB10
begin
end_data_block
data_block db6
FB6
begin
end_data_block
Data Block:
DATA_BLOCK DB 10
TITLE = DB Example 10
STRUCT
aa : BOOL; // Variable aa of type BOOL
bb : INT; // Variable bb of type INT
cc : WORD;
END_STRUCT;
BEGIN // Assignment of actual values
aa := TRUE;
bb := 1500;
END_DATA_BLOCK
DATA_BLOCK DB 20
TITLE = DB (UDT) Example
UDT 20 // Specifies associated UDT
BEGIN
start := TRUE; // Assignment of actual values
setp := 10;
END_DATA_BLOCK
Note
The UDT used must come before the data block in the source file.
DATA_BLOCK DB 30
TITLE = DB (FB) Example
FB 30 // Specifies associated FB
BEGIN
start := TRUE; // Assignment of actual values
setp := 10;
END_DATA_BLOCK
Note
The associated function block must come before the data block in the source file.
TYPE UDT20
STRUCT
start : BOOL; // Variable of type BOOL
setp. : INT; // Variable of type INT
value : WORD; // Variable of type WORD
END_STRUCT;
END_TYPE
View Purpose
Cross-reference list Overview of the addresses in the memory areas I, Q, M, P, T, C, and DB, FB,
FC, SFB, SFC calls used in the user program.
Using the menu command View > Cross References for Address, you can
display all the cross-references including overlapping access to the selected
address.
Assignment list for inputs, Overview of which bits of the addresses in the memory areas I, Q, and M, and
outputs, and bit memory which timers and counters (T and C) are already occupied within the user
program; forms an important basis for troubleshooting or changes in the user
program
Program structure Call hierarchy of the blocks within a user program and an overview of the
blocks used and their nesting levels
Unused symbols Overview of all symbols which are defined in the symbol table but not used in
the parts of the user program for which reference data are available
Addresses without symbols Overview of all absolute addresses which are used in the parts of the user
program for which reference data are available but for which no symbol has
been defined in the symbol table
The reference data for the selected user program include all the lists in the table. It is possible to
create and display one or more of the lists for one user program or for more than one user
program.
The cross-reference list provides an overview of the use of addresses within the S7 user program.
When you display the cross-reference list you obtain a list of the addresses of memory areas input
(I), output (Q), bit memory (M), timer (T), counter (C), function block (FB), function (FC), system
function block (SFB), system function (SFC), I/O (P) and data block (DB), as used in the S7 user
program along with their addresses (absolute address or symbol) and usage. It is displayed in an
active window. The working window's title bar shows the name of the user program to which the
cross-reference list belongs.
Every line in the window corresponds to a cross-reference list entry. The search function makes it
easier for you to find specific addresses and symbols.
The cross-reference list is the default view when you display reference data. You can change this
default.
Structure
A cross-reference list entry consists of the following columns:
Column Content/Meaning
Address (symbol) Address
Block (symbol) Block in which the address is used
Type Whether a read (R) and/or write (W) access to the address is involved
Language Information on the programming language used to create the block
Location Double-click the location field to jump to the location of use for the selected
address.
The Block, Type, Language and Location columns are displayed only if the corresponding
properties were selected for the cross-reference list. This block information varies, depending on
the programming language the block was written in.
You can set the column width in the crossreference list shown on the screen as required using the
mouse.
Sorting
The crossreference list default option is to sort by memory areas. If you click a column header with
the mouse, you can sort the entries of this column by the default sort criteria.
The program structure describes the call hierarchy of the blocks within an S7 user program. You
are also given an overview of the blocks used, their dependencies, and their local data
requirements.
Using the menu command View > Filter in the "Generating Reference Data" window you open a
tabbed dialog box. In the "Program Structure" tab you can set how you want the program structure
displayed.
You can choose between:
• Call structure and
• Dependency structure
• Recursions in the call are recognized and indicated graphically in the call structure.
• Recursions within the call hierarchy are indicated by different symbols.
• Regularly called blocks (CALL), conditionally called blocks (CC) or unconditionally called
blocks (UC) are marked by different symbols.
• Blocks not called are displayed at the bottom of the call structure and marked with a black
cross. There is no further breakdown of the call structure of a block which is not called.
Call Structure
The complete call hierarchy is displayed.
If the program structure is to be created for all organization blocks (OB) and OB1 is not in the S7
user program, or if a starting block was specified which is not present in the program, you are
automatically prompted to specify another block for the program structure root.
Display of multiple calls of blocks can be deactivated by option settings, both for the call structure
and for the dependency structure.
Dependency Structure
The dependency structure shows the dependency of each block in the project on other blocks. The
block is displayed at the outer left and listed below in the indented segments are the blocks that call
or use this block.
The Assignment lists show you which addresses are already assigned in the user program. This
display is an important basis for troubleshooting or making changes in the user program.
The I/Q/M assignment list display gives you an overview of which bit in which byte of the memory
areas input (I), output (Q), bit memory (M), times (T) and counter (Z) is used. The I/Q/M
assignment list is displayed in a working window.
The working window's title bar shows the name of the S7 user program to which the assignment list
belongs.
I/Q/M Table
Each line contains one byte of the memory area in which the eight bits are coded according to their
access. It also indicates whether the access is of a byte, word, or double word.
Column Content/Meaning
7
6
5
4 Bit number of the corresponding byte
3
2
1
0
B The byte is occupied by a one-byte access
W The byte is occupied by a one-word access
D The byte is occupied by a double-word access
Example
The following example shows the typical layout of an assignment list for inputs, outputs, and bit
memory (I/Q/M).
The first row shows the assignment of input byte IB 0. Inputs for address IB 0 are accessed directly
(bit access). The columns "0", "1", "2", "3", "5", and "6" are identified with "X" for bit access.
There is also word access to memory bytes 1 and 2, 2 and 3 or 4 and 5. For this reason, a "bar" is
shown in the "W" column, and the cells also have a light blue background. The black tip of the bar
shows the start of word access.
T/C Table
Each row displays 10 timers or counters.
Example
0 1 2 3 4 5 6 7 8 9
T 00-09 . T1 . . . T6 . . .
T 10-19 . . T12 . . . . T17 . T19
T 20-29 . . . . T24 . . . . .
Z 00-09 . . Z2 . . . . Z7 . .
Z 10-19 . . . . . . . . . Z19
Z 20-29 . . . . . . . . . .
Z 30-39 . . . . Z34 . . . . .
In this example, the timers T1, T6, T12, T17, T19, T24 and the counters Z2, Z7, Z19, Z34 are
occupied.
The lists are sorted alphabetically. You can arrange the entries by clicking on the column title.
You are shown an overview of all the symbols with the following characteristics:
• The symbols defined in the symbol table.
• The symbols not used in the parts of the user program for which reference data exist.
They are displayed in an active window. The working window's title bar shows the name of the user
program to which the list belongs.
Every line shown in the window corresponds to a list entry. A line consists of address, symbol, data
type, and comment.
Column Content/Meaning
Address Absolute address
Data Type Data type of the address
Comment Comment on the address from the symbol table
When you display the list of addresses without symbols, you obtain a list of the elements which are
used in the S7 user program, but which are not defined in the symbol table. They are displayed in
an active window. The working window's title bar shows the name of the user program to which the
list belongs.
A line consists of the address and the number of times that the address is used in the user
program. The entries are sorted according to address.
Example:
Address Number
Q 2.5 4
I 23.6 3
M 34.1 20
You can also assign names to addresses without symbols. To do this, select addresses in the list
and then execute the "Edit symbols" function.
Language relevant information for Ladder Logic, Function Block Diagram, and Statement List is
displayed in the cross-reference list and the program structure. This information consists of the
block language and details.
The "Program Structure" view only displays language relevant information if the filter is set to "Call
Structure" in the "Program Structure" tab and if respective options were selected.
Language relevant information in the "Cross References" can be shown or hidden via menu
command View > Filter.
• Activate the "Block language" and "Details" check box in the "Cross References" tab of the
"Filter" dialog box to display the block language information.
Language relevant information varies according to the programming language the block was
written in and is shown using abbreviations.
Nw and Inst specify in which network and in which statement the address is used (cross-reference
list) or the block is called (program structure).
Using the menu command Window > New Window you can open additional working windows and
display other views of the reference data (for example, List of Unused Symbols).
You open a working window for previously hidden reference data using the menu command
Reference Data > Open.
You can change to another view of the reference data by selecting one of the commands in the
"View" menu or the corresponding button in the toolbar:
Reference Data View Menu Command to Display this Reference Data View
Addresses Without Symbols View > Addresses Without Symbols
Unused Symbols View > Unused Symbols
Assignment View > Assignment
Program Structure View > Program Structure
Cross-Reference List View > Cross References
Choice Meaning
For modified blocks only The reference data are updated for any modified or new blocks; information
on any blocks deleted is removed from the reference database.
For all blocks The reference data are generated again from scratch for all blocks.
Do not update The reference data are not updated.
In order to update the reference data, the blocks are recompiled. The appropriate compiler is called
to compile each block. Using the menu command View > Update you can refresh the view of the
reference data already displayed in the active window.
You can use reference data to position the cursor at different locations of an address in the
program when programming. To do this, you must have up-to-date reference data. However, you
do not have to start the application for displaying reference data.
Basic Procedure
1. Select the menu command Options > Reference Data > Generate in the SIMATIC Manager
to generate the current reference data. This step is only necessary if there are no reference
data, or if you have old reference data.
2. Select the address in an open block.
3. Select the menu command Edit > Go To > Instance.
A dialog box is now displayed containing a list with all instances of the address in the program.
4. Select the option "Overlapping access to memory areas" if you also want to display the
instances of addresses whose physical addresses or address area overlap with that of the
called address. The "Address" column is added to the table.
5. Select a location in the list and click the "Go To" button.
If the reference data are not up-to-date when you open the dialog box, a message to this effect will
appear. You can then update the reference data.
List of Locations
The list of locations in the dialog box contains the following details:
• The block in which the address is used
• The symbolic name of the block, if one exists
• Details, for example, information on the location and, if appropriate, the instruction, which
depends on the original programming language of the block or source file (SCL)
• Language-dependent information
• Type of access to the address: read-only (R), write-only (W), read and write (RW), unknown
(?).
• Block language
You can filter the display of locations and in this way view, for example, write access only for an
address. The online help for this dialog box provides you with more detailed information on what to
enter in the fields and the other information displayed.
Note
Reference data only exist offline. This function therefore always works with the cross references of
the offline blocks, even if you call the function in an online block.
You want to determine at which locations output Q1.0 (direct/indirect) is set. The following STL
code in OB1 is used as an example:
Network 1: ...........
A Q 1.0 // irrelevant
= Q 1.1 // in this example
Network 2:
A M1.0
A M2.0
= Q 1.0 // assignment
Network 3:
//comment line only
SET
= M1.0 // assignment
Network 4:
A I 1.0
A I 2.0
= M2.0 // assignment
In STEP 7 versions earlier than V5, you would now have to run through the entire
sequence of assignments all over again. The buttons ">>" and "<<" make this much
simpler:
8. Place the open dialog box "Go to Location" on top, or call the function "Go to Location" in the
LAD/STL/FBD Editor from your current position.
9. Click the "<<" button once or twice until all the locations of Q1.0 are displayed; the last jump
location "NW 2 Inst 3" is selected.
10. Jump from the address locations dialog box to "NW 2 Inst 3" in the Editor using the "Go To"
button (as in point 3):
Network 2:
A M1.0
A M2.0
= Q 1.0
11. In point 4, the assignment to M1.0 was checked. Now you have to check all the (direct/indirect)
assignments to M2.0. Position the cursor on M2.0 in the Editor and call the function "Go to
Location:" All the assignments to M2.0 are displayed:
OB1 Cycle Execution NW 4 Inst 3 /= W STL
OB1 Cycle Execution NW 2 Inst 2 /A R STL
12. Jump to "NW 4 Inst 3" in the LAD/STL/FBD Editor using the "Go To" button:
Network 4:
A I 1.0
A I 2.0
= M2.0
13. Now you have to check the assignments to I1.0 and I2.0. This process is not described in this
example, because you proceed in the same way as before (point 4 onwards).
By switching between the LAD/STL/FBD Editor and the address locations dialog box, you can find
and check the relevant locations in your program.
Introduction
If the interfaces or the code of individual objects have to be adapted or extended, this can lead to
time stamp conflicts. Time stamp conflicts can in turn cause block inconsistencies between calling
objects and called objects or reference blocks and thus to a high amount correction work.
The "Check block consistency" function eliminates a lot of this correction work. The "Check block
consistency" function removes a large part of all the time stamp conflicts and block inconsistencies.
In the case of objects whose block inconsistencies could not be eliminated automatically, the
function places you at the position to be changed in the corresponding editor, where you can carry
out the required changes. All the block inconsistencies are eliminated and the objects are compiled
step-by-step.
Requirements
It is only possible to check block consistency for projects created from STEP 7 V5.0, Service Pack
3. For older projects, you must first compile everything when starting the block consistency check
(menu command Program > Compile All).
For objects created with an options package, the options package must be installed for the
consistency check.
4. Start Steps 2 and 3 again. Repeat this process until no more errors are displayed in the
message window.
Note
Even if the relationship between the interface time stamps is correct, inconsistencies may occur:
• The definition of the interface for the referenced block does not match the definition in the
location at which it is used.
These inconsistencies are known as interface conflicts. They can occur, for example, when blocks
are copied from different programs or when an ASCII source file is compiled and not all of the
blocks in a program are generated.
15.6 Time Stamps in UDTs and Data Blocks Derived from UDTs
User-defined data types (UDTs) can, for example, be used to create a number of data blocks with
the same structure.
! Danger
Danger of damage to property and persons when:
1. Using CALL FC, CALL FB, CALL multiple instance
2. Accessing a DB using the complete absolute address (for example DB20.DBW10)
3. Accessing variables of a complex data type
It is possible that the contents of DB registers (DB and DI), address registers (AR1, AR2), and
accumulators (ACCU1, ACCU2) may be changed.
In addition, you cannot use the RLO bit of the status word as an additional (implicit) parameter
when you call an FB or FC.
When using the programming techniques mentioned above, you must make sure that you save
and restore the contents yourself; otherwise errors may occur.
Situation Description
With actual parameters from • Once you have assigned an actual parameter to a block from a DB (for
a DB example DB20.DBX0.2) STEP 7 opens the DB (DB20) and adapts the
content of the DB register. The program then works with the adapted
DB after the block call.
When calling blocks in • After a block has been called from within an FC that transfers a
conjunction with higher data component of a formal parameter of a higher data type (string, array,
types structure or UDT) to the called block, the content of AR1 and the DB
register of the calling block are modified.
• The same applies to a call from within an FB if the parameter is in the
VAR_IN_OUT area of the caller.
When accessing components • When an FB accesses a component of a formal parameter of a higher
of a higher data type data type in the VAR_IN_OUT area (string, array, structure or UDT),
STEP 7 uses the address register AR1 and the DB register. This
means that the contents of both registers are modified.
• When an FC accesses a component of a formal parameter of a higher
data type in the VAR_IN_OUT area (string, array, structure or UDT),
STEP 7 uses the address register AR1 and the DB register. This
means that the contents of both registers are modified.
Note
• When an FB is called from within a version 1 block, the actual parameter for the first Boolean
IN or IN_OUT parameter is not transferred correctly if the command before the call does not
limit the RLO. In this case, it is logically combined with the existing RLO.
• When an FB is called (single or multiple instance), the address register AR2 is written to.
• If the address register AR2 is modified in an FB, such by the operations UC, CC or CALL (Call
FC/SFC without parameters), there is no guarantee that the FB will be executed correctly.
• If the complete absolute DB address is not transferred to an ANY parameter, the ANY pointer
does not get the DB number of the open DB. Instead, it always gets the number 0.
Bit Messaging
Bit messaging requires the programmer to perform three steps:
• Create the user program on the programming device and set the required bit.
• Create an assignment list using any text editor in which a message text is assigned to the
message bit (for example, M 3.1 = limit switch pressure).
• Create the list of message texts on the operator panel on the basis of the assignment list.
The operator interface system queries the programmable controller cyclically to see whether the
message bit has changed or not. If the programmable controller signals a change, the
corresponding message is displayed. The message receives the time stamp from the operator
interface system.
Message Numbering
Message numbering requires the programmer to perform only one step:
• Create the user program on the programming device, set the required bit, and assign the
required message text to the bit directly while programming.
There is no cyclic query of the programmable controller. When the programmable controller signals
a change, the corresponding message number is passed to the operator interface system and the
corresponding message text is displayed. The message receives the time stamp from the
programmable controller and can therefore be traced more exactly than with bit messaging.
Overview
The following table shows the properties and requirements for the different messaging methods:
The message numbering method recognizes the following three types of messages:
• Synchronized with the • Not synchronized with the • Synchronized with the program
program program • Display in the diagnostic buffer
• Displayed by ProTool (only • Display by WinCC on the PG
ALARM_S) and WinCC • Only possible with S7-400 • Possible with S7-300/400
• Possible with S7-300/400 • Configuration using the • Programming using message
• Programming using symbol table block (system function)
message blocks: • Transfer to the AS - WR_USMSG
- ALARM (S7-400 only) using system data • No transfer to operator control
- ALARM_8 (S7-400 only) blocks (SDBs) system
- ALARM_8P (S7-400 • Transfer to
only) operator control system
using AS-OS engineering
- NOTIFY (S7-400 only)
- NOTIFY_8P (S7-400
only)
- ALARM_S(Q)
- AR_SEND (S7-400
only)
- ALARM_D(Q)
• Transfer to the operator
control system
STEP 7 only supports the more user-friendly message numbering method which will be described
in detail below. Bit messaging is configured in the HMI devices and is described there.
Overview
The following figure shows an overview of which SIMATIC components are involved in configuring
and displaying messages.
How a message is displayed depends on the messaging method, the message block used, and the
display device.
The possible parts of a message are listed in the following table:
Part Description
Timestamp Generated in the programmable controller when the message event occurs
Message state The following states are possible: incoming, outgoing, outgoing without
acknowledgement, outgoing with acknowledgement
Associated value Some messages can be assigned a process value that can be evaluated by the
message block used
Image If the system crashes the messages that occurred can be displayed subsequently
on the operator station
Message number A unique number throughout the project or CPU (project-oriented or CPU-
oriented). The number is assign by the system and identifies a message
Message texts Configured by the user
Example
The following example shows an alarm message on an operator panel.
You can choose between the following message blocks, each of which contains a programmed
message function:
You will find more detailed information in the reference online help on system attributes.
The system attributes are assigned automatically if the message blocks that you use in your
program are SFBs or FBs with corresponding system attributes and are called as multiple
instances.
Message configuration allows you to use different procedures to create a message type or a
message. This depends on the message-type block via which you gain access to message
configuration.
The message-type block can be either a function block (FB) or an instance data block.
• With an FB you can create a message type to use as a type for creating messages. All entries
you make for the message type are entered in the messages automatically. If you assign an
instance data block to the function block, messages for the instance data block are generated
automatically in accordance with the message type and assigned message numbers.
• For an instance data block, you can modify messages generated based on this message type
for a specific instance.
The visible difference here is that message numbers are assigned for messages but not for
message types.
Caution:
When you copy the instances to another program and do not include the message type, the instance might
only be partially displayed. To remedy, copy the message type to the new program.
If texts and attributes for an instance are displayed in green, this means the following: these texts and
attributes are still as they were configured in the message type. They have not been changed at the instance.
When you generate an STL source file from message-type blocks, the configuration information is
also written to the source file.
This information is written to a pseudo-comment that begins with "*$ALARM_SERVER" and ends
with "*".
Caution
When you set a symbolic reference for a block, note that the symbol table may not be modified
prior to the compilation of the source file.
When the source file contains multiple blocks, several pseudo-comment blocks will be joined to
form a single comment block. Individual blocks with message attributes must not be deleted from
the STL source file.
You can specify if you want to assign message numbers for the project (project-oriented message
numbers) or for the CPU (CPU-oriented message numbers). Assigning message numbers for the
CPU has the advantage of allowing you to copy a program without having the message numbers
change, in which case they would have to be recompiled. It is only possible to display message
numbers for the CPU on an HMI device with the applications "WinCC V6.0" and/or "ProTool V6.0".
If you are working with an earlier version of these applications, you have to select message
numbers for the project.
The table below lists the differences between project-oriented and CPU-oriented assignment of
message numbers:
In the "Message number" tab of the SIMATIC manager you can preset the way message numbers
will be assigned (Menu command Options > Customize) to future projects and libraries. In this tab
you determine whether the message numbers are to be assigned only to the CPU (CPU-oriented)
or only to the project (project-oriented). You can also choose "Always ask for setting" if you want to
specify the assignment later.
If the initially set default "CPU-oriented" or "project-oriented" was active when you created the
project or library, you can no longer change the type of message number assignment for this
project or library.
If you have set "project-oriented" unique message number assignment and want to set "CPU-
oriented" unique assignment proceed as follows:
1. In SIMATIC Manager, select the corresponding project or library.
2. Select menu command File > Save As.
3. Enable the "With rearrangement" check box In the next dialog box and enter a new name.
4. Start the process with "Save As" and confirm your entries with "OK".
5. In one of the next dialogs you can specify "CPU-oriented" unique message number
assignments.
You can use the File > Delete command to delete the original project or library.
Messages are identified by a number which is unique throughout a project. To achieve this, the
individual STEP 7 programs are each allocated a number range within the total available range (1
to 2097151). If you copy a program and a conflict results - that is, if the same message numbers
have already been assigned in the target range - the new program must be allocated a new
number range. If such a situation arises, STEP 7 automatically opens the dialog box in which you
can specify the new number range.
If no messages have been configured, you can also set or change the number range for an
S7 program using the menu command Edit > Special Object Properties > Message Numbers.
By default, the message number range is assigned in steps of 20,000.
Block-related messages are assigned to a block (instance DB). To create a block-related message,
you can use system function blocks (SFBs) and system functions (SFCs) as message blocks.
Basic Procedure
1. In the SIMATIC Manager select the function block (FB) for which you want to generate a block-
related message and open this block with a double-click.
Result: The selected block is opened and displayed in the "LAD/STL/FBD" window.
2. Fill out the variable declaration table. For every message block that is called in the function
block you must declare variables in the calling function block.
Result: A flag should appear in the "Name" column for the parameter "IN" if the column is not
selected. The selected block is then set as a message-type block. The required system
attributes (for example, S7_server and S7_a_type) and the corresponding values are assigned
automatically (Note: for certain SFCs you will have to assign the system attributes for the
parameter "IN" yourself. To do this select the menu command Edit > Object Properties and
then select the "Attributes" tab.).
Caution: If you do not call an SFB, but rather an FB that contains multiple instances and
configured messages, you must also configure the messages of this FB, with multiple
instances, in the calling block.
5. Repeat steps 2 to 4 for all calls to message blocks in this function block.
6. Save the block using the menu command File > Save.
7. Close the "LAD/STL/FBD" window.
Result: The STEP 7 message configuration dialog box (standard dialog box) is opened.
Information on opening the PCS7 Message Configuration function can be found under PCS 7
Message Configuration.
Note
When editing the display device specific texts and attributes, please read the documentation
supplied with your display device.
Example: Enter "CALL FB1, DB1". If DB1 does not yet exist, confirm the prompt asking
whether you want the instance DB created with "Yes."
Result: The instance DB is created. In the code section of the OB, the input variables of the
associated FBs, here for example "Mess01," and the message number allocated by the
system, here "1," are displayed.
2. Save the OB with the menu command File > Save and close the "LAD/STL/FBD" window.
Editing Messages
1. In SIMATIC Manager, select the generated instance DB, for example, "DB1" and then call the
menu command Edit > Special Object Properties > Message to open the message
configuration dialog box.
Result: The "Message Configuration" dialog box is opened and the selected instance DB with
the message number allocated by the system is displayed.
2. Enter the required changes for the corresponding instance DB in the appropriate tabs and add
other display devices if you wish. Exit the dialog box with "OK."
Result: The message configuration for the selected instance DB is then complete.
Result: You have created a standard message that can be displayed on all display devices.
4. Using the "New Device" button, add a new display device of the type "ProTool" (Opx) or
"WinCC." Only those display devices on which the configured messages can be displayed are
available for selection.
Result: The new device is added and selected, and the corresponding tabbed section is
displayed.
5. Enter attributes and texts for the display-specific message in the display-specific "Texts" and
"Attributes" tabs.
Result: You have created a message variation that is only used as the message for the
selected display device.
If you want to edit other message variations for existing display devices:
• Select and open the message block in the detailed view by double-clicking it.
Result: The first display device is automatically selected and you can now edit display-specific
message variations for it.
Result: The dialog box displays a tab for each message block for which you declared a
variable in the FB.
2. Fill out the text boxes for the message components "Origin," "OS area," and "Batch ID."
3. Enter the message class and the event text for all events of the message blocks used and
specify whether every event must be acknowledged individually.
4. For the message parts that apply for all instances and should not be changed, select the
"Locked" check box.
Editing Messages
1. Open SIMATIC Manager. Select the instance DB whose message texts you want to edit and
open PCS7 message configuration function.
2. Do not edit instance-specific message parts that are not locked.
Note
The time interval is dependent on the CPU used.
Basic Procedure
During processing, the signals for which you have configured messages are checked
asynchronously to your program. The checks take place at the configured time intervals. The
messages are displayed on the assigned display devices.
Caution
If you want to assign or edit symbol-related messages and, during the same work procedure, you
have previously copied symbols between two symbol tables, you will then have to first close the
symbol table that you no longer need to work in. Otherwise, you will not be able to save your
message configurations. Under certain conditions, the last entries made in the message
configuration dialog will be lost.
Using this function you can write a user entry in the diagnostic buffer and send a corresponding
message that you create in the message configuration application. User-defined diagnostic
messages are created by means of the system function SFC52 (WR_USMSG; Error Class A or B)
that is used as a message block. You must insert the call for the SFC52 in your user program and
allocate it the event ID.
Requirements
Before you can create a user-defined diagnostic message, you must have done the following:
• Created a project in the SIMATIC Manager
• Created a S7 program in the project to which you want to assign one or more messages.
Basic Procedure
To create and display a user-defined diagnostic message, proceed as follows:
Messages of the CPU are identified by a unique number. This is done by assigning each CPU a
number area. Other than for assigning project-oriented message numbers, there is no need to
assign a new number area to the new program. A new compilation of the program is therefore not
required. Note the exception when you copy individual blocks: In this case, you must recompile the
program in order to implement the modified message number.
Requirements
• WinCC V6.0
• ProTool V6.0
Principles of operation
Result: The selected block is opened and displayed in the "LAD/STL/FBD" window.
2. Fill out the variable declaration table. You must declare the corresponding variables in the
calling function block for every message block that is called in the function block.
Result: The input variables for the called message block (here SFB 33) are displayed in the
code section of the function block.
4. Assign the symbolic name you assigned in step 2. for the message block input, here "Mess01,"
to the variable "EV_ID".
Result: A flag should appear in the "Name" column for parameter "IN" if the column is not
selected. The selected block is then set as a message-type block. The required system
attributes (for example, S7_server and S7_a_type) and the corresponding values are assigned
automatically (Note: for certain SFCs you will have to assign the system attributes for the
parameter "IN" yourself. To do this select the menu command Edit > Object Properties and
then select the "Attributes" tab.).
Caution: If you call an FB that contains multiple instances and configured messages instead of
an SFB, you must also configure the messages of this FB in the calling block.
5. Repeat steps 2. to 4. for all calls to message blocks in this function block.
6. Save the block using the menu command File > Save.
7. Close the "LAD/STL/FBD" window.
Result: The STEP 7 message configuration dialog box is opened. Information on opening the
PCS7 Message Configuration function can be found under PCS7 Message Configuration
(CPU-Oriented).
Example: Enter "CALL FB1, DB1". If DB1 does not yet exist, confirm the prompt asking
whether you want the instance DB created with "Yes."
Result: The instance DB is created. In the code section of the OB, the input variables of the
associated FBs, here for example "Mess01," and the message number allocated by the
system, here "1," are displayed.
2. Save the OB with the menu command File > Save and close the "LAD/STL/FBD" window.
Editing Messages
1. In the SIMATIC Manager, select the created instance DB, for example, "DB1" and select the
menu command Edit > Special Object Properties > Message to open the message
configuration dialog box.
Result: The "Message Configuration" dialog box is opened and the selected instance DB with
the message number assigned by the system is displayed.
2. Enter the required changes for the corresponding instance DB in the appropriate tabs and add
other display devices if you wish. Exit the dialog box with "OK."
Result: The message configuration for the selected instance DB is then complete.
No te
If texts and attributes for an instance are displayed in green, this means the following: these texts
and attributes are still as they were configured in the message type. They have not been changed
at the instance.
No te
If texts and attributes for an instance are displayed in green, this means the following: these texts
and attributes are still as they were configured in the message type. They have not been changed
at the instance.
Editing Messages
1. Open SIMATIC Manager. Select the instance DB whose message texts you want to edit and
open PCS7 message configuration function.
2. Do not edit instance-specific message parts that are not locked.
Note
The time interval is dependent on the CPU used.
Basic Procedure
During processing, the signals for which you have configured messages are checked
asynchronously to your program. The checks take place at the configured time intervals. The
messages are displayed on the assigned display devices.
Caution
If you want to assign or edit symbol-related messages and, during the same work procedure, you
have previously copied symbols between two symbol tables, you will then have to first close the
symbol table that you no longer need to work in. Otherwise, you will not be able to save your
message configurations. Under certain conditions, the last entries made in the message
configuration dialog will be lost.
Using this function you can write a user entry in the diagnostic buffer and send a corresponding
message that you create in the message configuration application. User-defined diagnostic
messages are created by means of the system function SFC52 (WR_USMSG; Error Class A or B)
that is used as a message block. You must insert the call for the SFC52 in your user program and
allocate it the event ID.
Requirements
Before you can create a user-defined diagnostic message, you must have done the following:
• Created a project in the SIMATIC Manager
• Created a S7 program in the project to which you want to assign one or more messages.
Basic Procedure
To create and display a user-defined diagnostic message, proceed as follows:
Element Type
This parameter assigns a unique identification to the data type of the associated value:
The element type only uniquely specifies the data type transferred by the PLC. It is not used as a
casting operator.
Format Code
These codes specify the output format for the associated value on the display device. A format
instruction is introduced by a "%" sign. For message texts, there are the following fixed message
codes:
If the format code is too small, the value is still output in its full length.
If the format code is too large, an appropriate number of blanks are output before the value.
Note
Note that you can also optionally specify the "[i]", in which case you must leave out the brackets
when you enter this parameter.
Note
When using S7-PDIAG, you must always indicate "C" for the element type CHAR and "R" for the
element type REAL. For all other element types valid for S7-PDIAG (BOOL, BYTE, WORD, INT,
DWORD and DINT), you must always specify "X".
If you wish to pass one of the ALARM_S blocks more than one associated value, you can send an
array with a maximum length of 12 bytes. This can be, for example, a maximum of 12 bytes or
characters, a maximum of 6 words or Int or a maximum of 3 double words, real or DInt.
You can integrate as many texts as you want from a maximum of four different text libraries into
one message. The texts can be placed freely, so their use in foreign language messages is also
guaranteed.
Proceed as follows:
1. In the SIMATIC Manager, select the CPU or an object subordinate to the CPU and select the
menu command Options > Text Libraries > System Text Libraries or Options > Text
Libraries > User-Specific Text Libraries to open a text library.
Caution
You can only integrate texts from user text libraries into messages if you have selected to assign
message numbers to the CPU (CPU-oriented message numbers).
Note
[Index] = 1W, where 1W is the first associated value for the message of type WORD.
Example
Configured message text: Pressure rose @2W%t#Textbib1@
Text library with the name Textbib1:
The second associated value transferred has been assigned the value 1734. The following
message is displayed: Pressure rose too high.
You can delete associated values by deleting the character string in the message text which
represents the associated value.
Proceed as follows:
1. Locate the block of information in the message text corresponding to the associated value that
you want to delete.
The block begins with an @ sign, followed by a location designator identifying the associated
value as well as a format code; it ends with another @ sign.
2. Delete this information from the message text.
You can create user texts for an entire project, for S7 programs, the block folder or individual
blocks, and for the symbol table if messages are configured in these objects. They contain all texts
and messages that can be shown on display devices, for example. For one project, there can be
several lists of operator related texts that you can translate into the required languages.
You can select the languages that are available in a project (menu command Options > Language
for Display Devices…). You can also add or delete languages later.
Basic Procedure
Ensure that you have set your target languages for the text translation in SIMATIC manager, under
menu command Options > Language for Display Devices.
Note
You can print user text only under the application used for the translation.
A user text library lets you view text or text segments dynamically, depending on the associated
value. Here, the associated value provides the text library index for the current text. A placeholder
is entered at the position were the dynamic text is to be displayed.
You can create user libraries for a program in which you can enter text and select your own index.
The application will automatically check the index in the user library for uniqueness. All messages
available for this CPU can contain a cross-reference to a user text library.
The number of text libraries in a text library folder is unlimited. It is therefore possible, for example,
to use the same program for different controlling tasks and merely adapt the text libraries to
application requirements.
Caution
When you copy a message-type block that contains a cross-reference to a text library into another
program, you must include the corresponding text libraries, or create a new text library of the same
name or edit the cross-reference in the message text.
An index is always assigned by default when you create a text entry. When you enter a new line,
the application proposes the next free index as the default. Ambiguous indexes are not permitted in
text library and are rejected by the application.
Note
An index is always assigned by default when you create a text entry. When you enter a new line,
the application proposes the next free index as the default. Ambiguous indexes are not permitted in
text library and are rejected by the application.
Caution
When you copy a message-type block that contains a cross-reference to a text
library into another program, you must include the corresponding text libraries, or
create a new text library of the same name or edit the cross-reference in the
message text.
When you change the name of an existing text library, you will render the
associated values cross-referenced to this text library invalid in already configured
messages!
System text libraries are automatically created when blocks are generated, e.g. in "Report System
Errors". The user can not create system text libraries and can only edit existing text libraries.
All messages available for this CPU can contain a cross-reference to a text library
System text libraries and user text libraries provide a list of texts that can be integrated into
messages, updated dynamically at run time, and shown on a programming device or other display
device.
The texts in system text libraries are provided by STEP 7 or STEP 7 optional packages. There can
be several text libraries assigned to one CPU. You can translate these texts into the required
languages.
In the SIMATIC Manager, you can select the languages that are available in a project (menu
command Options > Language for Display Devices…). You can also add or delete languages
later.
When you initiate the translation of a text library (Menu command Options > Manage Multilingual
Texts > Export), an export file will be generated that you can edit in Microsoft EXCEL, for
example. After you have opened the file, the screen displays a table that contains a column for
each language
Caution
Never open a *.cvs export file with double-click on the file. Always use menu command File >
Open under Microsoft EXCEL to open the file.
Note
You can print user text only in the application used for the translation.
German English
ausgefallen Failure
gestört Disruption
Parametrierfehler Parameter assignment
error
Basic Procedure
In the SIMATIC Manager, with the menu command Options > Language for Display Devices…,
make sure that you have set the languages into which you want to translate a text library.
Overview
Use the transfer program AS-OS Engineering to transfer the message configuration data generated
to the WinCC database.
Requirements
Before you start the transfer, the following requirements must be fulfilled:
• You have installed "AS-OS Engineering"
• You have generated the configuration data for creating messages.
Basic Procedure
Display Options
With the "CPU Messages" function, you can decide whether and how online messages for selected
CPUs are displayed.
• "Highlight in the Task Bar": As soon as a message is received and the window is not on top,
"CPU Message" is highlighted in the Windows task bar.
• "Leave in the Background": The CPU messages are received in the background. The window
remains in the background when new messages are received and can be brought to the
foreground if required.
• "Ignore Message": New CPU messages are not displayed and, in contrast to the other two
modes, not archived.
In the "CPU Messages" window you can select the "Archive" tab or the "Interrupt" tab. In both tabs
you can select the menu command View > Display Info Text to specify whether the messages are
displayed with or without Info text. The user can sort the columns as required.
"Archive" Tab
Incoming messages are here displayed and archived, sorted by the event message time. The
volume of the archive (between 40 and 3000 CPU messages) can be set via menu command
Options > Settings in the "Settings - CPU Messages" dialog box. The oldest queued message will
be deleted if the set archive volume is exceeded.
Acknowledgeable messages (ALARM_SQ and ALARM_DQ) are displayed in bold letters. You can
acknowledge these messages under the menu command Edit > Acknowledge CPU Message.
"Interrupt" Tab
The status of queued messages from ALARM_S blocks that have not yet been received or
acknowledged is also displayed in the "Interrupt" tab.
You can select the menu command View > Multiline Messages to display messages on one or
more lines. In addition, you can sort the columns as necessary.
Basic Procedure
To configure CPU messages for selected modules:
Result: The "CPU Messages" application window appears which lists the registered CPU.
2. You can extend the list of registered CPUs by repeating step 1. for other programs or
interfaces.
3. Click the check box in front of the list entries and specify which messages should be received
for the module:
A: activates messages from ALARM_S blocks (SFC 18 and SFC 108 for generating block-
related messages that are always acknowledged as well as SFC 17 and SFC 107 for
generating block-related messages that can be acknowledged), for example, reporting process
diagnostic messages from S7 PDIAG, S7-GRAPH, or system errors.
Result: As soon as the above messages occur, they are written in the message archive and
displayed in the form you selected.
Note
The CPUs for which you have called the menu command PLC > CPU Messages in the SIMATIC
Manager are entered in the list of registered modules in the "CPU Messages" application window.
The entries in the list are retained until they are deleted in the "CPU Messages" application
window.
CPU messages are always recorded in the archive unless you have selected the menu command
View > Ignore Message. All archived messages are always displayed.
With STEP 7, when system errors occur you can output messages with a description of the error
that has occurred and the location of the error to one or more display devices (for example, WinCC,
OP).
Introduction
When a system error occurs, hardware components and DP standard slaves (slaves whose
properties are determined by their GSD file) can trigger organization block calls.
Example: If there is a wire break, a module with diagnostic capability can trigger a diagnostic
interrupt (OB82).
The hardware components provide information for the system errors that occur. The start event
information, that is, the local data of the assigned OB (which contain the data record 0, among
other things), provide general information on the location (such as the logical address of the
module) and type (such as channel error or backup battery failure) of the error.
In addition, the error can be specified in greater detail by means of additional diagnostic information
(reading data record 1 with SFC51 or reading the diagnostic message of DP standard slaves with
SFC13). Examples of this would be channel 0 or 1 and wire break or measuring-range overrun.
With the Report System Error function, STEP 7 offers a convenient way to display diagnostic
information supplied by the component in message form.
STEP 7 generates the necessary blocks and message texts. All the user has to do is load the
generated blocks into the CPU and transfer the texts to connected HMI devices.
To display diagnostic events on an HMI device graphically, you can create a PROFIBUS DP DB
(default DB 125) or a PROFINET IO DB (default DB 126). The elements "Map_ErrorNo" and
"Map_HelpNo" are declared in the interface of each data block. During operation, these are
supplied with an error or help text ID. The 'Report System Error' application exports the possible
values and their significance to csv files in the selected folder during generation. To be able to
display the significance of an error or help text ID, the HMI must import these texts.
You can create a data block to support the CPU Web server (default DB127) to display the module
status in the Web server of the CPU.
You will find a complete overview of the supported diagnostic information for various slaves in the
section Supported Components and Functional Scope
Basic Procedure
The messages are sent by means of the standard message path ALARM_S/SQ to CPU Messages
on the programming device or to the connected HMI devices. The sending of message to an HMI
device can be deselected.
The components of S7 300 stations, S7 400 stations, PROFINET IO devices, DP slaves, and
WinAC are supported by Report System Error, as long as they support functions such as
diagnostic interrupt insert/remove module interrupt, and channel-specific diagnostics.
Note
If you use a CP 443-5 and this is in STOP mode, no master system failure will be reported during
startup.
PROFIBUS-DP
In the tables that follow, you will find all the diagnostic blocks of the various PROFIBUS slaves
supported by "Report System Error".
1) DS0: Standard diagnostics, for example module fault, external auxiliary voltage or front connector missing,
extent 4 bytes, contained in the local data of the OB 82.
DS1: Channel error, defined differently for each channel type, readable in the user program via SFC 51.
The texts come from the S7 HW diagnostics.
2) Header identifier: Identifier in the diagnostic message that identifies different diagnostic parts.
Note
• The station errors (failure/return) are displayed in plain text for all PROFIBUS DP slaves.
• The manufacturer-specific diagnostics is supported for all PROFIBUS DP slaves with the
following restrictions:
- Only V1 slaves are supported. These are slaves with a GSD file containing the entry
"DPV1_Slave=1".
- The DP interrupt mode must be set to "DPV0" for this slave.
Errors that do not occur during operation (CPU in STOP, DP slave failed):
• Station errors are supported
• Module errors are supported
• Channel errors are supported and extended channel error information is evaluated
In STEP 7 the diagnostics message is displayed via the call of the module state in the on-line
window "HW Config" (diagnose hardware) in the "DP Slave Diagnostics" tab card under "Hex
display".
Diagnostic Repeater: The messages of the Diagnostic Repeater are output as plain text in DPV0
mode. The text is read from the GSD file.
Note
• You cannot configure the DP/PA Link using a GSD file.
• Diagnostics of a DP/PA Link with a 300 series CPU is not supported.
PROFINET IO
Below, you will find the diagnostic information from the various PROFINET devices supported by
"Report System Error".
Errors that occur during operation (CPU in RUN):
• Device errors (failure, return) are supported
• Module error and submodule error (module/submodule removed, wrong module/submodule,
compatible module/submodule) are supported.
• Channel errors are supported and extended channel error information is evaluated
Errors that do not occur during operation (CPU in STOP, IO device failed):
• Integrated PROFINET IO interface are supported for CPUs as of firmware version 5.0 or later.
• Otherwise, device errors are reported.
All errors are displayed in plain language messages.
The diagnostic data records (according to the PROFINET standard) can be read by SFB54 and
SFB52 in the user program.
Note
• ET 200S: Slaves with packed addresses are supported..
• On PROFINET IO devices, vendor-specific diagnostics is supported.
AS Interface
For AS interface slaves, a message is sent if the planned configuration does not match the actual
configuration.
The following AS-i masters are supported:
• CP 342-2
• CP 343-2
• CP 343-2 P
• DP/AS-i Link 20E
• DP/AS-i LINK Advanced D (only if it is not configured per GSD file)
• DP/AS-i F-Link
• IE/AS-i Link
Shared Devices
RSE evaluates the information as to whether a (sub)module was configured as a shared device.
Since RSE always views a CPU, only the (sub)modules with full access set for the CPU are taken
into account in the diagnostics. Those configured as "not assigned" (sub)modules are ignored.
You have several possibilities for calling the dialog for the settings:
• In HW Config, select the CPU for which you would like to configure the reporting of system
errors. Then select the menu command Options > Report System Error.
• If you have already generated blocks for reporting system errors, you can call up the dialog by
double-clicking a generated block (FB, DB).
• In the Properties dialog of the station, select the option for automatic call up during Save and
Compile the configuration.
You get to the option for automatic call up during Save and Compile as follows:
1. In the SIMATIC Manager, select the appropriate station.
2. Select the menu command Edit > Object Properties.
3. Select the Settings tab.
Note
You can also open the "Settings" tab of the properties dialog in HW Config via menu command
Station > Properties.
After you have completed your settings for reporting system errors, you can generate the required
blocks (FB with assigned instance DB and one or more global DB(s) and an FC, depending on the
setting even OBs that do not yet exist). To do this, click on the "Generate" button in the "Report
System Errors" dialog box.
The following blocks are generated:
• Diagnostic FB (default: FB49)
• Instance DB for the diagnostic FB (default: DB49)
• Shared DB (default: shared DB50)
• FC (default: FC49)
• Error OBs (if you have selected this option in the "OB Configuration" dialog box)
• Optional user block called by the diagnostic FB
FBs and instance DBs are called by OBs, FCs and global DBs are used by RSE-FB.
Note
If you want to reorganize your project with the menu command File > Save As... and the "With
Reorganization" option, remember that the diagnostic blocks need to be regenerated in 'report
system error'. Since the reorganization of a project with diagnostic blocks is very slow, it is
advisable to delete the diagnostic blocks first and then generate them again.
Depending on the CPU, you can generate the following Error OBs with "Report System Error":
• OB 70 (I/O redundancy error) with a call for the generated diagnostic FB. This OB only exists
with H-CPUs.
• OB 72 (CPU redundancy error) with a call for the generated diagnostic FB. This OB only exists
with H-CPUs.
• OB 73 (communication redundancy error) with a call for the generated diagnostic FB. This OB
only exists with a few H-CPUs.
• OB 80 (time error)
This OB is generated without content to prevent the CPU from going to STOP when a
communication error occurs. Errors are not evaluated, no message is generated.
• OB81 (power supply error) with a call for the generated diagnostic FB.
• OB82 (diagnostic interrupt OB) with a call for the generated diagnostic FB.
• OB83 (plug/remove interrupt) with a call for the generated diagnostic FB.
• OB84 (CPU hardware fault)
This OB is generated without contents so that the CPU does not switch to STOP mode when
communication errors occur (for example, problems with the MPI terminating resistor when
inserting and removing the MPI cable). Errors are not evaluated; no message is generated.
• OB85 (program execution error)
If 'Report system error' creates this OB during the generation of the diagnostic blocks,
additional networks are inserted which realize the following program sequences:
The CPU is prevented from switching to STOP when there is an error updating the process
image (for example, removing the module). This is so that the diagnostic FB in OB83 can be
processed. Any CPU STOP setting after a Report System Error message takes effect in OB83.
With all other OB85 error events, the CPU goes into STOP mode.
If OB 85 already exists, it is not changed by 'Report system error'.
• OB86 (failure of an expansion rack, a DP master system, or a distributed I/O device) with a call
for the generated diagnostic FB.
ATTENTION
Please note the following:
• The CPU no longer goes into STOP mode when Report System Error generates OB85 upon
the error event Error While Updating Process Image.
• OB85 is also called up by the CPU when the following errors occur:
- "Error event for an OB that is not loaded"
- "Error when calling or accessing an OB that Is not loaded"
When these errors occur, the CPU still goes into STOP mode when Report System Error
generates OB85, as was the case before Report System Error was in use.
• The setting "CPU goes into STOP mode after executing diagnostic FB" is NOT effective for
OB84 and OB85, because the FB of Report System Error is not called up in these OBs. In the
case of OB85, this setting is noted indirectly by the FB call in OB83.
The diagnostic block set by 'Report System Error' (FB with associated instance DB and one or
more shared DB(s) and an FC evaluates the local data of the error OB and reads any additional
diagnostic information from the hardware component that caused the error.
The FB has the following properties:
• Language of generation RSE (Report System Error) (also applies to the blocks listed above)
• Know-how protected (also applies to the blocks listed above)
• Interrupts arriving delayed during run time
• If you double-click on the block, the dialog for setting the "Report System Error" function opens.
User Block
Because the diagnostics FB is know-how protected, you cannot edit it. However, the FB provides
an interface for the user program so that you can access such things as the error status or the
message number.
The block for evaluating in the user program (can be set in the User Block tab of the dialog) is
called in the generated FB with the selected parameters. The following parameters are available:
If the user FB does not exist yet, it is created by the RSE with the selected parameters.
The error texts generated for standard errors are arranged as follows:
Error numbers greater than 12288 refer to channel errors. If you view the error number in
hexadecimal representation, you can calculate the channel type and recognize the error bit. For an
exact description, refer to the respective module help or channel help text.
Example:
12288 = W#16#3000 -> high byte 0x30 - 0x10 = channel type 0x20 (CP interface);
low byte 0x00, means error bit 0
32774 = W#16#8006 -> high byte 0x80 - 0x10 = channel type 0x70 (digital input);
low byte 0x06, means error bit 6
Diagnostic support
To display diagnostic events on an HMI device graphically, you can create a PROFIBUS DP DB
(default DB 125) or a PROFINET IO DB (default DB 126). You can create a data block to support
the CPU Web server (default DB 127) to display the module status in the Web server of the CPU.
The following table shows the system errors and their error classes:
Note
The CPU doe not go to STOP in "Startup" mode.
You can display the messages configured in 'Report System Error' in the languages that you
installed when you installed STEP 7.
To do so, proceed as follows:
1. In the SIMATIC Manager, select the Options > Language for Display Devices... menu
command. In the dialog box that is then displayed, add the desired language to your project.
2. Confirm your settings with "OK".
3. In HW Config, select the Options > Report System Error... menu command. In the dialog box
that is then displayed, click the "Generate" button.
Result: The message texts are generated for all the languages that you installed, but they are
only displayed in the language that you have set as the default in the "Add/Delete Language,
Set Default Language" dialog box by clicking the "Set as Default" button.
Example
You have installed STEP 7 in German, English and French, and these languages are defined in
your project. Now you generate the message texts as described above. To display the messages
texts in a given language, set this language as the default in the "Add/Delete Language, Set
Default Language" dialog box.
Notes
If you use messages and error texts in more than one language, check the language for display devices in
the "Add/Delete Languages, Set Standard Language" dialog and change it if necessary.
Texts in a language not supplied with STEP 7 are displayed in the language defined as default. You can
export these texts, translate them into the required language and the import them into STEP 7 again.
If you change the language settings while editing 'Report System Error", the block must be regenerated so
that the messages can be displayed in the required language.
Translating messages and error texts into a language not supplied with STEP 7
Text in a language other than those supplied with STEP 7 will be displayed in the language set as
default. You can export these texts, translate them into the desired language and then import them
back into STEP 7. Add the desired language (Options > Language for Display Devices) and set
this as the default language. Before you export and compile the texts with "Manage Multilingual
Texts", you must regenerate 'Report system error'.
Recommended procedure:
1. Create a reference project with all components you use.
2. In the SIMATIC Manager, select the menu command Options > Language for Display
Devices..., add the desired language to project in the dialog box that appears and set this
language as the default.
3. Confirm your settings with OK.
4. When you have completed the configuration, select the menu command Options > Report
System Errors... in HW Config and click "Generate" in the dialog box that appears.
5. In the SIMATIC Manager, select the menu command Options > Manage Multilingual Texts >
Export and select the texts you want to export in the dialog box that appears. Select as source
language a language installed in the project that is also one of the languages delivered from
STEP 7and select your desired language for target language.
Result: Several text files are generated in the selected directory.
Note
If you subsequently change your configuration in HW Config and/or regenerate "Report System
Error", the new messages and error texts will be displayed once again in a language supplied with
STEP 7. You have to translate these texts as described above. Please make sure that you select
the option to add an export target in the message that appears when exporting. The new texts are
inserted at the end of the corresponding text file (under "//$_Delta-Export").
Overview
STEP 7 provides a user-friendly method of controlling and monitoring variables in your process or
programmable controller using WinCC.
The advantage of this method over previous methods is that you no longer need to configure data
separately for each operator station (OS), you simply configure once using STEP 7. You can
transfer the data generated when you configure with STEP 7 to the WinCC database using the
transfer program AS-OS Engineering (part of the software package "Process Control System
PCS7"), during which the consistency of the data and their compatibility with the display system are
checked. WinCC uses the data in variable blocks and graphic objects.
Using STEP 7, you can configure or modify operator control and monitoring attributes for the
following variables:
• Input, output, and in/out parameters in function blocks
• Bit memory and I/O signals
• Parameters for CFC blocks in CFC charts
Basic Procedure
The procedure for configuring operator control and monitoring variables is dependent on the
selecting programming/configuration language and the type of variables you want to control and
monitor. The basic procedure always includes the following steps, however:
1. Assign system attributes for operator control and monitoring to the parameters of a function
block or to the symbols in a symbol table.
The step is not required in CFC because you take blocks that have already been prepared from
a library.
2. Assign the variables you want to control and monitor with the required attributes and logging
properties in a dialog box (S7_m_c). In the Operator Interface dialog box (menu command Edit
> Special Object Properties > Operator Interface), you can change WinCC attributes, such
as limit values, substitute values, and protocol properties, etc.
3. Transfer the configuration data generated with STEP 7 to your display system (WinCC) by
means of the AS-OS Engineering tool.
Naming Conventions
For the configuration data for WinCC to be saved and transferred, they are stored under a unique
name automatically assigned by STEP 7. The names of the variables for operator control and
monitoring, the CFC charts, and the S7 programs form part of this name and for this reason are
subject to certain conventions:
• The names of the S7 programs in an S7 project must be unique (different stations may not
contain S7 programs with the same name).
• The names of the variables, S7 programs, and CFC charts may not contain underscores,
blanks, or the following special characters: [ ‘ ] [ . ] [ % ] [ - ] [ / ] [ * ] [ + ].
Overview
Using the procedure described below, you can make function block parameters suitable for
operator control and monitoring and assign the required O, C, and M attributes to associated
instance DBs or shared DBs in your user program.
Requirements
You must have created a STEP 7 project, an S7 program, and a function block.
Basic Procedure
Overview
Independent of the programming language used, you can configure the following variables using
the procedure described below:
• Bit memory
• I/O signals
Requirement
Before you start, the following requirements must be fulfilled:
• You have created a project in the SIMATIC Manager.
• An S7 program with a symbol table must exist in this project.
• The symbol table must be open.
Basic Procedure
Overview
With CFC, you create your user program by selecting blocks that already have operator control and
monitoring capabilities from a library, and placing and linking them in a chart.
Requirement
You have inserted an S7 program in a STEP 7 project, created a CFC chart, and placed blocks in
it.
Basic Procedure
Note
If you use blocks which you have created yourself and to which you have assigned the system
attribute S7_m_c, you can give these blocks operator control and monitoring capabilities by
activating the "Operator Control and Monitoring" check box in the "Operator Control and
Monitoring" dialog box (menu command Edit > Special Object Properties > Operator Control
and Monitoring).
Introduction
Using the transfer program AS-OS Engineering you transfer the configuration data for operator
control and monitoring generated to the WinCC database.
Requirement
Before you start the transfer, the following requirements must be fulfilled:
• You have installed the program ASOS Engineering.
• You have generated the configuration data for operator control and monitoring.
Basic Procedure
To transfer the configuration data for operator control and monitoring to the WinCC database,
proceed as follows:
This type of access enables you to access a programmable logic controller quickly, for test
purposes, for example. You can access all the accessible programmable modules in the network.
Select this method if no project data about the programmable controllers are available on your
programming device.
You open the "Accessible Nodes" window using the menu command PLC > Display Accessible
Nodes. In the "Accessible Nodes" object, all the nodes accessible in the network are displayed
with their address.
Nodes that cannot be programmed with STEP 7 (such as programming devices or operator panels)
can also be displayed.
For PROFIBUS, the following additional information can also be shown in parentheses:
• (direct): This node is directly connected to the programming device (programming device or
PC).
• (passive): Programming and status/modify via PROFIBUS DP is not possible with this node
• (waiting): This node cannot be communicated with because its configuration does not match
the rest of the settings in the network.
18.1.2 Establishing an Online Connection via the Online Window of the Project
Select this method if you have configured the programmable controller in a project on your
programming device/PC. You can open the online window in the SIMATIC Manager using the
menu command View > Online. It displays the project data on the programmable controller (in
contrast to the offline window that displays the project data on the programming device/PC). The
online window shows the data on the programmable controller for the S7 program.
You use this view of the project for functions involving access to the programmable controller.
Certain functions in the "PLC" menu of the SIMATIC Manager can be activated in the online
window but not in the offline window.
There are two types of access as follows:
• Access with Configured Hardware
This means you can only access modules which were configured offline. Which online modules
you can access is determined by the MPI address set when the programmable module was
configured.
• Access without Configured Hardware
The requirement for this is an existing S7 program which was created independently of the
hardware (meaning it lies directly beneath the project). Which online modules you can access
is determined here by specifying the corresponding MPI address in the object properties of the
S7 program.
Access via the online window combines the data on the programmable control system with the
relevant data on the programming device. If, for example, you open an S7 block beneath a project
online, the display is made up as follows:
• Code section of the block from the CPU in the S7 programmable logic controller, and
• Comments and symbols from the database in the programming device (provided they exist
offline) When you open blocks directly in the connected CPU without an existing project
structure, they are displayed as they are found in the CPU, which means without symbols and
comments.
Requirements
• PGs/PCs or PC stations you want to use for online access to PLCs must have been assigned
in any one project of the multiproject.
Note: The assigned PG/PC or PC station is highlighted in yellow color when the corresponding
project is open.
The PG/PC assignment is only visible if the PG that opens the project is properly assigned.
• The cross-project subnets are merged.
• All projects of the multiproject have been compiled and configuration data have been
downloaded to the participating stations; for example, to provide routing information to all
participating modules for establishing connections between the PG/PC and the target module.
• The target modules can be accessed across the networks.
Note
If your CPU is set to protection level 1 and your CPU makes SFC 109 "PROTECT" available, you
can switch between protection levels 1, 2 and 3 with this SFC.
If protection level 2 is set on your CPU and your CPU provides the SFC 109 "PROTECT", you can
switch between the protection levels 2 and 3 with this SFC.
The call of the SFC 109 "PROTECT" with MODE=12 causes protection level 3 to be set without
password legitimation. This means that you cannot remove the read and write protection set with
the SFC 109 even if you have a valid password.
If you need to enter a password to execute an online function or access the content of a MMC, the
"Enter Password" dialog box is displayed. If you enter the correct password, you are given access
rights to modules for which a particular protection level was set during parameter assignment. You
can then establish online connections to the protected module and execute the online functions
belonging to that protection level.
Using the menu command PLC > Access Rights > Setup, you can call the "Enter Password"
dialog box directly. By doing this, for example at the beginning of a session, you can enter the
password once and will no longer be queried during later online accesses. The password remains
effective until either the SIMATIC Manager is closed or the password is cancelled with the menu
command PLC > Access Rights > Cancel.
Note
If the module does not have a real-time clock, the dialog box shows "00:00:00" for the time and
"00.00.00" for the date.
18.3.1 CPU Clocks with Time Zone Setting and Summer/Winter Time
On S7-400 CPUs as of firmware version 3, you can make or evaluate the following settings in
addition to the time and date:
• Summer/Winter Time
• Offset factors for displaying time zones
Summer/Winter Time
You can also set daylight-saving or standard time when you set up the TOD and the date. When
switching from daylight-saving to standard time, for example, per user program only the time
difference to the Module Time is taken into account. You can make this changeover with the block
"SET_SW_S" (FB 61) from the standard library "Miscellaneous blocks".
TOD Interrupts
OB 80 is called if TOD interrupts were not triggered due to the "Time jump" when standard time is
switched to daylight saving.
For daylight saving/standard time conversion the periodicity is maintained for TOD interrupts with
minute and hourly periodicity.
TOD Synchronization
A CPU that is configured as TOD Master (for example, in the CPU register "Diagnostics/Clock"),
always synchronizes other clocks with the Module Time and the current TOD status.
As of STEP 7 V5.1 Service Pack 3, you can update modules or submodules on a station in a
standardized way online. To do so, proceed as described below:
Concept
To update the firmware on a module (CPU, IM, etc.) or a submodule (DI, DO, etc.), you can
download the files (*.UPD) containing the latest firmware on the Internet
("http://www.siemens.com/automation/support").
Select one of these files and download it to the module (PLC Menu).
Prerequisites
The module in the station or module whose firmware is to be updated must be available online.
This means that the programming device (PG) is connected to the same MPI PROFIBUS or
Ethernet as the module whose firmware is to be updated. The firmware can also be updated when
the programming device (PG) is connected to the MPI interface of the DP master CPU and the
module whose firmware is to be updated is connected at the PROFIBUS of the DP interface or the
Ethernet of the PN interface. The CPU must support S7 routing between the MPI interface and the
DP interface or between the MPI interface and the PN interface.
The module or submodule itself must support Firmware updates. PROFINET GSD devices
(GSDML devices) only support firmware updates via "Show accessible devices".
The files containing the latest firmware versions must be available in the file system on your
PG/PC. Only files for one firmware version must be in one folder.
Procedure in HW Config
1. Open the station containing the module to be updated.
2. Select the module
For PROFIBUS DP interface modules such as an IM 151, select the icon for the DP slave. In
this case, it is the one that stands for ET 200S.
3. Follow the same procedure for PROFINET IO devices.
If you want to update the firmware of modules of a DP slave or IO device, click the "Change
Slot" button and select the slot of the module you want to update in the "Change Slot" dialog.
4. Select the menu command PLC > Update Firmware.
You can only activate the menu command if the selected module / DP slave / IO device or the
selected submodule supports the "Update firmware" function.
5. In the "Update firmware" dialog that is displayed, click the "Browse" button and select the path
to the firmware update files (*.UPD).
6. After you have selected a file, the lower fields of the "Update firmware" dialog will contain
information telling you for which modules the file is suitable and as of which firmware version.
Principle
STOP Mode
Set the operating mode from RUN to STOP before you do the following:
• Download the complete user program or parts of it to the CPU
• Execute a memory reset on the CPU
• Compress the user memory
Saving Downloading
Menu commands File > Save PLC > Download
File > Save As
Function The current status of the block in the editor The current status of the block in the
is saved on the hard disk of the editor is only downloaded to the CPU.
programming device.
Syntax check A syntax check is run. Any errors are A syntax check is run. Any errors are
reported in dialog boxes. The causes of reported in dialog boxes. The causes of
the errors and the error locations are also the errors and the error locations are also
shown. You must correct these errors shown. You must correct these errors
before you save or download the block. If before you save or download the block. If
no errors are found in the syntax, the block no errors are found in the syntax, the
is compiled into machine code and either block is compiled into machine code and
saved or downloaded. either saved or downloaded.
The table applies independent of whether you have opened the block online or offline.
After completing the configuration, parameter assignment, and program creation and establishing
the online connection, you can download complete user programs or individual blocks to a
programmable controller. To test individual blocks, you must download at least one organization
block (OB) and the function blocks (FB) and functions (FC) called in the OB and the data blocks
(DB) used. To download the system data created when the hardware was configured, the networks
configured, and the connection table created to the programmable controller, you download the
object "System Data".
You download user programs to a programmable controller using the SIMATIC Manager, for
example, during the end phase of the program testing or to run the finished user program.
The division of the load memory of a CPU into RAM and EEPROM areas determines the methods
available for downloading your user program or the blocks in your user program. The following
methods are possible for downloading data to the CPU:
As of STEP 7 V5.1 Service Pack 3, you can update modules or submodules on a station in a
standardized way online. To do so, proceed as described below:
Concept
To update the firmware on a module (CPU, IM, etc.) or a submodule (DI, DO, etc.), you can
download the files (*.UPD) containing the latest firmware on the Internet
("http://www.siemens.com/automation/support").
Select one of these files and download it to the module (PLC Menu).
Prerequisites
The module in the station or module whose firmware is to be updated must be available online.
This means that the programming device (PG) is connected to the same MPI PROFIBUS or
Ethernet as the module whose firmware is to be updated. The firmware can also be updated when
the programming device (PG) is connected to the MPI interface of the DP master CPU and the
module whose firmware is to be updated is connected at the PROFIBUS of the DP interface or the
Ethernet of the PN interface. The CPU must support S7 routing between the MPI interface and the
DP interface or between the MPI interface and the PN interface.
The module or submodule itself must support Firmware updates. PROFINET GSD devices
(GSDML devices) only support firmware updates via "Show accessible devices".
The files containing the latest firmware versions must be available in the file system on your
PG/PC. Only files for one firmware version must be in one folder.
Procedure in HW Config
1. Open the station containing the module to be updated.
2. Select the module
For PROFIBUS DP interface modules such as an IM 151, select the icon for the DP slave. In
this case, it is the one that stands for ET 200S.
3. Follow the same procedure for PROFINET IO devices.
If you want to update the firmware of modules of a DP slave or IO device, click the "Change
Slot" button and select the slot of the module you want to update in the "Change Slot" dialog.
4. Select the menu command PLC > Update Firmware.
You can only activate the menu command if the selected module / DP slave / IO device or the
selected submodule supports the "Update firmware" function.
5. In the "Update firmware" dialog that is displayed, click the "Browse" button and select the path
to the firmware update files (*.UPD).
6. After you have selected a file, the lower fields of the "Update firmware" dialog will contain
information telling you for which modules the file is suitable and as of which firmware version.
7. Click the "Run" button.
STEP 7 checks whether the selected file can be interpreted by the module. If the check result
is positive, the file is downloaded to the module.
If the operating mode of the CPU needs to be changed, dialogs will prompt you to carry out
these steps.
The module then carries out the firmware update independently.
Note: For a firmware update, such as to a CPU 317-2 PN/DP, a separate connection is usually
established to the CPU. In such case, the process can be interrupted. If no resources are
available for another connection, the existing connection is automatically used instead. In this
case, the connection cannot be interrupted. The "Cancel" button in the transfer dialog is grayed
out and unavailable.
8. In STEP 7, check (read out the CPU diagnostic buffer) whether the module was able to start up
with the new firmware.
Principle
Note
If the power goes down and then returns and the RAM does not have a battery backup, or following
a memory reset of the CPU the "old" blocks become valid again.
Requirements
For access to EPROM memory cards in the programming device which are intended for an S7
programmable logic controller, you will require the appropriate EPROM drivers. EPROM drivers are
offered as options when you install the STEP 7 Standard package. If you are using a PC, an
external prommer will be required to save to EPROM memory cards.
You can also install the drivers at a later date. To do this, call up the corresponding dialog box via
Start > Simatic > STEP 7 > Memory Card Parameter Assignment or via the Control Panel
(double-click the "Memory Card Parameter Assignment" icon).
Note
For PCS 7 projects, blocks cannot be downloaded using the dialog "Compile and Download Objects"- just as
they cannot be downloaded from the SIMATIC Manager. For PCS 7 projects, the following applies: PLCs must
only be downloaded to by means of CFCs in order to ensure correct sequencing during the download. This
must be done to prevent the CPU from going into STOP mode.
To determine whether the given project is a PCS 7 project, check the project properties.
• The interface of the target system that is being used for downloading must not be reconfigured
to any substantial extent:
- The interface address must not be changed.
- If you change the network settings, this may mean that not all the modules will be able to
be accessed.
• In the case of H-CPUs, you can select the CPU to receive the download (H-CPU 0 or H-CPU
1) before running the "Compile and Download Objects" function (Select the "CPU" object and
then click the "Edit" button).
• The following CPU parameters must not be changed:
- The maximum size for local data and communications resources on the CPU ("Memory"
tab)
- The password protection for the F-CPU ("Protection" tab)
• For each configured module, the following conditions must be fulfilled:
- The order number for the configured module must be identical with the order number of the
module that is actually inserted.
- The firmware version of the configured module must not be higher than the firmware
version of the module that is actually inserted.
- The station name, the name of the module and the plant designation must not have
changed since the last download. However, you can assign a new plant designation.
Tip
If, after the download is completed, a message appears stating that the download of the object was
completed with warnings, then be sure to view the contents of the log. It may be that the object was
either not downloaded or was not downloaded completely.
In the "Compile and download objects" dialog you prepare the objects that can be selected in your
project or multiproject for transfer to the PLC and their subsequent download (if desired). This
dialog can be used for objects in a station, a project or a multiproject.
Depending on the object selected, certain information may not be displayed. In addition, not all the
functions described below may be available for these objects. In particular, these restrictions may
apply to objects that were created with optional software packages.
For blocks in a block folder "compile" means that the consistency of the blocks is checked. In the
following, for simplicity, the consistency check for blocks will be referred to as compilation.
Procedure:
1. In SIMATIC Manager, select the object that you want to compile, or compile and download.
The following objects can be selected in the SIMATIC Manager:
- Multiproject
- Project
- Station
- S7 program without station assignment
2. In the SIMATIC Manager, select menu command PLC > Compile And Download Objects.
3. Select "Only compile" if you want to perform a check of the blocks without downloading them to
the PLC. Select this option if you do not want to download any of these objects to the PLC.
Note: Stations with missing HSPs are not compiled and loaded (the check boxes are not
visisble).
4. To prevent incomplete downloads to stations due to compilation errors, select the check box
"No download on compilation error". If this check box is selected, nothing will be downloaded. If
the check box is not selected, then all objects compiled without error are downloaded. Objects
that caused an error during compilation are not downloaded.
5. If you want to compile and download connections, select the corresponding check box for the
"Connections" object.
A multiproject is particularly suited for use as a starting point, since all connection partners for
cross-project connections can also be downloaded from this object.
6. In the "Compile" and "Download" columns, select the objects that you want to compile or
download. You selections will be indicated by checkmarks. If you selected "Compile only" in
Step 3, the "Download" column will be grayed out and unavailable.
7. Click on "Start" to begin the compilation.
8. Follow the instructions on the screen.
After the compilation or download is complete, a full log is displayed. You can open the full log or
single-object log at any time:
• Click on the "All" button to view the full log of the complete action.
• Click on "Single object" button to view only the log of the object you have selected in the object
table.
Fast Configuring
Entering the station configuration is easier if you upload the configuration data from the
programmable controller to your programming device after you have configured the hardware and
restarted (warm restart) the station. This provides you with the station configuration and the types
of the individual modules. Then all you have to do is specify these modules in more detail (order
number) and assign them parameters.
The following information is uploaded to the programming device:
• S7-300: Configuration for the central rack and any expansion racks
• S7-400: Configuration of the central rack with a CPU and signal modules without expansion
racks
• Configuration data for the distributed I/O cannot be uploaded to the programming device.
This information is uploaded if there is no configuration information on the programmable controller;
for example, if a memory reset has been carried out on the system. Otherwise, the Upload function
provides much better results.
For S7-300 systems without distributed I/O, all you have to do is specify these modules in more
detail (order number) and assign them parameters.
Note
When you upload data (if you do not already have an offline configuration), STEP 7 cannot
determine all the order numbers of the components.
You can enter the "incomplete" order numbers when you configure the hardware using the menu
command Options > Specify Module. In this way, you can assign parameters to modules that
STEP 7 does not recognize (that is, modules that do not appear in the "Hardware Catalog"
window); however, STEP 7 will not then check whether you are keeping to the parameter rules.
Using the menu command PLC > Upload Station you can upload the current configuration and all
blocks from the programmable controller of your choice to the programming device.
To do this, STEP 7 creates a new station in the current project under which the configuration will be
saved. You can change the preset name of the new station (for example, "SIMATIC 300-
Station(1)"). The inserted station is displayed both in the online view and in the offline view.
The menu command can be selected when a project is open. Selecting an object in the project
window or the view (online or offline) has no effect on the menu command.
You can use this function to make configuring easier.
• For S7-300 programmable controllers, the configuration for the actual hardware configuration is
uploaded including the expansion racks, but without the distributed I/O (DP).
• For S7-400 programmable controllers, the rack configuration is uploaded without the expansion
racks and without the distributed I/O.
With S7-300 systems without distributed I/O, all you have to do is specify the modules in more
detail (order number) and assign them parameters.
You can upload S7 blocks from the CPU to the hard disk of the programming device using the
SIMATIC Manager. Uploading blocks to the programming device is useful in the following
situations:
• Making a backup copy of the current user program loaded in the CPU. This backup can then
be downloaded again, for example, following servicing or following a memory reset of the CPU
by maintenance personnel.
• You can upload the user program from the CPU to the programming device and edit it there,
for example, for troubleshooting purposes. In this case you do not have access to symbols or
comments for program documentation. Therefore we recommend that this procedure is used
only for service purposes.
Being able to upload blocks from the CPU to the programming device has the following uses:
• During the test phase, you can correct a block directly on the CPU and document the result.
• You can upload the current contents of blocks from the RAM load memory of the CPU to your
programming device via the load function.
Note
Time stamp Conflicts when Working Online and Offline
The following procedures lead to time stamp conflicts and should therefore be avoided.
Time stamp conflicts result when you open a block online if:
• Changes made online were not saved in the offline S7 user program
• Changes made offline were not downloaded to the CPU
Time stamp conflicts result when you open a block offline if:
• An online block with a time stamp conflict is copied to the S7 user program offline and the
block is then opened offline.
19.3.3.2 Editing Uploaded Blocks if the User Program is Not on the PG/PC
To edit blocks from the CPU, proceed as follows:
1. In the SIMATIC Manager, click the "Accessible Nodes" toolbar button or select the menu
command PLC > Display Accessible Nodes.
2. Select the node ("MPI=..." object) from the list displayed and open the "Blocks" folder to display
the blocks.
3. You can now open blocks and edit, monitor, or copy them as required.
4. Select the menu command File > Save As and enter the path for the programming device
where you want to store the blocks in the dialog box.
5. Select the menu command PLC > Download to download the changed blocks to the
programmable controller.
Before downloading your user program to the S7 programmable controller, you should perform a
memory reset on the CPU to ensure that no "old" blocks are still on the CPU.
Deleting individual blocks on the CPU may be necessary during the test phase of the CPU
program. Blocks are stored in the user memory of the CPU either in the EPROM or RAM
(depending on the CPU and the load procedure).
• Blocks in the RAM can be deleted directly. The occupied space in the load or work memory
becomes free and can be used again.
• Blocks in the integrated EPROM are always copied to the RAM area following a memory reset
of the CPU. The copies in the RAM can be deleted directly. The deleted blocks are then
marked in the EPROM as invalid until the next memory reset or power down without RAM
backup. Following a memory reset or power down without RAM backup, the "deleted" blocks
are copied from the EPROM to the RAM and become active. Blocks in the integrated EPROM
(for example, in the CPU 312) are deleted by overwriting them with the new RAM contents.
• EPROM memory cards must be erased in the programming device.
After deleting and reloading blocks, gaps can occur in the user memory (load and work memory)
and reduce the usable memory area. With the compress function, the existing blocks are
rearranged in the user memory without gaps, and a continuous free memory is created.
The following figure shows a diagram of how occupied blocks of memory are shifted together by
the compress function.
Procedure
1. Select the S7 program in the "Accessible Nodes" window or the online view of the project.
2. Select the menu command PLC > Diagnostics/Setting > Module Information.
3. In the dialog box which then appears, select the "Memory" tab. In this tabbed page there is a
button for compressing the memory if the CPU supports this function.
Before you can monitor or modify variables, you must create a variable table (VAT) and enter the
required variables. To create a variable table, you can choose from one of the following methods:
In "Monitor/Modify Variables":
• You can use the menu command Table > New to create a new variable table which is not yet
assigned to any S7 program. You can open existing tables with Table > Open.
• You can use the corresponding symbols in the toolbar to create or open variable tables.
Once you have created a variable table, you can save it, print it out, and use it again and again for
monitoring and modifying.
Note
When copying/moving variable tables, remember that the symbolic name is the main criterion, in
other words, the number is assigned automatically.
Exa m p le 1: You want to copy or move the variable table with the symbolic name "OTTO" and the
(unchangeable) name "VAT1" to another project that also has a variable table with the symbolic
name "OTTO". You will be asked whether you want to overwrite the existing variable table or
assign a new name. If you assign a new (symbolic) name, the unchangeable name of the new
variable table is adapted.
Example 2: You want to copy or move the variable table with the symbolic name "OTTO" and the
(unchangeable) name "VAT1" to another project that does not have a variable table with the
symbolic name "OTTO". When you insert the new variable table, the unchangeable name of the
new variable table is adapted.
You can use saved variable tables to monitor and modify variables when you test a program again.
1. Save the variable table using the menu command Table > Save.
2. If the variable table has been created, you must now give the variable table a name, for
example, "ProgramTest_1."
When you save a variable table, all the current settings and the table format are saved. This means
that the settings made under the menu item "Trigger" are saved.
Select the variables whose values you want to modify or monitor and enter them in the variable
table. Start from the "outside" and work "inwards"; this means you should first select the inputs and
then the variables that are influenced by the inputs and which influence the outputs, and finally the
outputs.
If you want, for example, to monitor the input bit 1.0, the memory word 5, and the output byte 0,
enter the following in the "Address" column:
Example:
I 1.0
MW5
QB0
Syntax Check
When you enter variables in the variable table, a syntax check is carried out at the end of each line.
Any incorrect entries are marked in red.
If you position the cursor in a row marked in red, brief information is displayed telling you the cause
of the error. Notes on correcting the error can be obtained by pressing F1.
Note
If you prefer to edit the variable table with the keyboard (without the mouse), you should keep the
"Brief Information When Using the Keyboard" feature enabled.
If necessary, you can change the setting in the variable table by selecting the menu command
Option > Customize and then selecting the "General" tab.
Maximum Size
A maximum of 255 characters per line are permitted in a variable table. A carriage return into the
next row is not possible. A variable table can have up to a maximum of 1024 rows. This is then its
maximum size.
Examples:
Note
• You can enter timers in millisecond steps but the value entered is adapted to the time frame.
The size of the time frame depends on the size of the time value entered (137 becomes 130
ms; the 7 ms were rounded down).
• The modify values for addresses of the data type WORD, for example, IW1, are converted to
BCD format. Not every bit pattern is a valid BCD number, however. If the entry cannot be
represented as SIMATIC_TIME for an address of the data type WORD, the application reverts
automatically to the default format (here: HEX, see Select Monitor Format, Default Command
(View Menu)) so that the value entered can be displayed.
Examples:
Note
• If you enter a decimal number for a counter and do not mark the value with C#, this value is
automatically converted to BCD format (137 becomes C#137).
• The modify values for addresses of the data type WORD, for example, IW1, are converted to
BCD format. Not every bit pattern is a valid BCD number, however. If the entry cannot be
represented as COUNTER for an address of the data type WORD, the application reverts
automatically to the default format (here: HEX, see Select Monitor Format, Default Command
(View Menu)) so that the value entered can be displayed.
20.4.7 Examples
Note
The entry "DB0. .." is not permitted because it is already used internally.
Note that in this example the designation in the "Address" column changes after the eighth entry.
Bit Addresses
Byte Addresses
Word Addresses
Timers
Modifying a timer affects only the value, not the state. This means that the timer T1 can be
modified to the value 0, without the result of logic operation for A T1 being changed.
The strings 5t, s5time can be written in either upper or lower case.
Counters
Modifying a counter only affects the value, not the state. This means that Counter C1 can be
modified to the value 0 without the result of logic operation for A C1 being changed.
Note
If you created an unnamed variable table with the menu command Table > New, you can establish
a connection to the last configured CPU configured if it is defined.
You can display on the programming device the current values of individual variables in a user
program at a specific point during program processing (trigger point) in order to monitor them.
When you select a trigger point you determine the point in time at which the monitor values of
variables will be displayed.
You can set the trigger point and a trigger frequency using the menu command Variable > Trigger.
Trigger Point
The following figure shows the position of the trigger points.
To display the modified value in the "Status Value" column, you should set the trigger point for
monitoring to "Start of cycle" and the trigger point for modifying to "End of cycle".
Trigger Immediately
You can update the values of selected variables using the menu command Variable > Update
Monitor Values. This command is taken to mean "trigger immediately" and is executed as quickly
as possible without reference to any point in the user program. These functions are mainly used for
monitoring and modifying in STOP mode.
Trigger Frequency
The following table shows the effect that the trigger frequency has on the monitoring of variables:
! Danger
Changing the variable values while a process is running can lead to serious damage to property or
personnel if errors occur in the function or in the program.
Make sure that no dangerous situations can occur before you execute the "Modify" function.
You can assign fixed values to individual variables of a user program (once or every cycle) at a
specific point during program processing (trigger point).
When you select a trigger point you determine the point in time at which the modify values are
assigned to the variables.
You can set the trigger point and a trigger frequency using the menu command Variable > Trigger.
Trigger Point
The following figure shows the position of the trigger points.
Trigger Immediately
You can modify the values of selected variables using the menu command Variable > Activate
Modify Values. This command is taken to mean "trigger immediately" and is executed as quickly
as possible without reference to any point in the user program. This function is used mainly for
modifying in STOP mode.
Trigger Frequency
The following table shows the effect that the trigger condition set has on the modifying of variables:
! Caution
• Before you start the Force function you should check that nobody is executing this function on the same
CPU at the same time.
• A Force job can only be deleted or terminated with the menu command Variable > Stop Forcing. Closing
the force values window or exiting the "Monitoring and Modifying Variables" application does not delete
the force job.
• Forcing cannot be undone (for example, with Edit > Undo).
• Read the information on the Differences between Forcing and Modifying Variables.
• If a CPU does not support the Force function, all menu commands in the Variable menu linked with
forcing are deactivated.
If the output disable is deactivated with the menu command Variable > Enable Peripheral Output, all forced
output modules output their force value.
You can assign fixed values to individual variables of a user program so that they cannot be
changed or overwritten even by the user program executing in the CPU. The requirement for this is
that the CPU supports this function (for example, the S7-400 CPUs). By assigning fixed values to
variables you can set specific situations for your user program and use this to test the programmed
functions.
The name of the current online connection is shown in the title bar.
The data and time the force job was read from the CPU are shown in the status bar.
If no force job is active, the window is empty.
The different methods of displaying variables in the "Force Values" window have the following
significance:
Display Meaning
Bold: Variables that are already assigned a fixed value in the CPU.
Normal: Variables that are being edited.
Grayed out: Variables of a module that is not present/inserted in the rack
or
Variables with an address error; an error message is displayed.
Using the Force Job from the CPU or Setting Up a New Force Job
If the "Force Values" window is open and active, another message is displayed:
• If you confirm it, the changes in the window are overwritten with the force job existing on the
CPU. You can restore the previous window contents with the menu command Edit > Undo.
• If you cancel it, the current contents of the window are retained.
You can then save the contents of the "Force Values" window as a variable table using the
menu command Table > Save As or select the menu command Variable > Force: this writes
the current contents of the window to the CPU as the new force job.
Monitoring and modifying variables is only possible in the variable table and not in the "Force
Values" window.
The following table summarizes the differences between forcing and modifying:
Note
• With "Enable Peripheral Outputs," the force values for forced peripheral outputs become
effective on the corresponding output modules; the modify values for peripheral outputs,
however, do not.
• With forcing, the variable always has the forced value. This value is read during each read
access to the user program. All forms of write access are ineffective.
• With permanent modifying, read access to the program is effective and remains so until the next
trigger point.
! Warning
Testing a program while a process is running can lead to serious damage to property or persons if
errors occur in the function or in the program.
Ensure that no dangerous situations can occur before you execute this function.
Requirements
To display the program status, the following requirements must be fulfilled:
• You must have saved the block without errors and then downloaded it to the CPU.
• The CPU must be in operation and the user program running.
To set breakpoints, and to execute the program in single-step mode, test operation mode must be
set (see menu command Debug > Operation). These test functions are not possible in process
operation mode.
Status of Elements
• The status of a contact is:
- Fulfilled if the address has the value "1,"
- Not fulfilled if the address has the value "0,"
- Unknown if the value of the address is unknown.
• The status of elements with enable output (ENO) corresponds to the status of a contact with
the value of the ENO output as the address.
• The status of elements with a Q output corresponds to the status of a contact with the value of
the address.
• The status for CALLs is fulfilled if the BR bit is set following the call.
• The status of a jump instruction is fulfilled if the jump is executed, meaning if the jump condition
is fulfilled.
• Elements with enable output (ENO) are shown in black if the enable output is not connected.
Status of Lines
• Lines are black if they are not run through or if their status is unknown.
• The status of lines that start at the power rail is always fulfilled ("1").
• The status of lines at the start of parallel branches is always fulfilled ("1").
• The status of the line following an element is fulfilled if both the status of the line before the
element and the status of the element are fulfilled.
• The status of the line following NOT is fulfilled if the status of the line before NOT is not fulfilled
(and vice versa).
• The status of the line after an intersection of a number of lines is fulfilled if:
- The status of at least one line before the intersection is fulfilled.
- The status of the line before the branch is fulfilled.
Status of Parameters
• The values of parameters in bold type are current.
• The values of parameters in thin type result from a previous cycle; the program section was not
processed in the current scan cycle.
Requirements
• The test operation mode must be set. Testing in single-step mode is not possible in process
operation mode (see menu command Debug > Operation).
• Testing in single-step mode is possible only in Statement List. For blocks in Ladder Logic or
Function Block Diagram you must change the view using the menu command View > STL.
• The block must not be protected.
• The block must be open online.
• The opened block must not be changed in the Editor.
Number of Breakpoints
The number of breakpoints is variable and depends on the following:
• The number of breakpoints already set
• The number of variable statuses running
• The number of program statuses running
Refer to your programmable controller documentation to find out whether it supports testing in
single-step mode.
You will find the menu commands you can use to set, activate, or delete breakpoints in the "Debug"
menu. You can also select these menu commands using icons in the breakpoint bar. Display the
breakpoint bar using the menu command View > Breakpoint Bar.
Danger
Risk of dangerous plant status in HOLD mode.
You can set the display of the program status in a Statement List, Function Block Diagram, or
Ladder Logic block yourself.
To set the display, proceed as follows:
1. Select the menu command Options > Customize.
2. In the "Customize" dialog box, select the "STL" tab or the "LAD/FBD" tab.
3. Select the required options for testing the program. You can display the following status fields.
Symbol Meaning
Mismatch between preset and actual configuration: the
configured module does not exist or a different module type
is inserted
Fault: module has a fault.
Possible causes: diagnostic interrupt, I/O access error, or
error LED detected
Diagnostics not possible: no online connection, or the CPU
does not return diagnostic information to the module (for
example, power supply, or submodule).
Symbol Mode
STARTUP
STOP
STOP
triggered by STOP mode on another CPU in
multicomputing operation
RUN
HOLD
Symbol Mode
Variables are being forced on this module, meaning
variables in the user program for the module are assigned
fixed values that cannot be changed by the program.
The symbol for forcing can also appear in combination with
other symbols (here with the symbol for RUN mode).
Symbol Meaning
Maintenance required
Icon Meaning
The quick view offers you a quick way of using "Diagnosing Hardware" with less information than
the more detailed displays in the diagnostic view of HW Config. The quick view is displayed as
default when the "Diagnose Hardware" function is called.
Using this method you can open the "Module Information" dialog box for all modules in the rack.
The diagnostic view (configuration table) shows the actual structure of a station at the level of the
racks and DP stations with their modules.
Note
• If the configuration table is already open offline, you can also get the online view of the
configuration table using the menu command Station > Open Online.
• Depending on the diagnostics capability of the module, a varying number of tabs are displayed
in the "Module Information" dialog box.
• In the "Accessible Nodes" window, only the modules with their own node address (Ethernet,
MPI or PROFIBUS address) are ever visible.
Note
In the "Accessible Nodes" window, only the modules with their own node address (Ethernet, MPI or
PROFIBUS address) are visible.
In contrast to the quick view, the diagnostic view displays the entire station configuration available
online. This consists of:
• Rack configurations
• Diagnostics symbols for all configured modules
From these, you can read the status of each module and, with CPU modules, the operating
mode.
• Module type, order number and address details, comments on the configuration.
You can display the "Module Information" dialog box from different starting points. The following
procedures are examples of frequently used methods of calling module information:
• In the SIMATIC Manager from a window with the project view "online" or "offline."
• In the SIMATIC Manager from an "Accessible Nodes" window
• In the diagnostic view of HW Config
In order to display the status of a module with its own node address, you require an online
connection to the programmable controller. You establish this connection via the online view of a
project or via the "Accessible Nodes" window.
The module information functions can each be found in the various tabs within the "Module
Information" dialog box. When displayed in an active situation, only those tabs relevant to the
selected module are displayed.
Scan Cycle Time Duration of the longest, shortest, and To keep a check on the configured
last scan cycle of the selected CPU minimum cycle time, and the maximum
and current cycle times
Time System Current time, operating hours, and To display and set the time and date of
information about synchronizing clocks a module and to check the time
(synchronization intervals) synchronization
Performance Data Address areas and the available blocks Before and during the creation of a user
for the selected module (CPU/FM) program to check whether the CPU
fulfils the requirements for executing a
user program; for example, load
memory size or size of the process
image
Blocks Display of all block types available in the To check which standard blocks your
(can be opened from scope of supply of the selected module user program can contain or call to be
the "Performance List of OBs, SFBs, and SFCs you can able to run on the selected CPU.
Data" tab) use for this module
Communication Transmission rates, the overview of To determine how many and which CPU
communication connections, the connections are possible and how many
communication load, and the maximum are in use
message frame size on the
communication bus of the selected
module
Connection statistics Statistics about the distribution of the To determine whether an overload
communication load on your CPU. through communication existst
The scope of information that can be evaluated and displayed is dependent on:
• The module selected, and
• From which view you call the module information
A full scope of information is available when called from the online view of the configuration
tables or from the project window.
A limited scope of information is available when called from the "Accessible Nodes" window.
Depending on the scope of the information, the modules are divided into the categories "with
system diagnostic capability," "with diagnostic capability," or "without diagnostic capability." The
following figure shows these categories:
• Modules with system diagnostic capability are, for example, the modules FM 351 and FM 354
• Modules with diagnostic capability are most analog signal modules.
• Modules without diagnostic capability are most digital signal modules.
Tabs Displayed
The table shows which property tabs can be present in the "Module Information" dialog box for
each module type.
In addition to the information in the tabbed property sheets, the operating mode is displayed for
modules with an operating mode. When you open the dialog box from the configuration tables
online, the status of the module from the viewpoint of the CPU is displayed (for example, OK, error,
module not available).
23.5.4 Displaying the Module Status of PA Field Devices and DP Slaves After a
Y-Link
As of STEP 7 V5.1 Service Pack 3, you can evaluate the module status of DP slaves and PA field
devices "after" a DP/PA link (IM 157).
This affects the following configurations:
• IM 157 with DP/PA connectors for connecting a PROFIBUS-PA
• IM 157 as a redundant modular interface module for connecting a non-redundant PROFIBUS-
DP ("Y-link")
In this configuration, the programming device (PG) is connected to the same PROFIBUS subnet as
the DP/PA link.
In addition, there is another configuration option in which the PG is connected to an Industrial
Ethernet and routes an S7-400 station to the PROFIBUS subnet.
The prerequisites for this setup are shown in the following diagram:
IM 157 as Y-link
PG in an Industrial Ethernet
To determine why the CPU has gone into "STOP" mode, proceed as follows:
1. Select the CPU that has gone into STOP.
2. Select the menu command PLC > Diagnostics/Settings > Module Information.
3. Select the "Diagnostic Buffer" tab.
4. You can determine the cause of the STOP from the last entries in the diagnostic buffer.
By evaluating the diagnostic buffer and the stack contents you can determine the cause of the fault
in the processing of the user program.
If, for example, the CPU has gone into STOP as a result of a programming error or the STOP
command, the "Stacks" tab in the module information displays the block stack. You can display the
contents of the other stacks using the "I Stack", "L Stack", and "Nesting Stack" buttons. The stack
contents give you information on which instruction in which block led to the CPU going into STOP.
B Stack Contents
The B stack, or block stack, lists all the blocks that were called before the change to STOP mode
and which were not completely processed.
I Stack Contents
When you click the "I Stack" button, the data at the interrupt location are displayed. The I stack, or
interrupt stack, contains the data or the states which were valid at the time of the interrupt, for
example:
• Accumulator contents and register contents
• Open data blocks and their size
• Content of the status word
• Priority class (nesting level)
• Interrupted block
• Block in which program processing continues after the interrupt
L Stack Contents
For every block listed in the B stack, you can display the corresponding local data by selecting the
block and clicking the "L Stack" button.
The L stack, or local data stack, contains the local data values of the blocks the user program was
working with at the time of the interrupt.
In-depth knowledge of the system is required to interpret and evaluate the local data displayed.
The first part of the data displayed corresponds to the temporary variables for the block.
The "Scan Cycle Time" tab in the module information gives information about the scan cycle times
of the user program.
If the duration of the longest cycle time is close to the configured maximum scan cycle time, there
is a danger that fluctuations in the cycle time might cause a time error. This can be avoided if you
extend the maximum cycle time (watchdog time) of the user program.
If the cycle length is less than the configured minimum scan time, the cycle is automatically
extended by the CPU/FM to the configured minimum cycle time. In the case of a CPU, the
background OB (OB90) is processed during this extended time (if it has been downloaded).
The system status list (SSL) describes the current status of the programmable logic controller. It
provides an overview of the configuration, the current parameter assignment, the current statuses
and sequences on the CPU, and the modules belonging to it.
You can only read the data in the system status list but not modify them. It is a virtual list that is
only created on request.
The information that you can display using the system status list can be divided into four areas.
Topic Information
Module identification Order number, type ID, and version of the module
CPU characteristics Time system, system behavior (for example,. multicomputing)
and language description of the CPU
Memory areas Memory configuration of the module (size of the work memory).
System areas System memory of the module (for example, number of memory
bits, timers, counters, memory type).
Block types Which blocks (OB, DB, SDB, FC, FB) exist on the module, the
maximum number of blocks of one type, and the maximum size
of a block type
Assignment of interrupts and errors Assignment of interrupts/errors to OBs
Interrupt status Current status of interrupt processing/interrupts generated
Status of the priority classes Which OB is being executed, which priority class is disabled due
to the parameter setting
Operating mode and mode transition Which operating modes are possible, the last operating mode
change, the current operating mode
Topic Information
Communication status data All the communication functions currently set in the system
Diagnostic modules The modules with diagnostics capability logged on at the CPU
Start information list of the OB Start information about the OBs of the CPU
Start event list Start events and priority classes of the OBs
Module status information Status information about all assigned modules that are plugged in,
faulty, or generate hardware interrupts
Topic Information
Module diagnostic information Module start address, internal/external faults, channel faults, parameter
errors (4 bytes)
Module diagnostic data All the diagnostic data of a particular module
You can also extend the standard system diagnostics of SIMATIC S7 by using the system function
SFC 52 WRUSMSG to:
• Enter your own diagnostic information in the diagnostic buffer (for example, information about
the execution of the user program).
• Send user defined diagnostic messages to logged-on stations (monitoring devices such as a
PG, OP or TD).
System diagnostics detect, evaluate, and report errors that occur within a programmable controller.
For this purpose, every CPU and every module with system diagnostics capability (for example,
FM 354) has a diagnostic buffer in which detailed information on all diagnostic events is entered in
the order they occurred.
Diagnostic Events
The following entries are displayed as diagnostic events, for example:
• Internal and external faults on a module
• System errors in the CPU
• Operating mode changes (for example, from RUN to STOP)
• Errors in the user program
• Inserting/removing modules
• User messages entered with the system function SFC52
The content of the diagnostic buffer is retained following a memory reset. Using the diagnostic
buffer, errors in the system can still be analyzed at a later time to find the cause of a STOP or to
trace back and categorize the occurrence of individual diagnostic events
Displaying Faults
Internal and external module faults are displayed on the front panels of the module. The LED
displays and their evaluation are described in the S7 hardware manuals. With the S7-300, internal
and external faults are displayed together as a group error.
The CPU recognizes system errors and errors in the user program and enters diagnostic
messages in the system status list and the diagnostic buffer. These diagnostic messages can be
read out on the programming device.
Signal and function modules with diagnostic capability detect internal and external module errors
and generate a diagnostic interrupt to which you can react using an interrupt OB.
Error Error OB
I/O redundancy error OB70
CPU redundancy error OB72
Time error OB80
Power supply error OB81
Diagnostic interrupt OB82
Insert/remove module interrupt OB83
CPU hardware fault OB84
Priority class error OB85
Rack failure or failure of a station in the distributed I/O OB86
Communication error OB87
Programming error OB121
I/O access error OB122
If the appropriate OB is not available, the CPU goes into STOP mode (exceptions: OB70, OB72,
OB81, OB87). Otherwise, it is possible to store instructions in the OB as to how it should react to
this error situation. This means the effects of an error can be reduced or eradicated.
Basic Procedure
Using the RET_VAL output parameter (return value), a system function indicates whether or not
the CPU was able to execute the SFC function correctly
Processing of the SFC by the CPU Return Value Sign of the Integer
Error occurred Less than "0" Negative (sign bit is "1")
No error Greater than or equal to "0" Positive (sign bit is "0")
You can find more detailed information on the output parameter RET_VAL in the Help on
SFBs/SFCs.
Detectable Errors
The system program can detect the following errors:
• CPU functioning incorrectly
• Error in the system program execution
• Errors in the user program
• Error in the I/Os
Depending on the type of error, the CPU is set to STOP mode or an error OB is called.
Programming Reactions
You can design programs to react to the various types of errors and to determine the way in which
the CPU reacts. The program for a particular error can then be saved in an error OB. If the error
OB is called, the program is executed.
Error OBs
A distinction is made between synchronous and asynchronous errors as follows:
• Synchronous errors can be assigned to an MC7 instruction (for example, load instruction for a
signal module which has been removed).
• Asynchronous errors can be assigned to a priority class or to the entire programmable logic
controller (for example, cycle time exceeded).
The following table shows what types of errors can occur. Refer to your "S7-300 Programmable
Controller, Hardware and Installation Manual" or the "S7-400 Programmable Controller, Hardware
and Installation Manual" for information as to whether your CPU provides the specified OBs.
You can write a program that evaluates the event code triggered by the OB81 call. You can also
write a program that brings about a reaction, such as activating an output connected to a lamp on
the operator station.
STL Description
L B#16#21 // Compare event code "battery exhausted"
//(B#16#21) with
L #OB81_FLT_ID // the error code for OB81.
==I // If the same (battery is exhausted),
// jump to Berr.
JC Berr
L B#16#22 // Compare event code "battery failure"
//(b#16#22) with
==I // the error code for OB81.
JC BF // If the same, jump to Berr.
BEU // No message about battery failure
You can find detailed information on OBs, SFBs, and SFCs, as well as an explanation of event IDs,
in the corresponding Help on Blocks.
With certain types of error (for example, a wire break affecting an input signal), you can supply
substitute values for values that are not available due to the error. There are two ways in which you
can supply substitute values:
• You can assign substitute values for configurable output modules using STEP 7. Output
modules that cannot have parameters assigned have the default substitute value 0.
• Using SFC44 RPLVAL, you can program substitute values in error OBs (only for input
modules).
For all load instructions that lead to synchronous errors, you can specify a substitute value for the
accumulator content in the error OB.
In this example, the substitute value in the following figure is entered in the program so that the
program can continue to operate with feasible values.
If an input module fails, the processing of the statement L PIB0 produces a synchronous error and
starts OB122. As standard, the load instruction reads in the value 0. With SFC44, however, you
can define any substitute value suitable for the process. The SFC replaces the accumulator content
with the specified substitute value.
The following sample program could be written in OB122. The following table shows the temporary
variables that must be declared, in this case, in the variable declaration table of OB122.
STL Description
L B#16#2942 Compare the event code of OB122 with the event code
L #OB122SWFLT (B#16#2942) for the acknowledgement of a time error when
reading the I/O. If the same, jump to "Aerr".
==I
Compare the event code of OB122 with the event code
JC Aerr
(B#16#2943) for an addressing error (writing to a module
L B#16#2943 that does not exist). If not the same, jump to "Stop."
<> I Label "Aerr": transfers DW#16#2912 (binary 10010) to
JC Stop SFC44 (REPL_VAL). SFC44 loads this value in accumulator
1 (and substitutes the value that triggered the OB122 call).
The SFC error code is saved in #Error.
Aerr: CALL "REPL_VAL"
VAL : = DW#16#2912 Compare #Error with 0 (if the same, no error occurred when
RETVAL : = #Error executing OB122). End the block if no error occurred.
L #Error "Stop" label: calls SFC46 "STP" and changes the CPU to
L 0 STOP mode.
==I
BEC
Description
The operating system of a H CPU calls OB70 if a loss of redundancy occurs on the PROFIBUS DP
(for example, if there is a bus failure on the active DP master or an error in the DP slave interface
module) or if the active DP master changes from DP slaves with switched I/Os.
Programming OB70
You must create OB70 as an object in your S7 program using STEP 7. Write the program to be
executed in OB70 in the generated block and download it to the CPU as part of your user program.
You can use OB70, for example, for the following purposes:
• To evaluate the start information of OB70 and determine which event triggered the loss of I/O
redundancy.
• To determine the status of your system using SFC51 RDSYSST (SZLID=B#16#71).
The CPU does not change to STOP mode if an I/O redundancy error occurs and OB70 is not
programmed.
If OB70 is downloaded and the H system is not in redundant mode, OB70 is processed in both
CPUs. The H system remains in redundant mode.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the H CPU calls OB72 if one of the following events occurs:
• Loss of redundancy on the CPUs
• Comparison error (for example, RAM, PIQ)
• Standby-master switchover
• Synchronization error
• Error in a SYNC submodule
• Update process aborted
• OB72 is executed by all CPUs which are in RUN mode or STARTUP mode after an
accompanying start event.
Programming OB72
You must create OB72 as an object in your S7 program using STEP 7. Write the program to be
executed in OB72 in the generated block and download it to the CPU as part of your user program.
You can use OB72, for example, for the following purposes:
• To evaluate the start information of OB72 and determine which event triggered the loss of CPU
redundancy.
• To determine the status of your system using SFC51 RDSYSST (SZLID=B#16#71).
• To react to the loss of CPU redundancy specifically for the plant.
The CPU does not change to STOP mode if a CPU redundancy error occurs and OB72 is not
programmed.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the CPU calls OB80 when a time error occurs. Time errors include the
following, for example:
• Maximum cycle time exceeded
• Timeofday interrupts skipped by moving the time forward
• Delay too great when processing a priority class
Programming OB80
You must create OB80 as an object in your S7 program using STEP 7. Write the program to be
executed in OB80 in the generated block and download it to the CPU as part of your user program.
You can use OB80, for example, for the following purposes:
• To evaluate the start information of OB80 and to determine which timeofday interrupts were
skipped.
• By including SFC29 CANTINT, you can deactivate the skipped timeofday interrupt so that it is
not executed and only timeofday interrupts relative to the new time will be executed.
If you do not deactivate skipped timeofday interrupts in OB80, the first skipped timeofday
interrupt is executed, all others are ignored.
If you do not program OB80, the CPU changes to STOP mode when a time error is detected.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the CPU calls OB81 if one of the following fails in a CPU or an expansion
unit
• The 24-V voltage supply
• A battery
• The complete backup
This OB is also called when the problem has been eliminated (the OB is called when an event
comes and goes).
Programming OB81
You must create OB81 as an object in your S7 program using STEP 7. Write the program to be
executed in OB81 in the generated block and download it to the CPU as part of your user program.
You can, for example, use OB81 for the following purposes:
• To evaluate the start information of OB81 and determine which power supply error has
occurred.
• To find out the number of the rack with the defective power supply.
• To activate a lamp on an operator station to indicate that maintenance personnel should
replace a battery.
If you do not program OB81, the CPU does not change to STOP mode if a power supply error is
detected. The error is, however, entered in the diagnostic buffer and the corresponding LED on the
front panel indicates the error.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the CPU calls OB82 when a module with diagnostics capability on which
you have enabled the diagnostic interrupt detects an error and when the error is eliminated (the OB
is called when the event comes and goes).
Programming OB82
You must create OB82 as an object in your S7 program using STEP 7. Write the program to be
executed in OB82 in the generated block and download it to the CPU as part of your user program.
You can, for example, use OB82 for the following purposes:
• To evaluate the start information of OB82.
• To obtain exact diagnostic information about the error that has occurred.
When a diagnostic interrupt is triggered, the module on which the problem has occurred
automatically enters 4 bytes of diagnostic data and their start address in the start information of the
diagnostic interrupt OB and in the diagnostic buffer. This provides you with information about when
an error occurred and on which module.
With a suitable program in OB82, you can evaluate further diagnostic data for the module (which
channel the error occurred on, which error has occurred). Using SFC51 RDSYSST, you can read
out the module diagnostic data and enter this information in the diagnostic buffer with SFC52
WRUSRMSG. You can also send a userdefined diagnostic message to a monitoring device.
If you do not program OB82, the CPU changes to STOP mode when a diagnostic interrupt is
triggered.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
S7-400 CPUs monitor the presence of modules in the central rack and expansion racks at intervals
of approximately 1 second.
After the power supply is turned on, the CPU checks whether all the modules listed in the
configuration table created with STEP 7 are actually inserted. If all the modules are present, the
actual configuration is saved and is used as a reference value for cyclic monitoring of the modules.
In each scan cycle, the newly detected actual configuration is compared with the previous actual
configuration. If there are discrepancies between the configurations, an insert/remove module
interrupt is signaled and an entry is made in the diagnostic buffer and the system status list. In
RUN mode, the insert/remove module interrupt OB is started.
Note
Power supply modules, CPUs, and IMs must not be removed in RUN mode.
Between removing and inserting a module, at least two seconds must be allowed to pass so that the CPU can
detect that a module has been removed or inserted.
Programming OB83
You must create OB83 as an object in your S7 program using STEP 7. Write the program to be
executed in OB83 in the generated block and download it to the CPU as part of your user program.
You can use OB83, for example, for the following purposes:
• To evaluate the start information of OB83.
• By including system functions SFC55 to 59, to assign parameters to a newly inserted module.
If you do not program OB83, the CPU changes from RUN to STOP when an insert/remove module
interrupt occurs.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the CPU calls OB84 when an error is detected on the interface to the MPI
network, to the communication bus, or to the network card for the distributed I/Os; for example, if
an incorrect signal level is detected on the line. The OB is also called when the error is eliminated
(the OB is called when the event comes and goes).
Programming OB84
You must create OB84 as an object in your S7 program using STEP 7. Write the program to be
executed in OB84 in the generated block and download it to the CPU as part of your user program.
You can use OB84, for example, for the following purposes:
• To evaluate the start information of OB84.
• By including system function SFC52 WRUSMSG to send a message to the diagnostic buffer.
If you do not program OB84, the CPU changes to STOP mode when a CPU hardware fault is
detected.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the CPU calls OB85:
• When a start event for an interrupt OB exists but the OB cannot be executed because it has
not been downloaded to the CPU.
• When an error occurs accessing the instance data block of a system function block.
• When an error occurs updating the process image table (module configured but does not exist
or module configured but defective).
Programming OB85
You must create OB85 as an object in your S7 program using STEP 7. Write the program to be
executed in OB85 in the generated block and download it to the CPU as part of your user program.
You can use OB85, for example, for the following purposes:
• To evaluate the start information of OB85 and determine which module is defective or not
inserted (the module start address is specified).
• By including SFC49 LGCGADR to find out the slot of the module involved.
If you do not program OB85, the CPU changes to STOP mode when a priority class error is
detected.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the CPU calls OB86 when it has detected one of the following events:
• Failure of a central expansion rack (not for S7-300) such as a broken connecting line,
distributed power failure on a rack
• Failure of a master system or a slave (PROFIBUS DP) or failure of an IO system or an IO
device (PROFINET IO)
OB86 is also called when the error is eliminated (the OB is called when the event comes and
goes).
Programming OB86
You must create OB86 as an object in your S7 program using STEP 7. Write the program to be
executed in OB86 in the generated block and download it to the CPU as part of your user program.
You can use OB86, for example, for the following purposes:
• To evaluate the start information of OB86 and determine which rack is defective or missing.
• To enter a message in the diagnostic buffer with system function SFC 52 WRUSMSG and to
send the message to a monitoring device.
If you do not program OB86, the CPU changes to STOP mode when a rack failure is detected.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the CPU calls OB87 when a communication error occurs in data exchange
using communication function blocks or in global data communication, for example:
• When receiving global data, an incorrect frame ID was detected
• The data block for the status information of the global data does not exist or is too short.
Programming OB87
You must create OB87 as an object in your S7 program using STEP 7. Write the program to be
executed in OB87 in the generated block and download it to the CPU as part of your user program.
You can use OB87, for example, for the following purposes:
• To evaluate the start information of OB87.
• To create a data block if the data block for the status information of global data communication
is missing.
The CPU does not change to "STOP" mode when a communication error is detected and OB87 is
not programmed.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the CPU calls OB121 when a programming error occurs, for example:
• Addressed timers do not exist.
• A called block is not loaded.
Programming OB121
You must create OB121 as an object in your S7 program using STEP 7. Write the program to be
executed in OB121 in the generated block and download it to the CPU as part of your user
program.
You can use OB121, for example, for the following purposes:
• To evaluate the start information of OB121.
• To enter the cause of an error in a message data block.
If you do not program OB121, the CPU changes to STOP mode when a programming error is
detected.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
Description
The operating system of the CPU calls OB122 when a STEP 7 instruction accesses an input or
output of a signal module to which no module was assigned at the last warm restart, for example:
• Errors with direct I/O access (module defective or missing)
• Access to an I/O address that is not known to the CPU.
Programming OB122
You must create OB122 as an object in your S7 program using STEP 7. Write the program to be
executed in OB122 in the generated block and download it to the CPU as part of your user
program.
You can use OB122, for example, for the following purposes:
• To evaluate the start information of OB122
• To call the system function SFC 44 and supply a substitute value for an input module so that
program execution can continue with a meaningful, process-dependent value.
If you do not program OB122, the CPU changes to STOP mode when an I/O access error is
detected.
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
To graphically output diagnostic events to an HMI device, you can create a PROFIBUS DP DB (DB
125 by default) or a PROFINET IO DB (DB 126 by default).
Note
The master system of an IE/PB link cannot be diagnoses. The diagnostics is performed via the
PROFINET IO DB.
"MANUAL" mode
In this mode all errors in the selected station are shown in sequence.
"AUTOMATIC" mode
In this mode all the errors in all configured stations are shown in sequence.
The following table shows an example of the assignment of DB125 in "Manual" mode.
You want to display all errors of master system 27 on an OP. This master system is plugged into
an integrated interface.
The ET 200S station, PROFIBUS ID 15, diagnostic address 8190 has a channel error.
Query:
DP_MASTERSYSTEM 27
EXTERNAL_DP_INTERFACE FALSE
RESET to TRUE (positive edge)
Result:
Result:
ALL_DP_SLAVE_OK TRUE: No problem occurred
SUM_SLAVES_DIAG 0: No station is faulty
Note
The diagnostics downstream from an IE/PB link is restricted.
Byte N N+1
Bit 6-7 4-5 2-3 0-1 6-7 4-5 2-3 0-1
IO_Sys_<n>[0]: Device 4 3 2 1 8 7 6 5
number
IO_Sys_<n>[1]: Device 12 11 10 9 16 15 14 13
number
...
Status All devices in the group are OK or At least one device in the group is
not configured. faulty or has failed.
Coding 0 1
Byte N N+1
Bit 7 ... 0 7 ... 0
IO_Sys_Statu 113-128 17-112 1 - 16 241 - 256 145 - 240 129 - 144
s_<n>[0]:
Device
number
Group 8 2-7 1 16 10 - 15 9
...
23.10.2.6 Example of a DB126 with an IO System 100 and Devices with Device
Numbers 2, 3 and 4
Status:
The status bar is grouped as a bit field, 2 bits indicate the status of a device. Byte 50 looks as
follows:
[11] [01] [00] [10]
Request
HMI_ID 1
System_No 100
Device_No 50
Enable TRUE
Next_Error *
Because the module works asynchronously, you have to wait until Busy becomes "FALSE".
The result for an IO system 100 device 50 has two channel errors.
Result 1
Bu s y FALS E
Offset_Sys_Header 42
Offset_Sys_Array 50
Vendor Id 0
Device Id 0
Device_Status 1
More_Errors TRUE
Error_Level 4
…
Map_HelpNr 16884
Note
After restarting a Web server CPU, the module information is displayed with a delay. To reduce the
waiting time, you can call the RSE diagnostics block in a cyclic interrupt OB with a short interval.
*) If the component was deactivated, the index of the requested/actual error is not changed and
"E_LastError" is set to "true". The variable area of the interrupt is also not filled in.
**) The list of subcomponents is valid only when Q_WithSubComponent is set. The ARRAY
contains one status byte per configured component. For a master. the ARRAY contains the
status of the configured stations sorted in ascending order according to the station ID. For a
station, the ARRAY contains the status of the configured slots sorted in ascending order
according to slot number. This array can contain up to a maximum of 4096 entries (for an IO
system); only the actual maximum size is displayed.
The status byte per subcomponent is defined as follows:
Bit 0 = SubFault: the component cannot be reached
Bit 1 = Fault: the component is not available or has a fault
Bit 2 = Maintenance1: the component has signaled maintenance
Bit 3 = Maintenance2: the component has signaled maintenance
Bit 4 = Deactivated: The component was deactivated
Bit 5 = SubFault: a subcomponent is disrupted
Bit 6 = SubMaintenance1: a subcomponent has signaled maintenance
Bit 7 = SubMaintenance2: a subcomponent has signaled maintenance
Query
1. As long as Q_ClientID_Intern is not equal to DW#16#00000005,
Q_ClientID_User := DW#16#00000005
2. If Q_ClientID_Intern is equal to DW#16#00000005
Q_WithSubComponent := FALSE
C_AddressMode := B#16#1
C_ComponentID := W#16#8032
E_ErrorNo := 1
Q_Start := TRUE
3. Wait until Q_Start is set to FALSE
4. If Q_ClientID_Intern is not equal to DW#16#00000005,
return to step 1
5. Read out the data:
S_SupFault FALSE
S_NotAvailable FALSE
S_Faulty TRUE
S_MoreErrors FALSE
S_Maintenance1 FALSE
S_Maintenance2 FALSE
S_SubFault FALSE
S_SubMainenance1 FALSE
S_SubMaintenance2 FALSE
S_TIAMS DW#16#00000007
S_TIAMSChannelExist DW#16#00000003
S_TIAMSChannelOK DW#16#FFFFFFFD
S_ChannelCount W#16#2
A_ComponentID W#16#8002
A_TextID1 W#16#8C06
A_TextLexikonID1 W#16#1
A_AlarmID DW#32#60200032
A_ValueCount W#16#C
A_AssociatedValue[1] W#16#8C06
A_AssociatedValue[2] W#16#1
A_AssociatedValue[3] W#16#0
A_AssociatedValue[4] W#16#0
A_AssociatedValue[5] W#16#0
A_AssociatedValue[6] W#16#8002
U_SubComponentCount W#16#0
U_SubComponentFault[] {FALSE}
Example 2:
You want to call up the errors of the DP master system connected to the CP with diagnostic
address E 16383 on an OP with the IP address 192.168.10.54. DP stations with PROFIBUS
addresses 1, 48, 50 were configured. Station 1 is disrupted, station 48 is running problem-free and
station 50 has failed.
Query
1. As long as Q_ClientID_Intern does not equal DW#16#00000005,
Q_ClientID_User := DW#16#00000005
2. If Q_ClientID_Intern is equal to DW#16#00000005,
Q_WithSubComponent := TRUE
C_AddressMode := B#16#1
C_ComponentID := W#16#3FFF
E_ErrorNo := 0
Q_Start := TRUE
3. Wait until Q_Busy is set to FALSE
4. If Q_ClientID_Intern is not equal to DW#16#00000005.
return to step 1
5. Read out the data:
6.
S_SupFault FALSE
S_NotAvailable FALSE
S_Faulty TRUE
S_MoreErrors FALSE
S_Maintenance1 FALSE
S_Maintenance2 FALSE
S_SubFault TRUE
S_SubMainenance1 FALSE
S_SubMaintenance2 FALSE
S_TIAMS DW#16#0
S_TIAMSChannelExist DW#16#0
S_TIAMSChannelOK DW#16#0
S_ChannelCount W#16#0
U_SubComponentCount W#16#3
U_SubComponentFault[1] TRUE
U_SubComponentFault[2] FALSE
U_SubComponentFault[3] TRUE
7.
8. Check the validity:
If Q_ClientID_Intern is not equal to DW#16#00000005,
return to step 1
9. The data can be evaluated. The DB is reinitialized automatically.
Name Content
Other_Profibus40...csv Error/help texts for PROFIBUS with a text length of 40 characters
Other_Profinet40...csv Error/help texts for PROFINET with a text length of 40 characters
Other_Profibus80...csv Error/help texts for PROFIBUS with a text length of 80 characters
Other_Profinet80...csv Error/help texts for PROFINET with a text length of 80 characters
Other_Profibus256...csv Error/help texts for PROFIBUS with a text length of 256 characters
Other_Profinet256...csv Error/help texts for PROFINET with a text length of 256 characters
An identifier consisting of the project, station, and CPU is appended to the name of the file
specified above. This allows you to export files for different CPUs to the same folder.
You have to rename the export file with the desired text length in 'other.csv' and import it into the
OP.
In the following cases, you have to import a new export data to the HMI device:
• Modified hardware configuration
• Modified settings of ‘Report System Error’
The following additional functions are available for printing print objects:
Step-for-step instructions for printing the individual print objects can be found under:
• How to Print
Print Preview
You can use the "Print Preview" function to display the page layout of the document to be printed.
Note
The print format of the finished document is not displayed in the print preview.
In the "Print Object List" dialog box, in addition to the object list you can also print the object tree by
selecting the option "Tree window."
If you select the option "All" under "Print range," the whole tree structure is printed. If you select the
option button "Selection," the tree structure from the selected object downwards is printed.
Note
The settings made in the dialog box apply only to printing the list or tree and not for printing the
contents of the objects; the settings in the relevant applications are used for this.
You can store individual projects or libraries in compressed form in an archive file. This
compressed storage procedure is possible on a hard disk or on a portable data medium (such as a
floppy disk).
Archive Programs
In STEP 7, you can use the archive program you prefer to archive projects. The archiving programs
ARJ and PKZip ship with STEP 7 and are installed automatically. You will find the relevant
descriptions in the installation paths of the archiving programs.
To use a specific archiving program, you require the following version (or newer):
• PKZip V12.4 (ships with STEP 7)
• WinZip (tested with Version 20)
• 7-Zip (tested with Version 9.20)
• ARJ V2.50a (only for retrieving, ships with STEP 7 (not for Windows 7/Server 2008))
Special Issues
If you used ARJ32 V3.x for archiving with previous STEP 7 versions, these archives may only be
retrieved with ARJ32 V3.x.
Creating an archive with PKZip will take substantially more time on network drives than on local
drives.
Save As
With this function you create a copy of the project under another name.
You can use this function:
• To create backup copies
• To duplicate an existing project in order to adapt it for other purposes.
To use the fastest method of creating a copy, select the "Save As" option without rearranging in the
dialog box. The whole file structure from the project directory down is copied without a check and
saved under another name.
There must be sufficient space on the data medium to store the backup copy. Do not attempt to
save projects to diskette as there will not generally be sufficient space available. To transport
project data on diskette use the "Archive" function.
Saving with rearranging takes longer, but a message is displayed if an object cannot be copied and
saved. Causes for this may be a missing optional package or defective data for an object.
Archive
You can store individual projects or libraries in compressed form in an archive file. This
compressed storage procedure is possible on a hard disk or on a portable data medium (such as a
floppy disk).
Only transport projects on diskette in the form of archive files. If the project is too large, select an
archive program with which disk-crossing archives can be created.
Projects or libraries which were compressed into an archive file cannot be edited. If you want to
edit them again you must unpack the data which means retrieving the project or library.
You archive/retrieve your project or library using the menu command File > Archive or File >
Retrieve.
Note
Projects or libraries which were compressed into an archive file cannot be edited. If you want to
edit them again you must unpack the data which means retrieving the project or library.
When retrieving, the retrieved projects or libraries are automatically included in the project/library
list.
25.3 Rearranging
If unexplained problems occur when working with STEP 7, it often helps to rearrange the database
of the project or library.
Select the menu command File > Rearrange to do this. This removes any gaps which occur when
contents are deleted, meaning that the amount of memory required for the project/library data is
reduced.
The function optimizes the data storage for the project or library in a similar way to which a
program defragments a hard disk also optimizes file storage on the hard disk.
The duration of the reorganization process depends on the amount of data to be moved around
and may take some time. The function is therefore not executed automatically (for example, when
you close a project) but must be triggered by the user when he/she wants to rearrange the project
or library.
To check the extent to which the data management is being used, select the block folder and select
the menu command Edit > Object Properties. The click the "Get fill level" button in the "Fill Level"
tab. When the fill level has been calculated, the values and a recommendation for the
reorganization of the project are displayed in the lower part of the tab.
Requirement
Projects and libraries can only be rearranged if no objects in them are being edited by other
applications and therefore locked for access.
Requirements
• In the symbol table, you have assigned this property to the address you want to modify via the
menu command Special Object Properties > Control at Contact
• You have selected the "Control at Contact" option in the "General" tab of the LAD/STL/FBD
program editor (Menu command Options > Customize).
• You have selected the menu command Debug > Monitor.
Triggering condition is here "permanent/at the cycle start".
The inputs actually available in your plant will be monitored for as long as you keep the button
pressed. You can also modify multiple inputs via multiple selection (CTRL key).
In the case of bit memories or unavailable inputs, pressing the button will cause the status to be set
to 1. The status will only be reset to 0 if this is explicitly requested through a shortcut menu entry or
in the variable table, or if the address is reset by the STEP 7 program.
In the case of a non-negated input or bit memory, pressing the button will cause the modify value
"1" to apply; in the case of a negated input or bit memory, the modify value "0" will apply.
Note on WinCC
If you have started the program editor in WinCC via the operator control and monitoring of a
variable, only the control options of WinCC are allowed. Otherwise, if the operator has been
granted "Maintenance rights" of WinCC, both modify options are allowed.
Note
As the virtual memory is on the hard disk (default C:) and dynamic, you should ensure that
sufficient memory is available for the directory TMP or TEMP (approx. 20 to 30 MB):
• If the S7 project is also on the same partition on which the virtual memory is set, approximately
twice the size of the S7 project should be available as free memory space.
• If the project is stored on another partition, this requirement becomes irrelevant.
Operating Modes
Operating modes describe the behavior of the CPU at a particular point in time. Knowing the
operating modes of CPUs is useful when programming the startup, testing the controller, and for
troubleshooting.
The S7-300 and S7-400 CPUs can adopt the following operating modes:
• STOP
• STARTUP
• RUN
• HOLD
In STOP mode, the CPU checks whether all the configured modules or modules set by the default
addressing actually exist and sets the I/Os to a predefined initial status. The user program is not
executed in STOP mode.
In STARTUP mode, a distinction is made between the startup types "warm restart," "cold restart,"
and "hot restart:"
• In a warm restart, program processing starts at the beginning of the program with initial settings
for the system data and user address areas (the non-retentive timers, counters, and bit
memory are reset).
• In a cold restart, the process-image input table is read in and the STEP 7 user program is
processed starting at the first command in OB1 (also applies to warm restart).
- Any data blocks created by SFC in the work memory are deleted; the remaining data
blocks have the preset value from the load memory.
- The process image and all timers, counters, and bit memory are reset, regardless of
whether they were assigned as retentive or not.
• In a hot restart, the program is resumed at the point at which it was interrupted (timers,
counters, and bit memory are not reset). A hot restart is only possible on S7-400 CPUs.
In RUN mode, the CPU executes the user program, updates the inputs and outputs, services
interrupts, and process error messages.
In HOLD mode, processing of the user program is halted and you can test the user program step
by step. The HOLD mode is only possible when you are testing using the programming device.
In all these modes, the CPU can communicate via the multipoint interface (MPI).
The table shows the conditions under which the operating modes can change.
Transition Description
1. After you turn on the power supply, the CPU is in STOP mode.
2. The CPU changes to STARTUP mode:
• After the CPU is changed to RUN or RUNP using the key switch or by the
programming device.
• After a startup triggered automatically by turning on the power.
• If the RESUME or START communication function is executed.
In both cases the key switch must be set to RUN or RUNP.
3. The CPU changes back to STOP mode when:
• An error is detected during the startup.
• The CPU is changed to STOP by the key switch or on the programming device.
• A stop command is executed in the startup OB.
• The STOP communication function is executed.
4. The CPU changes to HOLD mode when a breakpoint is reached in the startup program.
5. The CPU changes to STARTUP mode when the breakpoint in a startup program was set
and the "EXIT HOLD" command was executed (test functions).
6. The CPU changes back to STOP mode when:
• The CPU is changed to STOP with the key switch or by the programming device.
• The STOP communication command is executed.
7. If the startup is successful, the CPU changes to RUN.
8. The CPU changes back to STOP mode when:
• An error is detected in RUN mode and the corresponding OB is not loaded.
• The CPU is changed to STOP by the key switch or on the programming device.
• A stop command is edited in the user program.
• The STOP communication function is executed.
Transition Description
9. The CPU changes to RUN mode when a breakpoint was set and the "EXIT HOLD"
command is executed.
10. The CPU changes to HOLD mode when a breakpoint is reached in the user program.
Priority Mode
Highest STOP
HOLD
STARTUP
Lowest RUN
The user program is not executed in STOP mode. All the outputs are set to substitute values so
that the controlled process is in a safe state. The CPU makes the following checks:
• Are there any hardware problems(for example, modules not available)?
• Should the default setting apply to the CPU or are there parameter sets?
• Are the conditions for the programmed startup behavior satisfied?
• Are there any system software problems?
In STOP mode, the CPU can also receive global data and passive one-way communication is
possible using communication SFBs for configured connections and communication SFCs for not
configured connections.
Memory Reset
The CPU memory can be reset in STOP mode. The memory can be reset manually using the key
switch (MRES) or from the programming device (for example, before downloading a user program).
Resetting the CPU memory returns the CPU to its initial status, as follows:
• The entire user program in the work memory and in the RAM load memory and all address
areas are cleared.
• The system parameters and the CPU and module parameters are reset to the default settings.
The MPI parameters set prior to the memory reset are retained.
• If a memory card (Flash EPROM) is plugged in, the CPU copies the user program from the
memory card to the work memory (including the CPU and module parameters if the appropriate
configuration data are also on the memory card).
The diagnostic buffer, the MPI parameters, the time, and the runtime meters are not reset.
Before the CPU can start processing the user program, a startup program must first be executed.
By programming startup OBs in your startup program, you can specify certain settings for your
cyclic program.
There are three types of startup: warm restart, cold restart, and hot restart. A hot restart is only
possible on S7-400 CPUs. This must be set explicitly in the parameter set for the CPU using
STEP 7.
The features of the STARTUP mode are as follows:
• The program in the startup OB is processed (OB100 for warm restart, OB101 for hot restart,
OB102 for cold restart).
• No time-driven or interrupt driven program execution is possible.
• Timers are updated.
• Runtime meters start running.
• Disabled digital outputs on signal modules (can be set by direct access).
Warm Restart
A warm restart is always permitted unless the system has requested a memory reset. A warm
restart is the only possible option after:
• Memory reset
• Downloading the user program with the CPU in STOP mode
• I stack/B stack overflow
• Warm restart aborted (due to a power outage or changing the mode selector setting)
• When the interruption before a hot restart exceeds the selected time limit.
Hot Restart
Following a power outage in RUN mode followed by a return of power, S7-400 CPUs run through
an initialization routine and then automatically execute a hot restart. During a hot restart, the user
program is resumed at the point at which its execution was interrupted. The section of user
program that had not been executed before the power outage is known as the remaining cycle. The
remaining cycle can also contain time-driven and interrupt driven program sections.
A hot restart is only permitted when the user program was not modified in STOP mode (for
example, by reloading a modified block) and when there are no other reasons for a warm restart.
Both a manual and automatic hot restart are possible.
The following table shows the data that are retained on work memory (EPROM and RAM load
memory):
Startup Activities
The following table shows which activities are performed by the CPU during startup:
Aborting a Startup
If an error occurs during startup, the startup is aborted and the CPU changes to or remains in
STOP mode.
An aborted warm restart must be repeated. After an aborted restart, both a warm restart and a hot
restart are possible.
A startup (restart (warm restart) or hot restart) is not executed or it is aborted in the following
situations:
• The operating mode switch of the CPU is set to STOP.
• A memory reset is requested.
• A memory card with an application code that is not permitted for STEP 7 is plugged in (for
example, STEP 5).
• More than one CPU is inserted in the single processor mode.
• If the user program contains an OB that the CPU does not recognize or that has been disabled.
• If, after power on, the CPU recognizes that not all the modules listed in the configuration table
created with STEP 7 are actually inserted (difference between preset and actual parameter
assignment not permitted).
• If errors occur when evaluating the module parameters.
A hot restart is not executed or it is aborted in the following situations:
• The CPU memory was reset (only a warm restart is possible after memory reset).
• The interruption time limit has been exceeded (this is the time between exiting RUN mode until
the startup OB including the remaining cycle has been executed).
• The module configuration has been changed (for example module replaced).
• The parameter assignment only permits a warm restart.
• When blocks have been loaded, deleted, or modified while the CPU was in STOP mode.
Sequence of Activities
The following figure shows the activities of the CPU during STARTUP and RUN:
Key to the figure "Activities of the CPU during STARTUP and RUN"
1. All peripheral outputs are switched to a safe state (default value = 0) on the hardware side by
the I/O modules. This switch takes place regardless of whether the user program employs the
outputs inside the process-image area or outside of it.
If you are using signal modules that have substitute value capability, you can assign
parameters to the behavior of the outputs, such as Keep Last Value.
2. Necessary for processing the remaining scan cycle.
3. A current process-image input table is also available to the interrupt OBs the first time that they
are called up.
4. You can determine the status of the local and distributed peripheral outputs in the first scan
cycle of the user program by taking the following steps:
- Use output modules to which you can assign parameters to enable the output of substitute
values or to keep the last value.
- For a hot restart: activate the CPU startup parameter "Reset outputs during hot restart" in
order to output a 0 (corresponds to the default setting).
- Preset the outputs in the startup OB (OB100, OB101, OB102).
5. In S7-300 systems that are not backed up, only those DB areas that were configured as
retentive are retained.
In RUN mode, the CPU executes the cyclic, timedriven, and interruptdriven program, as follows:
• The process image of the inputs is read in.
• The user program is executed.
• The process-image output table is output.
The active exchange of data between CPUs using global data communication (global data table)
and using communication SFBs for configured connections and using communication SFCs for
non-configured connections is only possible in RUN mode.
The following table shows an example of when data exchange is possible in different operating
modes:
The HOLD mode is a special mode. This is only used for test purposes during startup or in RUN
mode. The HOLD mode means the following:
• All timers are frozen: timers and runtime meters are not processed, monitoring times are
stopped, the basic clock pulses of the timedriven levels are stopped.
• The real-time clock runs.
• Outputs are not enabled but can be enabled explicitly for test purposes.
• Inputs and outputs can be set and reset.
• If a power outage occurs on a CPU with a backup battery while in HOLD mode, the CPU
changes to stop when the power returns but does not execute an automatic hot restart or
restart (warm restart). CPUs without battery backup execute an automatic restart (warm
restart) when power returns.
• Global data can be received and passive one-way communication using communication SFBs
for configured connections and communication SFCs for non-configured connections is
possible (see also table in RUN Mode).
The memory of an S7 CPU can be divided into three areas (see figure below):
• The load memory is used for user programs without symbolic address assignments or
comments (these remain in the memory of the programming device). The load memory can be
either RAM or EPROM.
• Blocks that are not marked as required for startup will be stored only in the load memory.
• The work memory (integrated RAM) contains the parts of the S7 program relevant for running
your program. The program is executed only in the work memory and system memory areas.
• The system memory (RAM) contains the memory elements provided by every CPU for the user
program, such as the process-image input and output tables, bit memory, timers, and counters.
The system memory also contains the block stack and interrupt stack.
• In addition to the areas above, the system memory of the CPU also provides temporary
memory (local data stack) that contains temporary data for a block when it is called. This data
only remains valid as long as the block is active.
When you download the user program from the programming device to the CPU, only the logic and
data blocks are loaded in the load and work memory of the CPU.
The symbolic address assignment (symbol table) and the block comments remain on the
programming device.
Note
Data blocks that are created in the user program with the help of system functions (for example,
SFC22 CREAT_DB) are saved entirely in the work memory by the CPU.
Some CPUs have separately managed areas for code and data in the work memory. The size and
assignment of these areas is shown in the "Memory" tab of the Module Information for these CPUs.
Programs stored in RAM are lost when you reset the CPU memory (MRES) or if you remove the
CPU or RAM memory card.
Programs saved on EPROM memory cards are not erased by a CPU memory reset and are
retained even without battery backup (transport, backup copies).
outputs
Peripheral output word PQW
Peripheral output double PQD
word
Refer to the following CPU manuals or instruction lists for information on which address areas are
possible for your CPU:
• "S7-300 Programmable Controller, Hardware and Installation" Manual
• "S7-400 Programmable Controller, Module Specifications" Reference Manual
• "S7-300 Programmable Controller, Instruction List"
• "S7-400 Programmable Controller, Reference Guide"
One of the internal tasks of the operating system (OS) is to read the status of inputs into the
process image input table (PII). Once this step is complete, the user program is executed with all
blocks that are called in it. The cycle ends with writing the process image output table (PIQ) to the
outputs for the modules. Reading in the process image input table and writing the process image
output table to the outputs for the modules is all independently controlled by the operating system.
One of the internal tasks of the operating system (OS) is to write the process image output table
(PIQ) to the outputs for the modules and to read in the status of inputs into the process image input
table (PII). Once this step is complete, the user program is executed with all blocks that are called
in it. Writing the process image output table to the outputs for the modules and reading in the
process image input table is all independently controlled by the operating system.
Note
For S7-300 CPUs, unassigned process-image inputs and outputs can be used as additional bit
memory areas. Programs that use this capability can run on older (that is, before 4/99) S7-400
CPUs only under one of the following conditions:
For these S7-400 CPUs
• The process image areas used as bit memory must be located outside of the parameter
assignment for "Size of the Process Image" or.
• must be located in a process-image partition that is updated neither by the system nor by
SFC26/SFC27.
! Caution
When using temporary variables, remember that they are only valid within the relevant block or are
only available as previous local data for other blocks called in this block. In particular, there is no
guarantee that if you close and then re-open the block, the temporary variables will have the same
values they had when the previous block call was completed. Temporary variables are by definition
undetermined when a block is called and must be re-initialized again when they are used for the
first time in the block.
All the temporary variables (TEMP) of an OB and its associated blocks are saved in the L stack. If
you use too many nesting levels when executing your blocks, the L stack can overflow.
S7 CPUs change to STOP mode if the permitted L stack size for a program is exceeded.
Test the L stack (the temporary variables) in your program.
The local data requirements of synchronous error OBs must be taken into consideration.
In the lower text box, all the additional information is displayed for the event selected in the list in
the upper window. This information includes:
• Event number
• Description of the event
• Mode transition caused by the diagnostic event
• Reference to the location of the error in a block (block type, block number, relative address)
which caused the entry in the buffer
• Event state being entered or left
• Additional information specific to the event
With the "Help on Event" button you can display additional information on the event selected in the
upper list box.
Information on event IDs can be found in the Reference Help on System Blocks and System
Functions (Jumps to Language Descriptions and Help on Blocks, System Attributes)
To do this set the CPU so that the following data are saved in the nonvolatile RAM:
• Data contained in a DB (this is only useful if you have also stored your program in an EPROM
of the load memory)
• Values of timers and counters
• Data saved in bit memory.
On every CPU, you can save a certain number of timers, counters, and memory bits. A specific
number of bytes is also available in which the data contained in DBs can be saved.
The MPI address of your CPU is stored in the NVRAM. This makes sure that your CPU is capable
of communication following a power outage or memory reset.
All the data in a user program must be identified by a data type. The following data types are
available:
• Elementary data types provided by STEP 7
• Complex data types that you yourself can create by combining elementary data types
• Parameter types with which you define parameters to be transferred to FBs or FCs
General Information
Statement List, Ladder Logic, and Function Block Diagram instructions work with data objects of
specific sizes. Bit logic instructions work with bits, for example. Load and transfer instructions (STL)
and move instructions (LAD and FBD) work with bytes, words, and double words.
A bit is a binary digit "0" or "1." A byte is made up of eight bits, a word of 16 bits, and a double word
of 32 bits.
Math instructions also work with bytes, words, or double words. In these byte, word, or double word
addresses you can code numbers of various formats such as integers and floating-point numbers.
When you use symbolic addressing, you define symbols and specify a data type for these symbols
(see table below). Different data types have different format options and number notations.
This chapter describes only some of the ways of writing numbers and constants. The following
table lists the formats of numbers and constants that will not be explained in detail.
Each elementary data type has a defined length. The following table lists the elementary data
types.
Type and Size Format Options Range and Number Notation Example
Description in Bits (lowest to highest value)_
BOOL(Bit) 1 Boolean text TRUE/FALSE TRUE
Format Range
Integer (16 bits) -32 768 to +32 767
Format Range
Integer (32 bits) -2 147 483 648 to +2 147 483 647
The following figure shows the integer -500 000 as a binary number. In the binary system, the
negative form of an integer is represented as the twos complement of the positive integer. You
obtain the twos complement of an integer by reversing the signal states of all bits and then adding
+1 to the result.
The following table shows the values of the individual bits in floating-point format.
Using the three components S, e, and m, the value of a number represented in this form is defined
by the formula:
Number = 1.m ∗ 2 to the power of (e - bias)
Where:
• e: 1 ≤ e ≤ 254
• Bias: bias = 127. This means that an additional sign is not required for the exponent.
• S: for a positive number, S = 0 and for a negative number, S = 1.
1)
Format Range
Floating-point numbers according to the ANSI/IEEE -3.402 823E+38 to -1.175 495E-38
standard and 0 and
+1.175 495E-38 to +3.402 823E+38
The following table shows the signal state of the bits in the status word for the results of
instructions with floating-point numbers that do not lie within the valid range:
! Caution
Calculations involving a long series of values including very large and very small numbers can
produce inaccurate results.
The floating-point numbers in STEP 7 are accurate to 6 decimal places. You can therefore only
specify a maximum of 6 decimal places when entering floating-point constants.
Note
The calculation accuracy of 6 decimal places means, for example, that the addition of number1 +
number2 = number1 if number1 is greater than number2 ∗ 10 to the power of y, where y>6:
26.3.2.4 Format of the Data Types WORD and DWORD in Binary Coded Decimal
Numbers
The binary-coded decimal (BCD) format represents a decimal number by using groups of binary
digits (bits). One group of 4 bits represents one digit of a signed decimal number or the sign of the
decimal number. The groups of 4 bits are combined to form a word (16 bits) or double word (32
bits). The four most significant bits indicate the sign of the number (1111 indicates minus and 0000
indicates plus). Commands with BCDcoded addresses only evaluate the highestvalue bit (15 in
word, 31 in double word format). The following table shows the format and range for the two types
of BCD numbers.
Format Range
Word -999 to +999
(16 bits, threedigit BCD number with sign)
Double word -9 999 999 to +9 999 999
(32 bits, sevendigit BCD number with sign)
The following figures provide an example of a binary coded decimal number in the following
formats:
• Word format
When working with S5TIME, you enter a time value in the range of 0 to 999 and you indicate a time
base (see the following table). The time base indicates the interval at which a timer decrements the
time value by one unit until it reaches 0.
Time base for S5TIME
You can preload a time value using either of the following syntax formats:
1)
• L W#16#wxyz
- Where w = time base (that is, the time interval or resolution)
- Where xyz = the time value in binary coded decimal format
1)
• L S5T#aH_bbM_ccS_dddMS
- Where a = hours, bb = minutes, cc = seconds, and dd = milliseconds
- The time base is selected automatically and the value is rounded to the next lower number
with that time base.
The maximum time value that you can enter is 9,990 seconds, or 2H_46M_30S.
1)
= L only to be specified in STL programming
Complex data types define data groups that are larger than 32 bits or data groups consisting of
other data types. STEP 7 permits the following complex data types:
• DATE_AND_TIME
• STRING
• ARRAY
• STRUCT
• UDT (user-defined data types)
• FBs and SFBs
The following table describes the complex data types. You define structures and arrays either in
the variable declaration of the logic block or in a data block.
Structured data types are saved in accordance with word limits (WORD aligned).
Arrays
An array combines a group of one data type (elementary or complex) to form a unit. You can create
an array consisting of arrays. When you define an array, you must do the following:
• Assign a name to the array.
• Declare an array with the keyword ARRAY.
• Specify the size of the array using an index. You specify the first and last number of the
individual dimensions (maximum 6) in the array. You enter the index in square brackets with
each dimension separated by a comma and the first and last number of the dimension by two
periods. The following index defines, for example, a threedimensional array:
[1..5,-2..3,30..32]
• You specify the data type of the data to be contained in the array.
Example: 1
The following figure shows an array with three integers. You access the data stored in an array
using the index. The index is the number in square brackets. The index of the second integer, for
example, is Op_temp[2].
An index can be any integer (-32768 to 32767) including negative values. The array in the following
figure could also be defined as ARRAY [-1..1]. The index of the first integer would then be
Op_temp[-1], the second would be Op_temp[0], and the third integer would then be Op_temp[1].
Example 2
An array can also describe a multidimensional group of data types. The following figure shows a
two-dimensional array of integers.
You access the data in a multidimensional array using the index. In this example, the first integer
is Op_temp[1,1], the third is Op_temp[1,3], the fourth is Op_temp[2,1], and the sixth is
Op_temp[2,3].
You can define up to a maximum of 6 dimensions (6 indexes) for an array. You could, for example,
define the variable Op_temp as follows as a sixdimensional array:
ARRAY [1..3,1..2,1..3,1..4,1..3,1..4]
The index of the first element in this array is Op_temp[1,1,1,1,1,1]. The index of the last element
Op_temp[3,2,3,4,3,4].
Creating Arrays
You define arrays when you declare the data in a DB or in the variable declaration. When you
declare the array, you specify the keyword (ARRAY) followed by the size in square brackets, as
follows:
[lower limit value..upper limit value]
In a multi-dimensional array you also specify the additional upper and lower limit values and
separate the individual dimensions with a comma. The following figure shows the declaration for
creating an array of the format 2 x 3.
Structures
A structure combines various data types (elementary and complex data types, including arrays and
structures) to form one unit. You can group the data to suit your process control. You can therefore
also transfer parameters as a data unit and not as single elements. The following figure illustrates a
structure consisting of an integer, a byte, a character, a floating-point number, and a Boolean
value.
Creating a Structure
You define structures when you declare data within a DB or in the variable declaration of a logic
block.
The following figure illustrates the declaration of a structure (Stack_1) that consists of the following
elements: an integer (for saving the amount), a byte (for saving the original data), a character (for
saving the control code), a floating-point number (for saving the temperature), and a Boolean
memory bit (for terminating the signal).
In addition to elementary and complex data types, you can also define parameter types for formal
parameters that are transferred between blocks. STEP 7 recognizes the following parameter types:
• TIMER or COUNTER: this specifies a particular timer or particular counter that will be used
when the block is executed. If you supply a value to a formal parameter of the TIMER or
COUNTER parameter type, the corresponding actual parameter must be a timer or a counter,
in other words, you enter "T" or "C" followed by a positive integer.
• BLOCK: specifies a particular block to be used as an input or output. The declaration of the
parameter determines the block type to be used (FB, FC, DB etc.). If you supply values to a
formal parameter of the BLOCK parameter type, specify a block address as the actual
parameter. Example: "FC101" (when using absolute addressing) or "Valve" (with symbolic
addressing).
• POINTER: references the address of a variable. A pointer contains an address instead of a
value. When you supply a value to a formal parameter of the parameter type POINTER, you
specify an address as the actual parameter. In STEP 7, you can specify a pointer in the pointer
format or simply as an address (for example, M 50.0). Example of a pointer format for
addressing the data beginning at M 50.0: P#M50.0
• ANY: this is used when the data type of the actual parameter is unknown or when any data
type can be used. For more information about the ANY parameter type, refer to the sections
"Format of the Parameter Type ANY" and "Using the Parameter Type ANY".
A parameter type can also be used in a userdefined data type (UDT). For more information about
UDTs, refer to the section "Using UserDefined Data Types to Access Data".
The permitted number of blocks, timers, and counters is dependent on the type of your S7 CPU.
You will find more information on the permitted number of timers and counters and on the
maximum number of available blocks in the data sheets for your CPU in the "S7-300
Programmable Controller, Hardware and Installation Manual" or in the "S7-400 Programmable
Controller, Hardware and Installation Manual."
The offset 0.0 has no influence. Output 10.0 is calculated from 8.7 (AR1) plus the offset 1.1. The
result is 10.0 and not 9.8, see pointer format.
L P# I8.7 Load the value of the pointer and the area identification in
accumulator 1.
LAR1 Load memory area I and the address 8.7 into AR1.
L P# Q8.7 Load the value of the pointer and the area identification in
accumulator 1.
LAR2 Load memory area Q and the address 8.7 into AR2.
A [AR1, P#0.0] Query the signal state at input bit I 8.7 and
= [AR2, P#1.1] assign the signal state to output bit Q 10.0.
The offset 0.0 has no influence. Output 10.0 is calculated from 8.7 (AR2) plus the offset 1.1. The
result is 10.0 and not 9.8, see pointer format.
VAR_INPUT
Bit_Byte : BOOL ; //0: Bit address, 1: byte address
Inc_Value : INT ; //Increment (if value neg. => decrement/if value
pos. => increment)
END_VAR
VAR_IN_OUT
Pointer : DWORD ; //Pointer to be changed
END_VAR
VAR_TEMP
Inc_Value1 : INT ; //Interim value increment
Pointer1 : DWORD ; //Interim value pointer
Int_Value : DWORD ; //Auxiliary variable
END_VAR
BEGIN
NETWORK
TITLE =
//The block intercepts changes that change the area information of the
pointer
//or that lead to "negative" pointers automatically.
SET ; //Set RLO to 1 and
R #RET_VAL; //reset overflow
L #Pointer; //Supply value to temporary
T #Pointer1; //interim value pointer
L #Inc_Value; //Supply value of temporary
T #Inc_Value1; //interim value increment
A #Bit_Byte; //If =1, byte address instruction
JC Byte; //Jump to byte address calculation
L 7; //If value of increment > 7,
L #Inc_Value1;
<I ;
S #RET_VAL; //then set RET_VAL and
JC End; //jump to End
L -7; //If value of increment < -7,
<I ;
S #RET_VAL; //then set RET_VAL and
JC End; //jump to End
A L 1.3; //If bit 4 of the value = 1 (Inc_Value negative)
JC neg; //then jump to bit address subtraction
L #Pointer1; //Load pointer address information
L #Inc_Value1; //and add the increment
+D ;
JU test; //Jump to test for negative result
neg: L #Pointer1; //Load pointer address information
L #Inc_Value1; //Load the increment
NEGI ; //Negate the negative value,
-D ; //subtract the value
JU test; //and jump to test
Byte: L 0; //Start of byte address change
L #Inc_Value1; //If increment >=0, then
<I ;
JC pos; //jump to addition, otherwise
L #Pointer1; //Load pointer address information,
L #Inc_Value1; //load the increment,
NEGI ; //negate the negative value,
SLD 3; //shift the increment 3 digits to the left,
-D ; //subtract the value,
JU test; //and jump to test
pos: SLD 3; //Shift the increment 3 digits to the left
L #Pointer1; //Load pointer address information
+D ; //Add increment
test: T #Int_Value; //Transfer results of calculation to Int_Value
A L 7.3; //If invalid byte address (too large or
S #RET_VAL; //negative), then set RET_VAL
JC End; //and jump to End,
L #Int_Value; //otherwise transfer result
T #Pointer; //to pointer
End: NOP 0;
END_FUNCTION
The repetition factor identifies a quantity of the indicated data type to be transferred by the
parameter type ANY. This means you can specify a data area and also use arrays and structures
in conjunction with the parameter type ANY. STEP 7 identifies arrays and structures as a number
(with the help of the repetition factor) of data types. If, for example, 10 words are to be transferred,
the value 10 must be entered for the repetition factor and the value 04 must be entered for the data
type.
The address is stored in the format Byte.Bit where the byte address is stored in bits 0 to 2 of
byte 7, in bits 0 to 7 of byte 8, and in bits 3 to 7 of byte 9. The bit address is stored in bits 0 to 2 of
byte 9.
With a null pointer of the type NIL all bytes from byte 1 are assigned 0.
The following tables show the coding of the data types or of the memory areas for the parameter
type ANY.
The following table shows the coding of the data types for the parameter type ANY for parameter
types.
In this example, FC100 has three parameters (in_par1, in_par2, and in_par3) declared as the ANY
data type.
• When FB10 calls FC100, FB10 transfers an integer (the static variable speed), a word
(MW100), and a double word to DB10 (DB10.DBD40).
• When FB11 calls FC100, FB11 transfers an array of real numbers (the temporary variable
"Thermo"), a Boolean value (M 1.3), and a timer (T2).
STL Explanation
FUNCTION FC10: VOID
VAR_TEMP
Source : ANY;
Target : ANY;
END_VAR
BEGIN
LAR1 P#Source; Load the start address of the ANY pointer in AR1.
LAR1 P#Target; Load the start address of the ANY pointer in AR1.
STEP 7 restricts the assignment of formal parameters of an FC as actual parameters for the formal
parameters of a different FC. You cannot, for example, assign parameters with complex data types
or a parameter type as the actual parameter.
The following table shows the permitted data types () when one FC calls another FC.
STEP 7 restricts the assignment of the formal parameters of an FB to the formal parameters of an
FC. You cannot, for example, assign parameters of the parameter type as actual parameters. The
following table shows the permitted data types () when an FB calls an FC.
STEP 7 restricts the assignment of formal parameters of an FC to the formal parameters an FB.
You cannot, for example, assign parameters with a complex data type as actual parameters. You
can, however, assign input parameters of the parameter types TIMER, COUNTER, or BLOCK to
the input parameters of the called FB.
The following table shows the permitted data types () when an FC calls an FB.
Valid Data Types for the Call of a Function Block by a Function Block
You can assign the formal parameters of a calling FB to the formal parameters of a called FB. The
following figure illustrates the formal parameters of FB10 that are assigned as actual parameters to
the formal parameters of FB12.
STEP 7 restricts the assignment of the formal parameters of an FB to the formal parameters of
another FB. You cannot, for example, assign input and output parameters with complex data types
as the actual parameters for the input and output parameters of a called FB. You can, however,
assign input parameters of the parameter types TIMER, COUNTER, or BLOCK to the input
parameters of the called FB.
The following table shows the permitted data types () when an FB calls another FB.
In STEP 7 you can also open version 2 projects using the menu command File > Open.
Version 2 projects/libraries can be converted (migrated) to your current STEP 7 version using the
menu command File > Save As and the option "Rearrange before saving." The project is then
saved as a project with the current STEP 7 version.
You can edit projects and libraries from older STEP 7 versions retaining their format and save them
by selecting the older STEP 7 version as the file type in the "Save Project As" dialog box. For
example, to edit the objects with STEP 7 version 2.1, select "Project 2.x" or "Library 2.x" here (it is
not possible to save as Version 2 as from Version 5.1 on. Also refer to Editing Version 2 projects
and libraries).
This means you only have access to the scope of functions of the older STEP 7 version. You can,
however, still continue to manage the projects and libraries with the older STEP 7 version.
Note
The upgrade from version 3 to versions 4 and higher only involves a change in name: the format has
remained identical. Therefore there is no file type "Project3.x" in STEP 7 V4.
Procedure
To convert version 2 projects to the format of the current STEP 7 version, proceed as follows:
1. Execute the "Save As" command in the File menu with the "Rearrange before saving" option
for the project.
2. Select the file type "Project" in the "Save Project As" dialog box and click the "Save" button.
To convert version 2 projects to the current STEP 7 version while retaining their format, proceed as
follows:
1. Execute step 1 above if necessary.
2. Select the file type of the older STEP 7 version in the "Save Project As" dialog box and click
the "Save" button.
Remedy
If you want to use the DP slave with new modules that are described in the *.GSD file:
• Delete the DP slave and configure it again. Then the DP slave is described completely by the
*.GSD file, not by the type file.
If you do not want to use any new modules that are described only in the *.GSD file:
• Under PROFIBUS-DP in the Hardware Catalog window, select the "Other FIELD
DEVICES/Compatible PROFIBUS-DP Slaves" folder. STEP 7 moves the "old" type files into
this folder when they are replaced by new *.GSD files. In this folder you will find the modules
with which you can expand the already configured DP slave.
Constellation after Replacement of Type Files by GSD Files in STEP 7 V5.1 Service Pack 4
As of STEP 7 V5.1, Service Pack 4, the type files have been either updated or largely replaced by
GSD files. This replacement only affects the catalog profiles supplied with STEP 7, not any catalog
profiles that you may have created yourself.
DP slaves whose properties were previously determined by type files and are now determined by
GSD files are still located in the same place in the hardware catalog.
The "old" type files were not deleted but moved to another place in the hardware catalog. They are
now located in the catalog folder "Other field devices\Compatible PROFIBUS DP slaves\...".
If you process older station configurations with STEP 7 Version 5.1, it is possible in rare cases that
the GSD file of a DP slave is missing or cannot be not compiled (for example, due to syntax errors
in the GSD file).
In this case STEP 7 generates a "dummy" slave that represents the configured slave, for example
after a station download to the programming device or after an older project has been opened and
processed further. This "dummy" slave can only be processed to a limited extent. You cannot
change the slave structure (DP identifiers) and the slave parameters. However, renewed
downloading to the station is possible. The original configuration of the slave is retained. The
complete DP slave can also be deleted.
The STEP 7 installation medium contains a number of useful sample projects that are listed below.
You will find the sample projects in the "open" dialog of the SIMATIC Manager ("Sample Projects"
tab). Other sample projects may also be added when optional packages are installed. For
information on these sample projects, refer to the documentation for the optional packages.
The emphasis of the examples is not on teaching a particular programming style or the specialist
knowledge needed to control a particular process. The examples are simply intended to illustrate
the steps that must be followed to design a program.
Note
When STEP 7 is installed, the supplied sample projects are copied, unless otherwise specified. If
you have edited the supplied sample projects, these modified projects are overwritten with the
originals when STEP 7 is reinstalled.
For this reason, you should copy the supplied sample projects before making any changes and
then only edit the copies.
The sample program is makes use of information that you have already read in part 1 of the
manual about controlling an industrial blending process.
Task
Two ingredients (ingredient A and ingredient B) are mixed together in a mixing tank by an agitator.
The finished product is drained from the tank through a drain valve. The following figure shows a
diagram of the sample process.
Operator Station
To allow an operator to start, stop, and monitor the process, an operator station is also required.
The operator station is equipped with the following:
• Switches for controlling the most important stages of the process. Using the "reset
maintenance display" switch, you can turn off the maintenance display lamps for the motors
due for maintenance and reset the corresponding counters for the maintenance interval to 0.
• Display lamps to indicate the status of the process.
• The emergency stop switch.
• OB1: The interface to the operating system of the CPU and contains the main program. In OB1
the blocks FB1 and FC1 are called and the specific parameters required to control the process
are transferred.
• FB1: The feed pump for ingredient A, the feed pump for ingredient B and the agitator motor can
be controlled by a single function block because the requirements (on, off, count applications
etc.) are identical.
• Instance DB 1-3: The actual parameters and the static data for controlling the feed pumps for
ingredient A, ingredient B and for the agitator motor are different and are therefore stored in
three instance DBs associated with FB1.
• FC1: The inlet and feed valves for ingredients A and B and the drain valve also use a common
logic block. As only the function "open and close" must be programmed, one single FC is
sufficient.
Symbolic Addresses for Feed Pump, Agitator Motor, and Inlet Valves
Symbolic Name Address Data Type Description
Feed_pump_A_start I0.0 BOOL Starts the feed pump for ingredient A
Feed_pump_A_stop I0.1 BOOL Stops the feed pump for ingredient A
Flow_A I0.2 BOOL Ingredient A flowing
Inlet_valve_A Q4.0 BOOL Activates the inlet valve for ingredient A
Feed_valve_A Q4.1 BOOL Activates the feed valve for ingredient A
Feed_pump_A_on Q4.2 BOOL Lamp for "feed pump ingredient A running"
Feed_pump_A_off Q4.3 BOOL Lamp for "feed pump ingredient A not
running"
Feed_pump_A Q4.4 BOOL Activates the feed pump for ingredient A
Feed_pump_A_fault Q4.5 BOOL Lamp for "feed pump A fault"
Feed_pump_A_maint Q4.6 BOOL Lamp for "feed pump A maintenance"
Feed_pump_B_start I0.3 BOOL Starts the feed pump for ingredient B
Feed_pump_B_stop I0.4 BOOL Stops the feed pump for ingredient B
Flow_B I0.5 BOOL Ingredient B flowing
Inlet_valve_B Q5.0 BOOL Activates the inlet valve for ingredient A
Feed_valve_B Q5.1 BOOL Activates the feed valve for ingredient B
Feed_pump_B_on Q5.2 BOOL Lamp for "feed pump ingredient B running"
Feed_pump_B_off Q5.3 BOOL Lamp for "feed pump ingredient B not
running"
Feed_pump_B Q5.4 BOOL Activates the feed pump for ingredient B
Feed_pump_B_fault Q5.5 BOOL Lamp for "feed pump B fault"
Feed_pump_B_maint Q5.6 BOOL Lamp for "feed pump B maintenance"
Agitator_running I1.0 BOOL Response signal of the agitator motor
Agitator_start I1.1 BOOL Agitator start button
Agitator_stop I1.2 BOOL Agitator stop button
Agitator Q8.0 BOOL Activates the agitator
Agitator_on Q8.1 BOOL Lamp for "agitator running"
Agitator_off Q8.2 BOOL Lamp for "agitator not running"
Agitator_fault Q8.3 BOOL Lamp for "agitator motor fault"
Agitator_maint Q8.4 BOOL Lamp for "agitator motor maintenance"
Symbolic Addresses for Sensors and Displaying the Level of the Tank
Symbolic Name Address Data Type Description
Tank_below_max I1.3 BOOL Sensor "mixing tank not full"
Tank_above_min I1.4 BOOL Sensor "mixing tank above minimum level"
Tank_not_empty I1.5 BOOL Sensor "mixing tank not empty"
Tank_max_disp Q9.0 BOOL Lamp for "mixing tank full"
Tank_min_disp Q9.1 BOOL Lamp for "mixing tank below minimum level"
Tank_empty_disp Q9.2 BOOL Lamp for "mixing tank empty"
With FBs, the input, output, in/out, and static variables are saved in the instance DB specified in the
call statement. The temporary variables are stored in the L stack.
With FCs, the temporary variables are saved in the L stack. The input, output, and in/out variables
are saved as pointers to the logic block that called the FC. Additional memory space in the L stack
(after the temporary variables) is used for these variables.
The code section of OB1 appears as shown below in the STL programming language:
Task
Output Q 4.0 should be set in the time from Monday, 5.00 am to Friday, 8.00 pm. In the time from
Friday, 8.00 pm to Monday, 5.00 am the output Q 4.0 should be reset.
Block Sub-Task
OB1 Calls the function FC12
FC12 Depending on the state of the output Q 4.0, the time-of-day interrupt status, and the
inputs I 0.0 and I 0.1
• Specify the starting time
• Set the time-of-day interrupt
• Activate the time-of-day interrupt
• CAN_TINT
OB10 Depending on the current day of the week
• Specify the starting time
• Set or reset output Q 4.0
• Set next time-of-day interrupt
• Activate next time-of-day interrupt
OB80 Set output Q 4.1
Store start event information of OB80 in bit memory area
Addresses Used
The following table shows the shared addresses used. The temporary local variables are declared
in the declaration section of the respective block.
Address Meaning
I0.0 Input to enable "set time-of-day interrupt" and "activate time-of-day interrupt"
I0.1 Input to cancel a time-of-day interrupt
Q4.0 Output set/reset by the time-of-day interrupt OB (OB10)
Q4.1 Output set by a time error (OB80)
MW16 STATUS of the time-of-day interrupt (SFC31 "QRY_TINT")
MB100 to MB107 Memory for start event information of OB10 (time-of-day only)
MB110 to MB129 Memory for start event information of OB80 (time error)
MW200 RET_VAL of SFC28 "SET_TINT"
MB202 Binary result (status bit BR) buffer for SFCs
MW204 RET_VAL of SFC30 "ACT_TINT"
MW208 RET_VAL of SFC31 "QRY_TINT"
26.6.3.2 FC12
Declaration Section
The following temporary local variables are declared in the declaration section of FC12:
Network 2:
AN Q 4.0 Specify start time dependent on Q 4.0 (in
JC mond variable
L D#1995-1-27 #IN_DATE and #IN_TIME)
T #IN_DATE Start date is a Friday
L TOD#20:0:0.0
T #IN_TIME
JU cnvt
mond: L D#1995-1-23
T #IN_DATE Start date is a Monday
L TOD#5:0:0.0
T #IN_TIME
cnvt: NOP 0
26.6.3.3 OB10
Declaration Section
In contrast to the default declaration section of OB10 the following temporary local variables are
declared:
• Structure for the entire start event information (STARTINFO)
• Within the STARTINFO structure a structure for the time (T_STMP)
• Other temporary local variables WDAY, IN_DATE, IN_TIME, and OUT_TIME_DATE
mond: L D#1995-1-23
T #IN_DATE
L TOD#5:0:0.0
T #IN_TIME
Starting time specified.
CLR Convert specified starting time to
= Q 4.0 format DATE_AND_TIME (for SFC28).
cnvt: NOP 0
Network 4: Set time-of-day interrupt.
CALL FC 3
IN1 := #IN_DATE
IN2 := #IN_TIME
RET_VAL := #OUT_TIME_DATE
Network 5:
CALL SFC 28
OB_NO := 10
SDT := #OUT_TIME_DATE
PERIOD := W#16#1201
RET_VAL := MW 200
A BR
= M 202.1
Network 6:
CALL SFC 30 Activate time-of-day interrupt.
OB_NO := 10
RET_VAL := MW 204
A BR
= M 202.2
Network 7:
CALL SFC 20 Block transfer: save time of day from
SRCBLK := #STARTINFO.T_STMP start event information of OB10 to the
RET_VAL := MW 206 memory area MB100 to MB107.
DSTBLK := P#M 100.0 BYTE 8
Task
When input I 0.0 is set, output Q 4.0 should be set 10 seconds later. Every time input I 0.0 is set,
the delay time should be restarted.
The time (seconds and milliseconds) of the start of the time-delay interrupt should appear as a
user-specific ID in the start event information of the time-delay interrupt OB (OB20).
If I 0.1 is set in these 10 seconds, the organization block OB20 should not be called; meaning the
output Q 4.0 should not be set.
When input I 0.2 is set, output Q 4.0 should be reset.
Block Sub-Task
OB1 Read current time and prepare for start of time-delay interrupt
Dependent on edge change at input I 0.0, start time-delay interrupt
Depending on the status of the time-delay interrupt and the edge change at input I 0.1,
cancel time-delay interrupt
Dependent on the state of input I 0.2, reset output Q 4.0
OB20 Set output Q 4.0
Read and prepare current time
Save start event information to bit memory area
Addresses Used
The following table shows the shared addresses used. The temporary local variables are declared
in the declaration section of the respective block.
Address Meaning
I0.0 Input to enable "start time-delay interrupt"
I0.1 Input to cancel a time-delay interrupt
I0.2 Input to reset output Q 4.0
Q4.0 Output set by the time-delay interrupt OB (OB20)
MB1 Used for edge flag and binary result (status bit BR) buffer for SFCs
MW4 STATUS of time-delay interrupt (SFC34 "QRY_TINT")
MD10 Seconds and milliseconds BCD-coded from the start event information of OB1
MW 100 RET_VAL of SFC32 "SRT_DINT"
MW102 RET_VAL of SFC34 "QRY_DINT"
MW104 RET_VAL of SFC33 "CAN_DINT"
MW106 RET_VAL of SFC20 "BLKMOV"
MB120 to MB139 Memory for start event information of OB20
MD140 Seconds and milliseconds BCD-coded from the start event information of OB20
MW144 Seconds and milliseconds BCD-coded from the start event information of OB1;
acquired from start event information of OB20 (user-specific ID SIGN)
26.6.4.2 OB20
Declaration Section
In contrast to the default declaration section of OB20 the following temporary local variables are
declared:
• Structure for the entire start event information (STARTINFO)
• Within the STARTINFO structure a structure for the time (T_STMP)
Code Section
Enter the following STL user program in the code section of OB20:
26.6.4.3 OB1
Declaration Section
In contrast to the default declaration section of OB1 the following temporary local variables are
declared:
• Structure for the entire start event information (STARTINFO)
• Within the STARTINFO structure a structure for the time (T_STMP)
Code Section
Enter the following STL user program in the code section of OB1:
Code Section
Below you will find the OB1 in which the example of the user program was programmed in
Statement List.
Invert RLO
A M 37.3
M 0.0=1 if PQB 16 present
NOT
= M 0.0
Invert RLO
A M 37.3
NOT M 0.1=1 if PQB 17 present
= M 0.1
Invert RLO
A M 37.3
M 0.3=1 if PQB 19 present
NOT
= M 0.3
A M 10.0
S M 190.1
A M 10.1
S M 190.0
:
:
The CPU can access inputs and outputs of central and distributed digital input/output modules
either indirectly using the process image tables or directly via the backplane/P bus.
The CPU accesses inputs and outputs of central and distributed analog input/output modules
directly via the backplane/P bus. You can also enter the addresses of analog modules in the
process image area.
Addressing Modules
You assign the addresses used in your program to the modules when you configure the modules
with STEP 7, as follows:
• With central I/O modules: arrangement of the rack and assignment of the modules to slots in
the configuration table.
• For stations with a distributed I/O (PROFIBUS DP or PROFINET IO): arrangement of the DP
slaves or IO devices with the PROFIBUS address or device name and assignment of the
modules to slots.
By configuring the modules, it is no longer necessary to set addresses on the individual modules
using switches. As a result of the configuration, the programming device sends data to the CPU
that allow the CPU to recognize the modules assigned to it.
To find out which address areas are possible on individual modules, refer to the following manuals:
• CPU 31xC and CPU 31x, Technical Data
• S7-400 Programmable Controllers, CPU Data
User Data
User data is addressed with the byte address (for digital signal modules) or the word address (for
analog signal modules) of the input or output area. User data can be accessed with load and
transfer commands, communication functions (operator interface access), or by transferring the
process image. User data can be any of the following:
• Digital and analog input/output signals from signal modules
• Control and status information from function modules
• Information for pointtopoint and bus connections from communication modules (only S7-300)
When transferring user data, a consistency of a maximum of 4 bytes can be achieved (with the
exception of DP standard slaves, see Setting the Operating Behavior). If you use the "transfer
double word" statement, four contiguous and unmodified (consistent) bytes are transferred. If you
use four separate "transfer input byte" statements, a hardware interrupt OB could be inserted
between the statements and transfer data to the same address so that the content of the original 4
bytes is changed before they were all transferred.
Data Description
Diagnostic data If the modules are capable of diagnostics, you obtain the diagnostic data of the module
by reading data records 0 and 1.
Parameter data If the modules are configurable, you transfer the parameters to the module by writing
data records 0 and 1.
SFC Purpose
Assigning parameters to modules
SFC55 WR_PARM Transfers the modifiable parameters (data record 1) to the addressed signal
module
SFC56 WR_DPARM Transfers parameters from SDBs 100 to 129 to the addressed signal module
SFC57 PARM_MOD Transfers parameters from SDBs 100 to 129 to the addressed signal module
SFC58 WR_REC Transfers any data record to the addressed signal module
Reading out diagnostic information
SFC59 RD_REC Reads the diagnostic data
Note
If a DPV1 slave is configured using a GSD file (GSD as of Rev. 3) and the DP interface of the DP
master is set to "S7 compatible", then data records must not be read from or written to the I/O
modules in the user program with SFC 58/59 or SFB 53/52. The reason is that in this case the DP
master addresses the incorrect slot (configured slot +3).
Remedy: Set the interface for the DP master to "DPV1".
Addressing S5 Modules
You can access S5 modules as follows:
• By connecting an S7400 to SIMATIC S5 expansion racks using the interface module IM 4632
• By plugging in certain S5 modules in an adapter casing in the central rack of the S7400
How you address S5 modules with SIMATIC S7 is explained in the "S7-400 Programmable
Controller, Hardware and Installation" Manual or the description supplied with the adapter casing.
This chapter explains how you can modify certain properties of S7-300 and S7400 programmable
controllers by setting system parameters or using system functions (SFCs).
You will find detailed information on the module parameters in the STEP 7 online help and in the
following manuals:
• "S7-300 Programmable Controller, Hardware and Installation" Manual
• "S7-300 Programmable Controller, Module Specifications" Reference Manual
• "S7-400 Programmable Controller, Module Specifications" Reference Manual
You will find all you need to know about SFCs in the "System Software for S7-300 and S7-400,
System and Standard Functions" Reference Manual.
SFC Purpose
Assigning parameters to modules
SFC15 DPWR_DAT Transfers any data to the addressed signal module
Reading out diagnostic information
SFC13 DPNRM_DG Reads the diagnostic information (asynchronous read access)
SFC14 DPRD_DAT Reads consistent data (length 3 or greater than 4 bytes)
When a DP diagnostic frame arrives, a diagnostic interrupt with 4 bytes of diagnostic data is
signaled to the CPU. You can read out these 4 bytes using SFC13 DPNRM_DG.
Default Settings
• When supplied, all the configurable modules of the S7 programmable controller have default
settings suitable for standard applications. With these defaults, you can use the modules
immediately without making any settings. The default values are explained in the module
descriptions in the following manuals:
• "S7-300 Programmable Controller, Hardware and Installation" Manual
• "S7-300 Programmable Controller, Module Specifications" Reference Manual
• "S7-400Programmable Controller, Module Specifications" Reference Manual
SFC Purpose
SFC55 WR_PARM Transfers the modifiable parameters (data record 1) to the addressed signal
module
SFC56 WR_DPARM Transfers the parameters from the corresponding SDBs to the addressed
signal module
SFC57 PARM_MOD Transfers all parameters from the corresponding SDBs to the addressed
signal module
SFC58 WR_REC Transfers any data record to the addressed signal module
The system functions are described in detail in the "System Software for S7-300 and S7-400,
System and Standard Functions" Reference Manual.
Which module parameters can be modified dynamically is explained in the following manuals:
• "S7-300 Programmable Controller, Hardware and Installation" Manual
• "S7-300 Programmable Controller, Module Specifications" Reference Manual
• "S7-400 Programmable Controller, Module Specifications" Reference Manual
26.8.3 Updating the Firmware (of the Operating System) in Modules and
Submodules Offline
The following section describes how to transfer a new firmware version (new operating system
version) to a module or a CPU by means of a memory card.
The update requires the following two steps:
1. Create an "update memory card" (transfer the update files to a memory card) with the
programming device (PG) or PC with an external prommer.
2. Using the "update memory card", update the operating system on the CPU.
Requirements
• Memory card with sufficient storage capacity. For information on this, refer to the download
pages at customer support. This is where you will also find the update files.
• Programming device (PG) or PC set up to program memory cards.
All S7-300/S7-400 CPUs are equipped with a clock (real-time clock or software clock). The clock
can be used in the programmable controller both as clock master or clock slave with external
synchronization. The clock is required for TimeOfDay interrupts and runtime meters.
Time Format
The clock always indicates the time (minimum resolution 1 s), date, and weekday. With some
CPUs it is also possible to indicate milliseconds (refer to the "S7-300 Programmable Controller,
Hardware and Installation" Manual and "S7-400 Programmable Controller, Module Specifications"
Reference Manual).
Note
To prevent the time from being displayed differently on HMI systems, you should set winter time
on the CPU.
Clock Memory
The clock memory is a memory byte that changes its binary state periodically at a pulsepause
ratio of 1:1. You select which memory byte is used on the CPU when you assign parameters for the
clock memory using STEP 7.
Uses
You can use clock memory bytes in the user program, for example, to activate flashing lights or to
trigger periodic activities (for example, measuring an actual value).
Possible Frequencies
Each bit of the clock memory byte is assigned a frequency. The following table shows the
assignment:
Note
Clock memory bytes are not synchronous with the CPU cycle, in other words, in long cycles, the state of the
clock memory byte may change several times.
Timers
Timers are a memory area of the system memory. You specify the function of a timer in the user
program (for example, ondelay timer). The number of timers available depends on the CPU.
Note
• If you use more timers in your user program than the CPU permits, a synchronous error is
signaled and OB121 started.
• On the S7-300 (with the exception of the CPU 318), timers can be started and updated
simultaneously only in OB1 and OB100; in all other OBs timers can only be started.