Programming With STEP 7
Programming With STEP 7
0
Manual
This manual is part of the documentation package with the order no.:6ES7 810-4CA04-8BA0
Important Notes, Contents Introducing the Product Installing and Authorization Designing the Automation Solution Basics of Designing a Program Structure Startup and Operation Setting Up and Editing a Project Defining Symbols Creating Blocks and Libraries Creating Logic Blocks Creating Data Blocks Creating STL Source Files Overview of the Available Reference Data Time Stamp as a Block Property Configuring Messages Controlling and Monitoring Variables Establishing Online Connections and Making CPU Settings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
Downloading and Uploading Testing with the Variable Table Testing using Program Status Testing using the Simulation Program (Optional Package) Diagnostics Printing and Archiving When Several Users are Editing the Same Project Working with M7 Programmable Control Systems Tips and Tricks How to Set Up and Edit Projects How to Program with STEP 7 How to Establish Online Connections and MakeCPU Settings How to Download and Upload How to Debug
Working with Diagnostics How to Print and Archive How Several Users Edit the Same Project Appendix, Index
Contents
Important notes Contents 1 Introducing the Product 1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 2 iii ix 1-1
Overview of STEP 7 ..................................................................................... 1-1 The STEP 7 Standard Package..................................................................... 1-6 Whats New in STEP 7, Version 5.0? .......................................................... 1-10 Extended Uses of the STEP 7 Standard Package ....................................... 1-14 Extended Uses of the STEP 7 Standard Package ....................................... 1-14 Engineering Tools ....................................................................................... 1-16 Run-Time Software ..................................................................................... 1-18 Human Machine Interface ........................................................................... 1-19 2-1
Installing and Authorization 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.2.2 2.2.3 2.3 2.3.1
Authorization................................................................................................. 2-1 Authorization................................................................................................. 2-1 Installing and Removing the Authorization .................................................... 2-1 Guidelines for Handling Authorizations.......................................................... 2-5 Installing STEP 7 .......................................................................................... 2-8 Installing STEP 7 .......................................................................................... 2-8 Installation Procedure ................................................................................. 2-10 Setting the PG/PC Interface........................................................................ 2-13 Uninstalling STEP 7 .................................................................................... 2-16 Uninstalling STEP 7 .................................................................................... 2-16 3-1
Designing the Automation Solution 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9
Basic Procedure for Planning an Automation Project .................................... 3-1 Dividing the Process into Tasks and Areas.................................................... 3-2 Describing the Individual Functional Areas.................................................... 3-4 Listing Inputs, Outputs, and In/Outs............................................................... 3-6 Creating an I/O Diagram for the Motors......................................................... 3-6 Creating an I/O Diagram for the Valves......................................................... 3-7 Establishing the Safety Requirements........................................................... 3-8 Describing the Required Operator Displays and Controls .............................. 3-9 Creating a Configuration Diagram ............................................................... 3-10 4-1
Basics of Designing a Program Structure 4.1 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5
Programs in a CPU ....................................................................................... 4-1 Blocks in the User Program........................................................................... 4-2 Blocks in the User Program........................................................................... 4-2 Organization Blocks and Program Structure.................................................. 4-3 Call Hierarchy in the User Program ............................................................. 4-10 Block Types and Cyclic Program Processing............................................... 4-12 Organization Blocks for Interrupt-Driven Program Processing ..................... 4-27
ix
Contents
Startup and Operation 5.1 5.1.1 5.1.2 5.1.3 5.2 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8 5.4 5.4.1 5.4.2 5.4.3 5.4.4 5.4.5 5.4.6
5-1
Starting STEP 7............................................................................................ 5-1 Starting STEP 7............................................................................................ 5-1 Starting STEP 7 with Default Start Parameters ............................................. 5-2 Calling the Help Functions ............................................................................ 5-4 Objects and Object Hierarchy ....................................................................... 5-5 Objects and Object Hierarchy ....................................................................... 5-5 Project Object ............................................................................................... 5-7 Library Object ............................................................................................... 5-9 Station Object ............................................................................................. 5-10 Programmable Module Object .................................................................... 5-11 S7/M7 Program Object ............................................................................... 5-13 Block Folder Object .................................................................................... 5-14 Source File Folder Object ........................................................................... 5-17 S7/M7 Program without a Station or CPU ................................................... 5-18 User Interface and Operation ...................................................................... 5-19 Operating Philosophy.................................................................................. 5-19 Window Arrangement ................................................................................. 5-20 Elements in Dialog Boxes ........................................................................... 5-21 Creating and Managing Objects .................................................................. 5-22 Selecting Objects in a Browser.................................................................... 5-28 Session Memory ......................................................................................... 5-29 Changing the Window Arrangement............................................................ 5-29 Saving and Restoring the Window Arrangement ......................................... 5-30 Keyboard Control ........................................................................................ 5-31 Keyboard Control ........................................................................................ 5-31 Key Combinations for Menu Commands ..................................................... 5-31 Key Combinations for Moving the Cursor .................................................... 5-33 Key Combinations for Selecting Text .......................................................... 5-34 Key Combinations for Access to Online Help .............................................. 5-35 Key Combinations for Toggling between Windows...................................... 5-35 6-1
Setting Up and Editing a Project 6.1 6.2 6.2.1 6.2.2 6.2.3 6.3 6.3.1
Project Structure ........................................................................................... 6-1 Setting Up a Project ...................................................................................... 6-3 Creating a Project ......................................................................................... 6-3 Inserting Stations .......................................................................................... 6-5 Inserting an S7/M7 Program ......................................................................... 6-6 Editing a Project ........................................................................................... 6-9 Editing a Project ........................................................................................... 6-9 7-1
Defining Symbols 7.1 7.2 7.3 7.4 7.4.1 7.4.2 7.4.3 7.4.4 7.5 7.5.1 7.5.2 7.5.3
Absolute and Symbolic Addressing ............................................................... 7-1 Shared and Local Symbols ........................................................................... 7-2 Displaying Shared or Local Symbols............................................................. 7-4 Symbol Table for Shared Symbols................................................................ 7-4 Symbol Table for Shared Symbols................................................................ 7-4 Structure and Components of the Symbol Table ........................................... 7-5 Addresses and Data Types Permitted in the Symbol Table ........................... 7-6 Incomplete and Non-Unique Symbols in the Symbol Table ........................... 7-7 Entering Shared Symbols ............................................................................. 7-8 Entering Shared Symbols ............................................................................. 7-8 General Tips on Entering Symbols................................................................ 7-9 Entering Single Shared Symbols in a Dialog Box .......................................... 7-9
Contents
Entering Multiple Shared Symbols in the Symbol Table .............................. 7-10 Setting the Address Priority......................................................................... 7-12 Exporting and Importing Symbol Tables...................................................... 7-12 File Formats for Importing/Exporting a Symbol Table.................................. 7-13 8-1
Creating Blocks and Libraries 8.1 8.2 8.2.1 8.2.2 8.2.3 8.2.4 8.2.5 8.2.6 8.2.7 8.2.8 8.3 8.3.1 8.3.2 8.3.3 8.3.4 8.4 8.4.1 8.4.2 8.4.3
Selecting an Editing Method.......................................................................... 8-1 Selecting the Programming Language........................................................... 8-2 Selecting the Programming Language........................................................... 8-2 Ladder Logic Programming Language (LAD)................................................. 8-4 Function Block Diagram Programming Language (FBD) ............................... 8-4 Statement List Programming Language (STL)............................................... 8-5 S7 SCL Programming Language................................................................... 8-6 S7 Graph Programming Language (Sequential Control)................................ 8-7 S7 HiGraph Programming Language (State Graph) ...................................... 8-8 S7 CFC Programming Language ................................................................ 8-10 Creating Blocks........................................................................................... 8-10 Blocks Folder .............................................................................................. 8-10 User-Defined Data Types (UDT) ................................................................. 8-11 Block Properties.......................................................................................... 8-12 Attributes for Blocks and Parameters .......................................................... 8-14 Working with Libraries................................................................................. 8-15 Working with Libraries................................................................................. 8-15 Hierarchical Structure of Libraries ............................................................... 8-17 Overview of the Standard Libraries ............................................................. 8-17 9-1
Creating Logic Blocks 9.1 9.1.1 9.1.2 9.1.3 9.1.4 9.2 9.2.1 9.2.2 9.2.3 9.2.4 9.3 9.3.1 9.3.2 9.4 9.4.1 9.4.2 9.4.3 9.4.4 9.4.5 9.5 9.5.1 9.5.2 9.5.3 9.6 9.6.1 9.6.2 9.7 9.7.1
Basics of Creating Logic Blocks .................................................................... 9-1 Basic Procedure for Creating Logic Blocks.................................................... 9-1 Default Settings for the LAD/STL/FBD Program Editor.................................. 9-3 Access Rights to Blocks and Source Files..................................................... 9-3 Instructions from the Program Element Catalog ............................................ 9-4 Editing the Variable Declaration Table .......................................................... 9-4 Using the Variable Declaration in Logic Blocks.............................................. 9-4 Relationship between the Variable Declaration Table and the Code Section . 9-6 Structure of the Variable Declaration Table ................................................... 9-7 General Notes on Variable Declaration Tables .............................................. 9-8 Multiple Instances in the Variable Declaration Table ..................................... 9-9 Using Multiple Instances ............................................................................... 9-9 Rules for Declaring Multiple Instances......................................................... 9-10 General Notes on Editing Statements and Comments................................. 9-11 Structure of the Code Section ..................................................................... 9-11 Procedure for Entering Statements ............................................................. 9-12 Entering Shared Symbols in a Program....................................................... 9-13 Title and Comments for Blocks and Networks ............................................. 9-14 Search Function for Errors in the Code Section........................................... 9-15 Editing LAD Statements in the Code Section............................................... 9-16 Settings for Ladder Logic Programming ...................................................... 9-16 Rules for Entering Ladder Logic Elements................................................... 9-17 Illegal Logic Operations in Ladder ............................................................... 9-19 Editing FBD Statements in the Code Section .............................................. 9-20 Settings for Function Block Diagram Programming ..................................... 9-20 Rules for Entering FBD Elements................................................................ 9-21 Editing STL Statements in the Code Section............................................... 9-23 Settings for Statement List Programming .................................................... 9-23
xi
Contents
Rules for Entering STL Statements............................................................. 9-23 Updating Block Calls................................................................................... 9-24 Updating Block Calls................................................................................... 9-24 Saving Logic Blocks.................................................................................... 9-25 Saving Logic Blocks.................................................................................... 9-25 Correcting the Interfaces in a Function, Function Block, or UDT ................. 9-26 Avoiding Errors when Calling Blocks........................................................... 9-26 10-1
Creating Data Blocks 10.1 10.2 10.3 10.4 10.4.1 10.4.2 10.4.3 10.4.4 10.4.5 10.4.6 10.4.7
Basic Information on Creating Data Blocks ................................................. 10-1 Declaration View of Data Blocks ................................................................. 10-2 Data View of Data Blocks............................................................................ 10-3 Editing and Saving Data Blocks .................................................................. 10-4 Entering the Data Structure of Shared Data Blocks..................................... 10-4 Entering and Displaying the Data Structure of Data Blocks Referencing an FB (Instance DBs).................................................................................. 10-5 Entering the Data Structure of User-Defined Data Types (UDT) .................. 10-6 Entering and Displaying the Structure of Data Blocks Referencing a UDT... 10-7 Editing Data Values in the Data View.......................................................... 10-8 Resetting Data Values to their Initial Values................................................ 10-8 Saving Data Blocks..................................................................................... 10-9 11-1
11
Creating STL Source Files 11.1 11.2 11.2.1 11.2.2 11.2.3 11.2.4 11.2.5 11.2.6 11.3 11.3.1 11.3.2 11.3.3 11.3.4 11.4 11.4.1 11.4.2 11.4.3 11.4.4 11.4.5 11.5 11.5.1 11.5.2 11.5.3 11.5.4 11.6 11.6.1 11.6.2 11.6.3 11.6.4 11.6.5 11.6.6
Basic Information on Programming in STL Source Files ............................. 11-1 Rules for Programming in STL Source Files ............................................... 11-2 Rules for Entering Statements in STL Source Files..................................... 11-2 Rules for Declaring Variables in STL Source Files ...................................... 11-3 Rules for Block Order in STL Source Files.................................................. 11-4 Rules for Setting System Attributes in STL Source Files ............................. 11-5 Rules for Setting Block Properties in STL Source Files ............................... 11-5 Permitted Block Properties for Each Block Type ......................................... 11-7 Structure of Blocks in STL Source Files ...................................................... 11-8 Structure of Blocks in STL Source Files ...................................................... 11-8 Structure of Logic Blocks in STL Source Files............................................. 11-8 Structure of Data Blocks in STL Source Files.............................................. 11-9 Structure of User-Defined Data Types in STL Source Files ......................... 11-9 Syntax and Formats for Blocks in STL Source Files.................................. 11-10 Syntax and Formats for Blocks in STL Source Files.................................. 11-10 Format Table of Organization Blocks ........................................................ 11-10 Format Table of Function Blocks .............................................................. 11-11 Format Table of Functions ........................................................................ 11-12 Format Table of Data Blocks..................................................................... 11-13 Saving and Compiling STL Source Files and Executing a Consistency Check ....................................................................................................... 11-14 Saving STL Source Files .......................................................................... 11-14 Checking Consistency in STL Source Files ............................................... 11-14 Troubleshooting in STL Source Files......................................................... 11-15 Compiling STL Source Files...................................................................... 11-15 Examples of STL Source Files.................................................................. 11-16 Examples of Declaring Variables in STL Source Files............................... 11-16 Example of Organization Blocks in STL Source Files................................ 11-17 Example of Functions in STL Source Files................................................ 11-18 Example of Function Blocks in STL Source Files ...................................... 11-20 Example of Data Blocks in STL Source Files ............................................ 11-22 Example of User-Defined Data Types in STL Source Files ....................... 11-24
xii
Contents
12
Overview of the Available Reference Data 12.1 12.1.1 12.1.2 12.1.3 12.1.4 12.1.5 12.1.6 12.1.7 12.1.8 12.2 12.2.1 12.2.2 12.2.3 12.2.4 12.2.5
12-1
Overview of the Available Reference Data.................................................. 12-1 Overview of the Available Reference Data.................................................. 12-1 Cross-Reference List................................................................................... 12-2 Program Structure....................................................................................... 12-4 Assignment List for Inputs, Outputs, and Bit Memory (I/Q/M) ...................... 12-6 Assignment List for Timers and Counters (T/C) ........................................... 12-8 Unused Symbols......................................................................................... 12-9 Addresses Without Symbols...................................................................... 12-10 Displaying Block Information for LAD, FBD, and STL................................ 12-10 Working with Reference Data.................................................................... 12-11 Ways of Displaying Reference Data.......................................................... 12-11 Displaying Lists in Additional Working Windows........................................ 12-12 Generating and Displaying Reference Data............................................... 12-13 Finding Address Locations in the Program Quickly.................................... 12-14 Example of Working with Address Locations............................................. 12-15 13-1
13
Time Stamp as a Block Property and Time Stamp Conflicts 13.1 13.2 13.3 13.4 13.5
Time Stamps as a Block Property and Time Stamp Conflicts...................... 13-1 Time Stamps in Logic Blocks ...................................................................... 13-2 Time Stamps in Shared Data Blocks........................................................... 13-3 Time Stamps in Instance Data Blocks ......................................................... 13-3 Time Stamps in UDTs and Data Blocks Derived from UDTs ....................... 13-4 14-1
14
Configuring Messages 14.1 14.1.1 14.1.2 14.1.3 14.1.4 14.1.5 14.1.6 14.2 14.2.1 14.2.2 14.2.3 14.2.4 14.2.5 14.2.6 14.3 14.3.1 14.4 14.4.1 14.5 14.5.1 14.6 14.6.1 14.7 14.7.1 14.7.2 14.7.3
The Message Concept ................................................................................ 14-1 The Message Concept ................................................................................ 14-1 What Are the Different Messaging Methods? .............................................. 14-1 Choosing a Messaging Method ................................................................... 14-3 SIMATIC Components ................................................................................ 14-4 Parts of a Message ..................................................................................... 14-5 Assigning Message Numbers ...................................................................... 14-6 Assigning and Editing Block-Related Messages .......................................... 14-6 Assigning and Editing Block-Related Messages .......................................... 14-6 Which Message Blocks Are Available? ....................................................... 14-6 Formal Parameters, System Attributes, and Message Blocks...................... 14-8 Message Templates and Messages............................................................. 14-9 Creating Block-Related Messages............................................................. 14-10 PCS7 Message Configuration ................................................................... 14-13 Assigning and Editing Symbol-Related Messages ..................................... 14-15 Assigning and Editing Symbol-Related Messages ..................................... 14-15 Creating and Editing User-Defined Diagnostic Messages .......................... 14-16 Creating and Editing User-Defined Diagnostic Messages .......................... 14-16 Translating and Editing User Texts............................................................ 14-17 Translating and Editing User Texts............................................................ 14-17 Transferring Message Configuration Data to the Programmable Controller .................................................................................................. 14-20 Transferring Configuration Data to the Programmable Controller .............. 14-20 Displaying CPU Messages and User-Defined Diagnostic Messages .......... 14-21 Displaying CPU Messages and User-Defined Diagnostic Messages .......... 14-21 Configuring CPU Messages ...................................................................... 14-23 Displaying Stored CPU Messages............................................................. 14-24
xiii
Contents
15
Controlling and Monitoring Variables 15.1 15.2 15.2.1 15.3 15.3.1 15.4 15.4.1 15.5 15.5.1
15-1
Configuring Variables for Operator Control and Monitoring ......................... 15-1 Configuring Operator Control and Monitoring Attributes with Statement List, Ladder Logic, a.................................................................................... 15-2 Configuring Operator Control and Monitoring Attributes with Statement List, Ladder Logic, and Function Block Diagram.......................................... 15-2 Configuring Operator Control and Monitoring Attributes via the Symbol Table .......................................................................................................... 15-3 Configuring Operator Control and Monitoring Attributes via the Symbol Table .......................................................................................................... 15-3 Changing Operator Control and Monitoring Attributes with CFC .................. 15-4 Changing Operator Control and Monitoring Attributes with CFC .................. 15-4 Transferring Configuration Data to the Operator Interface Programmable Controller............................................................................ 15-5 Transferring Configuration Data to the Operator Interface Programmable Controller.................................................................................................. 15-5 16-1
16
Establishing Online Connections and Making CPU Settings 16.1 16.1.1 16.1.2 16.1.3 16.1.4 16.1.5 16.2 16.2.1 16.3 16.3.1
Establishing Online Connections................................................................. 16-1 Establishing Online Connections................................................................. 16-1 Establishing an Online Connection via the "Accessible Nodes" Window...... 16-1 Establishing an Online Connection via the Online Window of the Project.... 16-2 Password Protection for Access to Programmable Controllers .................... 16-3 Updating the Window Contents................................................................... 16-4 Displaying and Changing the Operating Mode............................................. 16-4 Displaying and Changing the Operating Mode............................................. 16-4 Displaying and Setting the Time and Date .................................................. 16-5 Displaying and Setting the Time and Date .................................................. 16-5 17-1
17
Downloading and Uploading 17.1 17.1.1 17.1.2 17.1.3 17.1.4 17.2 17.2.1 17.2.2 17.2.3 17.2.4 17.2.5 17.2.6
Downloading from the PG/PC to the Programmable Controller ................... 17-1 Requirements for Downloading ................................................................... 17-1 Differences Between Saving and Downloading Blocks ................................ 17-2 Load Memory and Work Memory in the CPU .............................................. 17-3 Download Methods Dependent on the Load Memory................................... 17-5 Uploading from the Programmable Controller to the PG/PC........................ 17-6 Uploading from the Programmable Controller to the PG/PC........................ 17-6 Uploading a Station..................................................................................... 17-8 Uploading Blocks from an S7 CPU.............................................................. 17-9 Editing Uploaded Blocks in the PG/PC...................................................... 17-10 Deleting in the Programmable Controller .................................................. 17-11 Compressing the User Memory (RAM)...................................................... 17-12 18-1
18
Testing with the Variable Table 18.1 18.2 18.3 18.3.1 18.3.2 18.4 18.4.1 18.4.2
Introduction to Testing with the Variable Table............................................ 18-1 Basic Procedure when Monitoring and Modifying with the Variable Table.... 18-2 Editing and Saving Variable Tables ............................................................ 18-2 Creating and Opening a Variable Table ...................................................... 18-2 Saving a Variable Table.............................................................................. 18-3 Entering Variables in Variable Tables.......................................................... 18-4 Inserting Addresses or Symbols in a Variable Table.................................... 18-4 Inserting Modify Values............................................................................... 18-5
xiv
Contents
18.4.3 18.4.4 18.4.5 18.5 18.5.1 18.5.2 18.5.3 18.6 18.6.1 18.7 18.7.1 18.7.2 18.8 18.8.1 18.8.2 18.9 18.9.1 18.9.2 18.9.3 19
Upper Limits for Entering Timers................................................................. 18-6 Upper Limits for Entering Counters ............................................................. 18-7 Inserting Comment Lines ............................................................................ 18-8 Example of Entering in Variable Tables ...................................................... 18-8 Example of Entering Addresses in Variable Tables ..................................... 18-8 Example of Entering a Contiguous Address Area ........................................ 18-9 Examples of Entering Modify and Force Values .......................................... 18-9 Establishing a Connection to the CPU....................................................... 18-12 Establishing a Connection to the CPU....................................................... 18-12 Monitoring Variables ................................................................................. 18-13 Introduction to Monitoring Variables .......................................................... 18-13 Defining the Trigger for Monitoring Variables ............................................ 18-14 Modifying Variables................................................................................... 18-15 Introduction to Modifying Variables ........................................................... 18-15 Defining the Trigger for Modifying Variables.............................................. 18-16 Forcing Variables ...................................................................................... 18-18 Introduction to Forcing Variables............................................................... 18-18 Diff Safety Measures When Forcing Variables .......................................... 18-21 Differences Between Forcing and Modifying Variables .............................. 18-22 19-1
Testing using Program Status ..................................................................... 19-1 Program Status Display............................................................................... 19-3 What You Should Know About Testing in Single-Step Mode/Breakpoints.... 19-5 What You Should Know About the HOLD Mode .......................................... 19-7 20-1
20
21
Diagnostics 21.1 21.2 21.3 21.3.1 21.3.2 21.4 21.4.1 21.4.2 21.5 21.5.1 21.5.2 21.5.3 21.6 21.6.1 21.6.2 21.7 21.7.1 21.8 21.8.1 21.8.2 21.8.3 21.8.4 21.9 21.9.1 21.9.2
Diagnosing Hardware and Troubleshooting ................................................. 21-1 Diagnostics Symbols in the Online View...................................................... 21-2 Diagnosing Hardware: Quick View .............................................................. 21-4 Calling the Quick View ................................................................................ 21-4 Information Functions in the Quick View ..................................................... 21-5 Diagnosing Hardware: Diagnostic View ....................................................... 21-6 Calling the Diagnostic View......................................................................... 21-6 Information Functions in the Diagnostic View .............................................. 21-8 Calling the Module Information.................................................................... 21-8 Module Information Functions ..................................................................... 21-8 Scope of the Module Type-Dependent Information.................................... 21-11 Calling the module information.................................................................. 21-13 Diagnosing in STOP Mode........................................................................ 21-14 Basic Procedure for Determining the Cause of a STOP ............................ 21-14 Stack Contents in STOP Mode.................................................................. 21-14 Checking Scan Cycle Times to Avoid Time Errors .................................... 21-16 Checking Scan Cycle Times to Avoid Time Errors .................................... 21-16 Flow of Diagnostic Information .................................................................. 21-17 Flow of Diagnostic Information .................................................................. 21-17 System Status List SSL............................................................................. 21-18 Sending Your Own Diagnostic Messages .................................................. 21-21 Diagnostic Functions................................................................................. 21-22 Program Measures for Handling Errors ..................................................... 21-23 Program Measures for Handling Errors ..................................................... 21-23 Evaluating the Output Parameter RET_VAL.............................................. 21-24
xv
Contents
21.9.3 21.9.4 21.9.5 21.9.6 21.9.7 21.9.8 21.9.9 21.9.10 21.9.11 21.9.12 21.9.13 21.9.14 21.9.15 21.9.16 22
Error OBs as a Reaction to Detected Errors .............................................. 21-25 Inserting Substitute Values for Error Detection .......................................... 21-29 I/O Redundancy Error (OB70)................................................................... 21-32 CPU Redundancy Error (OB72) ................................................................ 21-33 Time Error (OB80) .................................................................................... 21-34 Power Supply Error (OB81)....................................................................... 21-35 Diagnostic Interrupt (OB82)....................................................................... 21-36 Insert/Remove Module Interrupt (OB83).................................................... 21-37 CPU Hardware Fault (OB84)..................................................................... 21-38 Program Sequence Error (OB85) .............................................................. 21-38 Rack Failure (OB86) ................................................................................. 21-39 Communication Error (OB87).................................................................... 21-40 Programming Error (OB121) ..................................................................... 21-41 I/O Access Error (OB122) ......................................................................... 21-41 22-1
Printing and Archiving 22.1 22.1.1 22.1.2 22.1.3 22.1.4 22.2 22.2.1 22.2.2 22.2.3 22.2.4
Printing Project Documentation................................................................... 22-1 Printing Project Documentation................................................................... 22-1 Basic Procedure when Printing ................................................................... 22-2 Print Functions............................................................................................ 22-3 Special Note on Printing the Object Tree .................................................... 22-4 Archiving Projects and Libraries.................................................................. 22-5 Archiving Projects and Libraries.................................................................. 22-5 Uses for Saving/Archiving........................................................................... 22-6 Requirements for Archiving......................................................................... 22-7 Procedure for Archiving/Retrieving ............................................................. 22-7 23-1
23
24
Procedure for M7 Systems.......................................................................... 24-1 Optional Software for M7 Programming ...................................................... 24-3 M7-300/M7-400 Operating Systems............................................................ 24-6
xvi
Contents
25
25-1
26
How to Set Up and Edit Projects 26.1 26.1.1 26.1.2 26.1.3 26.2 26.2.1 26.2.2 26.2.3 26.2.4 26.2.5 26.2.6 26.3 26.3.1 26.3.2 26.3.3 26.3.4
How to Set Up Projects ............................................................................... 26-1 Creating a Project Using the Wizard ........................................................... 26-1 Creating a Project Manually ........................................................................ 26-1 Inserting a Station ....................................................................................... 26-1 How to Edit Projects.................................................................................... 26-2 Copying a Project........................................................................................ 26-2 Copying Part of a Project ............................................................................ 26-2 Deleting a Project........................................................................................ 26-2 Deleting Part of a Project ............................................................................ 26-3 Configuring the Hardware............................................................................ 26-3 Creating the Software in the Project (General) ............................................ 26-3 How to Manage Objects .............................................................................. 26-4 Copying Objects.......................................................................................... 26-4 Renaming Objects ...................................................................................... 26-4 Moving Objects........................................................................................... 26-5 Deleting Objects.......................................................................................... 26-5 27-1
27
How to Program with STEP 7 27.1 27.1.1 27.1.2 27.1.3 27.1.4 27.1.5 27.1.6 27.1.7 27.1.8 27.1.9 27.1.10 27.1.11 27.1.12 27.1.13 27.1.14 27.1.15 27.1.16 27.1.17 27.2 27.2.1 27.2.2 27.2.3 27.3 27.3.1 27.3.2 27.3.3 27.3.4 27.3.5 27.3.6 27.3.7
How to Edit the Symbol Table ..................................................................... 27-1 Creating a Symbol Table............................................................................. 27-1 Opening a Symbol Table............................................................................. 27-2 Defining Individual Symbols........................................................................ 27-2 Inserting Symbol Rows................................................................................ 27-3 Deleting Symbol Rows ................................................................................ 27-3 Filtering the Symbol Table .......................................................................... 27-4 Sorting the Symbol Table............................................................................ 27-4 Searching for Specific Strings ..................................................................... 27-5 Displaying and Changing the Properties of a Symbol Table ........................ 27-5 Selecting Symbol Rows............................................................................... 27-6 Copying Symbol Rows to the Clipboard....................................................... 27-6 Editing the Operator Control and Monitoring Attribute ................................. 27-7 Editing the Message Attribute...................................................................... 27-8 Editing the Communication Attribute ........................................................... 27-8 Saving a Symbol Table ............................................................................... 27-9 Closing a Symbol Table .............................................................................. 27-9 Exiting the Symbol Editor............................................................................ 27-9 How to Import and Export Symbol Tables ................................................. 27-10 Importing a Symbol Table ......................................................................... 27-10 Importing an Excel File into the Symbol Table .......................................... 27-10 Exporting a Symbol Table ......................................................................... 27-11 How to Change the Window Settings in the Symbol Editor ........................ 27-12 Toggling the Toolbar On/Off...................................................................... 27-12 Toggling the Status Bar On/Off ................................................................. 27-12 Positioning the Toolbar ............................................................................. 27-12 Setting the Size of a Window for Display................................................... 27-13 Splitting a Table Window .......................................................................... 27-13 Changing the Window Arrangement of Symbol Tables.............................. 27-14 Modifying the Program Settings ................................................................ 27-14
xvii
Contents
27.4 27.4.1 27.4.2 27.4.3 27.4.4 27.4.5 27.4.6 27.4.7 27.5 27.5.1 27.5.2 27.5.3 27.5.4 27.5.5 27.5.6 27.6 27.6.1 27.6.2 27.6.3 27.6.4 27.6.5 27.7 27.7.1 27.7.2 27.7.3 27.7.4 27.7.5 27.7.6 27.7.7 27.7.8 27.7.9 27.7.10 27.7.11 27.7.12 27.8 27.8.1 27.8.2 27.8.3 27.8.4 27.8.5 27.8.6 27.8.7 27.8.8 27.8.9 27.8.10 27.8.11 27.8.12 27.8.13 27.9 27.9.1 27.9.2 27.9.3 27.9.4 27.9.5 27.9.6
How to Create Blocks................................................................................ 27-15 Creating Blocks with the SIMATIC Manager.............................................. 27-15 Creating Blocks with the Incremental Editor .............................................. 27-15 Creating Data Blocks (DB) ........................................................................ 27-16 Setting Block Properties............................................................................ 27-17 Setting the Address Priority (Symbolic/Absolute)....................................... 27-18 Comparing Blocks..................................................................................... 27-18 Rewiring.................................................................................................... 27-19 How to Work with Libraries ....................................................................... 27-20 Creating a Library ..................................................................................... 27-20 Using a Library.......................................................................................... 27-20 Copying a Library...................................................................................... 27-21 Copying Part of a Library .......................................................................... 27-21 Deleting a Library...................................................................................... 27-21 Deleting Part of a Library .......................................................................... 27-21 Defining the View in the Editing Window................................................... 27-22 Zooming Out............................................................................................. 27-22 Zooming the View ..................................................................................... 27-22 Setting the Window Split ........................................................................... 27-22 Setting Column Widths ............................................................................. 27-23 Toggling between Programming Languages.............................................. 27-23 How to Work with the Variable Declaration Table...................................... 27-24 Inserting Blank Rows in Variable Declaration Tables................................. 27-24 Entering Elementary Data Types in the Declaration Table......................... 27-24 Entering a Multiple Instance in the Variable Declaration Table .................. 27-25 Entering Data Elements of the Data Type STRUCT .................................. 27-26 Entering Data Elements of the Data Type ARRAY .................................... 27-27 Copying Variables in Declaration Tables................................................... 27-28 Deleting Variables in Declaration Tables................................................... 27-28 Changing the Column Width ..................................................................... 27-29 Assigning System Attributes...................................................................... 27-29 Entering Block Comments and Network Comments .................................. 27-30 Creating Network Templates..................................................................... 27-30 Inserting a Network Template in a Program .............................................. 27-31 How to Enter Ladder Elements.................................................................. 27-32 Entering Ladder Elements......................................................................... 27-32 Entering and Editing Addresses or Parameters in Ladder Elements .......... 27-33 Overwriting Addresses or Parameters in Ladder Elements........................ 27-33 Overwriting Ladder Elements.................................................................... 27-34 Selecting in Ladder Networks.................................................................... 27-35 Inserting Additional Ladder Networks ........................................................ 27-35 Creating Parallel Branches in Ladder Networks......................................... 27-36 Creating New Branches in Ladder Networks.............................................. 27-36 Creating a Closed Branch in Ladder Networks .......................................... 27-37 Opening Closed Parallel Branches in Ladder ............................................ 27-38 Splitting a Junction in Ladder Networks..................................................... 27-38 Creating T Branches with Coils in Ladder Networks .................................. 27-39 Creating T Branches in Ladder Networks .................................................. 27-40 How to Enter FBD Elements ..................................................................... 27-40 Entering FBD Elements ............................................................................ 27-40 Inserting FBD Elements from the Catalog ................................................. 27-41 Entering Addresses or Parameters in FBD Elements ................................ 27-41 Overwriting FBD Elements........................................................................ 27-42 Selecting in FBD Networks........................................................................ 27-42 Inserting Additional FBD Networks............................................................ 27-43
xviii
Contents
27.9.7 27.9.8 27.9.9 27.10 27.10.1 27.10.2 27.10.3 27.10.4 27.11 27.11.1 27.12 27.12.1 27.12.2 27.12.3 27.12.4 27.12.5 27.12.6 27.12.7 27.13 27.13.1 27.13.2 27.13.3 27.13.4 27.13.5 27.13.6 27.13.7 27.13.8 27.13.9 27.14 27.14.1 27.14.2 27.14.3 27.14.4 27.15 27.15.1 27.15.2 27.15.3 27.15.4 27.15.5 27.15.6 27.15.7 27.15.8 27.15.9 27.15.10 27.15.11 27.16 27.16.1 27.16.2 27.16.3 27.16.4 27.16.5 27.17
Creating T Branches in FBD Networks ...................................................... 27-43 Creating Connections in FBD Networks..................................................... 27-43 Splitting and Joining Connections in FBD Networks .................................. 27-44 How to Enter STL Statements ................................................................... 27-44 Entering STL Statements .......................................................................... 27-44 Selecting Text Areas in STL Statements ................................................... 27-45 Inserting Additional STL Networks............................................................. 27-45 Entering Comments in STL Statements .................................................... 27-45 Steps for Saving Code Blocks................................................................... 27-46 Saving Logic Blocks.................................................................................. 27-46 How to Enter and Save in Data Blocks...................................................... 27-47 Entering the Data Structure of Shared Data Blocks ................................... 27-47 Entering and Displaying the Data Structure of Data Blocks Referencing an FB (Instance DBs) ................................................................................ 27-48 Entering the Data Structure of User-Defined Data Types (UDT) ................ 27-49 Entering and Displaying the Structure of Data Blocks Referencing a UDT . 27-50 Editing Data Values in the Data View ........................................................ 27-51 Resetting Data Values to their Initial Values.............................................. 27-51 Saving Data Blocks................................................................................... 27-52 How to Create STL Source Files ............................................................... 27-53 Creating STL Source Files ........................................................................ 27-53 Editing S7 Source Files............................................................................. 27-53 Inserting Block Templates in STL Source Files ......................................... 27-54 Inserting the Contents of Other STL Source Files...................................... 27-54 Inserting Source Code from Existing Blocks in STL Source Files .............. 27-54 Inserting External Source Files.................................................................. 27-55 Generating STL Source Files from Blocks................................................. 27-55 Importing Source Files .............................................................................. 27-56 Exporting Source Files.............................................................................. 27-56 Saving and Compiling STL Source Files and Executing a Consistency Check ....................................................................................................... 27-57 Saving STL Source Files........................................................................... 27-57 Checking Consistency in STL Source Files ............................................... 27-57 Troubleshooting in STL Source Files......................................................... 27-58 Compiling STL Source Files...................................................................... 27-58 How to Work with Reference Data............................................................. 27-59 Searching the Reference Data .................................................................. 27-59 Sorting Reference Data............................................................................. 27-59 Filtering Reference Data ........................................................................... 27-60 Changing the Reference Data View........................................................... 27-61 Jumping from the Cross-Reference List to a Location in the Program ....... 27-61 Jumping from the Program Structure to a Location in the Program ........... 27-62 Opening Working Windows for Reference Data Already Displayed ........... 27-62 Opening Working Windows for Reference Data Not Yet Displayed ........... 27-62 Displaying Overlapping Access ................................................................. 27-63 Updating Reference Data Automatically On Compilation........................... 27-63 Changing the Default Reference Data View .............................................. 27-63 How to Configure Messages...................................................................... 27-64 Editing Block-Related Messages ............................................................... 27-64 Editing Symbol-Related Messages............................................................ 27-68 Creating and Editing User-Defined Diagnostic Messages .......................... 27-71 Translating and Editing User Texts............................................................ 27-73 Transferring Message Configuration Data to the Programmable Controller.................................................................................................. 27-75 How to Configure Operator Control and Monitoring Variables.................... 27-76
xix
Contents
Assigning System Attributes to Function Block Parameters....................... 27-76 Assigning WinCC Attributes to Data Blocks............................................... 27-77 Changing WinCC Attributes of CFC Block Parameters ............................. 27-77 Inserting Operator Station Objects ............................................................ 27-78 Starting the Transfer Program................................................................... 27-78 Transferring the Data ................................................................................ 27-79 Displaying the Transfer Log ...................................................................... 27-80 28-1
How to Establish Online Connections and Make CPU Settings 28.1 28.1.1 28.1.2 28.1.3 28.2 28.2.1
How to Establish Online Connections.......................................................... 28-1 Establishing a Connection from a Project With Configured Hardware.......... 28-1 Establishing a Connection from a Project Without Configured Hardware..... 28-1 Establishing a Connection Without a Project ............................................... 28-2 How to Change the Operating Mode ........................................................... 28-2 Switching the Operating Mode of an S7 CPU.............................................. 28-2 29-1
29
How to Download and Upload 29.1 29.1.1 29.1.2 29.1.3 29.1.4 29.1.5 29.2 29.2.1 29.2.2 29.2.3 29.2.4 29.2.5 29.2.6 29.3 29.3.1 29.3.2 29.3.3 29.3.4
Downloading the Entire Program to the S7 CPU ......................................... 29-1 Downloading with Project Management....................................................... 29-1 Downloading without Project Management.................................................. 29-1 Reloading Blocks in the Programmable Controller ...................................... 29-2 Saving Downloaded Blocks on Integrated EPROM ..................................... 29-2 Downloading via EPROM Memory Cards.................................................... 29-3 Uploading the Entire Program from the S7 CPU ......................................... 29-4 Uploading Blocks to the Corresponding Project on the Programming Device ........................................................................................................29-4 Uploading Blocks to a Different Project on the Programming Device .......... 29-4 Uploading Blocks to a New Project on the Programming Device ................. 29-5 Editing Uploaded Blocks if the User Program is on the PG/PC.................... 29-5 Editing Uploaded Blocks if the User Program is Not on the PG/PC ............. 29-6 Compressing the Memory Contents of an S7 CPU...................................... 29-6 How to Delete on the Programmable Controller .......................................... 29-7 Performing a Memory Reset on CPUs/FMs................................................. 29-7 Deleting in the RAM of the Programmable Controller.................................. 29-7 Erasing the EPROM Memory Card ............................................................. 29-8 Deleting in the Integrated EPROM .............................................................. 29-8 30-1
30
How to Debug 30.1 30.1.1 30.1.2 30.1.3 30.1.4 30.1.5 30.1.6 30.1.7 30.1.8 30.1.9 30.1.10 30.1.11 30.1.12 30.1.13 30.1.14 30.1.15 30.1.16
Testing with the Variable Table ................................................................... 30-1 How to Create and Open a Variable Table .................................................. 30-1 Selecting the Monitor Format ...................................................................... 30-2 Displaying and Hiding Columns in Variable Tables...................................... 30-3 Cutting Selected Areas to the Clipboard...................................................... 30-4 Pasting Areas from the Clipboard into the Variable Table ........................... 30-4 Copying Selected Areas to the Clipboard .................................................... 30-4 Copying from the Symbol Table to the Variable Table ................................ 30-4 Inserting a Contiguous Address Area in a Variable Table ............................ 30-5 Monitoring Variables with a Defined Trigger ................................................ 30-5 Monitoring Variables Once and Immediately ............................................... 30-6 Modifying Variables with a Defined Trigger ................................................. 30-6 Modifying Variables Once and Immediately ................................................ 30-7 Modify: Initialize CPU in STOP Mode with Preset Values............................ 30-7 Modifying the Peripheral Outputs when the CPU is in STOP Mode ............. 30-8 Displaying the Force Values Window .......................................................... 30-9 Setting Up a Force Job ............................................................................... 30-9
xx
Contents
30.1.17 30.2 30.2.1 30.2.2 30.2.3 30.2.4 30.2.5 30.2.6 30.3 30.3.1 30.3.2 30.3.3 30.3.4 31
Deleting a Force Job ................................................................................... 30-9 How to Test in Program Status.................................................................. 30-10 Opening the Block Online ......................................................................... 30-10 Setting the Display for Program Status...................................................... 30-11 Setting the Call Environment for a Block................................................... 30-12 Setting the Mode for the Test .................................................................... 30-13 Modifying Variables in Program Status...................................................... 30-14 Activating and Deactivating the Test using Program Status....................... 30-14 Steps for Testing using Breakpoints .......................................................... 30-15 Testing using Breakpoints ......................................................................... 30-15 Searching and Deleting Breakpoints.......................................................... 30-16 Testing in Single-Step Mode ..................................................................... 30-16 Stopping the Test using Breakpoints ......................................................... 30-17 31-1
Working with Diagnostics 31.1 31.2 31.2.1 31.2.2 31.3 31.3.1 31.3.2 31.3.3
Setting the Display (Quick View or Diagnostic View) ................................... 31-1 Calling the Module Information.................................................................... 31-2 Calling the Module Information for a Programmable Module ....................... 31-2 Calling the Module Information for Any Module ........................................... 31-3 Opening the Block for a Diagnostic Buffer or Stack Entry............................ 31-4 Opening the Block for a Diagnostic Buffer Entry.......................................... 31-4 Opening the Block from the B Stack List ..................................................... 31-5 Opening the Block from the I Stack List ...................................................... 31-5 32-1
32
How to Print and Archive 32.1 32.1.1 32.1.2 32.1.3 32.1.4 32.1.5 32.1.6 32.1.7 32.1.8 32.1.9 32.1.10 32.1.11 32.1.12 32.1.13 32.2 32.2.1 32.2.2 32.2.3 32.2.4 32.2.5
How to Print ................................................................................................ 32-1 Printing Blocks and STL Source Files ......................................................... 32-1 Printing Module Information ........................................................................ 32-2 Printing a Global Data Table ....................................................................... 32-2 Printing a Configuration Table..................................................................... 32-3 Printing Messages....................................................................................... 32-3 Printing User Text Lists ............................................................................... 32-4 Printing the Object Tree .............................................................................. 32-4 Printing Objects .......................................................................................... 32-4 Printing Object Lists .................................................................................... 32-5 Printing Reference Data.............................................................................. 32-6 Printing a Symbol Table.............................................................................. 32-6 Printing a Variable Table............................................................................. 32-7 Printing a Connection Table ........................................................................ 32-7 Archiving/Retrieving.................................................................................... 32-8 Setting Your Preferred Archive Program ..................................................... 32-8 Setting the Search Path for Archive Programs ............................................ 32-8 Setting the Default Target Directory ............................................................ 32-8 Archiving..................................................................................................... 32-9 Retrieving ................................................................................................... 32-9 33-1
33
How Several Users Edit the Same Project 33.1 33.2 33.3
Setting the Workstation Configuration ......................................................... 33-1 Merging Several S7 Programs into One ...................................................... 33-1 Copying S7 Programs with Message Attributes ........................................... 33-2
xxi
Contents
Appendix A.1 A.1.1 A.1.2 A.1.3 A.1.4 A.1.5 A.2 A.2.1 A.2.2 A.2.3 A.3 A.3.1 A.3.2 A.3.3 A.3.4 A.4 A.4.1 A.4.2 A.4.3 A.5 A.5.1 A.5.2 A.5.3 A.5.4 A.6 A.6.1 A.6.2 A.7 A.7.1 A.7.2 A.7.3 A.7.4
A-1
Operating Modes ..........................................................................................A-1 Operating Modes and Mode Transitions........................................................A-1 STOP Mode..................................................................................................A-4 STARTUP Mode ...........................................................................................A-5 RUN Mode..................................................................................................A-13 HOLD Mode................................................................................................A-14 Memory Areas of S7 CPUs .........................................................................A-15 Distribution of the Memory Areas ................................................................A-15 Load Memory and Work Memory ................................................................A-16 System Memory..........................................................................................A-19 Data Types and Parameter Types...............................................................A-31 Introduction to Data Types and Parameter Types........................................A-31 Elementary Data Types...............................................................................A-32 Complex Data Types ..................................................................................A-41 Parameter Types ........................................................................................A-52 Working with Older Projects........................................................................A-74 Converting Version 1 Projects.....................................................................A-74 Converting Version 2 Projects.....................................................................A-75 Notes on STEP 7 V.2.1 Projects with GD Communication...........................A-77 Sample Programs .......................................................................................A-78 Sample Projects and Sample Programs......................................................A-78 Sample Program for an Industrial Blending Process....................................A-80 Example for Handling Time-of-Day Interrupts .............................................A-99 Example for Handling Time-Delay Interrupts............................................. A-106 Accessing the Process Data Area and the Peripheral Data Area ............... A-118 Accessing the Process Data Area ............................................................. A-118 Accessing the Peripheral Data Area.......................................................... A-119 Setting the Operating Behavior ................................................................. A-122 Setting the Operating Behavior ................................................................. A-122 Changing the Behavior and Properties of Modules.................................... A-123 Using the Clock Functions......................................................................... A-125 Using Clock Memory and Timers .............................................................. A-126 Index-1
Index
xxii
3.1
Divide the process into tasks. Describe the individual areas. Define the safety requirements. Describe the required operator displays and controls. Create configuration diagrams of your programmable controller.
3-1
3.2
Agitator motor Inlet valve Feed pump Feed valve Flow sensor M Switch for tank level measurement
Ingredient A
Inlet valve
Feed pump
Ingredient B
3-2
Area: ingredient A
M M
Inlet valve
Feed pump
Feed valve
Flow sensor
Area: ingredient B
M M
Inlet valve
Feed pump
Feed valve
Area: drain
M Drain valve
As each group is divided into smaller tasks, the tasks required for controlling that part of the process become less complicated.
3-3
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.
Functional Area Equipment Used
Ingredient A
Feed pump for ingredient A Inlet valve for ingredient A Feed valve for ingredient A Flow sensor for ingredient A
Ingredient B
Feed pump for ingredient B Inlet valve for ingredient B Feed valve for ingredient B Flow sensor for ingredient B
3.3
The sample industrial blending process uses pumps, motors, and valves. These must be described precisely to identify the operating characteristics and type of interlocks required during operation. The following tables provide examples of the description of the equipment used in an industrial blending process. When you have completed description, you could also use it to order the required equipment.
Ingredients A/B: Feed Pump Motors
1. The feed pump motors convey ingredients A and B to the mixing tank. Flow rate: 400 l (100 gallons) per minute Rating: 100 kW (134 hp) at 1200 rpm 2. The pumps are 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. 3. The following conditions must be satisfied for the pumps to operate: The mixing tank is not full. The drain valve of the mixing tank is closed. The emergency off is not activated. 4. The pumps are switched off if the following condition is satisfied:
3-4
Ingredients A/B: Feed Pump Motors The flow sensor signals no flow 7 seconds after the pump motor is started. The flow sensor signals that the flow has ceased.
1. The inlet and feed valves for ingredients A and B allow or prevent the flow of the ingredients into the mixing tank. The valves have a solenoid with a spring return. When the solenoid is activated, the valve is opened. When the solenoid is deactivated, the valve is closed. 2. The inlet and feed valves are controlled by the user program. 3. For the valves to be activated, the following condition must be satisfied: The feed pump motor has been running for at least 1 second. 4. The pumps are switched off if the following condition is satisfied: The flow sensor signals no flow.
Agitator Motor
1. The agitator motor mixes ingredient A with ingredient B in the mixing tank. Rating: 100 kW (134 hp) at 1200 rpm 2. 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. 3. 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. 4. 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
1. 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. 2. The outlet valve is controlled (open/close) from an operator station. 3. 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. 4. The pumps are switched off if the following condition is satisfied: The tank level sensor is indicating "Tank empty."
3-5
1. The switches in the mixing tank indicate the level in the tank and are used to interlock the feed pumps and the agitator motor.
3.4
Output n
In/out n
3.5
3-6
I/O Diagram of the Agitator Motor "Motor Block" Start Stop Response Reset_Maint Timer_No Response_Time Motor Fault Start_Dsp Stop_Dsp Maint
Motor
3.6
Valve
Valve
3-7
3.7
3-8
3.8
Ingr. A start
Ingr. B start
Start agitator
Tank full
Open drain
Ingr. A stop
Ingr. B stop
Stop agitator
Close drain
Reset maintenance
Maint. pump A
Maint. pump B
Maint. agitator
Tank empty
EMERGENCY STOP
3-9
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.
3.9
The following figure illustrates an example of an S7 configuration for the industrial blending process.
S7-300 CPU
3-10
4.1
Programs in a CPU
In a CPU, two different programs are always executing: The operating system The user program.
Operating System
Every CPU has an operating system that organizes all the functions and sequences of the CPU that are not associated with a specific control task. The tasks of the operating system include the following: Handling a warm restart and hot restart Updating the process image table of the inputs and outputting the process image table of the outputs Calling the user program Detecting interrupts and calling the interrupt OBs Detecting and dealing with errors Managing the memory areas Communicating with programming devices and other communications partners
If you change operating system parameters (the operating system default settings), you can influence the activities of the CPU in certain areas.
4-1
User Program
You yourself must create the user program and download it to the CPU. This contains all the functions required to process your specific automation task. The tasks of the user program include the following: Specifying the conditions for a warm restart and hot restart on the CPU (for example, initializing signals with a particular value) Processing process data (for example, logically combining binary signals, reading in and evaluating analog signals, specifying binary signals for output, outputting analog values) Specifying the reaction to interrupts Handling disturbances in the normal running of the program
4.2
The example of an industrial blending process illustrated the advantages of breaking down an automation process into individual tasks. The program sections of a structured user program correspond to these individual tasks and are known as the blocks of a program.
4-2
Block Types
There are several different types of blocks you can use within an S7 user program:
Block Brief Description of Function See Also
Organization blocks (OB) System function blocks (SFB) and system functions (SFC) Function blocks (FB) Functions (FC) Instance data blocks (instance DB) Data blocks (DB)
OBs determine the structure of the user program. SFBs and SFCs are integrated in the S7 CPU and allow you access to some important system functions. FBs are blocks with a "memory" which you can program yourself.
Organization Blocks and Program Structure System Function Blocks (SFB) and System Functions (SFC) Function Blocks (FB)
FCs contain program routines for frequently Functions (FC) used functions. Instance DBs are associated with the block when an FB/SFB is called. They are created automatically during compilation. Instance Data Blocks
DBs are data areas for storing user data. In Shared Data Blocks (DB) addition to the data that are assigned to a function block, shared data can also be defined and used by any blocks.
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.
4-3
blocks assigned to them. Not all listed organization blocks and their priority classes are available in all S7 CPUs (see "S7-300 Programmable Controller, Hardware and Installation Manual" and "S7-400, M7-400 Programmable Controllers Module Specifications Reference Manual").
Type of Interrupt Organization Block Priority Class (Default) See Also
1 2
Organization Block for Cyclic Program Processing (OB1) Time-of-Day Interrupt Organization Blocks (OB10 to OB17) Time-Delay Interrupt Organization Blocks (OB20 to OB23)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 25 28
Cyclic interrupts
Hardware interrupts
Multicomputing OB60 Multicomputing interrupt Redundancy errors OB70 I/O Redundancy Error (only in H systems) OB72 CPU Redundancy Error (only in H systems)
Multicomputing - Synchronous Operation of Several CPUs "Error Handling Organization Blocks (OB70 to OB87 / OB121 to OB122)"
Asynchronous
26
4-4
Organization Block
See Also
OB81 Power Supply Error OB82 Diagnostic Interrupt OB83 Insert/Remove Module Interrupt OB84 CPU Hardware Fault OB85 Priority Class Error OB86 Rack Failure OB87 Communication Error
Blocks (OB70 to OB87 / OB121 (or 28 if the to OB122) asynchronous error OB exists in the startup program)
OB90 OB100 Warm Restart OB101 Hot Restart OB102 Cold Restart
29 1) 27 27 27
Synchronous errors
Priority of the OB Error Handling Organization that caused the Blocks (OB70 to OB87 / OB121 error to OB122)
1)The priority class 29 corresponds to priority 0.29. The background cycle has a lower priority than the free cycle.
4-5
The following priority classes are permitted: Priority classes 2 to 23 for OB10 to OB47 Priority classes 2 to 28 for OB70 to OB72 Priority classes 24 to 26 for OB81 to OB87
You can assign the same priority to several OBs. OBs with the same priority are processed in the order in which their start events occur. Error OBs started by synchronous errors are executed in the same priority class as the block being executed when the error occurred.
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.
By deselecting interrupt OBs that you do not require, you increase the amount of local data area available, and this can be used to save temporary data in other priority classes.
4-6
User program
Cycle
Main program
4-7
User program
Cycle <Interrupt>
<Error>
Interruption
Error handling
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.
4-8
Linear programming
Structured programming
Main program = OB 1
Main program
OB 1 FB 1
FC 1
4-9
Start of cycle
Nesting depth
OB 1 Operating system
FB 1 Instance DB 1
FC 1
FB 2 Instance DB 2
FB 1 Instance DB 1
SFC 1
DB 1 FC 1
There is a set order for creating blocks: You create the blocks from top to bottom, so you start with the top row of blocks. Every block that is called must already exist, meaning that within a row of blocks the order for creating them is from right to left. The last block to be created is OB1.
Putting these rules into practise 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 (see also Local Data Stack).
4-10
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.
Calling block (OB, FB, FC) Program execution Instruction that calls another block
Program execution
Block end
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 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.
4-11
4.2.4 Block Types and Cyclic Program Processing 4.2.4.1 Organization Block for Cyclic Program Processing (OB1)
Cyclic program processing is the normal" type of program execution on programmable logic controllers. The operating system calls OB1 cyclically and with this call it starts cyclic execution of the user program.
1. 2.
The CPU reads the state of the inputs of the The CPU writes the values from the process input modules and updates the process image table of the outputs to the output modules. image table of the inputs. The CPU processes the user program and executes the instructions contained in the program. The CPU reads the state of the inputs of the input modules and updates the process image table of the inputs.
3.
4.
The CPU writes the values from the process The CPU processes the user program and image table of the outputs to the output executes the instructions contained in the modules. program. At the end of a cycle, the operating system executes any tasks that are pending, for example downloading and deleting blocks, receiving and sending global data. At the end of a cycle, the operating system executes any tasks that are pending, for example downloading and deleting blocks, receiving and sending global data..
5.
6.
Finally, the CPU returns to the start of the Finally, the CPU returns to the start of the cycle cycle and restarts the cycle monitoring time. and restarts the cycle monitoring time.
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.
4-12
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
OB10
OB1
OB1
OB1
4-13
OB10
OB1
OB1
OB1
4-14
The following figures show the function of the cycle monitoring time in program processing in the existing and new CPUs.
Next cycle
Tmin TC Twait
PC16
PC07
PC29
OB90
OB90
OB90
= Maximum cycle time that can be set = Minimum cycle time that can be set = Actual scan cycle time = Difference between Tmin and actual scan cycle time. In this time, occurred interrupts and the background OB can be processed = Priority class
4-15
Next cycle
Tmin TC Twart
PC16
PC07
Updating of the Updating of the process image process image OB1 PC01 output table input table
OB1
PC29
OB90
OB90
OB90
= Maximum cycle time that can be set = Minimum cycle time that can be set = Actual scan cycle time = Difference between Tmin and actual cycle time. In this time, occurred interrupts and and the background OB can be processed = Priority class
4-16
Communication Load
To prevent communication functions extending the time required for program execution too much, you can specify the maximum amount by which the cycle can be extended by communication. When you decide on the load added to the cycle by communication, remember that the operating system execution time further extends the run time. If you set a communication load of 50%, this does not double the original run time but more than doubles it, the further increase depending on the CPU being used. This is illustrated by an example based on a worst case situation. Case 1: The operating system execution time is 250 ms per second cycle time. The user program has a run time of 750 ms. The load on the cycle caused by communication, test functions, and setup functions is 0%.
0
Ops. 250 ms Usp. 750 ms
1
Ops. 250 ms Usp. 750 ms
2
Ops. 250 ms Usp. 750 ms
3
t s
Total scan cycle time = 1000 ms Ops. = Run-time load due to operating system Usp. = Run-time load due to user program
Case 2: The operating system execution time continues to be 250 ms per second cycle time. The user program continues to run for 750 ms. The cycle load due to communication, test functions, and setup functions is now set to 50%.
4-17
0
Ops. Comm. 250 ms 500 ms
1
Usp. Ops. Comm. 250 ms 250 ms 500 ms
2
Usp. Ops. Comm. 250 ms 250 ms 500 ms
3
Usp. 250 ms t s
Ops. = Run-time load due to operating system Comm. = Run-time load due to communication Usp. = Run-time load due to user program
The run-time load due to communication is therefore 1500 ms per cycle. In this example, setting the communication load to 50% extends the cycle time from 1 second to 3 seconds, in other words, the total cycle time is tripled. The communication load must be taken into account when setting the minimum cycle time otherwise time errors will occur.
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).
4-18
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.
4-19
The following figure shows the formal parameters of an FB that uses the actual parameters saved in the instance DB.
Formal parameter Start INT IN Speed INT IN History DT IN_OUT Run_time TIME IN_OUT
Actual parameter Integer (16 bits): start Integer (16 bits): speed Date and time (48 bits): pointer to the address of the history
When you specify actual parameters in the call statement: the instructions of the FB use the actual parameters provided. When you do not specify actual parameters in the call statement: the instructions of the FB use the value saved in the instance DB.
4-20
The following table shows which variables of the FB must be assigned actual parameters.
Data Type Variable Elementary Data Type Complex Data Type Parameter Type
Initial value permitted Initial value permitted Initial value permitted Initial value permitted
4-21
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.
DB201:Motor_1
FB22:Motors
DB202:Motor_2
Call FB22,DB202 uses data for motor 2 Call FB22,DB203 uses data for motor 3
DB203:Motor_3
4-22
FB21:Motor processing Variable declaration: stat, Motor_1, FB 22 stat, Motor_2, FB 22 stat, Motor_3, FB 22
DB100 Data for Motor_1 Data for Motor_2 Data for Motor_3
Call FB 21 from a logic block: CALL FB21,DB100 transfers data for Motor_1, Motor_2, Motor_3 Call FB 22 from FB 21: CALL Motor_1 CALL Motor_2 CALL Motor_3
FB22:Motors
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.
4-23
In the example in this figure, the assigned instance data are stored in a common instance DB.
FB12:Motor
DB12:Motor
FB13:Pump
DB13:Pump
Access only for FB 13, call: CALL FB13, DB13 Access for FB 14, FB 13 and FB 12, call: CALL FB14,DB14 Transfers data for agitator, Motor_10 and Pump_10 Call FB 12 from FB 14: CALL Motor_10 Call FB 13 from FB 14: CALL Pump_1
DB14 Data for agitator Data for Motor_10 Data for Pump_10
4-24
A shared DB and an instance DB can be opened at the same time. The following figure shows the different methods of access to data blocks.
FB12
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).
4-25
System Functions
A system function is a preprogrammed, tested 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 run-time meters Transferring data sets Transferring events from a CPU to all other CPUs in multicomputing mode Handling time-of-day and time-delay 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 non-configured connections Generating block-related 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, M7-400 Programmable Controllers Module Specifications Reference Manual" explain which SFBs and SFCs are available.
4-26
4.2.5 Organization Blocks for Interrupt-Driven Program Processing 4.2.5.1 Organization Blocks for Interrupt-Driven Program Processing
By providing interrupt OBs, the S7 CPUs allow the following: Program sections can be executed at certain times or intervals (time-driven) Your program can react to external signals from the process.
The cyclic user program does not need to query whether or not interrupt events have occurred. If an interrupt does occur, the operating system makes sure that the user program in the interrupt OB is executed so that there is a programmed reaction to the interrupt by the programmable logic controller.
Calculation of the total flow into a blending process at the end of a shift Controlling a fan that must continue to run for 20 seconds after a motor is switched off Scanning a signal level for a closed-loop control system Signaling that the maximum level of a tank has been reached
4-27
asynchronous error handling is executed (OB80, see Error Handling Organization Blocks (OB70 to OB87 / OB121 to OB122)). Periodic time-of-day interrupts must correspond to a real date. Repeating an OB10 monthly starting on January 31st is not possible. In this case, the OB would only be started in the months that have 31 days. A time-of-day interrupt activated during startup (warm restart or hot restart) is only executed after the startup is completed. Time-of-day interrupt OBs that are deselected by the parameter assignment cannot be started. The CPU recognizes a programming error and changes to STOP mode. Following a warm restart, time-of-day interrupts must be set again (for example, using SFC30 ACT_TINT in the startup program).
4-28
If the time was moved ahead and one or more time-of-day interrupts were skipped,
OB80 is started and the time-of-day interrupts that were skipped are entered in the start information of OB80.
You have not deactivated the skipped time-of-day interrupts in OB80, You have not deactivated the skipped time-of-day interrupts in OB80, By moving the time back, the start events for the time-of-day interrupts occur again,
the skipped time-of-day interrupts are no longer executed. the first skipped time-of-day interrupt is executed, the other skipped time-of-day interrupts are ignored. the execution of the time-of-day interrupt is not repeated.
4-29
4-30
The following figure shows how a cyclic interrupt OB with phase offset (OB37) is executed in contrast to a cyclic interrupt without phase offset (OB38).
Clock pulse:
OB 38
(n=8, m=0)
OB 37
(n=16, m=5)
0 8 16 16 + 5 24 32 32 + 5 40 48 48 +5
t [ms]
7 8 9 10 11 12 13 14 15
4-31
Using STEP 7, you activate the generation of hardware interrupts on the function blocks. You assign the remaining parameters in the parameter assignment dialogs of these function modules.
4-32
Startup Types
There are three distinct types of startup: Hot restart (not in S7-300 and S7-400H) Warm restart Cold restart
The following table shows which OB the operating system calls in each startup type.
Startup Type Related OB
Depending on the start event, the CPU used, and its set parameters the relevant startup OB (OB100, OB101, or OB102) is called.
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 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. Time-driven or interrupt-driven execution is not possible in the startup program. During the startup, all digital outputs have the signal state 0.
4-33
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 following which a hot restart is permitted.
Once the monitoring times expire, the CPU either changes to STOP and only a warm restart is possible.
4-34
Next cycle
OB1
OB90
OB90
t TC Tmin
TZ Tmin Twait = the actual cycle time required for a main program cycle = the minimum cycle time specified with STEP 7 = the time available before the start of the next cycle
Twait
4-35
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).
4-36
The following figure shows the types of errors that can occur, divided up into the categories of the error OBs.
Synchronous Errors
Error OB OB 70 OB 72 OB 80 OB 81 OB 82 OB 83 OB 84 OB 85 OB 86 OB 87 I/O redundancy error (only in H CPUs) CPU redundancy error (only in H CPUs, e.g. CPU failure) Time error (e.g.: cycle time exceeded) Power supply error (e.g.: battery problem) Diagnostic interrupt (e.g.: short circuit in an input module) Insert/remove module interrupt (e.g. an input module has been removed) CPU hardware fault (fault on the interface to the MPI network) Priority class error (e.g.: OB is not loaded) Rack failure Communication error (e.g.: wrong identifier in global data communication)
Error OB OB 121 Programming error (e.g.: DB is not loaded) OB 122 I/O access error (e.g.: accessing an I/O module that does not exist)
4-37
SFC36 MSK_FLT
Masks individual synchronous errors. Masked errors do not start an error OB and do not trigger programmed reactions Unmasks synchronous errors Disables all interrupts and asynchronous errors. Disabled errors do not start an error OB in any of the subsequent CPU cycles and do not trigger programmed reactions Enables interrupts and asynchronous errors Delays higher priority interrupts and asynchronous errors until the end of the OB Enables higher priority interrupts and asynchronous errors
Note If you want interrupts to be ignored, it is more effective to disable them using a SFC, rather than to download an empty OB (with the contents BE).
4-38
5.1
Starting STEP 7
Note You will find more information about standard Windows operation and options in your Windows users guide or in the Windows 95/98/NT online help.
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.
5-1
You can work with the SIMATIC Manager in one of two ways: Offline, without a programmable controller connected Online, with a programmable controller connected
On calling s7tgtopx.exe, you can specify the following start parameters: /e <complete physical project path> /o <logical path of the object, on which you want to position> /h <ObjectID> /onl or /off The easiest way to establish suitable parameters is described below.
5-2
Example of Parameters:
/e F:\SIEMENS\STEP7\S7proj\MyConfig\MyConfig.s7p /o 1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1 /h T00112001;129;T00116001;1;T00116101;16e
The complete logical path is constructed as follows: [View ID,online ID]:project name\{object name\}*\ object name Example: /o 1.8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1
5-3
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 Context-Sensitive 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 starting 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.
5-4
The last three of these ways of accessing the online help are known as context-sensitive help.
5.2
5-5
Project Object Station Object Programmable Module Object S7/M7 Program Object Source File Folder Object Block Folder Object
Objects have the following functions: Carriers of object properties, Folders, Carriers of functions (for example, to start a particular application).
Note If you want to change the settings for an object in the programming device (such as the parameters for a module), these are not initially active on the programmable controller. For this to happen, the system data blocks in which these settings are stored first have to be downloaded to the programmable controller. If you download a complete user program, the system data blocks are downloaded automatically as part of this process. If you make changes to the settings after you downloaded a progra m, you can reload the system data" object to update the settings on the programmable controller.
Objects as Folders
A folder (directory) can contain other folders or objects. These are displayed when you open the folder.
5-6
Note We strongly recommend you edit the folders only with STEP 7 as they may be physically structured differently from the layout you see in the SIMATIC Manager.
Project Object Station Object Programmable Module Object S7/M7 Program Object Source File Folder Object Block Folder Object
5-7
Symbol
Selection of Important Functions Creating a Project Archiving Projects and Libraries Printing Project Documentation Rearranging Translating and Editing User Texts Inserting Operator Station Objects More than One User Editing Projects Converting Version 1 Projects Converting Version 2 Projects Setting the PG/PC Interface
Symbol
Objects in the Project Level Station: SIMATIC 300 station SIMATIC 400 station S7 program
Inserting Stations Stations are both objects (project level) and object folder (station level). Other functions can be found under Station Object Inserting an S7/M7 Program S7/M7 programs are both objects (project level) and object folders (program level). Other functions can be found under S7/M7 Program Object Properties of Subnets and Communication Nodes Overview: Global Data Communication Procedure for Configuring Global Data Communication
M7 program
Network for starting the tool for network configuration and setting the network properties.
5-8
Library Object S7/M7 Program Object Source File Folder Object Block Folder Object
Symbol
Object Folder
Library
Overview of the Standard Libraries Working with Libraries Archiving Projects and Libraries
Selection of Important Functions
Symbol
Inserting an S7/M7 Program S7/M7 programs are both objects (project level) and object folders (program level). Other functions can be found under S7/M7 Program Object
5-9
Project Object Station Object Programmable Module Object S7/M7 Program Object Source File Folder Object Block Folder Object
Symbol
Object Folder
Station
Inserting a Station Uploading a Station Downloading a Configuration to a Programmable Controller Uploading a Configuration from a Station Displaying CPU Messages and User-Defined Diagnostic Messages Diagnosing Hardware and Displaying Module Information Displaying and Changing the Operating Mode Displaying and Setting the Time and Date Erasing the Load/Work Memory and Resetting the CPU Creating and Assigning Parameters to SIMATIC PC Stations Configuring Connections for a SIMATIC PC Station
SIMATIC PC station
5-10
Symbol
Hardware
Basic Procedure for Configuring Hardware Basic Steps for Configuring a Station Overview: Procedure for Configuring and Assigning Parameters to a Central Structure Basic Procedure for Configuring a DP Master System Configuring Multicomputing Operation Programmable modules are both objects (station level) and object folders ("Programmable Modules" level). Other functions can be found under Programmable Module Object
Programmable module
Project Object Station Object Programmable Module Object S7/M7 Program Object Source File Folder Object Block Folder Object
5-11
Symbol
Object Folder
Programmable module
Overview: Procedure for Configuring and Assigning Parameters to a Central Structure Displaying CPU Messages and User-Defined Diagnostic Messages Diagnosing Hardware and Displaying Module Information Downloading via EPROM Memory Cards Password Protection for Access to Programmable Controllers Displaying the Force Values Window Displaying and Changing the Operating Mode Displaying and Setting the Time and Date Setting the Operating Behavior Erasing the Load/Work Memory and Resetting the CPU Diagnostics Symbols in the Online View Division of the Memory Areas Saving Downloaded Blocks on Integrated EPROM
Symbol
Inserting an S7/M7 Program S7/M7 programs are both objects (project level) and object folders (program level). Other functions can be found under S7/M7 Program Object
Networking Stations within a Project Connection Types and Connection Partners What You Should Know About the Different Connection Types Entering a New Connection Configuring Connections for Modules in a SIMATIC Station
5-12
Project Object Station Object Programmable Module Object S7/M7 Program Object Source File Folder Object Block Folder Object
Symbol
Selection of Important Functions Basic Procedure for Creating Logic Blocks Assigning Message Numbers Creating User-Defined Diagnostic Messages Translating and Editing User Texts Displaying CPU Messages and User-Defined Diagnostic Messages Program Measures for Handling Errors Procedure for M7 Systems Creating the Software in the Project (General)
M7 program Program
5-13
Symbol
Absolute and Symbolic Addressing Structure and Components of the Symbol Table Entering Shared Symbols General Tips on Entering Symbols Assigning and Editing Symbol-Related Messages Translating and Editing User Texts Configuring Operator Control and Monitoring Attributes via the Symbol Table Editing the Communication Attribute Exporting and Importing Symbol Tables Source files can be both objects (program level) and object folders (source file level). Other functions can be found under Source File Folder Object Other functions can be found under Block Folder Object
Source file
Block folder
Project Object Station Object Programmable Module Object S7/M7 Program Object Source File Folder Object Block Folder Object
5-14
Symbol
Selection of Important Functions Downloading with Project Management Downloading without Project Management Overview of the Available Reference Data Rewiring Comparing Blocks Translating and Editing User Texts Jumps to Language Descriptions and Help on Blocks and System Attributes Selection of Important Functions
Symbol
Basic Procedure for Creating Logic Blocks Creating Blocks Basic Information on Programming in STL Source Files
Comparing Blocks Organizati Additional Functions: on Block Introduction to Data Types and Parameter Types (OB) Requirements for Downloading
Function (FC)
Testing using Program Status What You Should Know About Testing in Single-Step Mode/Breakpoints Rewiring Help on Blocks Introduction to Data Types and Parameter Types Requirements for Downloading Testing using Program Status What You Should Know About Testing in Single-Step Mode/Breakpoints Rewiring
Additional Functions:
Attributes for Blocks and Parameters Function Additional Functions: Block (FB) Introduction to Data Types and Parameter Types Using Multiple Instances Requirements for Downloading Testing using Program Status What You Should Know About Testing in Single-Step Mode/Breakpoints Rewiring Attributes for Blocks and Parameters Assigning and Editing Block-Related Messages
5-15
Symbol
Objects in the Block Folder User Defined Data Type (UDT) Data Block (DB) System Function (SFC) System Function Block (SFB) Variable Table (VAT)
PCS7 Message Configuration Translating and Editing User Texts Assigning System Attributes to Function Block Parameters Creating Blocks Basic Information on Programming in STL Source Files Introduction to Data Types and Parameter Types Using User-Defined Data Types to Access Data Attributes for Blocks and Parameters Data View of Data Blocks Declaration View of Data Blocks Requirements for Downloading Using Multiple Instances Program Status of Data Blocks Introduction to Data Types and Parameter Types Using Multiple Instances Attributes for Blocks and Parameters Assigning and Editing Block-Related Messages (Instance Data Blocks Only) PCS7 Message Configuration (Instance Data Blocks Only) Translating and Editing User Texts (Only Instance Data Blocks) Requirements for Downloading Attributes for Blocks and Parameters Help on Blocks Requirements for Downloading Attributes for Blocks and Parameters PCS7 Message Configuration Translating and Editing User Texts Help on Blocks Basic Procedure when Monitoring and Modifying with the Variable Table Introduction to Testing with the Variable Table Introduction to Monitoring Variables Introduction to Modifying Variables Introduction to Forcing Variables
System data blocks (SDBs) are only edited indirectly via functions: Introduction to Configuring Hardware Properties of Subnets and Communication Nodes Overview: Global Data Communication Assigning and Editing Symbol-Related Messages
5-16
Symbol
Project Object Station Object Programmable Module Object S7/M7 Program Object Source File Folder Object Block Folder Object
Symbol
Object Folder
Basic Information on Programming in STL Source Files Creating STL Source Files Inserting Block Templates in STL Source Files Inserting Source Code from Existing Blocks in STL Source Files Checking Consistency in STL Source Files Compiling STL Source Files Generating STL Source Files from Blocks Exporting Source Files Creating Network Templates
5-17
The S7/M7 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.
5-18
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.
5.3
5-19
Read On...
The following pages describe some of the basic actions used to edit objects. Take the time now to read up on these basic handling steps, as they will not be described in detail further on in the manual.
Close
File
Options
Window
Help
Status bar
Toolbar
The toolbar contains icons (or tool buttons) which provide shortcuts to frequently used and currently available menu bar commands via 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 context-dependent information.
5-20
Search/Replace
Search For: Q1.0 Whole Word/Cell only Match case Replace With: Q2.0
Option boxes to select one of a number of choices Check boxes to select one or more choices
Search
Only Search In
From Cursor Down From Cursor Up Whole Table Selection Search in Column
All
Buttons
Search
Replace
Replace All
Cancel
Help
5-21
No. 1 2
The names of the tabbed pages are shown on tabs along the top edge of the dialog box. To bring a particular tabbed page to the foreground, you simply click on its tab.
5-22
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.
5-23
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.
5-24
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. You will find a step-by-step guide to copying under Copying Objects.
Renaming Objects
The SIMATIC Manager assigns standard names to 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 projects) 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 and using "C for M7" (Borland compiler).
5-25
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 object properties: Select the required object and select the menu command Edit > Object Properties. Change the name in the dialog box. When you close the properties dialog box, the object is renamed and displayed under its new 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 (SDB) in the online view System functions (SFC) and system function blocks (SFB) in the online view
5-26
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. Default Sort Order When you re-open a project, the objects in the detailed view are displayed according to a default sort order. Examples: Blocks are shown in the order "OB, SDB, FB, FC, DB, UDT, VAT, SFB, SFC." In a project, all stations are shown first and then the S7 programs.
The default is not therefore an alphanumeric ascending or descending sort order in the detailed view. Restoring the Default Sort Order After resorting, for example, by clicking on the column header "Object Name," you can restore the default order if you proceed as follows: Click the column header "Type" in the detailed view. Close the project and open it again.
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 (SDB) in the online view System functions (SFC) and system function blocks (SFB) in the online view
5-27
Open
Entry Point: Project Name: example Project View: Standard Hierarchy Storage Path: C:\SIEMENS\STEP7\E Browse... Online Offline
example
Project view: The hierarchical tree structure of the objects which can contain other objects is displayed here.
Object Name: Object Type: All editable
Plant view: the content of the object selected in the left half of the window is displayed here.
OK
Cancel
Help
Name: The recognized objects of the type specified under Entry Point are desplayed here in a list box. You can select a name from the list ore enter a name using the keyboard.
Object Type: You can enter a filter criterion here to filter the list, restricting the number of objects displayed to give you a clearer overview. Object Name: If you select an object, the object name is entered here. You can also enter the required name directly.
5-28
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 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.
5-29
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.
5-30
5.4
Keyboard Control
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 ALT, W, A, C
5-31
New Open Close Compile Print Exit Copy Cut Paste Delete Select All Open Object Download Update
(File Menu) (File Menu) (File Menu) (File Menu) (Object) (File Menu) (File Menu) (Edit Menu) (Edit Menu) (Edit Menu) (Edit Menu) (Edit Menu) (Edit Menu) (PLC Menu) (View Menu)
CTRL+N CTRL+O CTRL+B CTRL+P ALT+F4 CTRL+C CTRL+X CTRL+V DEL CTRL+A ALT+RETURN CTRL+ALT+O CTRL+L CTRL+I F5 CTRL+F5 CTRL+ALT+E CTRL+ALT+R SHIFT+F5 SHIFT+F2 SHIFT+F3 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.)
Operating Mode (PLC Menu) Updates the status display of the visible CPUs in the online view Customize Reference Data, Display Arrange, Cascade Arrange, Horizontally Arrange, Vertically Context-Sensitive Help (Options Menu) (Options Menu) (Window Menu) (Window Menu) (Window Menu) (Help Menu)
5-32
To
move to the menu bar move to the pop-up menu move to the menu that contains the letter or number underlined which you typed in F10 SHIFT+F10
Press
select the menu command whose Underlined character in the menu command underlined letter or number corresponds to the letter you have typed move one menu command to the left move one menu command to the right move one menu command up move one menu command down activate the selected menu command LEFT ARROW RIGHT ARROW UP ARROW DOWN ARROW ENTER
deselect the menu name or close the open ESC menu and return to the text
5-33
5-34
5-35
5-36
6.1
Project Structure
Projects are used to store the data and programs which are created when you put together an automation solution. The data collected together in a project include: Configuration data on the hardware structure and parameters for modules, Configuration data for communication in networks, and Programs for programmable modules.
The main task when you create a project is preparing these data for programming.
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 95 Explorer. Only the object icons have a different appearance. The top end of the project hierarchy is structured as follows: 1. Level: Project 2. Level: Subnets, stations, or S7/M7 programs 3. Level: depends on the object in level 2.
6-1
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 or M7 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.
6-2
6.2
Setting Up a Project
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.
6-3
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.
6-4
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.
6-5
Next Steps
Once you have created the hardware configuration, you can create the software for your programmable modules (see also Inserting a S7/M7 Program).
6-6
Existing Components
An S7/M7 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
The following objects already exist in a newly created M7 program: Symbol table (Symbols" object) "Blocks" folder
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, user-defined data type (UDT), function, function block, organization block, or variable table (VAT)). 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.
6-7
6-8
6.3
Editing a Project
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.
6-9
6-10
Defining Symbols
7.1
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).
7-1
Defining Symbols
FB34 - <Offline>
FB1003 : Interrupt Trigger Network 1 : ??? U "Sensor1" "I1.0 Temperature overrange" UN "Switch2" "I1.2 Fault acknowledgment" = "Lighton" "Q4.0 Interrupt signal"
When you print out a block, the current screen representation with statement comments or symbol comments is printed.
7.2
7-2
Defining Symbols
Validity
Is valid in the whole user program, Can be used by all blocks, Has the same meaning in all blocks, Must be unique in the whole user program. Letters, numbers, special characters, Accents other than 0x00, 0xFF, and quotation marks, The symbol must be placed within quotation marks if you use special characters.
Only known to the block in which it was defined, The same symbol can be used in different blocks for different purposes. Letters, Numbers, Underscore (_).
Permitted characters
Use
You can define local symbols for: Block parameters (input, output, and in/out parameters), Static data of a block, Temporary data of a block.
Defined where?
Symbol table
7-3
Defining Symbols
7.3
You do not have to enter the quotation marks or the "#". When you enter your program in Ladder, FBD, or STL the syntax check adds these characters automatically. If you are concerned that there may be some confusion because, for example, the same symbols are used in both the symbol table and the variable declaration, you must code the shared symbol explicitly when you want to use it. Any symbols without the respective coding are interpreted as block-specific (local) variables in this case. Coding shared symbols is also necessary if the symbol contains blanks. When programming in an STL source file the same special characters and guidelines for their use apply. Code characters are not added automatically in freeedit mode, but they are still necessary if you wish to avoid confusion.
Note Using the menu command View > Display > Symbolic Representation you can toggle the display between the declared shared symbolic and the absolute addresses.
7.4
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).
7-4
Defining Symbols
Symbol Editor - Project/SIMATIC300 Station(1)/CPU314(1)/.../Symbols Table Edit Insert View Window Help
O/M/C Columns
The columns O/M/C shows whether a symbol was assigned special object properties: O means that the symbol can be operated and monitored with WinCC. M means that a symbol-related message (SCAN) was assigned to the symbol. C means that the symbol is assigned communication properties (can only be selected with NCM).
Symbol
The symbolic name must not be longer than 24 characters. A symbol table can contain a maximum of 16380 symbols. 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
An address is the abbreviation for a particular memory area and memory location. Example: Input I 12.1 The syntax of the address is checked as it is entered. A check is also made to see whether the address may be assigned the specified data type.
7-5
Defining Symbols
Data Type
You can choose between a number of data types available in STEP 7. The data type field already contains a default data type which you may change, if necessary. If the change you make is not suitable for the address and its syntax is incorrect, an error message appears as you exit the field.
Comment
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.
Converting to C Variables
You can select symbols in the symbol table for an M7 program and convert them to corresponding C variables in conjunction with the ProC/C++ software option.
I IB IW ID Q QB QW QD M MB MW MD PIB
E EB EW ED A AB AW AD M MB MW MD PEB
Input bit Input byte Input word Input double word Output bit Output byte Output word Output double word Memory bit Memory byte Memory word Memory double word Peripheral input byte
BOOL BYTE, CHAR WORD, INT, S5TIME DWORD, DINT, REAL, TOD, TIME BOOL BYTE, CHAR WORD, INT, S5TIME DWORD, DINT, REAL, TOD, TIME BOOL BYTE, CHAR WORD, INT, S5TIME DWORD, DINT, REAL, TOD, TIME BYTE, CHAR
0.0 to 65535.7 0 to 65535 0 to 65534 0 to 65532 0.0 to 65535.7 0 to 65535 0 to 65534 0 to 65532 0.0 to 65535.7 0 to 65535 0 to 65534 0 to 65532 0 to 65535
7-6
Defining Symbols
IEC
SIMATIC
Description
Data Type
Value Range
Peripheral output byte Peripheral input word Peripheral output word Peripheral input double word Peripheral output double word Timer Counter Function block Organization block Data block Function System function block System function Variable table User-defined data type
BYTE, CHAR WORD, INT, S5TIME WORD, INT, S5TIME DWORD, DINT, REAL, TOD, TIME DWORD, DINT, REAL, TOD, TIME TIMER COUNTER FB OB DB, FB, SFB, UDT FC SFB SFC UDT
0 to 65535 0 to 65534 0 to 65534 0 to 65532 0..65532 0 to 65535 0 to 65535 0 to 65535 1 to 65535 1 to 65535 0 to 65535 0 to 65535 0 to 65535 0 to 65535 0 to 65535
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. 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.
7-7
Defining Symbols
7.5
7-8
Defining Symbols
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. When you confirm the entry in this field or exit the field, a check is made as to whether the address entered is allowed. 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. You can enter comments here to briefly explain the functions of the symbols (max. 80 characters). Entering a comment is optional.
Comment
7-9
Defining Symbols
The symbol table for the active program is displayed in its own window. You can now create symbols or edit them. When you open a symbol table for the first time after it was created, it is empty.
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 which 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.
7-10
Defining Symbols
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 which the records must fulfil 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.
7-11
Defining Symbols
Example:
A saved block contains the statement "A Symbol_A" where Symbol_A is defined in the symbol table for the absolute value I 0.1. Now the symbol table is changed and the block opened once again. Setting address priority therefore has the following effect on this statement: Address Priority Changing the Assignment "Symbol_A = I 0.1" Symbol_A = I 0.2 Statement when Block Opened Explanation
A I 0.1
The absolute value I 0.1 is displayed in the statement because a symbol is no longer assigned to this address. The new symbol for the still valid absolute value I 0.1 is displayed in the statement. The statement remains the same. A message informing you of the changed symbol assignment is displayed. The statement is marked as incorrect (red text) because Symbol_A is no longer defined.
Symbol_B = I0.1
A Symbol_B
Symbol_A = I 0.2
A Symbol_A
Symbol
Symbol_B = I 0.1
A Symbol_A
7-12
Defining Symbols
7-13
Defining Symbols
Structure: Example:
Record length, delimiter comma, record 126,green_phase_ped. pedestrians 126,red_ped. Q T 0.0 2 BOOL TIMER Duration of green phase for Red for pedestrians
Structure:
Header
TABLE
0,1 "<Title>" VECTORS 0,<No. of records> "" TUPLES 0,<No. of columns> "" DATA 0,0 "" Data (per record) <type>,<numeric value> <String> V ID for the data type, numeric value Alphanumeric part or if the alphanumeric part is not used ID for the end of the header and start of the data Number of data fields in a record Comment string Number of records in the file
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.
7-14
Defining Symbols
Structure: Example:
Strings in quotation marks, parts separated by commas "green_phase_ped.","T "red_ped.","Q 2","TIMER","Duration of green phase for pedestrians" 0.0","BOOL","Red for pedestrians"
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.
Structure: Example:
TAB Address TAB Symbol TAB Comment CR T 2 green_phase_ped. Duration of green phase for pedestrians Q 0.0 red_ped. Red for pedestrians
TAB stands for the tabulator key (09H), CR stands for carriage return with the RETURN key (0DH).
7-15
Defining Symbols
7-16
8.1
Incremental Editors for the Programming Languages Ladder Logic, Function Block Diagram, Statement List, 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 each line or element has its syntax checked immediately as it is entered. Any errors are indicated and must be corrected before completing the entry. Syntactically correct entries are automatically compiled and stored in the user program. Any symbols use must be defined before editing the statements. If certain symbols are not available, the block cannot be compiled fully; this inconsistent interim version can, however, be saved.
Free-Edit (Text) Editors for the Programming Languages Statement List, S7 SCL, or S7 HiGraph
In free-edit mode editors, you create source files that are then subsequently compiled into blocks. You should choose to use free-edit mode to enter a program quickly. In free-edit mode the program or a block is edited in a text file and the text file is then compiled. The text files (source files) are stored in the source file folder of your S7 program, for example, as an STL source file or SCL source file. A source file can contain the code for one or more blocks. With the text editors for STL and SCL you can generate code for OBs, FBs, FCs, DBs, and UDTs (user-defined data types), but you can also create a whole user program. The whole program for a CPU (meaning all blocks) can be contained in one single text file.
8-1
When you compile the source file are the respective blocks created and stored in the user program. Any symbols used must be defined before compilation. Any errors are only reported by the respective compiler during compilation. For compilation it is important that the particular syntax for the programming language has been adhered to. A syntax check is run only when you select the consistency check command or when the source file is compiled into blocks.
8.2
8-2
By selecting a programming language, you also determine which type of input mode is permitted ().
Programming Language User Group Application Incremen tal Input FreeEdit Mode Block can be Documented Back from the CPU
Ladder Logic LAD Users who are Programming logic accustomed to controls working with circuit diagrams Function Block Diagram FBD Users who are familiar with the logic boxes of Boolean algebra Programming logic controls
Users who have Programming data programmed in processing tasks high-level languages such as PASCAL or C Users who want to work oriented on the technological functions without extensive programming or PLC experience Users who want to work oriented on the technological functions without extensive programming or PLC experience Users who want to work oriented on the technological functions without extensive programming or PLC experience Convenient description of sequential processes
Optional package
HiGraph
Optional package
CFC
Optional package
8-3
If blocks contain no errors, you can switch between representing your blocks in either Ladder Logic, Function Block Diagram, or Statement List. Program parts that cannot be displayed in the language you switch to are shown in Statement List. You can create blocks from source files in Statement List and also decompile them back into source files.
#Start #Coil
Network 1: #Stop
#Coil
#Coil
#Current_Time_bin #Reset_Time_BCD
#Stop_Lamp
The Ladder Logic programming language type is included with the STEP 7 standard software package. Creating programs in Ladder Logic is done with an incremental editor.
8-4
Network 1: Control drain valve A O O #Coil ) AN #Close = #Spule Network 2: Display "Valve open" A #Coil = #Disp_open Network 3: Display "Valve closed" AN #Coil = #Disp closed
The Statement List programming language type is included with the STEP 7 Standard software package. You can edit S7 blocks in this language representation type using incremental editors or create your program with a freeedit mode editor in an STL source file and then compile it into blocks.
8-5
Example:
FUNCTION_BLOCK FB20
VAR_INPUT ENDVAL: END_VAR VAR_IN_OUT IQ1 : END_VAR VAR INDEX: END_VAR INT; REAL; INT;
BEGIN CONTROL:=FALSE; FOR INDEX:= 1 TO ENDVALUE DO IQ1:= IQ1 * 2; IF IQ1 >10000 THEN CONTROL = TRUE END_IF END_FOR; END_FUNCTION_BLOCK
8-6
S4
I1.1 I1.1 M2.1 T4 M2.1 T5 D
S5
N I1.3 T6 N N
S6
I1.1 M2.2 T7 N
Blocks Created
With the S7 Graph editor, you program the function block that contains the step sequencer. A corresponding instance data block contains the data for the sequencer, for example, FB parameters, step and transition conditions. You can have this instance data block created automatically in the S7 Graph editor.
Source File
A textual source file (Graph source file) can be generated from a function block created in S7 Graph which can be interpreted by operator panels or operator interface text displays to display the sequencer.
8-7
8-8
Motor
Index inserted
States
A graph group is stored in a HiGraph source file in the "Source Files" folder beneath the S7 program. This source file is then compiled into S7 blocks for the user program. Syntax and formal parameters are checked on the last entry in a graph (when the working window is closed). The addresses and symbols are checked when the source file is compiled.
Programming with STEP 7 V5.0 C79000-G7076-C562-02
8-9
8.3
Creating Blocks
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.
8-10
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.
User-defined data types are created in the SIMATIC Manager or the incremental editor just like other blocks.
8-11
The user-defined data types in the S7 user program are not downloaded to the S7 CPU. They are either created directly using an incremental input editor and edited, or they are created when source files are compiled.
Note The mnemonics you want to use to program your S7 blocks can be set using the menu command Options > Customize in the "Language" tab of the dialog box which appears.
8-12
[KNOW_HOW_PROTECT]
Block protection; a block compiled with this option does not allow its code section to be viewed. Name of author: company name, department name, or other name (max. 8 characters without blanks) Name of block family: for example, controllers (max. 8 characters without blanks) Block name (max. 8 characters) Version number of block (both numbers between 0 and 15, meaning 0.0 to 15.15)
KNOW_HOW_PROTECT
[AUTHOR:]
AUTHOR : Siemens, but no keyword FAMILY : controllers, but no keyword NAME : PID, but no keyword VERSION : 3.10
[FAMILY:]
[CODE_VERSION1]
ID whether a function block can have CODE_VERSION1 multiple instances declared or not. If you want to declare multiple instances, the function block should not have this property A data block with the property UNLINKED is not linked into the program. Write protection for data blocks; its FAMILY= Examples data can only be read and cannot be VERSION= 3.10 changed READ_ONLY
The block protection KNOW_HOW_PROTECT has the following consequences: If you want to view a compiled block at a later stage in the incremental STL, FBD, or Ladder editors, the code section of the block cannot be displayed. The variable declaration table for the block displays only the variables of the declaration types var_in, var_out, and var_in_out. The variables of the declaration types var_stat and var_temp remain hidden.
8-13
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.
8-14
8.4
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.
8-15
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.
8-16
When you insert a new S7/M7 program, a "Blocks" folder, "Source Files" folder (S7 only), and a "Symbols" object are inserted automatically in it.
The standard libraries contain the following components: builtin/Built In: system function blocks (SFB) and system functions (SFC) fblib1/FB Lib 1: blocks for converting STEP 5 programs fblib2/FB Lib 2: standard functions for general use iec/IEC: blocks for IEC functions such as for processing time and date information, for comparison operations, for string processing, and selecting the maximum and minimum stdobs/Std OBs: standard organization blocks (OB)
The standard library for version 3 also contains the following components: PID Control: function blocks (FB) for PID control Net DP: functions (FC) for the distributed I/O and FDL connections
When you install optional software packages, other libraries may be added.
8-17
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.
8-18
9.1
9-1
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.
Procedure for Programming Logic Blocks in STL Create a logic block (FB, FC or OB) in the SIMATIC Manager
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.
9-2
Using the menu command Options > Customize you open a tabbed dialog box. In the "Editor" tab you can make the following default settings for programming blocks: The font (type and size) in text and tables. The language representation you prefer to use (LAD, STL, or FBD). According to your entry a block is then either created or opened in LAD, STL, or FBD. You can still view the block at a later stage in the other language representations, however, with some restrictions. 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.
9-3
LAD\STL\FDB:-FB6-<Offline>
File Edit Insert PLC Debug View Options Window Help
TRAFFIC\...\FB6-<Offline>
Address 0.0 2.0 4.0 6.0 8.0 10.0 Decl. in in in in in in Name dur_g_p del_r_p starter t_dur_y_car t_dur_y_car t_delay_y_car Type S5TIME S5TIME BOOL TIMER TIMER TIMER Initial Value S5T#0MS S5T#0MS FALSE Comment
FB6: Traffic light : ??? Network 1 U( U #starter U O #condition ) UN #t_dur_r_car = #condition Network 2 : ??? UN #condition = #g_car
9.2
9-4
LAD\STL\FDB:-FB6-<Offline>
File Edit Insert PLC Debug View Options Window Help
TRAFFIC\...\FB6-<Offline>
Address 0.0 2.0 4.0 6.0 8.0 10.0 Decl. in in in in in in Name dur_g_p del_r_p starter t_dur_y_car t_dur_y_car t_delay_y_car Type S5TIME S5TIME BOOL TIMER TIMER TIMER Initial Value S5T#0MS S5T#0MS FALSE Comment
FB6: Traffic light : ??? Network 1 U( U #starter U O #condition ) UN #t_dur_r_car = #condition Network 2 : ??? UN #condition = #g_car
In the variable declaration table you specify the local block-specific variables including the formal parameters for the block and 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 message and connection configuration, operator interface functions, and process control configuration to parameters.
9-5
9.2.2 Relationship between the Variable Declaration Table and the Code Section
The variable declaration table and code section of logic blocks are closely linked because the names in the variable declaration table are used in the code section. Any changes in the variable declaration therefore have an effect on the whole code section.
Action in the Variable Declaration Reaction in the Code Section
Correct new entry Correct name change without type change Correct name is changed to an invalid name Invalid name is changed to a correct name Type change Deleting a variable (symbolic name) used in the code
If invalid code present, previously undeclared variable now becomes valid Symbol is immediately shown everywhere with its new name Code remains unchanged If invalid code is present, it becomes valid If invalid code is present, it becomes valid and if valid code is present, this may become invalid Valid code becomes invalid
Changes to comments, the incorrect entry of a new variable, a change to an initial value, or deleting an unused variable has no effect on the code section.
9-6
Address
With data types for which more than one byte is required, the address shows the assignment by a jump to the next byte address. Key: * : size of an array element in bytes, + : initial address related to the start of the STRUCT, = : complete memory requirement of a STRUCT. The variable symbol must start with a letter. Reserved keywords are not permitted. Depending on the block type, the following are possible: Input parameters "in" Output parameters "out" In/out parameters "in_out" Static variables "stat" Temporary variables "temp"
System entry: the address is assigned by the system and displayed when you stop entering a declaration. Necessary Assigned by system depending on block type
Variable Declaration
Data type
Data type of the You can select the elementary data types using variable the pop-up right mouse button menu. (BOOL, INT, WORD, ARRAY etc.) Initial value if the software should not use the default value. Comment for documentation purposes
Necessary
Initial value
Must be compatible with the data type. Optional 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. Optional
Comment
9-7
Default
When you open a newly created logic block, a default variable declaration table is displayed. This lists only the valid declaration types for the selected block type (in, out, in_out, stat, temp) in the set order. When you create a new organization block (OB), a standard variable declaration is displayed whose values you can change.
The address is assigned by the system and displayed when you stop entering a declaration. The declaration type is determined by the position of the declaration within the table. This ensures that variables can only be entered in the correct order for declaration types. If you want to change the declaration type of a declaration, cut the declaration out and paste it in again below the new declaration type.
Undoing Actions
In the variable declaration table you can use the menu command Edit > Undo to undo the most recent cut or delete operation.
9-8
9.3
The following example illustrates the solution described: FB2 and FB3 use the instance DB of the function block FB1 from which they were called.
FB 1 Declaration section: Static variable of the type "FBs to be called" (FB2, FB3) instance_1: FB instance_2: FB FB call: CALL#instance_1 CALL#instance_2
Instance DB of FB 1
FB 3 (uses instance DB of FB 1)
9-9
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 section 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. Bumpless 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.
9-10
9.4
Structure of the Code Section Using the STL Programming Language as an Example
FB70 - <Offline>
FB70 : Engine C ontrol P rogram Statem ent List Engine C ontrol Program (G enerator1) PID Controller
Network Startup Control Program A I 1.1 //C om ment A Q 4.1 AN I 2.6 = Q 0.4 N etwork 2 : ??? ???
9-11
You can make changes in either overwrite mode or insert mode. You switch between modes using the INSERT key.
9-12
9-13
Comments in Ladder Logic, Function Block Diagram, and Statement List Programs
The following comments are available: Block title: title for a block (max. 64 characters) Block comment: documents the whole logic block, for example, the purpose of the block Network title: title for a network (max. 64 characters) Network comment: documents the functions of a single network Comment column in the variable declaration table: comments the declared local data Symbol comment: comments that were entered for an address when its symbolic name was defined in the symbol table. You can display these comments using the menu command View > Display > Symbol Information.
In the code section of a logic block you can enter the block title and network title, and block comments or network comments.
1.
2.
Network 2:
9-14
1.
2.
9-15
9.5
9-16
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)
9-17
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. The following coils must not be used as parallel outputs: Jump if Not _/(JMPN) Jump _/(JMP) Call from Coil _/(CALL) Return _/(RET)
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.
9-18
I 1.0
I 1.2
I 1.4
I 4.2
Q 6.0
Q 2.6
I 6.8
Illegal power flow!
Q 4.4
I 2.8
Short Circuit
No branches may be created which cause a short circuit. The following figure shows an example:
I 1.0
I 1.2
I 1.4
Q 6.0
#
Illegal short circuit!
9-19
9.6
9-20
If you position the mouse pointer on the token characters, the expected data type is displayed.
Positioning Boxes
Standard boxes (flip flops, counters, timers, math operations, etc.) can be added 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 T branch. The following figure shows a network with two assignments.
#starter #condition #t_next_red_car #t_dur_r_car >=1 & #condition =
T branch
9-21
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.
All other boxes can either have Boolean logic operations or not.
9-22
9.7
You set the mnemonics in the SIMATIC Manager with the menu command Options > Customize in the "Language" tab before opening a block. While editing a block you cannot change the mnemonics. You edit the block properties in their own dialog box. In the editor you can have a number of blocks open and edit them alternately as required.
9-23
9.8
When assigning formal and actual parameters, you must follow the following rules in the order specified: 1. Same parameter names: The actual parameters are assigned automatically, if the name of the formal parameter has remained the same. Special case: In Ladder Logic and Function Block Diagram, the preceding link for binary input parameters can only be assigned automatically if the data type (BOOL) is the same. If the data type has been changed, the preceding link is retained as an open branch. 2. Same parameter data types: After the parameters with the same name have been assigned, as yet unassigned actual parameters are assigned to formal parameters with the same data type as the "old" formal parameter. 3. Same parameter position: After you have carried out rules 1 and 2, any actual parameters which have still not been assigned are now assigned to the formal parameters according to their parameter position in the "old" interface. 4. If actual parameters cannot be assigned using the three rules described above, they are deleted or, in the case of binary preceding links in Ladder Logic or Function Block Diagram, they are retained as open branches. After carrying out this function, check the changes you have made in the variable declaration table and in the code section of the program.
9-24
9.9
In both cases the block is saved only if its syntax contains no errors. Syntax errors are identified immediately when the block is created and are then displayed in red. These errors must be corrected before the block can be saved.
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.
9-25
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.
9-26
If you use these addressing methods, STEP 7 automatically opens the correct DB. If you use the AR1 register for indirect addressing, you must always load the correct address in AR1.
Once you have assigned an actual parameter to a block from a DB (for 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. After a block has been called from within an FC that transfers a component of a formal parameter of a higher data type (string, array, 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 an FB accesses a component of a formal parameter of a higher data type in the VAR_IN_OUT area (string, array, structur 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, structur or UDT), STEP 7 uses the address register AR1 and the DB register. This means that the contents of both registers are modified.
When calling blocks in conjunction with higher data types When accessing components of a higher data type
9-27
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, there is no guarantee that the FB will be executed correctly.
9-28
10.1
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 userdefined 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.
10-1
10.2
Column
Explanation
Address Declaration
Displays the address which STEP 7 automatically assigns for the variable when you finish entering a 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)
Name Type
Static data (STAT) Enter the symbolic name you have to assign to each variable here. 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 userdefined data types. 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.
Initial Value
Comment
Entering a comment in this field helps to document the variables. The comment can have up to 80 characters.
10-2
10.3
Column
Explanation
Address Declaration
Displays the address which STEP 7 automatically assigns for the variable. 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)
Name Type
Static data (STAT) The symbolic name assigned in the variable declaration for the variable. You cannot edit this field in the data view. 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 userdefined 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 actual value if you have not explicitly defined actual values for the variables.
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 actual 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.
Comment
The comment entered to document the variable. You cannot edit this field in the data view.
10-3
10.4
Displays the address which STEP 7 automatically assigns for the variable when you finish entering a declaration. Enter the symbolic name you have to assign to each variable here. 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 userdefined data types. 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.
Initial Value
Comment
Entering an optional comment in this field helps to document the variable. The comment can have up to 80 characters.
10-4
10.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 table 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 Declaration
Displays the address which STEP 7 automatically assigns for the variable. 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 Type The symbolic name assigned in the variable declaration of the function block. 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. 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.
Initial Value
10-5
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.
Displays the address which STEP 7 automatically assigns for the variable when you finish entering a declaration. Enter the symbolic name you have to assign to each variable here. 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. 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.
Initial Value
Comment
Entering a comment in this field helps to document the variables. The comment can have up to 80 characters.
10-6
10.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
Displays the address which STEP 7 automatically assigns for the variable. The symbolic name assigned in the variable declaration of the user data 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 userdefined data types. 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.
Initial Value
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.
10-7
Note Any changes to the data values are only retained once the data block has been saved.
Note Any changes to the data values are only retained once the data block has been saved.
10-8
In both cases the block is saved only if its syntax contains no errors. Syntax errors are identified immediately when the block is created and are then displayed in red. These errors must be corrected before the block can be saved.
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.
10-9
10-10
11.1
The source file is created in the syntax of the programming language representation Statement List (STL). The source file is given its structure of blocks, variable declaration, and networks using keywords.
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
11-1
11.2
Rule The syntax of the STL statements is the same as in the incremental Statement List editor. One exception to this is the CALL instruction.
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); Example: FB call (more than 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.
CALL
Upper/lower case
The editor in this application is not case-sensitive, the exception to this being system attributes. 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. Begin every comment with a double slash (//) and end the comment with RETURN (or line feed).
11-2
Input parameters
FBs, FCs
Output parameters
FBs, FCs
In/out parameters
FBs, FCs
Static variables
FBs
Temporary variables
11-3
The declaration list is a list of the variables of a declaration type in which default values can be assigned to the variables (exception: VAR_TEMP). The following example shows the structure of an entry in the declaration list: Duration_Motor1 : Variable S5TIME := S5T#1H_30M ;
Data type
Default value
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.
11-4
The following applies when entering system attributes in source files: The keywords for system attributes always start with S7_. The system attributes are placed in braces (curly brackets). Syntax: {S7_idenifier := string} a number of identifiers are separated by ";". System attributes for blocks come before the block properties and after the keywords ORGANIZATION_ and TITLE. System attributes for parameters are included with the parameter declaration, meaning before the colon for the data declaration. A distinction is made between upper and lower case characters. This means that the correct use of upper and lower case characters is important when entering system attributes.
The system attributes for blocks can be checked or changed in incremental input mode using the menu command File > Properties under the "System 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.
11-5
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.
1.
[KNOW_HOW_PROTECT]
Block protection; a block compiled with this option does not allow its code section to be viewed. Name of author: company name, department name, or other name (max. 8 characters without blanks) Name of block family: for example, controllers (max. 8 characters without blanks) Block name (max. 8 characters)
KNOW_HO W_PROTE CT AUTHOR : Siemens, but no keyword FAMILY : controllers, but no keyword NAME : PID, but no keyword VERSION : 3.10 CODE_VER SION1
2.
[AUTHOR:]
3.
[FAMILY:]
4.
[NAME:]
5.
Version number of block (both numbers between 0 and 15, meaning 0.0 to 15.15) ID whether a function block can have multiple instances declared or not. If you want to declare
6.
[CODE_VERSION1]
11-6
Order
Keyword / Property
Meaning multiple instances, the function block should not have this property
Example
7.
A data block with the property UNLINKED is not linked into the program. Write protection for data blocks; its data can only be read and cannot be changed FAMILY= Examples VERSION= 3.10 READ_ONL Y
8.
11-7
11.3
11-8
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.
There are three types of data block: Data blocks, user-defined Data blocks with an associated user-defined data type (UDT) Data blocks with an associated function block (known as "instance" data blocks)
When you enter a user-defined data type, you must ensure that user-defined data types precede the blocks in which they are used.
11-9
11.4
"ORGANIZATION_BLOCK" ob_no or ob_name [TITLE= ] [Block comment] [System attributes for blocks] [Block properties] Variable declaration section "BEGIN" NETWORK [TITLE= ] [Network comment] List of STL instructions "END_ORGANIZATION_BLOCK"
ob_no is the block number, for example: OB1; ob_name is the symbolic name of the block as defined in the symbol table Block title (entries longer than 64 characters are cut off) Comments can be entered after "//" System attributes for blocks Block properties Declaration of temporary variables Keyword to separate the variable declaration section from the list of STL instructions Start of a network Network title (max. 64 characters) Comments can be entered after "//" Block instructions Keyword to end organization block
11-10
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 comment] [System attributes for blocks] [Block properties] Variable declaration section
Block title (entries longer than 64 characters are cut off) Comments can be entered after "//" System attributes for blocks Block properties 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.
Keyword to separate the variable declaration section from the list of STL instructions Start of a network Network title (max. 64 characters) Comments can be entered after "//" Block instructions Keyword to end function block
11-11
"FUNCTION"
fc_no is the block number, for example FC5; fc_name is the symbolic name of the block as defined in the symbol table; fc_type is the data type of the return value (RET_VAL) of the function. This can be an elementary or complex data type or VOID. If you want to use system attributes for the return value (RET_VAL), you must enter the system attributes for parametersin front of the colon for the data declaration.
[TITLE= ] [Block comment] [System attributes for blocks] [Block properties] Variable declaration section "BEGIN" NETWORK [TITLE= ] [Network comment] List of STL instructions "END_FUNCTION"
Block title (entries longer than 64 characters are cut off) Comments can be entered after "//" System attributes for blocks Block properties Declaration of input, output, and in/out parameters, and temporary variables Keyword to separate the variable declaration section from the list of STL instructions Start of a network Network title (max. 64 characters) Comments can be entered after "//" Block instructions Keyword to end function
11-12
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 comment] [System attributes for blocks] [Block properties] Declaration section
Block title (entries longer than 64 characters are cut off) Comments can be entered after "//" System attributes for blocks Block properties Declaration whether the block is associated with a UDT or an FB, given as a block number or symbolic name as defined in the symbol table, or as a complex data type Keyword to separate the declaration section from the list of value assignments Variables can have specific initial values assigned. Individual variables either have constants assigned or a reference is made to other blocks. Keyword to end data block
"END_DATA_BLOCK"
11-13
11.5
Saving and Compiling STL Source Files and Executing a Consistency Check
11-14
To find the location of an error in a source file, position the cursor on the respective error message in the lower part of the window. The text line containing the error is automatically highlighted in the upper part of the window. The error message also appears in the status bar.
11-15
Any syntax errors detected during compilation are shown in the lower part of the working window and must be corrected before the respective blocks can be created.
11.6
11-16
NETWORK TITLE = Function block call // transferring parameters // Parameter transfer in more than one line CALL Traffic light control , DB6 ( dur_g_p del_r_p := S5T#10S, := S5T#30S, // Name of FB, instance data block // Assign actual values to parameters
11-17
starter t_dur_y_car t_dur_g_ped t_delay_y_car t_dur_r_car t_next_red_car r_car y_car g_car r_ped g_ped
:= TRUE, := T 2, := T 3, := T 4, := T 5, := T 6, := "re_main", := "ye_main", := "gr_main", := "re_int", := "gr_int"); // Quotation marks show symbolic // names entered in symbol table
NETWORK TITLE = Function block call // transferring parameters // Parameter transfer in one line CALL FB10, DB100 (para1 :=I0.0,para2 :=I0.1); END_ORGANIZATION_BLOCK
FUNCTION FC2 : INT TITLE = Increment number of items // As long as the value transferred is < 1000, this function // increases the transferred value. If the number of items // exceeds 1000, "-1" is returned via the return value // for the function (RET_VAL).
11-18
AUTHOR FAMILY NAME VERSION VAR_IN_OUT ITEM_NOS : INT; 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; > I; JC ERR; L 0; T RET_VAL; L ITEM_NOS; INC 1; T ITEM_NOS; BEU; ERR: L -1; T RET_VAL; END_FUNCTION // Example for more than one // statement in a line.
FUNCTION FC3 {S7_m_c := true} : INT TITLE = Increment number of items // As long as the value transferred is < 1000, this function //increases the transferred value. If the number of items //exceeds 1000, "-1" is returned via the return value //for the function (RET_VAL). // //RET_VAL has a system attribute for parameters here AUTHOR FAMILY NAME VERSION VAR_IN_OUT ITEM_NOS {S7_visible := true}: INT; //System attributes for parameters // No. of items currently manufactured : : : : Siemens Throughput check INCR_ITEM_NOS 1.0
11-19
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; > I; JC ERR; L 0; T RET_VAL; L ITEM_NOS; INC 1; T ITEM_NOS; BEU; ERR: L -1; T RET_VAL; END_FUNCTION // Example for more than one // statement in a line.
11-20
BOOL
:=
// number has system attributes for parameters END_VAR VAR condition 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 A O ); AN = NETWORK TITLE = Green light for main street traffic AN = 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 #condition; #g_car; // No condition red for main street traffic // GREEN for main street traffic #t_dur_y_car; #condition; // And currently no red light // Condition red #starter; #t_next_r_car; #condition; // Request for green at pedestrian crosswalk and // time between red phases up // Or condition for red : BOOL := FALSE; // Condition red for cars
11-21
data_block db10 FB10 begin end_data_block data_block db6 FB6 begin end_data_block
Data Block:
DATA_BLOCK DB10 TITLE = DB Example 10 STRUCT aa : BOOL; bb : INT; cc : WORD; END_STRUCT; BEGIN aa := TRUE; bb := 1500; END_DATA_BLOCK // Assignment of initial values // Variable aa of type BOOL // Variable bb of type INT
11-22
Note The UDT used must come before the data block in the source file.
Note The associated function block must come before the data block in the source file.
11-23
11-24
12.1
The following table shows which information you can extract from the individual views:
View Purpose
Cross-reference list
Overview of the addresses in the memory areas I, Q, M, P, T, C, and DB 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, outputs, and bit memory (I,Q,M) Assignment list for timers and counters (T/C) Program structure Unused symbols
Overview of which bits of the addresses in the memory areas I, Q, and M, and 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 Call hierarchy of the blocks within a user program and an overview of the blocks used and their nesting levels 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 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.
12-1
12-2
Structure
A cross-reference list entry consists of the following columns:
Column Content/Meaning
Absolute address Symbolic address name Block in which the address is used Whether a read (R) and/or write (W) access to the address is involved Information on the programming language used to create the block
The columns Symbol, Block, Type, and Language/Details are displayed only if the corresponding options were selected for the cross-reference list. The information for Language and Details is shown in one column and only the whole column can be activated or deactivated. This block information varies depending on the programming language the block was written in. You can set the column width in the cross-reference list shown on the screen as required using the mouse.
Sorting
The cross-reference 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.
I1.0 M1.2 C2
R R
Nw 2 Inst 33 /0 Nw 33 Nw2
12-3
You can choose between: Tree structure and Parent/child structure (table form)
You can specify whether you want all blocks to be displayed or whether the hierarchy should start from a specific start block.
Recursions in the call are recognized and indicated visually in the tree structure. Recursions within the call hierarchy are marked with different symbols. Regularly called blocks (CALL), conditionally called blocks (CC) or unconditionally called blocks (UC) are marked by different symbols. Blocks which are not called are shown at the bottom of the tree structure and marked with a black cross. There is no further breakdown of the call structure of a block which is not called.
12-4
Tree Structure
The entire call hierarchy is shown, starting from a particular block. Every program structure possesses exactly one block as its root. This can be the OB1 block or any other block preset as starting block by the user.
Program Structure for pro\test\blocks\blocks S7 Program OB1 <maximum: 66> FB10, DB101 [42] DB10(dbten) [42] FC10 DB10(dbten) [66] SFB0(CTU), DB100 [66] SFC52(WR_USMSG) [66] FC10 DB10(dbten) [66] SFB0(CTU), DB100 [66] SFC52(WR_USMSG) [66] SFB0(CTU), DB100 [42] SFC52(WR_USMSG) [42]
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 tree structure and for the parent/child structure.
You can activate and deactivate this display in the Program Structure" tab. To display the local data requirement of a selected block, click the right mouse button and select the Block Information" menu command in the context-sensitive menu. If synchronous error OBs (OB121, OB122) are present, a plus sign and the additional requirement for the synchronous error OBs are displayed after the numerical value for the maximum local data requirement.
12-5
Parent/Child Structure
The calling and the called block are shown. This call pairing is given for every block in the S7 user program.
12.1.4 Assignment List for Inputs, Outputs, and Bit Memory (I/Q/M)
Assignment lists show you which addresses are already assigned within 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), and bit memory (M) is used. The I/Q/M assignment list is displayed in a working window. The working windows title bar shows the name of the S7 user program to which the assignment list belongs. 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.
12-6
7 6 5 4 3 2 1 0 B W D The byte is occupied by a one-byte access The byte is occupied by a one-word access The byte is occupied by a double-word access Bit number of the corresponding byte
O . O . X X
X O O . X X
X . O . X X
O . . . X X
X O O . X X
X . . . X X
X O O . X O
X . . . X X
O . . . . .
. . . . O .
. . . . . .
The first line gives the assignment of the output byte QB0. The address QB0 is accessed byte-wise. At the same time, however, there is bit access to the output bits Q 0.4 and Q 0.7. There is therefore an "O" in columns "4" and "7." There is an "X" in columns "0", "1", "2", "3", "5", and "6" to indicate the byte access. An "O" appears in column B because there is a byte access to address QB0.
12-7
. . . . . . .
X . . . . . .
. X . X . . .
. . . . . . .
. . X . . . X . . . . . .
X . . . . . .
. X . X . . .
. . . . . . .
. X . . X . .
In this example, the timers T1, T6, T12, T17, T19, T24 and the counters C2, C7, C19, C34 are assigned. These lists are sorted alphabetically. You can sort the entries by clicking the column title.
12-8
They are displayed in an active window. The working windows 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
Symbolic name Absolute address Data type of the address Comment on the address from the symbol table
12-9
Example:
Address Number
4 3 20
12-10
The block information varies according to the programming language the block was written in and is shown using abbreviations.
Language Network Statement Instruction
Nw Nw Nw
Inst
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).
12.2
12-11
Addresses Without Symbols Unused Symbols I/Q/M Assignment List T/C Assignment List Program Structure Cross-Reference List
View > Addresses Without Symbols View > Unused Symbols View > Assignment > Inputs, Outputs, and Bit Memory View > Assignment > Timers and Counters View > Program Structure View > Cross References
12-12
The reference data are updated for any modified or new blocks; information on any blocks deleted is removed from the reference database. The reference data are generated again from scratch for all blocks. 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.
12-13
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 > Location. A dialog box is now displayed containing a list with the locations of the address in the program. 4. Select the option "Overlapping access to memory areas" if you also want to display the locations of the 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
12-14
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.
12-15
Then proceed as follows: 1. Position the cursor on Q1.0 (NW 1, Inst 1) in OB1 in the LAD/STL/FBD Editor. 2. Select the menu command Edit > Go To > Location or use the right mouse button to select "Go to Location." The dialog box now displays all the assignments for Q1.0: OB1 Cycle Execution NW 2 Inst 3 /= W STL OB1 Cycle Execution NW 1 Inst 1 /A R STL 3. Jump to "NW 2 Inst 3" in the Editor using the "Go To" button in the dialog box: Network 2: A M1.0 A M2.0 = Q 1.0 4. The assignments to both M1.0 and M2.0 must now be checked. First position the cursor on M1.0 in the LAD/STL/FBD Editor. 5. Select the menu command Edit > Go To > Location or use the right mouse button to select "Go to Location." The dialog box now displays all the assignments for M1.0: OB1 Cycle Execution NW 3 Inst 2 /= W STL OB1 Cycle Execution NW 2 Inst 1 /A R STL 6. Jump to "NW 3 Inst 2" in the Editor using the "Go To" button in the dialog box. 7. In the LAD/STL/FBD Editor in Network 3, you will see the the assignment to M1.0 is not important (because it is always TRUE) and that the assignment to M2.0 needs to be examined instead. In STEP 7 versions earlier than V5, you would now have to run through the entire chain of assignments all over again. The buttons ">>" and "<<" make this much simpler: 8. Bring the open dialog box "Go to Location" to the fore, or call the function "Go to Location" in the LAD/STL/FBD Editor from your current position.
12-16
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.
12-17
12-18
13.1
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.
13-1
13.2
The time stamp is not updated: When symbols are changed When comments in the variable declaration are changed When changes are made in the TEMP area
13-2
13.3
13.4
13-3
13.5
13-4
13-5
13-6
14 Configuring Messages
14.1
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.
14-1
Configuring Messages
Assignment list
A I1.1 A M3.1
1 . . . .
1 . . . .
The operator interface system queries the programmable controller cyclically whether the message bit has changed or not. If the programmable controller signals a change, the corresponding message is displayed. The message receives the timestamp from the operator interface system.
Message Numbering
Message numbering required 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.
"Message text for Limit switch pressure "Message text for Limit switch pressure
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 timestamp from the programmable controller and can therefore be traced more exactly than with bit messaging.
14-2
Configuring Messages
Overview
The following table shows the properties and requirements for the different messaging methods:
Message Numbering Messages are managed in a common database for programming device and operator panel The load on the bus is low (programmable controller signals active) Messages receive the timestamp from the programmable controller Bit Messaging There is no common database for the programming device and operator panel The load on the bus is high (operator panel polls) Messages receive the timestamp from the operator panel
The message numbering method recognizes the following three types of messages:
Block-Related Messages
Symbol-Related Messages
Asynchronous to the program Display using WinCC Possible only with S7-400 Configure via the symbol table Download to the programmable controller via system data blocks (SDBs) Transfer to the operator panel via PLC-OS connection configuration
Display using WinCC and ProTool (ALARM_S only) Possible with S7-300/400 Program using message blocks: ALARM ALARM_8 ALARM_8P NOTIFY ALARM_S(Q) AR_SEND
Transfer to the operator panel for WinCC via PLC-OS connection configuration for ProTool
STEP 7 supports the more user-friendly message numbering method which will be described in detail below.
14-3
Configuring Messages
Block-related messages
Used to report program-synchronous events, for example, to show that a controller has reached a limit value Used to report events that are independent of the program, for example, a switch setting being monitored Used to report diagnostic events in the diagnostic buffer, with each call of the SFC
Overview
The following figure shows an overview of which SIMATIC components are involved in configuring and displaying messages.
Configuring/Creating Messages
SKA/SCL Symbols PDIAG CFC S7-GRAPH Data transfer PG
Displaying Messages
OP/OS WinCC ProTool PG CPU Messages Module Information
Load program/SDB
S7-300
S7-400
14-4
Configuring Messages
Timestamp Message state Associated value Image Message number Message text
Generated in the programmable controller when the message event occurs The following states are possible: incoming, outgoing, outgoing without acknowledgement, outgoing with acknowledgement Some messages can be assigned a process value that can be evaluated by the message block used If the system crashes the messages that occurred can be displayed subsequently on the operator station A unique number throughout the project which is allocated by the system and identifies a message Configured by the user
Example
The following example shows an alarm message on an operator panel.
0000049 K 11:32:00 27.03.98 Tank pressure too high: 12.7 bar Message text Associated value
14-5
Configuring Messages
14.2
SFB33 ALARM SFB34 ALARM_8 SFB35 ALARM_8P SFB36 NOTIFY SFC18 ALARM_S and SFC17 ALARM_SQ SFB37 AR_SEND (to send archives)
You will find more detailed information in the reference online help on blocks.
14-6
Configuring Messages
The number of channels available in the block and therefore the number of signals that are monitored per block call Whether messages are to be acknowledged The option of specifying associated values The display devices to be used
WinCC ProTool CPU Display Display Messages/ S7 Status Display PLC Remarks
ALARM SFB33
Possible Up to 10
Yes
No
No
S7-400
Sends a message for each incoming or outgoing edge Sends a message for each incoming or outgoing edge of one or more signals As ALARM_8 As ALARM Used to send an archive Not an edge change but every SFC call generates a message As ALARM_SQ
ALARM_8 SFB34
Possible No
Yes
No
No
S7-400
8 1 1 1
Possible Up to 10 No Up to 10
No No No Yes
No No No Yes
Possible 1
Yes
ALARM_S SFC18
No
Yes
Yes
Yes
S7300/S7400
14-7
Configuring Messages
8 channels, can be acknowledged, no associated values 8 channels, can be acknowledged, up to 10 associated values per channel 1 channel, cannot be acknowledged, up to 10 associated values 1 channel, can be acknowledged, up to 10 associated values 1 channel, cannot be acknowledged, up to 1 associated value 1 channel, can be acknowledged, up to 1 associated value Used to send an archive
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.
14-8
Configuring Messages
The message-type block can be either a function block (FB) or an instance data block.
With an FB you can create a message template to use as a template for creating messages. All entries you make for the message template 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 template and assigned message numbers. For an instance data block, you can modify messages generated based on this message template for a specific instance.
The visible difference here is that message numbers are assigned for messages but not for message templates.
14-9
Configuring Messages
Basic Procedure
Program an FB as a message type block. Select the function block (FB) to which you want to assign the message and open it. Fill out the variable declaration table. Program the call for the message block in the code section of the FB.
Call up the message configuration (standard dialog box or PCS7 message configuration).
Create the message template with texts, attributes, and display devices in the FB.
Associate instance DBs with the FB and change these according to your requirements.
14-10
Configuring Messages
3. In the code section of the function block, insert the call for the selected message block, here CALL alarm, and finish your entry with RETURN. Result:The input variables for the called message block (here SFB33) 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 and confirm that the system attributes should be used for message configuration. Result:A flag should appear in the "Name column 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. 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.
14-11
Configuring Messages
Note When editing the display device-specific texts and attributes, please read the documentation supplied with your display device.
14-12
Configuring Messages
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 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.
14-13
Configuring Messages
Note When you enter the system attributes, a syntax check is run and the incorrect entries are marked in red.
3. Exit the dialog box with OK. 4. Select the menu command Edit > Special Object Properties > Message Result: The "PCS7 Message Configuration" dialog box is opened.
Editing Messages
1. In the SIMATIC Manager, select the instance DB whose message texts you want to edit and open the PCS7 message configuration dialog box. 2. Do not change the instance-specific message parts that are not locked.
14-14
Configuring Messages
14.3
Basic Procedure
Create the symbol table for your S7 program using the Symbol Editor.
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.
14-15
Configuring Messages
14.4
Requirements
Before you can create a user-defined diagnostic message, you must have done the following: Created a project in the SIMATIC Manager Created the S7 program in the project to which you want to assign the message
Basic Procedure
To create and display a user-defined diagnostic message, proceed as follows:
In the SIMATIC Manager, select the required S7 program and start the message configuration application. Create a new message with message number, message name (identification), and texts.
Enter the message in the diagnostic buffer of the CPU via the SFC 52 call.
14-16
Configuring Messages
14.5
Overview
Texts that are output on display devices during process editing were usually input in the same language used to program the automation solution. It may often be the case that an operator who is to react to messages on a display device does not speak this language. This user needs texts in his own language to ensure smooth, problem-free processing and quick reaction to messages output by the system. STEP 7 allows you to translate any and all user texts into any language required. The only prerequisite for this is that you have already installed the language in your project (menu command: Options > Language for Display Devices in the SIMATIC Manager). The number of languages available is determined when Windows 95/98/NT is installed (system property). In this way you can be certain that any user faced with such a message at a later date will have it displayed in the appropriate language. This system feature considerably increases processing security and accuracy.
14-17
Configuring Messages
Basic Procedure
Ensure that you have set the languages into which you want to translate the user texts in the SIMATIC Manager using the menu command Options > Language for Display Devices.
Open the list, in which you want to translate text with the menu command Texts > Open
Save your translations using the menu command Texts > Save.
Notes When editing the exported texts, take care not to overwrite any other information (language IDs or path names). Only edit lines that start with "T-ID=" with the ASCII editor and do not delete any semi-colons. Never edit the first column or the first two rows with a table editor.
14-18
Configuring Messages
Example of editing with an ASCII Editor: (only the texts in italics ma be edited)
INTERN;GERMAN (GERMANY);ENGLISH (USA);ITALIAN (ITALY) ;1031;1033;1040 T-COUNTER=15;;; D:\SIEMENS\STEP7\S7proj\Project1;;; TL-ID=9;;; Project1 \ S7-Program(1) \ S7-Program(1) \ S7-Program(1);;; T-ID=1;Test point 21;Test point 21;Test point 21 T-ID=2;Test loop end;Test loop end;Test loop end
Example of editing with a table editor: (only the texts in italics may be edited)
INTERN GERMAN (GERMANY) ENGLISH (USA)
1031 T-COUNTER=15 D:\SIEMENS\STEP7\S7proj\Project1 TL-ID=9 Project1 \ S7-Program(1) \ S7-Program(1) \ S7Program(1) T-ID=1 T-ID=2
1033
14-19
Configuring Messages
14.6
Overview
Using the transfer program PLC-OS Engineering you transfer the message configuration data generated to the WinCC database. You have the choice of a number of different transfer options. You can, for example, select an address and text comparison to ensure that the current data are transferred.
Requirements
Before you start the transfer, the following requirements must be fulfilled: You have installed the setup program PLC-OS connection configuration You have generated the configuration data for creating messages.
Basic Procedure
In the SIMATIC Manager, create the OS objects on which you want to display messages.
Start the transfer of the configuration data using the menu command Options > PLC-OS Connection Data > Transfer.
14-20
Configuring Messages
14.7
Display Options
With the CPU Messages" function, you can decide whether and how online messages for selected CPUs are displayed. "Top: The window containing the CPU messages appears in the foreground. The window is topped every time a new message is received. 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: The CPU messages are not displayed and, in contrast to the other two modes, not archived.
14-21
Configuring Messages
In the CPU Messages" window, you can browse through the messages in the archive. Some examples are shown in the following figure:
CPU Messages
File Edit PLC View Options Help
Event ID: 16# 4303 Date: 12.02.97 Time 09:08:47:374 Class A/S7-Program(1) STOP caused bystop switch being activated Previous op. mode: RUN Requested op. mode: STOP (internal) ........................................................................... Event ID: 16# 9C41 Alarm message incoming Date: 18.02.97 Time:10:49:17:155 as414_SQ/S7-Program(1) Alarm_SQ 05 Test ........................................................................... Event ID: 16# 9C41 Alarm message outgoing Date: 18.02.97 Time:10:49:17:155 ........................................................................... EventID: 16#1 Event message incoming Datum: 18.02.97 as414/S7-Program(1) Alarm_S
Ready
NUM
Acknowledgable messages (ALARM_SQ) are displayed in bold type and can be acknowledged using the menu command Edit > Acknowledge CPU Message.
Archive Function
There is an archive to back up the messages in which between 40 and 2000 CPU messages can be stored. If the set archive size is exceeded, the oldest message in the archive is deleted to make space for the new message.
14-22
Configuring Messages
Basic Procedure
To configure CPU messages for selected modules:
In the SIMATIC Manager, select the S7 Program and select the menu command PLC > CPU Messages.
Specify which messages you want to receive and how these messages are to be displayed.
4. Set the size of the archive. 5. Close the dialog box when you have completed your settings. 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 "Customize" dialog box. The entries in the list are retained until they are deleted in the "Customize" dialog box.
14-23
Configuring Messages
14-24
15.1
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 PLC-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, such as limit values, substitute values, and logging properties in a dialog box. 3. Transfer the configuration data generated with STEP 7 to your display system (WinCC) by means of the PLC-OS Engineering tool.
15-1
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: [ ] [ . ] [ % ] [ - ] [ / ] [ * ] [ + ].
15.2
Configuring Operator Control and Monitoring Attributes with Statement List, Ladder Logic, a
15.2.1 Configuring Operator Control and Monitoring Attributes with Statement List, Ladder Logic, and Function Block Diagram
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
Assign the system attribute S7_m_c to all the parameters of function blocks which you want to control and monitor.
15-2
15.3
Configuring Operator Control and Monitoring Attributes via the Symbol Table
15.3.1 Configuring Operator Control and Monitoring Attributes via the Symbol Table
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
Assign the special object property "Operator Control and Monitoring" to the symbols..
15-3
15.4
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
Edit the object properties of the blocks.
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 > Object Properties).
15-4
15.5
Overview
Using the transfer program PLC-OS Engineering you transfer the configuration data for operator control and monitoring generated to the WinCC database. You have the choice of a number of different transfer options. You can, for example, select an address and text comparison to ensure that the current WinCC attributes are transferred.
Requirement
Before you start the transfer, the following requirements must be fulfilled: You have installed the setup program PLC-OS connection configuration (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:
In the SIMATIC Manager, create the operator station objects. Select the transfer options.
15-5
15-6
16.1
To establish an online connection, the programming device and programmable logic controller must be connected via a suitable interface (for example, multipoint interface (MPI)). You can then access the programmable controller via the online window of the project or the "Accessible Nodes" window.
16-1
16.1.3 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 both for the S7 program and for the M7 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 or M7 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/M7 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.
16-2
You can only protect a module with a password if the module supports this function. If you want to protect a module with a password, you must define the protection level and set the password in the course of assigning the module parameters and then download the changed parameters to the module. If you need to enter a password to execute an online function, 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 you can call the "Enter Password" dialog box directly. In this dialog box you can specify that the password entered should also be used for all future access to protected modules. The dialog box then only appears if this password is invalid.
Remarks Can be set in the "Protection" tab. In process operation, test functions such as program status or monitor/modify variables are restricted so that the set permissible scan cycle time increase is not exceeded. This means, for example, that no call conditions are allowed in program status and the status display of a programmed loop is interrupted at the point of return. Testing using breakpoints and single-step program execution cannot be used in process operation. In test operation, all test functions via programming device/PC even if they cause considerable increases to the scan cycle time can be used without restrictions.
Protection level
Can be set in the "Protection" tab. You can make write or read/write access to the CPU dependent on knowing the correct password. The password is set in this tab.
16-3
To update the display in a parallel open window, you must refresh the display in this window explicitly (using the menu command or the function key F5).
16.2
16-4
16.3
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.
16-5
16-6
17.1
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
17-1
File > Save File > Save As The current status of the block in the editor is saved on the hard disk of the programming device. A syntax check is run. Any errors are reported in dialog boxes. The causes of the errors and the error locations are also shown. You must correct these errors before you save or download the block. If no errors are found in the syntax, the block is compiled into machine code and either saved or downloaded.
PLC > Download The current status of the block in the editor is only downloaded to the CPU. A syntax check is run. Any errors are reported in dialog boxes. The causes of the errors and the error locations are also shown. You must correct these errors before you save or download the block. If no errors are found in the syntax, the block is compiled into machine code and either saved or downloaded.
Syntax check
The table applies independent of whether you have opened the block online or offline.
17-2
17-3
RAM
17-4
Alternatively you can upload the current contents of blocks from the RAM load memory of the CPU to your programming device via the load function. See also: Load Memory and Work Memory
RAM
Downloading and deleting individual blocks Downloading and deleting a complete user program Reloading individual blocks
Online PG PLC connection Online PG PLC connection Online PG PLC connection Online PG PLC connection External loading of the EPROM and inserting the memory card
17-5
17.2
17-6
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 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 a 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.
17-7
With S7-300 systems without a distributed I/O, all you have to do is specify the modules in more detail (order number) and assign them parameters.
17-8
17-9
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.
17-10
17.2.5 Deleting in the Programmable Controller 17.2.5.1 Erasing the Load/Work Memory and Resetting the CPU
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.
The contents of the diagnostic buffer and the MPI parameters are retained.
With the "memory reset" function you can restore the original state of the M7 CPU or FM following serious errors by deleting the current system data blocks (SDB) from the work memory and reloading the SDBs in the read-only memory. In some cases, a warm restart of the operating system will be required. To do this, you clear the M7 using the mode selector (switch to MRES position). A reset using the mode selector on SIMATIC M7 CPUs or FMs is only possible if the RMOS32 operating system is used on the CPU/FM.
17-11
17.2.6 Compressing the User Memory (RAM) 17.2.6.1 Gaps in the User Memory (RAM)
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.
17-12
17-13
17-14
18.1
You can assign or display the values for the following variables: Inputs, outputs, bit memory, timers, and counters Contents of data blocks I/O (periphery)
You enter the variables you want to display or modify in variable tables. You can determine when and how often the variables are monitored or assigned new values by defining a trigger point and trigger frequency.
18-1
18.2
Basic Procedure when Monitoring and Modifying with the Variable Table
To use the Monitor and Modify functions, proceed as follows: 1. Create a new variable table or open an existing variable table. 2. Edit or check the contents of the variable table. 3. Establish an online connection between the current variable table and the required CPU using the menu command PLC > Connect To. 4. Using the menu command Variable > Trigger, select a suitable trigger point and set the trigger frequency. 5. The menu commands Variable > Monitor and Variable > Modify toggle the Monitor and Modify functions on and off. 6. Save the completed variable table using the menu command Table > Save or Table > Save As, so that you can call it up again at any time.
18.3
18-2
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 or M7 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.
18-3
18.4
// Inputs: "switch_le_sin BOOL I 0.1 false IB 1 --HEX B#16#06 // Bit Memory: "gr_int M 0.1 BIN 2#1 MW 1 --DEC 1 // Outputs: "gr_ped_sim Q 0.1 BIN 2#0 QD 1 --DEC l#0 // I/O: No monitor value available --PIB 2 HEX No monitor value available PQW 3 --HEX // Counters: COUNTER --C 1 C#0 // Data Word: No monitor value available DB1.DBW 1 - - DEC // Timers: --T 1 S5T#0ms SIMATIC_TIME T 4 --SIMATIC_TIME S5T#0ms
2#1
//C#1
//S5T#20ms
MPI = 2 (direct)
OV Online
Edit
7 / 23
18-4
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, you can read the cause of the error in the status bar. Notes on correcting the error can be obtained by pressing F1.
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.
18-5
Examples:
Address Monitor Format Enter Modify Value Display Explanation
Conversion to milliseconds Representation in BCD format possible Representation in BCD format possible Representation in BCD format not possible, therefore the monitor format SIMATIC_TIME cannot be selected
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.
18-6
Examples:
Address Monitor Format Enter Modify Value Display Explanation
Conversion Representation in BCD format possible Representation in BCD format possible Representation in BCD format not possible, therefore the monitor format COUNTER cannot be selected
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.
18-7
18.5
Permitted Address:
Data Type:
Input | Output | Bit memory Input | Output | Bit memory Input | Output | Bit memory Input | Output | Bit memory I/O (Input | Output) I/O (Input | Output) I/O (Input | Output) Timers Counters Data block Data block Data block Data block
BOOL BYTE WORD DWORD BYTE WORD DWORD TIMER COUNTER BOOL BYTE WORD DWORD
I 1.0 | Q 1.7 | M 10.1 IB 1 | QB 10 | MB 100 IW 1 | QW 10 | MW 100 ID 1 | QD 10 | MD 100 PIB 0 | PQB 1 PIW 0 | PQW 1 PID 0 | PQD 1 T1 C1 DB1.DBX 1.0 DB1.DBB 1 DB1.DBW 1 DB1.DBD 1
Note:
The entry "DB0. .." is not permitted because it is already used internally.
18-8
M 3.0 M 3.1 M 3.2 M 3.3 M 3.4 M 3.5 M 3.6 M 3.7 M 4.0 M 4.1
BIN BIN BIN BIN BIN BIN BIN BIN BIN BIN
Note that in this example the designation in the "Address" column changes after the eighth entry.
Bit Addresses
Possible bit addresses Permitted modify/force values
18-9
Byte Addresses
Possible byte addresses Permitted modify/force values
IB 1 MB 12 MB 14 QB 10 DB1.DBB 1 PQB 2
Word Addresses
Possible word addresses Permitted modify/force values
2#0011001100110011 w#16#ABCD ABCD b#(12,34) ab -12345 12345 s5t#12s340ms 0.3s or 0,3s c#123 d#1990-12-31
18-10
ID 1 MD 0 MD 4 QD 10 QD 12 DB1.DBD 1 PQD 2 MD 8 MD 12 MD 16 MD 20 MD 24 MD 28 MD 32
2#00110011001100110011001100110011 1.23e4 1.2 dw#16#abcdef10 ABCDEF10 b#(12,34,56,78) abcd l# -12 l#12 -123456789 123456789 t#12s345ms tod#1:2:34.567 p#e0.0
Timer
Possible addresses of the type "Timer" Permitted modify/force values Explanation
T1 T 12 T 14 T 16 T 18 T 20
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 literal constants s5t, s5time can be written in either upper or lower case.
18-11
COUNTER
Possible addresses of the type "Counter" Permitted modify/force values
C1 C 14 C 16
0 20 c#123
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.
18.6
ON
Connection to configured CPU Connection to directly connected CPU (for example, MPI=2 (direct))
ON
18-12
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.
18.7
Monitoring Variables
18-13
Trigger point
Trigger frequency
Trigger Point
The following figure shows the position of the trigger points.
OB1 Trigger point "Transition from RUN to STOP" Trigger point "End of cycle" Process-image output table
If you set the same trigger point when monitoring and modifying, the monitor value is displayed before modifying because the Monitor function is executed before the Modify function. To display the modified value, you should set the trigger point for monitoring to Start of cycle" and the trigger point for modifying to End of cycle".
18-14
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:
Trigger frequency: Once Trigger frequency: Every cycle
Monitor Variables
Update once
Dependent on trigger point
18.8
Modifying Variables
The functions Force and Enable Peripheral Output (PQ) provide other possibilities.
18-15
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.
Trigger point
Trigger frequency
18-16
Trigger Point
The following figure shows the position of the trigger points.
OB1 Trigger point "Transition from RUN to STOP" Trigger point "End of cycle" Process-image output table
If you set the same trigger point when monitoring and modifying, the monitor value is displayed before modifying because the Monitor function is executed before the Modify function. To display the modified value, you should set the trigger point for monitoring to Start of cycle" and the trigger point for modifying to End of cycle". The following applies to trigger points when modifying variables: If you set Once" as the trigger frequency, a message appears if the selected variables cannot be modified. With the trigger frequency Every cycle," no message appears.
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.
18-17
Trigger Frequency
The following table shows the effect that the trigger condition set has on the modifying of variables:
Trigger frequency: Once Trigger frequency: Every cycle
Modify Variables
Activate once
You can assign values to variables once, independent of the trigger point.
18.9
Forcing Variables
18-18
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
Variables that are already assigned a fixed value in the CPU. Variables that are being edited. Variables of a module that is not present/inserted in the rack or Variables with an address error; an error message is displayed.
18-19
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.
18-20
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.
18-21
Bit memory (M) Timers and counters (T, C) Data blocks (DB) Peripheral inputs (PIB, PIW, PID) Peripheral outputs (PQB, PQW, PQD) Inputs and outputs (I, Q) Setting triggers Function only affects variable in visible area of active window User program can overwrite the modify/force values Replacing the force value effective without interruption The variables retain their values when the application is exited The variables retain their values after the connection to the CPU is broken Addressing errors permitted: e.g. IW1 modify/force value: 1 IW1 modify/force value: 0
always trigger immediately affects all force values
once or every cycle
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.
18-22
19.1
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. The block must be open online.
19-1
To test in program status, to set breakpoints, and to execute the program in singlestep mode, test operation mode must be set (see menu command Debug > Operation). These test functions are not possible in process operation mode.
19-2
19.2
The preset for line type and color can be changed under the menu command Options > Customize, "LAD/FBD" tab.
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.
19-3
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.
19-4
19.3
The function "testing in single-step mode" is not possible for all programmable controllers (refer to the documentation for the relevant programmable controller).
3039 0
58 84000000
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.
19-5
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.
19-6
19.4
19-7
19-8
20.1
20-1
20-2
21 Diagnostics
21.1
SIMATIC Manager ONLINE Project Station S7 Program Call the function "Diagnose Hardware"
Diagnostic View
Module Information
2 3
21-1
Diagnostics
21.2
21-2
Diagnostics
Preset-actual mismatch in the configuration: the configured module is not available or a different module type is inserted Fault: module has a fault. Possible causes: diagnostic interrupt, I/O access error, or error LED detected Diagnosis not possible because no online connection exists or the CPU cannot supply diagnostic information for the module (for example, power supply, or submodule).
STARTUP
STOP
HOLD
21-3
Diagnostics
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).
21.3
From the configuration tables displayed, you can select modules whose module information you want to display.
21-4
Diagnostics
21-5
Diagnostics
21.4
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 (MPI or PROFIBUS address) are ever visible.
21-6
Diagnostics
Note In the "Accessible Nodes" window, only the modules with their own node address (MPI or PROFIBUS address) are ever visible.
21-7
Diagnostics
21.5
General
Identification data on the selected module; for The online information from example, order number, release number, the inserted module can be status, slot in rack compared with the data for the configured module Overview of events in the diagnostic buffer and detailed information on the selected event To find the cause of a CPU STOP and evaluate the events on the selected module leading to it 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
Diagnostic Buffer
Diagnostic data for the selected module Diagnostic data for the selected DP slave (to EN 50170)
To evaluate the cause of a module fault To evaluate the cause of a fault in a DP slave
21-8
Diagnostics
Function/Tab
Information
Use
Memory
Current utilization of the work memory and the load memory of the selected CPU or M7 function module
Before new or extended blocks are transferred to a CPU, to check whether sufficient load memory is available in the CPU/function module or to compress the memory content. To keep a check on the configured minimum cycle time, and the maximum and current cycle times To display and set the time and date of a module and to check the time synchronization Before and during the creation of a user 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
Duration of the longest, shortest, and last scan cycle of the selected CPU or M7 function module Current time, operating hours, and information about synchronizing clocks (synchronization intervals)
Time System
Performance Data
Memory configuration, address areas, and the available blocks for the selected module (CPU/FM)
Display of all block types available in the To check which standard scope of supply of the selected module List of blocks your user program OBs, SFBs, and SFCs you can use for this can contain or call to be module able to run on the selected CPU. Transmission rates, the overview of communication connections, the communication load, and the maximum message frame size on the communication bus of the selected module Stacks tab: Can only be called up in STOP mode or HOLD mode. The B stack for the selected module is displayed. You can then also display the I stack, the L stack, and the nesting stack and jump to the error location in the interrupted block. To determine how many and which CPU or M7 FM connections are possible and how many are in use To determine the cause of a transition to STOP and to correct a block
Communication
Stacks
21-9
Diagnostics
The operating mode of the CPU itself and the status of the selected module cannot be displayed if the module information for a non-CPU module is opened from the "Accessible Nodes" window.
21-10
Diagnostics
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:
Diagnostic information of the CPU via the module Diagnostic data of the module
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.
21-11
Diagnostics
Tabs Displayed
The table shows which property tabs are present in the Module Information" dialog box for each module type.
Tab CPU or M7 FM Module with System Diagnostics Capability Module with Diagnostics Capability Module without Diagnostics Capability DP Slave
General Diagnostic Buffer Diagnostic Interrupt Memory Scan Cycle Time Time System Performance Data Stacks Communication DP Slave Diagnostics H state 1)
1)
yes yes
yes
yes
yes
yes
yes
yes
yes
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, fault, module not available).
21-12
Diagnostics
21.5.3 Calling the module information 21.5.3.1 Options for Displaying the Module Information
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
Module Information
Accessible Nodes Accessible Nodes MPI=2 2 3 Call from "Accessible Nodes" "Module Information" "Diagnosing Hardware" 1
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.
21-13
Diagnostics
21.6
If a programming error occurs: 1. The entry "STOP because programming error OB not loaded" means, for example, that the CPU has detected a program error and then attempted to start the (non-existent) OB to handle the programming error. The previous entry points to the actual programming error. 2. Select the message relating to the programming error. 3. Click the "Open Block" button. 4. Select the "Stacks" tab.
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.
21-14
Diagnostics
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.
21-15
Diagnostics
21.7
21-16
Diagnostics
21.8
CPU The diagnostic function of the CPU detects a system error. The diagnostic function of the CPU detects an error in the user program
Modules The diagnostic function of a module detects an error and generates a diagnostic interrupt (OB 82).
Diagnostic interrupt
STEP 7
21-17
Diagnostics
Diagnostic buffer
21-18
Diagnostics
Module identification CPU characteristics Memory areas System areas Block types
Order number, type ID, and version of the module Time system, system behavior (for example,. multicomputing) and language description of the CPU Memory configuration of the module (size of the work memory). System memory of the module (for example, number of memory bits, timers, counters, memory type). 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/errors to OBs Current status of interrupt processing/interrupts generated Which OB is being executed, which priority class is disabled due to the parameter setting Which operating modes are possible, the last operating mode change, the current operating mode
Assignment of interrupts and errors Interrupt status Status of the priority classes Operating mode and mode transition
21-19
Diagnostics
Communication status data Diagnostic modules Start information list of the OB Start event list Module status information
All the communication functions currently set in the system The modules with diagnostics capability logged on at the CPU Start information about the OBs of the CPU Start events and priority classes of the OBs Status information about all assigned modules that are plugged in, faulty, or generate hardware interrupts
Module start address, internal/external faults, channel faults, parameter errors (4 bytes) All the diagnostic data of a particular module
21-20
Diagnostics
21-21
Diagnostics
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 is 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.
21-22
Diagnostics
21.9
I/O redundancy error CPU redundancy error Time error Power supply error Diagnostic interrupt Insert/remove module interrupt CPU hardware fault Priority class error Rack failure or failure of a station in the distributed I/O Communication error Programming error I/O access error
OB70 OB72 OB80 OB81 OB82 OB83 OB84 OB85 OB86 OB87 OB121 OB122
If the appropriate OB is not available, the CPU goes into STOP mode. 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
21-23
Diagnostics
21-24
Diagnostics
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.
An error occurs...
If an error OB is programmed, the CPU executes the program in the OB. If no error OB is programmed, the CPU goes into "STOP" mode. (Exception: OB 81)
21-25
Diagnostics
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, M7400 Programmable Controllers, Hardware and Installation Manual" for information as to whether your CPU provides the specified OBs.
Error Class Error Type OB Priority
Redundancy
I/O redundancy error (only in H CPUs) OB70 CPU redundancy error (only in H CPUs) OB72 OB80 OB81 OB82 OB83 OB84 OB85 OB86 OB87 OB121 OB122
Asynchronous
Time error Power supply error Diagnostic Interrupt Insert/remove module interrupt CPU hardware fault Program sequence error Rack failure Communication error
Synchronous
21-26
Diagnostics
OB 81 checks the type of power supply error that was detected and displays whether the error was caused by a battery failure.
Types of power supply error Operating system Program execution 21 Battery exhausted 1 (CPU) 22 No backup voltage (CPU) 23 24 V power supply failure 1 (CPU) 31 Battery exhausted 1 (Expansion unit) 32 No backup voltage 1 (Expansion unit) 33 24V power supply failure 1 (Expansion unit)
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.
21-27
Diagnostics
TEMP TEMP
OB81EVCLASS OB81FLTID
BYTE BYTE
Error class/error identifier 39xx Error code: b#16#21 = At least one backup battery of the CPU is 1) exhausted b#16#22 = No backup voltage in the CPU b#16#23 = Failure of the 24-V power supply in the 1 CPU b#16#31 = At least one backup battery of an 1) expansion rack is exhausted b#16#32 = Backup voltage not present in an 1 expansion rack b#16#33 = Failure of the 24-V power supply of an 1) expansion rack
TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP
1)
OB81PRIORITY OB81OBNUMBR OB81RESERVED1 OB81RESERVED2 OB81MDLADDR OB81RESERVED3 OB81RESERVED4 OB81RESERVED5 OB81RESERVED6 OB81DATETIME
Priority class = 26/28 81 = OB81 Reserved Reserved Reserved Only relevant for error codes B#16#31, B#16#32, B#16#33
21-28
Diagnostics
Compare event code "battery exhausted" (B#16#3921) with the error code for OB81. If the same (battery is exhausted), jump to Berr. Compare event code "battery failure" (b#16#3922) with the error code for OB81. If not the same (no battery failure in central rack), end block. Berr sets the output batteryerror" if a battery failure or an exhausted battery is detected.
#batteryerror
You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
For all load instructions that lead to synchronous errors, you can specify a substitute value for the accumulator content in the error OB.
21-29
Diagnostics
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.
Substitute value: 0 0 0 1
0 0 1 0
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.
Decl. Name Type Description
Priority class = priority of the OB in which the error occurred 122 = OB122 Block type in which the error occurred
21-30
Diagnostics
Decl.
Name
Type
Description
Memory area and type of access Address in the memory at which the error occurred Number of the block in which the error occurred Relative address of the instruction that caused the error Date and time at which the OB was started Saves the error code of SFC44
STL
Description
L B#16#2942 L #OB122SWFLT ==I JCAerr L B#16#2943 <> I JC Stop Aerr: CALL REPLVAL" VAL : = DW#16#2912 RETVAL : = #Error L #Error L 0 ==I BEC
Compare the event code of OB122 with the event code (B#16#2942) for the acknowledgement of a time error when reading the I/O. If the same, jump to Aerr". Compare the event code of OB122 with the event code (B#16#2943) for an addressing error (writing to a module that does not exist). If not the same, jump to Stop." Label Aerr": transfers DW#16#2912 (binary 10010) to SFC44 (REPLVAL). SFC44 loads this value in accumulator 1 (and substitutes the value triggered by the OB122 call). The SFC error code is saved in #Error. Compare #Error with 0 (if the same, no error occurred when executing OB122). End the block if no error occurred. "Stop" label: calls SFC46 STP" and changes the CPU to STOP mode.
Stop:
CALL STP"
21-31
Diagnostics
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.
21-32
Diagnostics
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.
21-33
Diagnostics
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 Time-of-day 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 time-of-day interrupts were skipped. By including SFC29 CANTINT, you can deactivate the skipped time-of-day interrupt so that it is not executed and only time-of-day interrupts relative to the new time will be executed.
If you do not deactivate skipped time-of-day interrupts in OB80, the first skipped time-of-day 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.
21-34
Diagnostics
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, in contrast to all other asynchronous error OBs. 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.
21-35
Diagnostics
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 user-defined 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.
21-36
Diagnostics
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.
21-37
Diagnostics
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 does not exist or defective).
21-38
Diagnostics
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.
Description
The operating system of the CPU calls OB86 when a rack failure is detected; for example: Rack failure (missing or defective IM or break on the connecting cable) Distributed power failure on a rack Failure of a DP slave in a master system of the SINEC L2-DP bus system
The OB is also called when the error is eliminated (the OB is called when the event comes and goes).
21-39
Diagnostics
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.
If you do not program OB87, the CPU changes to STOP mode when a communication error is detected. You can find detailed information on OBs, SFBs, and SFCs in the corresponding Help on Blocks.
21-40
Diagnostics
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.
21-41
Diagnostics
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, processdependent 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.
21-42
22.1
22-1
By opening the respective object, the following parts of a project can be printed: Blocks in Ladder Logic, Statement List, or Function Block Diagram representation or in other languages (optional software) Symbol table with the symbolic names for absolute addresses Configuration table with the arrangement of modules in the programmable controller and the module parameters Diagnostic buffer content Variable table with monitor formats, and monitor and modify values Reference data; such as cross-reference lists, assignment lists, program structures, lists of unused addresses, lists of addresses without symbols Global data table Module information with the module status User text lists Documents from optional packages such as other programming languages
22-2
Configuration table Station > * Object, object folder Reference data Symbol table Variable table Connection table List of user texts File > * Reference Data > * Symbol Table >
*
* : The * symbol serves as a wildcard for the respective function in the menu command (e.g. print preview or page setup)
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. If the document consists of several pages, two periods appear after the page number in the bottom right corner of the page. The last page does not have these periods, indicating no more pages are to follow. Note The print format of the finished document is not displayed in the print preview.
22-3
Print Setup
With the "Print Setup" function, you can select a printer and set the paper format (portrait or landscape). The settings available for this function depend on the type of print driver used.
22-4
22.2
Archive Programs
The archive function provides you with an interface for calling the archive program of your choice. The archive programs ARJ and PKZIP 2.50 are included as a part of the STEP 7 package. You will require the following versions if you use one of the archive programs below (or a newer version): ARJ from version 2.4.1a
22-5
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.
22-6
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.
22-7
22-8
23.1
Overview
In STEP 7 you can work in Windows 95/98/NT Workgroups and NT/Novell networks in a multi-user configuration. There are three different possible methods: The project is on a local drive and is also used from another workstation. Example: Workstations 1 and 2 access project A on workstation 1. The project is on a project/network server. Example: Workstations 1 and 2 access project C on the network server. The projects are distributed among the local drives and one or more project/network servers. Example: Workstations 1 and 2 access projects A, B, and C.
Project B
23-1
23-2
24.1
Basic Procedure
When you create an automation solution with SIMATIC M7, there are a series of basic tasks. The following table shows the tasks that need to be performed for most projects and assigns them to a basic procedure. The table also gives references to the relevant chapter in this manual or other manuals.
Procedure Description
2. Start STEP 7 3. Create project structure 4. Set up station 5. Configure the hardware 6. Configure communication connections 7. Define symbol table 8. Create C or CFC user program 9. Configure operating system 10. Install operating system on M7-300/M7-400 11. Download hardware configuration and user program to M7
As for S7 As for S7
M7-SYS RT User Manual 12. Test and debug user program ProC/C++
24-1
Procedure
Description
To access M7 programmable control system management, select the following menu command from the context of a project that contains stations with M7 CPUs or FMs, with the M7 program folder selected: PLC > Manage M7 System You will find detailed instructions in the online help and user manual for M7-SYS RT.
24-2
24.2
M7 Optional Software
STEP 7 provides you with the basic functions you require to do the following: Create and manage projects Configure and assign parameters to the hardware Configure networks and connections Manage symbol data
These functions are provided regardless of whether you are using a SIMATIC S7 or SIMATIC M7 programmable controller. To create M7 applications, you will require the M7 optional software in addition to STEP 7.
Software Content
M7-SYS RT
M7 RMOS32 operating system M7-API system library Support for MPI Link for the Borland development environment in STEP 7 Symbol import editor and generator Organon xdb386 high-level language debugging tool
Borland C++
In conjunction with the M7 optional software, STEP 7 can also support the following additional tasks: Downloading data to the M7 programmable control system via the multipoint interface (MPI) Requesting information about the M7 programmable control system Making particular settings on the M7 programmable control system and resetting the M7
24-3
The following figure shows the dependencies of the M7 optional software for M7 programming.
C/C++ Programs
CFC Programs
M7 ProC/C++
Borland C++
M7 SYS RT
Summary
To create... You will require the M7 software option...
C/C++ programs
CFC programs
24-4
STEP 7
Installing the M7 operating system Managing the M7 programmable control system Downloading, starting, and deleting the M7 programs Displaying status and diagnostic data Resetting the CPU
M7-SYS RT
The M7 operating system and M7 system software utilities help with the following: Controlling program processing Managing memory and resources Access to computer hardware and SIMATIC hardware Handling interrupts Diagnostics Status monitoring Communication By integrated code creation (integrating the Borland development environment into STEP 7) By linking project symbols into the source code By integrated debugging functions Creating C and C++ programs Creating, testing, and debugging CFC programs Starting and running CFC programs
M7-ProC/C++
24-5
24.3
To solve automation tasks, the M7 RMOS32 (Realtime Multitasking Operating System) real-time operating system is used with the SIMATIC M7 automation computer. M7 RMOS32 has been extended to include a call interface, the M7 API (Application Programming Interface) to integrate it into the SIMATIC system. The real-time operating system M7 RMOS32 is used for 32-bit applications in time-critical, real-time, and multitasking solutions. It is available in the following configurations for M7 modules: M7 RMOS32 M7 RMOS32 with MS-DOS
The operating system configuration you choose for your M7 programmable control system depends on the M7 modules you are using:
Operating System Configuration Module / Main Memory PROFIBUS-DP and TCP/IP Installatio Yes/No n on Mass Memory
M7 RMOS32
24-6
25.1
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.
Requirement
Projects and libraries can only be rearranged if no objects in them are being edited by other applications and therefore locked for access.
25-1
25.2
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 Mbytes): 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.
25-2
26.1
26-1
26.2
26-2
5. Open the block or the source file and enter a program. You will find more information on programs in the programming language manuals.
26-3
6. Document the project using the menu command Insert > Project Documentation. To document a STEP 7 project you can organize all the configuration data created with STEP 7 in wiring manuals. This function is only available if the DOCPRO" optional package is installed. Depending on your task, you may not need to perform all these steps.
26.3
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.
26-4
3. Edit the object name. In general, the Windows 95/98 naming conventions apply. 4. To close the renaming function you can do either of the following: Press the ENTER key to enter the new name. If the new name is not allowed, the previous name is restored. Press ESC to abort the editing procedure and restore the previous object name.
3. Confirm the delete procedure in the prompt displayed by clicking the "Yes" button.
26-5
26-6
27.1
27-1
2. In the dialog box, which is then displayed, select the project and the required symbol table. 3. Confirm with "OK." To open a symbol table you have been editing recently, select one of the menu commands Symbol Table > 1, 2, 3, or 4. Note You can also open symbol tables in the SIMATIC Manager by opening the "symbols" object by double-clicking it. You can also open the symbol table from the "LAD/STL/FBD" window using the menu command Options > Symbol Table.
27-2
To delete the selected symbol rows without retaining a backup copy, you can: Select the menu command Edit > Delete. Press DEL.
Note that if you cut or delete the special object properties, you cannot reverse this action with Undo.
27-3
The filters "All symbols", "Unique symbols" and "Non-unique symbols" are predefined.
27-4
Note Using the "Find" button, the menu command Edit > Continue, or CTRL + W you can continue to search for the next occurrence of the specified search string. If you require help on the "Find and Replace" dialog box, click the "Help" button or press F1 while the dialog box is open.
27-5
Note When you select a whole row in this manner, attributes are only copied if you activated the option "Copy with special object properties" under Options > Customize. If you select a cell and then extend the selection with SHIFT + CTRL + arrow key, any existing attributes are not copied along with this selection.
To select all the rows in the active symbol table, you can: Select the menu command Edit > Select > All. Press CTRL + A.
To undo the selection, select the menu command Edit > Undo Selection.
Note When a symbol is copied, the special object properties are not taken into account. To prevent the special object properties being lost during copying, select the menu command Options > Customize in the Symbol Editor and activate the check box "Copy with special object properties."
27-6
Note You should note that the data entered for operator control and monitoring are only saved when the symbol table itself is saved. If you exit the Symbol Editor without saving the symbol table, your entries for the WinCC attributes will be lost. When a symbol is copied, the special object properties are not taken into account. To prevent the special object properties being lost during copying, select the menu command Options > Customize in the Symbol Editor and activate the check box "Copy with special object properties."
27-7
Note For configuring SCAN messages only the symbols "Input," "Output," and "Bit memory" of the data type "Bool" are permitted. When a symbol is copied, the special object properties are not taken into account. To prevent the special object properties being lost during copying, select the menu command Options > Customize in the Symbol Editor and activate the check box "Copy with special object properties."
Note When a symbol is copied, the special object properties are not taken into account. To prevent the special object properties being lost during copying, select the menu command Options > Customize in the Symbol Editor and activate the check box "Copy with special object properties."
27-8
If the symbol table is displayed in a split window, this command closes both parts of the window. Note: If you have made changes to the symbol table since it was last saved, you will be prompted whether you want to save before closing the symbol table. If the symbol table contains non-unique or incomplete symbols, you will be prompted whether you still want to close the symbol table.
If you close without saving, all the changes not saved are lost. To close all open symbol tables, select the menu command Window > Close All.
Note: If you have made changes to the symbol table since it was last saved, you will be prompted whether you want to save before closing the symbol table. If the symbol table contains non-unique or incomplete symbols, you will be prompted whether you still want to save the symbol table. If you close without saving, all the changes not saved are lost.
27-9
27.2
27-10
Note Handling non-unique symbols when exporting: When exporting, only those symbols you selected using a filter are taken into account (for example, all symbols or only the unique symbols or only the nonunique symbols).
27-11
27.3
27-12
To decrease the size of the display in the active window in stages: Select the menu command View > Zoom Out. Press CTRL + Num-.
To set the size of the display to a set value: 1. Select the menu command View > Zoom Factor. 2. Select the required zoom factor in the "Zoom Factor" dialog box. 3. Confirm with "OK."
27-13
If you want to arrange all windows containing the open symbol tables evenly from top to bottom, select the menu command Window > Arrange > Horizontally. If you want to arrange all windows containing the open symbol tables evenly from left to right, select the menu command Window > Arrange > Vertically. If you want to arrange the icons of the minimized windows evenly along the bottom edge of the main window, select the menu command Window > Arrange Icons.
27-14
27.4
27-15
The block is created and a window is opened for editing. The upper part of the window serves to edit the variable declaration table, and the lower part contains the code section where you program the new block.
Note When you create a function block (FB), the setting is made as to whether you can declare multiple instances in the function block. This property is set for each new function block according to your settings in the "Editor" tab in the "Customize" dialog box (using the menu command Options > Customize). Logic blocks can also be created by compiling STL source files. You can also create logic blocks in the SIMATIC Manager by inserting them in the appropriate S7 user program.
Note STEP 7 offers you the opportunity under certain circumstances of storing the data for various function blocks in a single data block (multiple instance data block, see Entering a Multiple Instance in the Variable Declaration Table).
27-16
5. Enter the values for the system attributes in the "Attributes" property sheet.
27-17
A I0.1
The absolute value I0.1 is displayed in the statement because no symbol is now assigned to it. The new symbol for the still valid absolute value I0.1 is displayed in the statement. The statement remains unchanged. A message concerning the modified symbol assignment is displayed. The statement is marked as faulty (red type) because Symbol_A is no longer defined.
A Symbol_B A Symbol_A
Symbol
A Symbol_A
27-18
27.4.7 Rewiring
The following blocks and addresses can be rewired: Inputs, outputs Memory bits, timers, counters Functions, function blocks
To rewire: 1. Select the block folder or 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.
27-19
27.5
Note The directory names in the path must not be longer than eight characters. Otherwise, there may be problems when archiving and using "C for M7" (Borland compiler).
3. Enter the name for the new library in the dialog box. 4. Under "Type" you can specify whether the library should be created for the current STEP 7 version (default) or for editing with an older STEP 7 version. 5. Click the "OK" button to create the library. A split window appears showing the icon for the library in the left half. Now you can copy S7/M7 programs from projects to the library or create S7/M7 programs in the library (using the menu command Insert > Program > S7 Program or Insert > Program > M7 Program).
27-20
27-21
27.6
27-22
Note Switching from Ladder Logic to Function Block Diagram and back is possible at any time. Switching from STL to Ladder/FBD is only possible for STL statements which imitate the whole set of parameters of the corresponding Ladder element and maintain the correct sequence. The parameters not used in STL should be set to NOP 0.
27-23
27.7
When the row is completed an address is assigned to the variable. Every time you edit a table cell, a syntax check is run and any errors are displayed in red. You do not have to remedy these errors immediately; you can continue editing and correct the errors at a later stage.
27-24
27-25
2. Enter a symbolic name in the "Name" column and exit the row in the table using the TAB key or RETURN. One blank row and the last line of the declaration END_STRUCT) are inserted initially. 3. Enter the elements in the structure in the blank row by defining their symbolic name, data type, initial value (optional), and any comment. You can add more rows using the functions in the "Insert" menu or by pressing RETURN or you can duplicate variables or delete them again using the "Edit" menu.
FB50 - <Offline>
Address 0.0 +0.0 +2.0 +4.0 =6.0 6.0 *2.0 Decl in in in in in in in array1 Name Struktur1 var1 var2 var3 Type STRUCT BOOL INT WORD END_STRUCT ARRAY[1..20,1..40 BOOL TRUE FALSE 0 W#16#0
Initial value
Comment
27-26
Type
The initial value 1234 is assigned to the first ARRAY element only. The initial values 1234, 56, 78, 90 are assigned to the first four ARRAY elements in this order. The initial value 9876 is assigned to all 14 ARRAY elements.
27-27
2. Select the menu command Edit > Copy or the corresponding button in the toolbar. 3. Position the cursor at the position after which you want to paste the copied variable and select the menu command Edit > Paste or the corresponding button in the toolbar. The copied variables are pasted. So the symbolic names of the variables remain unique, the names of the copied variables are automatically given an additional serial number.
2. Select the menu command Edit > Cut or the menu command Edit > Delete or the corresponding button in the toolbar.
Note When deleting ARRAYs and STRUCTs: If you select the first row of an ARRAY to delete it, the second row which belongs with it is also selected. If you select the first row of a STRUCT to delete it, all rows up to and including END STRUCT are also selected.
27-28
FB40 - <Offline>
Address 0.0 0.1 2.0 2.1 4.0 6.0 Decl. in in out out in_out in_out Name in start Motor Message in_out1 in_out2 Type BOOL BOOL BOOL BOOL INT INT
Initial value Comment
27-29
27-30
Note You can also copy the template from the catalog to the editor window using drag & drop.
27-31
27.8
The selected Ladder element is inserted and question mark characters (??.?) are used to represent addresses and parameters.
Note You can also edit the code section by selecting existing Ladder elements and then selecting one of the menu commands Edit > Cut, Edit > Copy, or Edit > Paste.
27-32
27-33
1. Switch to the overwrite mode with the INSERT key. The current mode is displayed in the status bar in the bottom right corner of the screen. 2. Select the Ladder element you want to overwrite. 3. Insert the required element in the network using one of the following techniques: Select the menu command for the element in the "Insert" menu, for example, Insert > LAD Element > Coil. Click the button for a normally open contact, normally closed contact, or output coil from the toolbar. Enter a normally open contact, normally closed contact, or output coil by using the function keys F2, F3, or F74. Press F11 or select the menu command Insert > Program Elements to open the "Program Elements" dialog box and select the required element in the catalog.
The existing Ladder element is overwritten by the new one you selected. If you press the INSERT key again, you switch back to insert mode. The current mode is displayed in the status bar in the bottom right corner of the screen.
27-34
You can only select one area at a time. The following figure shows examples of a number of selections made simultaneously.
#condition
#t_dur_y_car
#r_ped
#t_dur_g_ped
#condition
You can choose the color of the selection yourself in the "LAD/FBD" tab in the "Customize" dialog box. You open this dialog box by using the menu command Options > Customize.
27-35
To create a parallel branch, proceed as follows: 1. Select the element in front of which you want to open a parallel branch. 2. Use one of the following methods to open a parallel branch: Select the menu command Insert > LAD Element > Open Branch. Press the function key F8. Click the corresponding button in the toolbar.
3. Insert the required Ladder elements in the open parallel branch. 4. In the "main branch," select the element after which you want to close the parallel branch. 5. Use one of the following methods to close a parallel branch: Select the menu command Insert > LAD Element > Close Branch. Press the function key F9. Click the corresponding button in the toolbar.
27-36
1.
M2.0
I1.0
2.
M2.0
I1.0
or <F8> 3.
M2.0 I1.0
??.?
or <F2> 4.
M2.0 I1.0
??.?
or <F9>
When you close parallel branches, any necessary empty elements are added. If necessary, the branches are arranged so that they do not cross over. If you close the branch directly from the parallel branch, the branch is closed following the next possible Ladder element.
27-37
27-38
The junction is split and the Ladder element is inserted. If you press the INSERT key again, you switch back to insert mode. The current mode is displayed in the status bar in the bottom right corner of the screen.
M4.0
I6.0
Q2.4
I8.0
M4.6
Overwrite
M4.0
??.?
I6.0
Q2.4
I8.0
M4.6
27-39
3. Now select the Ladder element that you want to insert in the branch.
27.9
The selected FBD element is inserted and question mark characters (???) are used to represent addresses and parameters.
Note You can also edit the code section by selecting existing FBD elements and then selecting one of the menu commands Edit > Cut, Edit > Copy, or Edit > Paste.
27-40
Function blocks (FB) Functions (FC) System function blocks (SFB) System functions (SFC)
All FBs in the S7 program All FCs in the S7 program All SFBs available in the CPU All SFCs available in the CPU
Libraries
Note The character combination ">>" at an output means that this output must be connected before saving or downloading.
27-41
4. If you press the INSERT key again, you switch back to insert mode. The current mode is displayed in the status bar in the bottom right corner of the screen.
You can choose the color of the selection yourself in the "LAD/FBD" tab in the "Customize" dialog box. You open this dialog box by using the menu command Options > Customize. To select a network in which you can enter FBD elements, proceed as follows: 1. Click the network title (for example, "Network 1"). 2. You can then cut, paste, or copy the network you have selected in this way.
27-42
27-43
27-44
Note You can choose the color of the selections yourself. To do this, open the "LAD/FBD" tab using the menu command Options > Customize and select the color for the selected element.
27-45
In both cases the block is saved only if its syntax contains no errors. Syntax errors are identified immediately when the block is created and are then displayed in red. These errors must be corrected before the block can be saved.
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.
27-46
Displays the address which STEP 7 automatically assigns for the variable when you finish entering a declaration. Enter the symbolic name you have to assign to each variable here. 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 userdefined data types. 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.
Initial Value
Comment
Entering an optional comment in this field helps to document the variable. The comment can have up to 80 characters.
27-47
27.12.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 table 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 Declaration
Displays the address which STEP 7 automatically assigns for the variable. 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 Type The symbolic name assigned in the variable declaration of the function block. 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.
27-48
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.
Displays the address which STEP 7 automatically assigns for the variable when you finish entering a declaration. Enter the symbolic name you have to assign to each variable here. 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. 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.
Initial Value
Comment
Entering a comment in this field helps to document the variables. The comment can have up to 80 characters.
27-49
27.12.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
Displays the address which STEP 7 automatically assigns for the variable. The symbolic name assigned in the variable declaration of the user data 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. 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.
Initial Value
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.
27-50
Note Any changes to the data values are only retained once the data block has been saved.
Note Any changes to the data values are only retained once the data block has been saved.
27-51
In both cases the block is saved only if its syntax contains no errors. Syntax errors are identified immediately when the block is created and are then displayed in red. These errors must be corrected before the block can be saved.
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.
27-52
27-53
27.13.5 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.
27-54
An equivalent source file is generated from the block. The contents of the source file are inserted after the cursor position.
Note You can also use the menu command Insert > External Source File to import source files you created with STEP 7 version 1.
27-55
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."
27-56
27.14 Saving and Compiling STL Source Files and Executing a Consistency Check
27.14.1 Saving STL Source Files
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.
27-57
To find the location of an error in a source file, position the cursor on the respective error message in the lower part of the window. The text line containing the error is automatically highlighted in the upper part of the window. The error message also appears in the status bar.
27-58
Any syntax errors detected during compilation are shown in the lower part of the working window and must be corrected before the respective blocks can be created.
27-59
Alternative: 1. Select the menu command View > Sort. 2. Select the sort criteria in the dialog box which appears. 3. Click the "OK" button.
Program structure
You can define the following: whether the memory requirement (in bytes) of the local data is displayed per path beside the last block in each program path in brackets and whether the maximum local data requirement is displayed at the start of each program structure.
Assignment
You can choose the memory areas you want displayed in the assignment lists. For each memory area (inputs, outputs, bit memory, timers, counters) you can specify a range of addresses to which you want to restrict the display.
27-60
Alternative procedure:
1. Select an address in the cross-reference list. 2. Click the right mouse button to open a context-sensitive menu. 3. Select the menu command Go To Location". The command in the context-sensitive menu is also available in the menu bar: Edit > Go To > Location
27-61
27.15.8 Opening Working Windows for Reference Data Not Yet Displayed
Proceed as follows: 1. In the "Displaying Reference Data" window select the menu command Reference Data > Open. 2. In the "Open" dialog box, select the S7 user program for which you want to display a list of reference data. 3. If you have not deselected the "Settings" dialog box, you can choose which view the new window should show. Alternatively, select the appropriate command in the "View" menu.
27-62
27-63
27-64
27-65
4. If you wish to continue, exit the dialog box by clicking the Cancel button.
27-66
27-67
4. Enter the required watchdog time in the SCAN interval box. You should take the performance of your CPU into account here because the scan time you enter here may increase the load on the scan cycle. 5. The Filter tab helps you to choose the address types and data types from the symbol table that you want to enter as associated values. Set the required filters here. 6. Now select the box for associated value 1 in the SCAN Associated Values tab and click the Add button. Result:The symbol table is opened and displayed with the filter settings you made. 7. In the symbol table, select the row containing the address you want to add as an associated value (for example, M 1.0) and click the Add button. Result:The selected address is added to the "SCAN Associated Values tab as an associated value. 8. If you want to add a number of SCAN associated values, repeat steps 6 to 8 and then exit the message configuration dialog box with Save.
27-68
Result:In the symbol table displayed, all addresses which have a message allocated to them show a cross in the M column. 9. If you want to create more SCAN messages, repeat steps 2 to 8. Result:You have created standard messages that can be displayed on all display devices. 10. Add a new display device of the type "WinCC" by clicking the "New Device" button. Result:The new device is inserted and the corresponding tabbed section is displayed. 11. Enter attributes and texts for the display-specific message in the displayspecific tabs. Result:You have created a message variation that is only used as the message for the selected display device. 12. When you have finished configuring all your messages, click the Generate SDB button to save the configured data in one or more system data blocks. Result:All the data saved in the message configuration database are written in one or more SDBs. Note:If the "Generate SDB" button is not active, save the symbol table or click the "Save" button in the message configuration dialog box. 13. Exit the message configuration dialog box with Save. 14. In the appropriate S7 program in the SIMATIC Manager, select the "System Data" folder under "Blocks" which contains the generated SDBs and download the folder to the required CPU using the menu command PLC > Download. 15. Transfer the data you have configured.
27-69
Note If you want to cancel without inserting an associated value, exit the dialog box by clicking the "Cancel" button.
27-70
27.16.3 Creating and Editing User-Defined Diagnostic Messages 27.16.3.1 Creating User-Defined Diagnostic Messages
1. In the SIMATIC Manager, select the required S7 program and start the message configuration application using the menu command Edit > Special Object Properties > Message. 2. Select the displayed S7 program and click the "New Message" button on the right. Result:A new user-defined diagnostic message with the designation "WR_USMSG (<No.>)" is inserted and the "Identification" tab is displayed. 3. Fill out the "Identification" and "Text" tabs for a new message. Enter a message number if you do not want to use the number proposed by the system and enter a message name (identification) and the message text for the incoming and outgoing message.
27-71
Proceed as follows:
1. Put together a block of information starting with an @ symbol, containing a location designator and format code, and ending with another @ symbol. 2. Insert this block at the locations in the message text where the associated value is to be displayed.
Location Designator
This is a note telling you where the current information (such as a variable which can be controlled and monitored from a display device) can be found.
Format Code
This tells you the display format for the associated value on the display device. A format instruction is introduced by a "%" sign. The format codes permitted are those used in the respective programming language. In addition, there are format codes established for message texts.
Format Code Description
Hexadecimal number with i places Unsigned decimal number with i places Signed decimal number with i places Normalized floating-point number: Signed value of the form [ - ]d.dddd e [sign]ddd d: a single digit dddd: one or more digits ddd: three digits exactly sign: + or -
%E
As for format %e, but an upper case letter stands before the exponent (E instead of e).
27-72
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 is output before the 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.
27.16.4 Translating and Editing User Texts 27.16.4.1 Translating User Texts
To translate user texts, proceed as follows: 1. In the SIMATIC Manager, set the languages into which you want to translate the user texts using the menu command Options > Language for Display Devices... 2. In the dialog box Add/Delete Languages, Set Standard Language select the required language from the list of available languages and click the -> button to install this language as a new language in the project. For each new language you install, a new column is added to the list of user texts. 3. Repeat step 2. for all required languages and exit the dialog box with "OK." 4. In the SIMATIC Manager, select the object whose user texts you want to translate or edit and select the menu command Options > Translate Texts. Result:The list of user texts for the selected object is displayed in the selected languages. 5. Place the cursor in the field to receive the translation entry. Enter the text or make changes in an already existing text. The various options in the Edit menu are available here (such as Find, Replace, etc.). Note that you can only format the message texts for operator panels created in the message configuration application with the help of the buttons in the toolbar.
27-73
6. When you have finished translating and editing, save the texts using the menu command Texts > Save. 7. You can use the menu command Texts > Print to print out the texts. 8. Exit the function when you have translated or edited all the required texts by means of the menu command Texts > Exit.
27-74
27.16.5 Transferring Message Configuration Data to the Programmable Controller 27.16.5.1 Transferring the Configuration Data
The "Transfer PLC Data to Operator Station" wizard supports you when you transfer configuration data to WinCC. Proceed as follows: 1. Select the programmable controller type (for example, WinCC) and the operator stations to which you want to transfer the data. 2. Assign the S7 program in which you created the configuration data to the operator station on which you want the messages to be displayed. You can assign a number of S7 programs to one operator station or a number of operator stations to one S7 program. This means you have the possibility of displaying the messages on different operator stations. 3. Select the S7 program and use the right mouse button to select the menu command Select Network Connections. Select the network that is to be used for communication between the programmable controller and the operator station during runtime. 4. Select which S7 program is to be transferred and to which operator station you want to transfer the data. 5. Select the required transfer options here. You can choose from the following: Transfer Data: Select here which data you want to transfer. Size of Transfer: You can transfer all configuration data or only the modified configuration data to the operator station. If you choose the option All, you can also delete all previously transferred data at the same time (Clear operator station(s)). Comparison: Select this option to ensure that consistent data are transferred at the time of transfer. This is important if you have made changes between creating and transferring the data.
Note Note that running the comparison will increase the transfer time.
27-75
Create Logs: If you choose this option, a file is created that lists which WinCC tags are assigned to which picture objects and creates a log for the transfer of the configuration data. Compress: Click this button if you also want to physically delete all the tags marked as deleted. As an additional transfer option you can also choose which replacement character strategy you want to use. Refer here to the notes in the context-sensitive help for the dialog box. Here you can also set the origin for the message: HID; HID + chart name; HID + chart name + block name.
27-76
27-77
Note Note that the number of operator stations for which the data are to be transferred influences the duration of the transfer.
27-78
Note You should note that carrying out an update increases the transfer time. Create Logs: If you select this option, a file is created listing which WinCC variables are assigned to which picture objects, or a log is created for the transfer of the configuration data. Compress: Click this button if you want to physically delete the variables already marked as deleted. As an additional transfer option, you can choose which replacement character strategy is to be used. Note the information on the dialog box which is contained in the online help.
27-79
27-80
28.1
28-1
28.2
2. Select the menu command PLC > Operating Mode. The current mode is displayed in a dialog box. 3. Click the appropriate button to switch the operating mode. A button is deactivated (shown in paler color) if a change to that operating mode is not permitted in the current situation.
28-2
29.1
29-1
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.
29-2
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. For access to EPROM memory cards which are intended for an M7 programmable control system, the Flash File System must be installed (only possible on the PG 720, PG 740, and PG 760). EPROM drivers and the Flash File System 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).
3. Open or activate one of the following windows displaying the blocks you want to save: The following windows are possible: Project window, "ONLINE" view Project window, "offline" view Library window "Accessible Nodes" window
4. Select the "Blocks" folder or individual blocks and copy them to the "S7 Memory Card" window. 5. If a block already exists on the memory card, an error message is displayed. In this case, erase the contents of the memory card and repeat the steps from 2.
29-3
29.2
29-4
29-5
29.2.5 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.
Procedure
1. Select the S7 program in the "Accessible Nodes" window or the online view of the project. 2. Select the menu command PLC > 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.
29-6
29.3
2. Select the menu command PLC > Clear/Reset. 3. Confirm the memory reset in the dialog box which appears.
29-7
Note You can only erase EPROM memory cards on the programming device. With memory cards for S7 programmable controllers you can only erase the whole memory card, which means deleting all the blocks. You cannot delete individual blocks. With memory cards for M7 programmable control systems, the Flash File System makes it possible to delete individual objects.
Alternative procedure: 1. Insert the memory card in the slot of your programming device. 2. Select the menu command File > S7 Memory Card > Delete. In this way you can also erase memory cards which you cannot open.
29-8
30 Debugging
30.1
30-1
Debugging
Changing the Monitor Format for More Than One Row at a Time
1. Select the area in the table for which you want to change the monitor format by dragging the cursor across the area of the table while holding the left mouse button pressed. 2. Select the format with the menu command View > Select Monitor Format. Only those rows in the selected area of the table for which a format change is allowed are changed. Entering modify values influences the monitor formats you can select. The format used for modifying is also used for the display of monitor values.
30-2
Debugging
Menu Command to Show/Hide the Column (Always visible) View > Symbol View > Symbol Comment
Address Symbol Symbol Comment (this column is not displayed when you create a new variable table) Monitor Format Monitor Value Modify Value
View > Monitor Format View > Monitor Value View > Modify Value
Only those columns marked with a check mark in the "View" menu are displayed.
Automatic adjustment on entering: the column width adjusts itself automatically when you change the monitor format. Using the menu commands View > Optimize Column Widths or View > Select Monitor Format all the columns in the variable table are set to their optimum width.
30-3
Debugging
30.1.5 Pasting Areas from the Clipboard into the Variable Table
1. Position the cursor in the row of the variable table (VAT) at which you want to paste the area from the clipboard. 2. Paste the area from the clipboard with the menu command Edit > Paste.
30-4
Debugging
Note You cannot define a trigger while the Monitor or Modify functions are running. If necessary, stop the monitoring function with the menu command Variable > Monitor. Monitoring is deactivated when there is no check mark visible beside the Monitor menu command.
4. In the dialog box, define the trigger point and trigger frequency for monitoring variables. 5. Select the required trigger point and trigger frequency by clicking the appropriate option buttons. 6. Start the monitor function with the menu command Variable > Monitor. A check mark beside the command indicates that monitoring has started. 7. You can stop the Monitor function by selecting the menu command Variable > Monitor again. To define a new trigger, start again with step 3.
30-5
Debugging
Note You cannot define a trigger while the Monitor or Modify functions are running. If necessary, stop the modifying function with the menu command Variable > Modify. Modifying is deactivated when there is no check mark visible beside the Modify menu command.
4. Enter the fixed values for the variables you want to modify in the "Modify Value" column of the table. 5. Start the modify function with the menu command Variable > Modify. A check mark beside the command indicates that modifying has started. 6. If you want to assign new values, define a new trigger, or stop modifying the variables, deactivate the modify function by selecting the menu command Variable > Modify again. To define a new trigger, start again with step 3. To assign new values, start again with step 4.
30-6
Debugging
30-7
Debugging
30.1.14 Modifying the Peripheral Outputs when the CPU is in STOP Mode
The "enable peripheral outputs" function deactivates the output disable of the peripheral outputs (PQ). This enables you to modify the peripheral output when the CPU is in STOP mode. Proceed as follows: 1. Use the menu command Table > Open to open the variable table (VAT) that contains the I/O outputs you want to modify or activate the window for the relevant variable table. 2. Select the menu command PLC > Connect To > ... to establish a connection to the required CPU so you can modify the I/O outputs of the active variable table. 3. Open the "Operating Mode" dialog box with the menu command PLC > Operating Mode and switch the CPU to STOP mode. 4. Enter the appropriate values for the peripheral outputs you want to modify in the Modify Value" column. Examples: PQB 7 modify value: 2#00010011 PQW 2 W#16#0027 PQD 4 DW#16#00000001 5. Use the menu command Variable > Enable Peripheral Output to switch on the "Enable Peripheral Output" mode. 6. Use the menu command Variable > Activate Modify Values to modify the peripheral outputs. 7. "Enable Peripheral Output" remains active until you select the menu command Variable > Enable Peripheral Output again to switch off this function. 8. To assign new values, start again with step 4. Note The menu command Variable > Enable Peripheral Output is only relevant in STOP mode. The Enable Peripheral Output" Mode is exited by the following events: the CPU changes its operating mode (a message is displayed) the menu command Variable > Enable Peripheral Output is called again or by pressing the ESC key (no message is displayed)
30-8
Debugging
30-9
Debugging
30.2
30-10
Debugging
Status bit; bit 2 of the status word Bit 1 of the status word;
shows the result of a logic operation or a mathematical comparison Standard status Address register 1/2 Akku2 DB register 1/2 Indirect Content of a timer word, counter word, or accumulator 1 if corresponding instructions appear in the statement Content of the respective address register with register-indirect addressing (area-internal or area-crossing) Content of accumulator 2 Content of the data block register, of the first and/or second open data block Indirect memory reference; pointer reference (address), not address content reference;
for memory-indirect addressing only, not possible with registerindirect addressing Status word All status bits of the status word
30-11
Debugging
No condition
The call environment of the block to be tested is irrelevant. If you call the same block at different points in the program, however, you cannot distinguish for which call the status is displayed. Here you can specify the call path in which the block to be tested must be called to activate status recording. You can enter the last three call levels before reaching the test block. Here the call environment is specified by naming one or two data blocks. The status is recorded if the block to be tested was called with the specified data blocks.
Call path
30-12
Debugging
Procedure
1. Display the set test environment using the menu command Debug > Operation. 2. Select the required mode of operation. You can choose between test operation and process operation.
Mode of Operation Explanation
Test operation
All test functions are possible without restriction. Significant increases to the CPU scan cycle time can occur because, for example, the status of statements in programmed loops is recorded in every cycle.
Process operation
The test function program status is restricted to guarantee the minimum possible load on the scan cycle time. This means, for example, that no call conditions are permitted. The status display of a programmed loop is aborted at the point of return. The test functions HOLD and single-step program execution are not possible.
Note If the mode of operation was set when you assigned the CPU parameters, you can only change the mode by changing the parameters. Otherwise you can change the mode in the dialog box displayed.
30-13
Debugging
Alternative Procedure
1. Position the cursor on the address you want to modify. 2. Press the right mouse button and select the relevant modify command from the pop-up menu.
30-14
Debugging
30.3
3. Activate the breakpoint bar using the menu command View > Breakpoint Bar. 4. Position the cursor in the statement line in which you want to set a breakpoint. 5. Set the breakpoint using the menu command Debug > Set Breakpoint or using the corresponding button in the breakpoint bar. The statement line is marked with an empty circle. 6. Activate the breakpoint with the menu command Debug > Breakpoints Active. The breakpoint is then marked with a filled circle. 7. Switch the programmable controller to RUN-P. 8. When the program encounters the breakpoint, the programmable controller goes into HOLD mode. The breakpoint is marked with an arrow. The contents of the registers are displayed in a window that can be positioned anywhere on the screen. 9. To continue running the program up to the next breakpoint, select the menu command Debug > Resume or test in single-step mode using Debug > Execute Next Statement. 10. You can use the menu command Debug > Delete Breakpoint to delete the breakpoints individually, or you can delete all the breakpoints using the menu command Debug > Delete All Breakpoints.
30-15
Debugging
Note To view the call sequence, select the menu command PLC > Module Information in the SIMATIC Manager. To display the next breakpoint, select the menu command Debug > Show Next Breakpoint. The cursor jumps to the next selected breakpoint without the block being processed. When downloading to a programmable controller, the blocks that have breakpoints in the programmable controller are rejected. You can only download after you have deleted the breakpoints.
Note To view the call sequence, select the menu command PLC > Module Information in the SIMATIC Manager.
30-16
Debugging
30-17
Debugging
30-18
31 Diagnostics
31.1
31-1
Diagnostics
31.2
SIMATIC Manager (Online) Project Station CPU (6ES7 314-) Module Information S7 program
Note In the "Accessible Nodes" window, only the modules with their own node address (MPI or PROFIBUS address) are ever visible.
31-2
Diagnostics
Result
In both cases the "Module Information" dialog box is displayed. Depending on the diagnostics capability of the module, a varying number of tabs are displayed in the Module Information" dialog box. The General" tab is displayed for every module.
Note To gain a better overview of stations with many modules you can select the menu command PLC > Display Faulty Modules. A list of the faulty modules is then displayed in a dialog box. By selecting the required module and clicking the "Module Information" button you can open the "Module Information" tabbed dialog box.
2. Select a module in the configuration table and select the menu command PLC > Module Information or double-click the respective module. Result: In both cases the "Module Information" dialog box is displayed. Depending on the diagnostics capability of the module, a varying number of tabs are displayed in the Module Information" dialog box. The General" tab is displayed for every module.
31-3
Diagnostics
31.3
Note The diagnostic buffer stores all diagnostic events up to its maximum capacity. All events in the buffer are retained even if another user program is loaded. Therefore it is possible that older diagnostic buffer entries may refer to blocks which are no longer present in the CPU. In the worst case, there may be a new block in the CPU with the same name which did not, however, cause the diagnostic message. In rare cases, the following situations can occur: The diagnostic event is older than the date of the last block change: The Open Block" dialog box appears with the message that the block has been modified. This may also mean that the block is simply a block with the same name belonging to another program. You can still open the block online in the CPU and edit it if necessary, or You can select the block offline in the correct program and edit it offline.
-
The block that caused the event is no longer on the CPU: The Open Block" dialog box appears with the message that the referenced block does not exist in the CPU. The block was deleted after the time of the diagnostic event entry. You can select the block offline in the correct program and edit it offline.
31-4
Diagnostics
31-5
Diagnostics
31-6
32.1
How to Print
Note The view set for the display in the editor window is taken into account when printing. Logic blocks are printed in the currently displayed language representation (Ladder, FDB, or STL), data blocks are printed in the current view (declaration view or data view).
32-1
32-2
32-3
32-4
32-5
32-6
32-7
32.2
Archiving/Retrieving
32-8
32.2.4 Archiving
To archive a project or library, proceed as follows: 1. Make sure that no project windows are open showing the project you want to archive, or that the library you want to archive is closed. 2. Use the menu command File > Archive. 3. In the "Archive" dialog box, select the project or library you want to archive and confirm your entries. 4. In the dialog box which appears, set the target directory path for the archive file, the file name, and the file type. The file type is used to determine which archive program is required (for example, "ZIP for the archive program "PKZIP). 5. Another dialog box may be opened in which you can make more archive settings. Then a DOS window is opened in which the archive process can be seen running. The project/library is compressed and stored in the target directory.
32.2.5 Retrieving
To retrieve a project or library, proceed as follows: 1. Select the menu command File > Retrieve. 2. In the following dialog box, select the archive file which contains the compressed project or library and confirm your entries. 3. In the next dialog box, select the target directory into which data are to be retrieved. Then a DOS window is opened in which the retrieve process can be seen running.
32-9
32-10
33.1
33.2
33-1
33.3
33-2
Appendix
A.1
Operating Modes
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 nonretentive 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.
A-1
Appendix
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).
6.
2. 1. STOP 3.
A-2
Appendix
The table shows the conditions under which the operating modes can change.
Transition Description
1. 2.
After you turn on the power supply, the CPU is in STOP mode. The CPU changes to STARTUP mode: After the CPU is changed to RUN or RUN-P using the keyswitch 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 keyswitch must be set to RUN or RUN-P.
3.
The CPU changes back to STOP mode when: An error is detected during the startup. The CPU is changed to STOP by the keyswitch or on the programming device. A stop command is executed in the startup OB. The STOP communication function is executed.
4. 5.
The CPU changes to HOLD mode when a breakpoint is reached in the startup program. The CPU changes to STARTUP mode when the breakpoint in a startup program was set and the EXIT HOLD" command was executed (test functions). The CPU changes back to STOP mode when: The CPU is changed to STOP with the keyswitch or by the programming device. The STOP communication command is executed.
6.
7. 8.
If the startup is successful, the CPU changes to RUN. 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 keyswitch or on the programming device. A stop command is executed in the user program. The STOP communication function is executed.
9. 10.
The CPU changes to HOLD mode when a breakpoint is reached in the user program. The CPU changes to RUN mode when a breakpoint was set and the EXIT HOLD" command is executed.
A-3
Appendix
Highest
Lowest
RUN
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 non-configured connections.
A-4
Appendix
Memory Reset
The CPU memory can be reset in STOP mode. The memory can be reset manually using the keyswitch (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 run-time meters are not reset.
A-5
Appendix
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.
A-6
Appendix
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.
A manual hot restart can be triggered by the following: The mode selector The CRST/WRST must be set to WRST. The corresponding command on the programming device or by communication functions (mode selector set to RUN or RUN-P). When a manual hot restart is set in the parameter set of the CPU.
A-7
Appendix
A-8
Appendix
(Memory Battery
Card
or CPU
Data
DB in work memo ry
DB in work memory
DB in work memory
(defined as retentive ) VC VX
(defined as non-retentive) V
Warm restart on S7300 Warm restart on S7400 Cold restart on S7300 Cold restart on S7400 Hot restart on S7400
VC
---
VC
VC
---
Only
warm restart
permitted
A-9
Appendix
Startup Activities
The following table shows which activities are performed by the CPU during startup:
Activities in Order of Execution In Warm Restart In Cold Restart In Hot Restart
Clear I stack/B stack Clear non-retentive memory bits, timers, counters Clear all memory bits, timers, counters Clear process-image output table Clear outputs of digital signal modules Discard hardware interrupts Discard diagnostic interrupts Update the system status list (SZL) Evaluate module parameters and transfer to modules or transfer default values Execution of the relevant startup OB Execute remaining cycle (part of the user program not executed due to the power down) Update the process-image input table Enable digital outputs (cancel OD signal) after transition to RUN X means 0 means is performed is not performed
X X 0 X X X X X X X 0 X X
X 0 X X X X X X X X 0 X X
0 0 0 selectable selectable 0 X X X X X X X
A-10
Appendix
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 (warm restart or hot restart) is not executed or it is aborted in the following situations: The keyswitch 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.
A-11
Appendix
Sequence of Activities
The following figure shows the activities of the CPU during STARTUP and RUN:
STOP
Complete restart request Clear PI input/output table, peripheral I/Os, and non-retentive memory bits, timers, and counters
STARTUP
RUN
Complete restart OB
Enable the outputs Restart request Read process image input table Restart OB Execute user program
Output process image output table Delete process image output table and peripheral outputs (selectable)
STOP
yes
A-12
Appendix
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:
Type of Communication
Mode of CPU 1
Mode of CPU 2
RUN STOP/HOLD RUN STOP STOP/HOLD RUN STOP/HOLD RUN RUN STOP/HOLD RUN
X X
One-way communication with communication SFBs Two-way with communication SFBs One-way communication with communication SFCs
Two-way with communication SFCs RUN means data exchange is possible in both directions means data exchange is possible in only one direction X means data exchange is not possible
A-13
Appendix
A-14
Appendix
A.2
System memory (RAM) contains: Process-image input/output tables, bit memory, timers, counters Local data stack Block stack Interrupt stack Diagnostic buffer
Retentive load memory (FEPROM, on memory card or integrated in S7300 CPUs): contains the user program
A-15
Appendix
Programming device
S7-400 S7-300
Load memory Logic blocks Entire logic blocks Data blocks Entire data blocks Comments Symbols Saved on the hard disk
Work memory Parts of logic and data blocks relevant to program execution
Note Data blocks that are created in the user program with the help of system functions (for example, SFC22 CREAT_DB) are saved entirelyin 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.
A-16
Appendix
A-17
Appendix
RAM
Downloading and deleting individual blocks Downloading and deleting an entire S7 program Reloading individual blocks
Uploading the EPROM to the PG and inserting the memory card in the CPU Downloading the EPROM to the CPU
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).
A-18
Appendix
Input (bit)
At the beginning of the scan cycle, the CPU reads the inputs from the input modules and records the values in this area.
Input byte Input word Input double word Process image output table Output (bit)
IB IW ID Q During the scan cycle, the program calculates output values and places them in this area. At the end of the scan cycle, the CPU sends the calculated output values to the output modules.
Output byte Output word Output double word Bit memory Memory (bit)
QB QW QD M This area provides storage for interim results calculated in the program.
Memory byte Memory word Memory double word Timers Counters Data block Timer (T) Counter (C)
MB MW MD T C This area provides storage for timers. This area provides storage for counters. Data blocks contain information for the program. They can be defined for general use by all logic blocks (shared DBs) or they are assigned to a specific FB or SFB (instance DB).
DBX DBB
A-19
Appendix
Address Area
S7 Notation (IEC)
Description
DBW DBD
Data block, opened with DI "OPN DI": Data bit Data byte Data word Data double word Local data Local data bit DIX DIB DIW DID L This area contains the temporary data of a block while the block is being executed. The L stack also provides memory for transferring block parameters and for recording interim results from Ladder Logic networks.
Local data byte Local data word Local data double word Peripheral (I/O) area: Peripheral input byte
LB LW LD PIB The peripheral input and output areas allow direct access to central and distributed input and output modules (DP).
inputs Peripheral input word Peripheral input double word Peripheral (I/O) area: outputs Peripheral output byte PIW PID PQB
PQW
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, M7-400 Programmable Controllers, Module Specifications" Reference Manual "S7-300 Programmable Controller, Instruction List" "S7-400 Programmable Controller, Reference Guide"
A-20
Appendix
(10/98)
Startup program ... Read the inputs from the modules and update the data in the processimage input table Free scan cycle Execute the user program (OB1 and all the blocks called in it) Startup program ... Transfer the values of the processimage output table to the modules Read the inputs from the modules and update the data in the processimage input table Execute the user program (OB1 and all the blocks called in it) ... Free scan cycle
Transfer the values of the processimage output table to the modules ...
A-21
Appendix
Using SFCs
By using the following SFCs, the user program can update an entire processimage table or sections of a process-image table: SFC26 UPDAT_PI updates the process-image input table. SFC27 UPDAT_PO updates the process-image output table.
Note On S7-300 CPUs, inputs and outputs that are not used for the process-image tables can be used as additional bit memory areas. Programs that make use of this option cannot run on S7-400 CPUs.
A-22
Appendix
When you are programming organization blocks, you can declare temporary variables (TEMP) that are only available when the block is executed and are then overwritten again. Before you access the local data stack for the first time, the local data must be initialized. In addition to this, every organization block also requires 20 bytes of local data for its start information. The CPU has a limited amount of memory for the temporary variables (local data) of blocks currently being executed. The size of this memory area, the local data stack, is dependent on the CPU. The local data stack is divided up equally among the priority classes (default). This means that every priority class has its own local data area, thus guaranteeing that higher priority classes and their OBs also have space available for their local data.
A-23
Appendix
The following figure shows the assignment of local data to the priority classes in an example in which in the L stack OB1 is interrupted by OB10 which is then interrupted by OB81.
OB 81 Priority class 26
needs 20 bytes in the L Stack
SFC
L stack
OB 10 Priority class 2
needs 20 bytes in the L Stack
FB
Priority class 1
OB 1
needs 20 bytes in the L Stack
FB
FC
Caution 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.
A-24
Appendix
Using this data, the user program can then be resumed after the interrupt. If the CPU is in STOP mode, you can display the B stack with STEP 7 on a programming device. The B stack lists all the blocks that had not been completely executed when the CPU changed to STOP mode. The blocks are listed in the order in which processing was started (see figure below).
Order in which the blocks are called Block stack (B stack) Data of FC 3: Block number Return address Data of FC 2: Block number Return address Data of FB 1: Block number Return address DB and DI register: No. of open DB No. of open instance DB
FB1
FC2
FC3
Local data stack (L stack) The number of blocks that can be stored in the B stack (per priority class) depends on the CPU
Local data of FC 3
Local data of FC 2
Local data of FB 1
A-25
Appendix
2 99
99 2
100 1
The number of entries displayed in the diagnostic buffer is dependent on the module and its current operating mode. With some CPUs, it is possible to set the length of the diagnostic buffer.
A-26
Appendix
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.
A-27
Appendix
Work memory
System memory
CPU
To do this set the CPU so that the following data are saved in the non-volatile 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.
A-28
Appendix
A-29
Appendix
For more detailed information about defining retentive memory areas, refer to your "S7-400, M7-400 Programmable Controllers, Module Specifications" Reference Manual.
A-30
Appendix
A.3
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.
Format Size in Bits Number Notation
A-31
Appendix
L B#16#10 L byte#16#10 L 2#0001_0000_0000_0000 L W#16#1000 L word16#1000 L C#998 L B#(10,20) L byte#(10,20) 2#1000_0001_0001_1000_ 1011_1011_0111_1111 L DW#16#00A2_1234 L dword#16#00A2_1234 L B#(1, 14, 100, 120) L byte#(1,14,100,120) L1 L L#1 L 1.234567e+13
16
32
Hexadecimal number Decimal number unsigned Decimal number signed Decimal number signed IEEE Floating-point number S7 time in steps of 10 ms (default) IEC time in steps of 1 ms, integer signed IEC date in steps of 1 day Time in steps of 1 ms ASCII characters
2#0 to 2#1111_1111_1111_1111 1111_1111_1111_1111 DW#16#0000_0000 to DW#16#FFFF_FFFF B#(0,0,0,0) to B#(255,255,255,255) -32768 to 32767 L#-2147483648 to L#2147483647 Upper limit: 3.402823e+38 Lower limit: 1.175 495e-38 S5T#0H_0M_0S_10MS to S5T#2H_46M_30S_0MS and S5T#0H_0M_0S_0MS -T#24D_20H_31M_23S_648MS to T#24D_20H_31M_23S_647MS D#1990-1-1 to D#2168-12-31 TOD#0:0:0.0 to TOD#23:59:59.999 A,B etc.
INT (Integer) DINT (Integer, 32 bits) REAL (Floating-point number) S5TIME (SIMATIC time) TIME (IEC time) DATE (IEC date) TIME_OF_DAY (Time) CHAR (Character)
16 32 32
16
32 16 32 8
A-32
Appendix
Bits
15 0 0 Sign
12 11 0 0 0
8 0
7 0 0
4 0 +
3 1
0 0
Decimal values: 32
8 + 4 = 44
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.
Bits 31
28 27
24 23
20 19
16 15
12 11
8 7
4 3
1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 Sign
A-33
Appendix
The three components together occupy one double word (32 bits):
Bit 31 S
28 27 e
24 23
20 19
16 15
12 11 f
8 7
4 3
Sign (1 bit)
Exponent: e (8 bits)
A-34
Appendix
The following table shows the values of the individual bits in floating-point format. Component of the Floating-Point Number Sign S Exponent e ... Exponent e Exponent e Mantissa m ... Mantissa m Mantissa m Bit Number 31 30 ... 24 23 22 ... 1 0 2 to the power of 7 ... 2 to the power of 1 2 to the power of 0 2 to the power of 1 ... 2 to the power of 22 2 to the power of 23 Value
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.
The number zero is represented with e = m = 0; e = 255 and m = 0 stands for "infinite."
Format Range
1)
3.402 823E+38 to 1.175 495E38 and 0 and +1.175 495E38 to +3.402 823E+38
A-35
Appendix
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: Invalid Range for a Result -1.175494E-38 < result < -1.401298E-45 (negative number) underflow +1.401298E-45 < result < +1.175494E-38 (positive number) underflow Result < -3.402823E+38 (negative number) overflow Result > 3.402823E+38 (positive number) overflow Not a valid floating-point number or invalid instruction (input value outside the valid value range) CC1 0 0 0 1 1 0 0 1 0 1 CC0 1 1 1 1 1 OV 1 1 1 1 1 OS
Note when using mathematical operations: The result "Not a valid floating-point number" is obtained, for example, when you attempt to extract the square root from 2. You should therefore always evaluate the status bits first in math operations before continuing calculations based on the result. Note when modifying variables: If the values for floating-point operations are stored in memory double words, for example, you can modify these values with any bit patterns. However, not every bit pattern is a valid number.
A-36
Appendix
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: 100 000 000 + 1 = 100 000 000.
The number 10.0 in the first example results from its floating-point format (hexadecimal representation: 4120 0000) as follows: e = 2 to the power of 1 + 2 to the power of 7 = 2 + 128 = 130 m = 2 to the power of (-2) = 0.25 This results in: 1.m 2 to the power of (e bias) = 1.25 2 to the power of (130 127) = 1.25 2 to the power of 3 = 10.0.
A-37
Appendix
0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sign of Exponent: e Mantissa: m Mantissa: s (8 bits) (23 bits) (1 bit) f = 2-2 = 0.25 e = 27 + 21 = 130 1.f _ 2e-bias = 1.25 _ 23 = 10.0 [1.25 _ 2(130-127) = 1.25 _ 23 = 10.0] Decimal value 3.141593 Hexadecimal value 4 Bits 31 28 27 0 24 23 4 20 19 9 16 15 0 12 11 F 8 7 D 4 3 C 0
0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 1 1 0 0
0 0 1 1 1 1 1 1 1 0 1 1 0 1 0 1 0 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1
Exponent: e (8 bits)
A-38
Appendix
A.3.2.5 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 BCD-coded addresses only evaluate the highest-value 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 (16 bits, three-digit BCD number with sign) Double word (32 bits, seven-digit BCD number with sign)
999 to +999
The following figures provide an example of a binary coded decimal number in the following formats: Word format
Hundreds (102)
Tens (101)
Ones (100)
-9 999 999 (Decimal format) Bits 31 28 27 24 1 1 1 1 1 0 0 1 Sign Millions (106) 23 20 1 0 0 1 Hundreds of Thousands (105) 19 16 15 12 11 8 7 4 3 0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 Tens of Thousands Hundreds Tens Ones (103) (102) (101) (100) Thousands (104)
A-39
Appendix
...8 1
7... 0 0 2 1 0 0 1 7 1
...0 1
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
Time Base Binary Code for Time Base
10 ms 100 ms 1s 10 s
00 01 10 11
You can pre-load 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 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.
1)
The maximum time value that you can enter is 9,990 seconds, or 2H_46M_30S.
1)
A-40
Appendix
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.
Data Type Description
DATE_AND_TIME DT STRING
Defines an area with 64 bits (8 bytes). This data type saves in binary coded decimal format: Defines a group with a maximum of 254 characters (data type CHAR). The standard area reserved for a character string is 256 bytes long. This is the space required to save 254 characters and a header of 2 bytes. You can reduce the memory required for a string by defining the number of characters that will be stored in the character string (for example: string[9] Siemens). Defines a multi-dimensional grouping of one data type (either elementary or complex). For example: ARRAY [1..2,1..3] OF INT" defines an array in the format 2 x 3 consisting of integers. You access the data stored in an array using the Index ([2,2]"). You can define up to a maximum of 6 dimensions in one array. The index can be any integer (-32768 to 32767). Defines a grouping of any combination of data types. You can, for example, define an array of structures or a structure of structures and arrays. Simplifies the structuring of large quantities of data and entering data types when creating data blocks or declaring variables in the variable declaration. In STEP 7, you can combine complex and elementary data types to create your own user-defined" data type. UDTs have their own name and can therefore be used more than once. You determine the structure of the assigned instance data block and allow the transfer of instance data for several FB calls in one instance DB.
ARRAY
STRUCT UDT
FB, SFB
Structured data types are saved in accordance with word limits (WORD aligned).
A-41
Appendix
The following special IEC (International Electrotechnical Commission) standard functions are available for working with the DATE_AND_TIME data type: Convert date and time of day to the DATE_AND_TIME format FC3: D_TOD_DT Extract the date from the DATE_AND_TIME format FC6: DT_DATE Extract the day of the week from the DATE_AND_TIME format FC7: DT_DAY Extract the time of day from the DATE_AND_TIME format FC8: DT_TOD
A-42
Appendix
The following table shows the contents of the bytes that contain the date and time information for the example Thursday, December 25, 1993, at 8:01 and 1.23 seconds in the morning.
Byte Contents Example
0 1 2 3 4 5 6
Year Month Day Hour Minute Second Two most significant digits of MSEC
7 Two least significant digits of MSEC (4MSB) 7 (4LSB) Day of week 1 = Sunday 2 = Monday ... 7 = Saturday
B#16#5
The permitted range for the data type DATE_AND_TIME is: min.: DT#1990-1-1-0:0:0.0 max.: DT#2089-12-31-23:59:59.999
Possible Value Range BCD Code
Year
90h 99h 90h 99h 01h 12h 01h 31h 00h 23h 00h 59h 00h 59h 000h 999h 1h 7h
A-43
Appendix
The following figure shows how arrays and structures can structure data types in one area and save information. You define an array or a structure either in a DB or in the variable declaration of an FB, OB, or FC.
Structures STRUCT INT BYTE CHAR REAL BOOL Integer Byte Character Real number Boolean value Arrays
A-44
Appendix
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 three-dimensional 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].
Name Op_Temp
Init. Value
Comment
A-45
Appendix
Example 2
An array can also describe a multi-dimensional group of data types. The following figure shows a two-dimensional array of integers.
1,1 1,2 Op_Temp = ARRAY [1..2,1..3] INTEGER 1,3 2,1 2,2 2,3
You access the data in a multi-dimensional 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 six-dimensional 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.
Name Heat_2x3
Comment
A-46
Appendix
If you use the array declared in the above figure, you can specify the initial value for all six elements as follows: 17, 23, -45, 556, 3342, 0. You could also set the initial value of all six elements to 10 by specifying 6(10). You could specify specific values for the first two elements and then set the remaining four elements to 0 by specifying the following: 17, 23, 4(0).
A-47
Appendix
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.
STRUCT INT BYTE CHAR REAL BOOL Integer Byte Character Real number Boolean value
A structure can be nested to a maximum of 8 levels (for example, a structure consisting of structures containing arrays).
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).
120 FALSE
A-48
Appendix
A-49
Appendix
UDT20 INT BYTE CHAR REAL BOOL Integer Byte Character Real number Boolean value
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.
120 FALSE
A-50
Appendix
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.
Name Process_data_1
If you declare a variable as a UDT, the initial values of the variables are the values you specified when you created the UDT.
A-51
Appendix
DB17 "DARK_BLUE"
DB22 "LIGHT_BLUE"
DB 23 "TURQUOISE"
The structure of the data block is determined by the UDT assigned to it.
A-52
Appendix
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 user-defined data type (UDT). For more information about UDTs, refer to the section "Using User-Defined Data Types to Access Data".
Parameter Capacity Description
TIMER
2 bytes
Indicates a timer to be used by the program in the called logic block. Format: T1
COUNTER
2 bytes
Indicates a counter to be used by the program in the called logic block. Format: C10
2 bytes
Indicates a block to be used by the program in the called logic block. Format: FC101 DB42
6 bytes
ANY
10 bytes
Is used when the data type of the current parameter is unknown. Format: P#M50.0 BYTE 10 P#M100.0 WORD 5
A-53
Appendix
Bits 15 0 0 0 0 0 0 0
8 0
7 0 0 0 0 0 1 0
0 1
Byte 0
Byte 1
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, M7-400 Programmable Controllers, Hardware and Installation Manual."
Pointer format 15... Byte 0 Byte 2 Byte 4 b ...8 7... DB number (or 0) Memory area b b b b b b b 0 b 0 b 0 b 0 b 0 b b x b x b x ...0 Byte 1 Byte 3 Byte 5
b = Byte address
x = Bit address
A-54
Appendix
The parameter type POINTER stores the following information: DB number (or 0 if the data are not stored in a DB) Memory area in the CPU (the following table shows the hexadecimal codes of the memory areas for the parameter type POINTER)
Hexadecimal Code Memory Area Description
I Q M DB DI L
Input area Output area Bit memory area Data block Instance data block Local data (L stack) Previous local data
Address of the data (in the format Byte.Bit) STEP 7 provides the pointer format: p#memory_area byte.bit_address. (If the formal parameter was declared as the parameter type POINTER, you only need to indicate the memory area and the address. STEP 7 automatically reformats your entry into pointer format.) The following examples show how you enter the parameter type POINTER for the data that start at M50.0:
A-55
Appendix
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.
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.
A-56
Appendix
The area information of the pointer is not influenced by the function. The FC intercepts an overflow/underflow of the pointer. In this case the pointer is not changed and the output variable "RET_VAL" (error handling possible) is set to "1" (until the next correct processing of FC3). This is the case where: 1. Bit address is selected and Inc_Value >7, or <-7 2. Bit or byte address is selected and the change would result in a "negative" byte address 3. Bit or byte address is selected and the change would result in an illegally large byte address.
A-57
Appendix
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 R L T L T ; //Set RLO to 1 and #RET_VAL; //reset overflow #Pointer; //Supply value to temporary #Pointer1; //interim value pointer #Inc_Value; //Supply value of temporary #Inc_Value1; //interim value increment
A-58
Appendix
#Bit_Byte; //If =1, byte address instruction Byte; //Jump to byte address calculation 7; //If value of increment > 7, #Inc_Value1; ; #RET_VAL; //then set RET_VAL and End; //jump to End -7; //If value of increment < -7, ; #RET_VAL; //then set RET_VAL and End; //jump to End L 1.3; //If bit 4 of the value = 1 (Inc_Value negative)
neg; //then jump to bit address subtraction #Pointer1; //Load pointer address information #Inc_Value1; //and add the increment ; test; //Jump to test for negative result L #Pointer1; //Load pointer address information
#Inc_Value1; //Load the increment ; //Negate the negative value, ; //subtract the value test; //and jump to test L 0; //Start of byte address change
#Inc_Value1; //If increment >=0, then ; pos; //jump to addition, otherwise #Pointer1; //Load pointer address information, #Inc_Value1; //load the increment, ; //negate the negative value, 3; //shift the increment 3 digits to the left, ; //subtract the value, test; //and jump to test SLD 3; //Shift the increment 3 digits to the left
A-59
Appendix
test: A S JC L T End:
T L
#Int_Value; //Transfer results of calculation to Int_Value 7.3; //If invalid byte address (too large or
#RET_VAL; //negative), then set RET_VAL End; //and jump to End, #Int_Value; //otherwise transfer result #Pointer; //to pointer NOP 0;
END_FUNCTION
Data from elementary and complex data types ...8 7... 15... Byte 0 Byte 2 Byte 4 Byte 6 Byte 8 b 10h for S7 Repetition factor DB number (or 0) Memory area b b b b b b b 0 b 0 b 0 b 0 b 0 b b x b x Data type
b = Byte address
x = Bit address
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.
Programming with STEP 7 V5.0 C79000-G7076-C562-02
A-60
Appendix
STEP 7 identifies arrays and structures as a number (with the help of the repetition factor) of bytes. If, for example, 10 words are to be transferred, the value 20 (bytes) must be entered for the repetition factor. 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 table shows the coding of the data types for the parameter type ANY.
Hexadecimal Code Data Type Description
b#16#00 b#16#01 b#16#02 b#16#03 b#16#04 b#16#05 B#16#06 b#16#07 b#16#08 b#16#09 b#16#0A b#16#0B b#16#0C b#16#0E b#16#13
NIL BOOL BYTE CHAR WORD INT DWORD DINT REAL DATE TIME_OF_DAY (TOD) TIME S5TIME
Null pointer Bits Bytes (8 bits) Characters (8 bits) Words (16 bits) Integers (16 bits) Words (32 bits) Double integers (32 bits) Floating-point numbers (32 bits) Date Time of day Time Data type S5TIME
A-61
Appendix
Data from parameter types (timers, counters, blocks) 15... ...8 7... Byte 0 Byte 2 Byte 4 Byte 6 Byte 8 Data type 10h for S7 Data type
Repetition factor = 1 0 0 0 0 0 0 0 0 0
Byte 7 Byte 9
The following tables show the coding of the data types and memory areas for the parameter type ANY for parameter types.
Coding of the Data Types Hexadecimal Code Data Type Description
Coding of the Memory Areas Area Description I Input area Q Output area M Bit memory area DB Data block DI Instance data block L Local data (L stack) V Previous local data
A-62
Appendix
A-63
Appendix
FB10
with DB10
Variable declaration STAT Speed INT FC100 Variable declaration IN IN FB11 with DB20 IN Variable declaration TEMP Thermo ARRAY [1..3] REAL FC100 #Thermo M 1.3 T2 in_par1 in_par2 in_par3 in_par1 in_par2 in_par3 ANY ANY ANY
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 FC10, FB11 transfers an array of real numbers (the temporary variable "Thermo"), a Boolean value (M 1.3), and a timer (T2).
A-64
Appendix
Repetition Factor
For the data type element, you can specify all elementary data types and the data type DATE_AND_TIME in the format for constants. If the data type is not BOOL, the bit address of 0 (x.0) must be specified. The following table illustrates examples of the format for specifying memory areas to be transferred to an ANY parameter.
Actual Parameter Description
p# M 50.0 BYTE 10
p# DB10.DBX5.0 S5TIME 3 Specifies 3 units of data of the data type S5TIME, that are located in DB10: DB byte 5 to DB byte 10. p# Q 10.0 BOOL 4 Specifies 4 bits in the output area: Q 10.0 to Q 10.3.
A-65
Appendix
STL FUNCTION FC10: VOID VAR_TEMP Source : ANY; Target : ANY; END_VAR BEGIN LAR1 P#Source; L T L T L T L T L T B#16#10; LB[AR1,P#0.0]; B#16#02; LB[AR1,P#1.0]; 10; LW[AR1,P#2.0]; 22; LW[AR1,P#4.0]; P#DBX11.0; LD[AR1,P#6.0]; P#Target;
Explanation
Load the start address of the ANY pointer in AR1. Load the syntax ID and transfer it to the ANY pointer. Load data type Byte and transfer it to the ANY pointer. Load 10 bytes and transfer them to the ANY pointer. Source is DB22, DBB11
LAR1 L T L T L T L T L T
Load the start address of the ANY pointer in AR1. Load the syntax ID and transfer it to the ANY pointer. Load data type Byte and transfer it to the ANY pointer. Load 10 bytes and transfer them to the ANY pointer. Target is DB33, DBB202
B#16#10; LB[AR1,P#0.0]; B#16#02; LB[AR1,P#1.0]; 10; LW[AR1,P#2.0]; 33; LW[AR1,P#4.0]; P#DBX202.0; LD[AR1,P#6.0];
Call the system function BLKMOV CALL SFC 20 ( SRC BLK := Source, Evaluate the BR bit and MW12 RET_VAL := MW 12, DSTBLK := Target ); END FUNCTION
A-66
Appendix
Parameter Type
COUNTER
Parameter Type
BLOCK
l1
l1
l1
A-67
Appendix
Temporary 1 Stored as a reference (48-bit pointer) in the instance data block. 2 Located in the L stack of the FB.
l l l l l2
l l l1 l l2
l2
l l l
l l l
l l l
l l l
l1
A-68
Appendix
l l l
l l l
Complex Data Types
l l l
Declaration Type
Absolute Address
Symbolic Name of the DB Temporary Local Element Symbol (in the Symbol Table)
Constant
l l l
l l l
A-69
Appendix
Function (FC) -------- Call ---------- Function (FC) FC10 Variable declaration Param_1 Param_2 Param_3 Input Output In/out FC12 Variable declaration A_Param B_Param C_Param Input Output In/out
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 (l) when one FC calls another FC.
Declaration Type Elementary Complex Parameter Parameter Parameter Parameter Parameter Data Types Data Types Type Type Type Type Type TIMER COUNTER BLOCK POINTER ANY
Input Input Input Output Input In/out Output Input Output Output Output In/out In/out Input In/out Output In/out In/out
l l l
A-70
Appendix
Function Block (FB) ------------- Call ------------- Function (FC) FB10 with DB10 FC12 Variable declaration A_Param B_Param C_Param Input Output In/out
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 (l) when an FB calls an FC.
Declaration Type Elementary Complex Parameter Parameter Parameter Parameter Parameter Data Types Data Types Type Type Type Type Type
TIMER
Input Input Input Output Input In/out Output Input Output Output Output In/out In/out Input In/out Output In/out In/out
COUNTER
BLOCK
POINTER
ANY
l l l
A-71
Appendix
Function (FC) ------------ Call ----------- Function Block (FB) FC10 Variable declaration Param_1 Param_2 Param_3 Input Output In/out FB12 with DB11
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 (l) when an FC calls an FB.
Declaration Type Elementary Data Types Complex Data Types Parameter Parameter Parameter Parameter Parameter Type Type Type Type Type TIMER COUNTER BLOCK POINTER ANY
Input Input Input Output Input In/out Output Input Output Output Output In/out In/out Input In/out Output In/out In/out
l l l
A-72
Appendix
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.
Function Block (FB) ---------- Call ---------- Function Block (FB) FB10 with DB10 FB12 with DB11
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 (l) when an FB calls another FB.
Declaration Type Elementary Complex Parameter Parameter Parameter Parameter Parameter Data Types Data Types Type Type Type Type Type
TIMER
Input Input Input Output Input In/out Output Input Output Output Output In/out In/out Input In/out Output In/out In/out
COUNTER
BLOCK
POINTER
ANY
l l l
A-73
Appendix
A.4
The configuration of the hardware is not converted. You can copy the program components contained in the project to other projects. You can also add a station to the new project and configure and assign parameters to it.
A-74
Appendix
Once you have converted to version 2 you can decide in a dialog box whether you now want to convert this version 2 project to a project in your current STEP 7 version.
Note The individual blocks stay as version 1 blocks as regards their properties. The code generated in version 1 is not changed and the blocks cannot therefore be used in conjunction with multiple instances. If you want to declare multiple instances in the converted blocks, generate STL source files from the converted blocks first using the "LAD/STL/FBD: Programming Blocks" application and then compile them back into blocks. Programming multiple instances is a new feature of STEP 7 version 2 used to create function blocks (FB). If you want to continue using function blocks created with version 1 in the same way in a version 2 project, you do not need to convert them.
Procedure
To convert version 1 projects, proceed as follows: 1. Select the menu command File > Open Version 1 Project. 2. In the dialog box which appears, select the version 1 project which you want to use in version 2. You recognize a version 1 project by its extension *.s7a. 3. Then, in the next dialog box, enter the name of the new project to which you want the version 1 project to be converted.
A-75
Appendix
File type of the current version File type of the older version
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.
A-76
Appendix
A-77
Appendix
A.5
Sample Programs
"S7-Mix" project (industrial blending process) "GS-*" project (first steps and exercises) "S7-Zebra" project (traffic signal control at a zebra crossing) "COM_SFB" project (data exchange between two S7-400 CPUs) "COM_SFC1" and "COM_SFC2" project (data exchange using communication SFCs for nonconfigured connections) Example of handling time-of-day interrupts Example of handling time-delay interrupts Example of masking and unmasking synchronous errors Example of disabling and enabling interrupts and asynchronous errors Example of the delayed processing of interrupts and asynchronous errors
Separate Manual
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.
A-78
Appendix
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 overwitten 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.
A-79
Appendix
A.5.2 Sample Program for an Industrial Blending Process A.5.2.1 Sample Program for an Industrial Blending Process
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.
Area: Ingredient A
M M
Area: Ingredient B
M M
Inlet valve
Feed pump
Feed valve
Area: Drain
M Drain valve
A-80
Appendix
A-81
Appendix
Tank not empty: a normally open contact. If the tank is not empty, the contact is closed.
Drain area:
Drainage of the tank is controlled by a solenoid valve. The solenoid valve is controlled by the operator, but must be closed again at the latest when the tank empty" signal is generated. Opening the drain valve is interlocked when the agitator motor is running the tank is empty
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.
A-82
Appendix
OB 1
Feed pump ingredient A
DB 1
Ingredient A
FB1
Feed pump ingredient B Motor
DB 2
Ingredient B
DB 3
Agitator motor Agitator motor
FC1
Feed valves A and B Valves
Drain valve
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.
A-83
Appendix
BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL
Starts the feed pump for ingredient A Stops the feed pump for ingredient A Ingredient A flowing Activates the inlet valve for ingredient A Activates the feed valve for ingredient A Lamp for feed pump ingredient A running" Lamp for feed pump ingredient A not running" Activates the feed pump for ingredient A Lamp for feed pump A fault" Lamp for feed pump A maintenance" Starts the feed pump for ingredient B Stops the feed pump for ingredient B Ingredient B flowing Activates the inlet valve for ingredient A Activates the feed valve for ingredient B Lamp for feed pump ingredient B running" Lamp for feed pump ingredient B not running" Activates the feed pump for ingredient B Lamp for feed pump B fault" Lamp for feed pump B maintenance" Response signal of the agitator motor Agitator start button Agitator stop button Activates the agitator Lamp for "agitator running" Lamp for "agitator not running"
Feed_pump_A_main Q4.6 t Feed_pump_B_start Feed_pump_B_stop Flow_B Inlet_valve_B Feed_valve_B Feed_pump_B_on Feed_pump_B_off Feed_pump_B Feed_pump_B_fault I0.3 I0.4 I0.5 Q5.0 Q5.1 Q5.2 Q5.3 Q5.4 Q5.5
Feed_pump_B_main Q5.6 t Agitator_running Agitator_start Agitator_stop Agitator Agitator_on Agitator_off I1.0 I1.1 I1.2 Q8.0 Q8.1 Q8.2
A-84
Appendix
Symbolic Addresses for Feed Pump, Agitator Motor, and Inlet Valves Symbolic Name Address Data Type Description
Agitator_fault Agitator_maint
Q8.3 Q8.4
BOOL BOOL
Lamp for agitator motor fault" Lamp for agitator motor maintenance"
Symbolic Addresses for Sensors and Displaying the Level of the Tank Symbolic Name Address Data Type Description
Sensor mixing tank not full" Sensor mixing tank above minimum level" Sensor mixing tank not empty" Lamp for "mixing tank full" Lamp for "mixing tank below minimum level" Lamp for "mixing tank empty"
Symbolic Addresses for the Drain Valve Symbolic Name Address Data Type Description
Button for opening the drain valve Button for closing the drain valve Activates the drain valve Lamp for "drain valve open" Lamp for "drain valve closed"
Symbolic Addresses for the Other Program Elements Symbolic Name Address Data Type Description
EMERGENCY STOP switch Reset switch for the maintenance lamps on all motors FB for controlling pumps and motor FC for controlling the valves Instance DB for controlling feed pump A Instance DB for controlling feed pump B Instance DB for controlling the agitator motor
A-85
Appendix
Motor
A-86
Appendix
These requirements can be specified as inputs and outputs to the FB. The following table shows the parameters of the FB for the motor in our sample process.
Parameter Name Input n n n n n n n n n n n Output In/Out
Start Stop Response Reset_maint Timer_No Response_Time Fault Start_Dsp Stop_Dsp Maint Motor
A-87
Appendix
0.0 0.1 0.2 0.3 2.0 4.0 6.0 6.1 6.2 6.3 8.0 10.0 12.0 14.0 16.0
Start Stop Response Reset_Maint Timer_No Response_Time Fault Start_Dsp Stop_Dsp Maint Motor Time_bin Time_BCD Starts Start_Edge
BOOL BOOL BOOL BOOL TIMER S5TIME BOOL BOOL BOOL BOOL BOOL WORD WORD INT BOOL
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.
A-88
Appendix
2 Startup monitoring
lab1: NOP 0
A-89
Appendix
Network 6 Maintenance lamp L L >=I = A A JCN L T #Starts 50 #Maint #Reset_Maint #Maint END 0 #Starts 0
END: NOP
The following table shows the parameters that must be transferred to the FC.
Parameters for the Valves Input Output In/Out
A-90
Appendix
Dsp_Open Dsp_Closed
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.
A-91
Appendix
The program uses the FB for the motor with different instance DBs to handle the tasks for controlling the feed pumps and the agitator motor.
A-92
Appendix
0.0 1.0 2.0 3.0 4.0 5.0 6.0 8.0 10.0 12.0
TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP
OB1_EV_CLASS OB1_SCAN1 OB1_PRIORITY OB1_OB_NUMBR OB1_RESERVED_1 OB1_RESERVED_2 OB1_PREV_CYCLE OB1_MIN_CYCLE OB1_MAX_CYCLE OB1_DATE_TIME
BYTE BYTE BYTE BYTE BYTE BYTE INT INT INT DATE_AND_
TIME 20.0 20.1 20.2 20.3 20.4 20.5 20.6 20.7 21.0 21.1 21.2 21.3 21.4 21.5 21.6 TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP Enable_motor Enable_valve Start_fulfilled Stop_fulfilled Inlet_valve_A_open Inlet_valve_A_closed Feed_valve_A_open Feed_valve_A_closed Inlet_valve_B_open Inlet_valve_B_closed Feed_valve_B_open Feed_valve_B_closed Open_drain Close_drain Valve_closed_fulfilled BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL
A-93
Appendix
OB 1
Feed pump ingredient A FB 1 Instance DB 1 Inlet valve A FC 1
Feed valve A
FC 1
Operating system
FB 1 Instance DB 2
Inlet valve B
FC 1
Feed valve B
FC 1
Agitator motor
FB 1 Instance DB 3
Drain valve
FC 1
A-94
Appendix
The code section of OB1 appears as shown below in the STL programming language: Network 1 Interlocks for feed pump A A A AN = "EMER_STOP_off" "Tank_below_max" "Drain" #Enable_Motor
Network 2 Calling FB Motor for ingredient A A "Feed_pump_A_start" A #Enable_Motor = #Start_Fulfilled A( O "Feed_pump_A_stop" ON #Enable_Motor ) = #Stop_Fulfilled CALL "Motor_block", "DB_feed_pump_A" Start :=#Start_Fulfilled Stop :=#Stop_Fullfilled Response :="Flow_A" Reset_Maint :="Reset_maint" Timer_No :=T12 Reponse_Time:=S5T#7S Fault :="Feed_pump_A_fault" Start_Dsp :="Feed_pump_A_on" Stop_Dsp :="Feed_pump_A_off" Maint :="Feed_pump_A_maint" Motor :="Feed_pump_A" Network 3 Delaying the valve enable ingredient A A L SD AN R A = "Feed_pump_A" S5T#1S T 13 "Feed_pump_A" T 13 T 13 #Enable_Valve
Network 4 Inlet valve control for ingredient A AN "Flow_A" AN "Feed_pump_A" = #Close_Valve_Fulfilled CALL "Valve_block" Open :=#Enable_Valve Close :=#Close_Valve_Fulfilled Dsp_Open :=#Inlet_Valve_A_Open Dsp_Closed:=#Inlet_Valve_A_Closed Valve :="Inlet_Valve_A" Network 5 Feed valve control for ingredient A AN AN = "Flow_A" "Feed_pump_A" #Close_Valve_Fulfilled
A-95
Appendix
CALL "Valve_block" Open :=#Enable_Valve Close :=#Close_Valve_Fulfilled Dsp_Open :=#Feed_Valve_A_Open Dsp_Closed:=#Feed_Valve_A_Closed Valve :="Feed_Valve_A" Network 6 Interlocks for feed pump B A A AN = "EMER_STOP_off" "Tank_below_max" "Drain" "Enable_Motor
Network 7 Calling FB Motor for ingredient B A "Feed_pump_B_start" A #Enable_Motor = #Start_Fulfilled A( O "Feed_pump_B_stop" ON #Enable_Motor ) = #Stop_Fulfilled CALL "Motor_block", "DB_feed_pump_B" Start :=#Start_Fulfilled Stop :=#Stop_Fullfilled Response :="Flow_B" Reset_Maint :="Reset_maint" Timer_No :=T14 Reponse_Time:=S5T#7S Fault :="Feed_pump_B_fault" Start_Dsp :="Feed_pump_B_on" Stop_Dsp :="Feed_pump_B_off" Maint :="Feed_pump_B_maint" Motor :="Feed_pump_B" Network 8 Delaying the valve enable ingredient B A L SD AN R A = "Feed_pump_B" S5T#1S T 15 "Feed_pump_B" T 15 T 15 #Enable_Valve
Network 9 Inlet valve control for ingredient B AN "Flow_B" AN "Feed_pump_B" = #Close_Valve_Fulfilled CALL "Valve_block" Open :=#Enable_Valve Close :=#Close_Valve_Fulfilled Dsp_Open :=#Inlet_Valve_B_Open Dsp_Closed:=#Inlet_Valve_B_Closed Valve :="Inlet_Valve_B" Network 10 AN "Flow_B" Feed valve control for ingredient B
A-96
Appendix
AN "Feed_pump_B" = #Close_Valve_Fulfilled CALL "Valve_block" Open :=#Enable_Valve Close :=#Close_Valve_Fulfilled Dsp_Open :=#Feed_Valve_B_Open Dsp_Closed:=#Feed_Valve_B_Closed Valve :="Feed_Valve_B" Network 11 A A AN = Interlocks for agitator "EMER_STOP_off" "Tank_above_min" "Drain" #Enable_Motor Calling FB Motor for agitator
Network 12
A "Agitator_start" A #Enable_Motor = #Start_Fulfilled A( O "Agitator_stop" ON #Enable_Motor ) = #Stop_Fulfilled CALL "Motor_block", "DB_Agitator" Start :=#Start_Fulfilled Stop :=#Stop_Fullfilled Response :="Agitator_running" Reset_Maint :="Reset_maint" Timer_No :=T16 Reponse_Time:=S5T#10S Fault :="Agitator_fault" Start_Dsp :="Agitator_on" Stop_Dsp :="Agitator_off" Maint :="Agitator_maint" Motor :="Agitator" Network 13 A A AN = Interlocks for drain valve "EMER_STOP_off" "Tank_not_empty" "Agitator" "Enable_Valve Drain valve control
Network 14
A "Drain_open" A #Enable_Valve = #Open_Drain A( O "Drain_closed" ON #Enable_Valve ) = #Close_Drain CALL "Valve_block" Open :=#Open_Drain Close :=#Close_Drain Dsp_Open :="Drain_open_disp" Dsp_Closed :="Drain_closed_disp"
A-97
Appendix
Valve Network 15 AN = AN = AN =
A-98
Appendix
A.5.3 Example for Handling Time-of-Day Interrupts A.5.3.1 Structure of the User Program "Time-of-Day Interrupts"
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.
OB1 FC12
Calls the function 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 Specify the starting time Set or reset output Q 4.0 Set next time-of-day interrupt Activate next time-of-day interrupt
OB10
OB80
Set output Q 4.1 Store start event information of OB80 in bit memory area
A-99
Appendix
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 I0.1 Q4.0 Q4.1 MW16 MB100 to MB107 MB110 to MB129 MW200 MB202 MW204 MW208
Input to enable "set time-of-day interrupt" and "activate time-of-day interrupt" Input to cancel a time-of-day interrupt Output set/reset by the time-of-day interrupt OB (OB10) Output set by a time error (OB80) STATUS of the time-of-day interrupt (SFC31 "QRY_TINT") Memory for start event information of OB10 (time-of-day only) Memory for start event information of OB80 (time error) RET_VAL of SFC28 "SET_TINT" Binary result (status bit BR) buffer for SFCs RET_VAL of SFC30 "ACT_TINT" RET_VAL of SFC31 "QRY_TINT"
A-100
Appendix
A.5.3.2 FC12
Declaration Section
The following temporary local variables are declared in the declaration section of FC12:
Variable Name Data Type Declaration Comment
Start time Start date Start date/time converted Enable for setting time-of-day interrupt
Q 4.0 mond D#1995127 #IN_DATE TOD#20:0:0.0 #IN_TIME cnvrt D#1995123 #IN_DATE TOD#5:0:0.0 #IN_TIME 0
Specify start time dependent on Q 4.0 (in variable #IN_DATE and #IN_TIME) Start date is a Friday
A-101
Appendix
STL (FC12) Network 3: CALL FC 3 IN1 := #IN_DATE IN2 := #IN_TIME RET_VAL := #OUT_TIME_DATE Network 4: A I 0.0 AN M 17.2 A M 17.4 = #OK_MEMORY Network 5: A #OK_MEMORY JNB m001 CALL SFC 28 OB_NO := 10 SDT := #OUT_TIME_DATE PERIOD := W#16#1201 RET_VAL := MW 200 m001 A BR = M 202.3 Network 6: A #OK_MEMORY JNB m002 CALL SFC 30 OB_NO := 10 RET_VAL := MW 204 m002 A BR = M 202.4 Network 7: A I 0.1 JNB m003 CALL SFC 29 OB_NO := 10 RET_VAL := MW 210 m003 A BR = M 202.5
Explanation Convert format from DATE and TIME_OF_DAY to DATE_AND_TIME (for setting time-ofday interrupt)
All requirements for setting time-of-day interrupt fulfilled? (Input for enable set and time-of-day interrupt not active and time-of-day interrupt OB is loaded) If so, set time-of-day interrupt...
A-102
Appendix
A.5.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
Variable Name Data Type Declaration Comment
STARTINFO E_ID PR_CLASS OB_NO RESERVED_1 RESERVED_2 PERIOD RESERVED_3 T_STMP YEAR MONTH DAY HOUR MINUTES SECONDS MSEC_WDAY
STRUCT WORD BYTE BYTE BYTE BYTE WORD DWORD STRUCT BYTE BYTE BYTE BYTE BYTE BYTE WORD END_STRUCT END_STRUCT
TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP
Entire start event information of OB10 declared as structure Event ID: Priority class OB number Reserved Reserved Periodicity of time-of-day interrupt Reserved Structure for time-of-day details
WDAY IN_DATE
INT DATE
Day of the week Input variable for FC3 (conversion of time format)
IN_TIME
TIME_OF_DAY
TEMP
OUT_TIME_DATE
DATE_AND_TIME TEMP
A-103
Appendix
and store. If day of week is not Monday, then specify Monday, 5.00 am as next starting time and reset output Q 4.0.
cnvrt: NOP 0 Network 4: 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 OB_NO := 10 RET_VAL := MW 204 A BR = M 202.2 Network 7: CALL SFC 20 SRCBLK := #STARTINFO.T_STMP RET_VAL := MW 206 DSTBLK := P#M 100.0 BYTE 8
Block transfer: save time of day from start event information of OB10 to the memory area MB100 to MB107.
A-104
Appendix
FC 12
Variable Name
STARTINFO E_ID PR_CLASS OB_NO RESERVED_1 RESERVED_2 A1_INFO A2_INFO T_STMP YEAR MONTH DAY HOUR MINUTES SECONDS MSEC_WDAY
STRUCT WORD BYTE BYTE BYTE BYTE WORD DWORD STRUCT BYTE BYTE BYTE BYTE BYTE BYTE WORD END_STRUCT END_STRUCT
TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP
Entire start event information of OB80 declared as structure Event ID: Priority class OB number Reserved Reserved Additional information about the event that caused the error Additional information about the event ID, priority class, and OB no. of the error Structure for time-of-day details
A-105
Appendix
A.5.4 Example for Handling Time-Delay Interrupts A.5.4.1 Structure of the User Program "Time-Delay Interrupts"
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.
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
A-106
Appendix
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 I0.1 I0.2 Q4.0 MB1 MW4 MD10 MW 100 MW102 MW104 MW106 MB120 to MB139 MD140 MW144
Input to enable "start time-delay interrupt" Input to cancel a time-delay interrupt Input to reset output Q 4.0 Output set by the time-delay interrupt OB (OB20) Used for edge flag and binary result (status bit BR) buffer for SFCs STATUS of time-delay interrupt (SFC34 "QRY_TINT") Seconds and milliseconds BCD-coded from the start event information of OB1 RET_VAL of SFC32 "SRT_DINT" RET_VAL of SFC34 "QRY_DINT" RET_VAL of SFC33 "CAN_DINT" RET_VAL of SFC20 "BLKMOV" Memory for start event information of OB20 Seconds and milliseconds BCD-coded from the start event information of OB20 Seconds and milliseconds BCD-coded from the start event information of OB1; acquired from start event information of OB20 (user-specific ID SIGN)
A-107
Appendix
A.5.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)
Data Type Declaration Comment
Variable Name
Start information for OB20 Event ID: Priority class OB number Data ID 1 Data ID 2 User-specific ID Time with which the time-delay interrupt is started Structure for timeof-day details (time stamp)
T_STMP
STRUCT
TEMP
A-108
Appendix
Code Section
Enter the following STL user program in the code section of OB20:
STL (OB20) Network 1 SET = Network 2: L T Network 3: L T L T L SRD T Network 4: L T Explanation Set output Q 4.0 unconditionally Q 4.0 QW 4 PQW 4 #STARTINFO.T_STMP.SECONDS MW 140 #STARTINFO.T_STMP.MSEC_WDAY MW 142 MD 140 4 MD 140 Activate output word immediately
Read seconds from start event information Read milliseconds and day of week from start event information Eliminate day of week and write milliseconds back (now BCD-coded in MW 142) Read starting time of time-delay interrupt (= call SFC32) from start event information Copy start event information to memory area (MB120 to MB139)
#STARTINFO.SIGN MW 144
A-109
Appendix
A.5.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)
Data Type Declaration Comment
Variable Name
STARTINFO E_ID PC_NO OB_NO D_ID 1 D_ID 2 CUR_CYC MIN_CYC MAX_CYC T_STMP
STRUCT WORD BYTE BYTE BYTE BYTE INT INT INT STRUCT
TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP TEMP
Start information for OB1 Event ID: Priority class OB number Data ID 1 Data ID 2 Current cycle time Minimum cycle time Maximum cycle time Structure for time-of-day details (time stamp)
A-110
Appendix
Code Section
Enter the following STL user program in the code section of OB1:
STL (OB1) Network 1 L #STARTINFO.T_STMP.SECONDS T MW 10 L #STARTINFO.T_STMP.MSEC_WDAY T MW 12 L MD 10 SRD 4 T MD 10 Network 2: A I 0.0 FP M 1.0 = M 1.1 Network 3: A M 1.1 JNB m001 CALL SFC 32 OB_NO := 20 DTME := T#10S SIGN := MW 12 RET_VAL:= MW 100 m001: NOP 0 Network 4: CALL SFC 34 OB_NO := 20 RET_VAL:= MW 102 STATUS := MW 4 Network 5: A I 0.1 FP M 1.3 = M 1.4 Network 6: A M 1.4 A M 5.2 JNB m002 CALL SFC 33 OB_NO := 20 RET_VAL:= MW 104 m002: NOP 0 A I 0.2 R Q 4.0 Explanation Read seconds from start event information Read milliseconds and day of week from start event information Eliminate day of week and write milliseconds back (now BCD-coded in MW 12) Positive edge at input I 0.0?
If so, start time-delay interrupt (starting time of time-delay interrupt assigned to the parameter SIGN)
...and time-delay interrupt is activated (bit 2 of time-delay interrupt STATUS)? Then cancel time-delay interrupt
A-111
Appendix
With a second call of SFC36 "MSK_FLT" an access area can also be masked: I/O access error when writing
With SFC38 "READ_ERR" the masked synchronous errors are queried. The "I/O access error when writing" is unmasked again with SFC37 "DMSK_FLT."
Code Section
Below you will find the OB1 in which the example of the user program was programmed in Statement List.
STL (Network 1) AN JNB CALL Explanation Non-retentive memory bit M 255.0 (only in first run = 0) SFC36 MSK_FLT (mask synchronous errors) Bit 2 = Bit 3 = 1 (BLFL and BLFS are masked) All bits=0 (no access errors are masked) Return value Output current programming error filter to MD10 Output current access error filter to MD14 Set M255.0 if masking successful m001: A S BR M 255.0
Explanation SFC36 MSK_FLT (mask synchronous errors) All bits=0 (no further programming errors masked) Bit 3 = 1 (write access errors are masked) Return value Output current programming error filter to MD20 Output current access error filter to MD24
A-112
Appendix
M 27.3
Explanation Block end if write access error (bit 3 in ACCFLT_MASKED) not masked
STL (Network 4) L T
Explanation SFC38 READ_ERR (query synchronous errors) All bits=0 (no programming errors queried) Bit 3 = 1 (write access error queried) Return value Output current programming error filter to MD30 Output current access error filter to MD34 No error occurred and write access error detected Invert RLO M 0.0=1 if PQB 16 present
STL (Network 6) L T
Explanation SFC38 READ_ERR (query synchronous errors) All bits=0 (no programming errors queried) Bit 3 = 1 (write access error queried) Return value Output current programming error filter to MD30 Output current access error filter to MD34 No error occurred and write access error detected Invert RLO M 0.1=1 if PQB 17 present
STL (Network 8) L T
A-113
Appendix
Explanation SFC38 READ_ERR (query synchronous errors) All bits=0 (no programming errors queried) Bit 3 = 1 (write access error queried) Return value Output current programming error filter to MD30 Output current access error filter to MD34 No error occurred and write access error detected Invert RLO M 0.2=1 if PQB 18 present
STL (Network 11) CALL SFC 38 PRGFLT_QUERY ACCFLT_QUERY RET_VAL PRGFLT_CLR ACCFLT_CLR A A NOT = BR M 37.3 M 0.3 :=DW#16#0 :=DW#16#8 :=MW 104 :=MD 30 :=MD 34
Explanation SFC38 READ_ERR (query synchronous errors) All bits=0 (no programming errors queried) Bit 3 = 1 (write access error queried) Return value Output current programming error filter to MD30 Output current access error filter to MD34 No error occurred and write access error detected Invert RLO M 0.3=1 if PQB 19 present
STL (Network 12) CALL SFC 37 PRGFLT_RESET_MASK ACCFLT_RESET_MASK RET_VAL PRGFLT_MASKED ACCFLT_MASKED :=DW#16#0 :=DW#16#8 :=MW 102 :=MD 20 :=MD 24
Explanation SFC37 DMSK_FLT (unmask synchronous errors) All bits=0 (no further further programming errors unmasked) Bit 3 = 1 (write access error unmasked) Return value Output current programming error filter to MD20 Output current access error filter to MD24
Explanation Block end if write access error (bit 3 in ACCFLT_MASKED) not unmasked
A-114
Appendix
Explanation
Explanation
Explanation
Explanation
A-115
Appendix
A.5.4.5 Example of Disabling and Enabling Interrupts and Asynchronous Errors (SFC39 and SFC40)
In this example of a user program, a program section is assumed that cannot be interrupted by interrupts. For this program section, OB35 calls (time-of-day interrupt) are disabled using SFC 39 "DIS_IRT" and later enabled again using SFC 40 "EN_IRT". SFC39 and SFC40 are called in OB1:
STL (OB1) A S A S : : CALL MODE OB_NO RET_VAL : : L T L T : : CALL MODE OB_NO RET_VAL Explanation Program section that can be interrupted without problems:
M M M M
Program section that must not be interrupted by interrupts: Disable and discard interrupts Mode 2: disable individual interrupt OBs Disable OB35
Enable interrupts Mode 2: enable individual interrupt OBs Enable OB35 Program section that can be interrupted without problems:
A S A S : :
M M M M
A-116
Appendix
A.5.4.6 Example of the Delayed Processing of Interrupts and Asynchronous Errors (SFC41 and SFC42)
In this example of a user program, a program section is assumed that cannot be interrupted by interrupts. For this program section, interrupts are delayed using SFC41 "DIS_AIRT" and later enabled again using SFC42 "EN_AIRT." SFC41 and SFC42 are called in OB1:
STL (OB1) A S A S : : CALL RET_VAL L T L T : : : CALL RET_VAL L DEC L <>I JC err Explanation Program section that can be interrupted without problems:
M M M M
Program section that must not be interrupted by interrupts: Disable and delay interrupts
Enable interrupts The number of set interrupt disables is in the return value The number of set interrupt disables is in the return value The number must have the same value after the interrupt is enabled as before the interrupt disable (here "0")
err:
A S A S : : BEU L T
M M M M
MW 102 QW 12
A-117
Appendix
A.6
Accessing the Process Data Area and the Peripheral Data 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): arrangement of the DP slaves in the configuration table master system" with the PROFIBUS address 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.
Peripheral input byte Peripheral input word Peripheral input double word Peripheral output byte Peripheral output word Peripheral output double word
A-118
Appendix
To find out which address areas are possible on individual modules, refer to the following manuals: S7-300 Programmable Controller, Hardware and Installation" Manual S7-300, M7-300 Programmable Controllers, Module Specifications" Reference Manual "S7-400, M7-400 Programmable Controllers, Module Specifications" Reference Manual
Both areas have an input area (can only be read) and an output area (can only be written).
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 point-to-point 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.
A-119
Appendix
If the modules are capable of diagnostics, you obtain the diagnostic data of the module by reading data sets 0 and 1. If the modules are configurable, you transfer the parameters to the module by writing data sets 0 and 1.
Assigning parameters to modules SFC55 WR_PARM SFC56 WR_DPARM SFC57 PARM_MOD SFC58 WR_REC Transfers the modifiable parameters (data set 1) to the addressed signal module Transfers parameters (data sets 0 or 1) from SDBs 100 to 129 to the addressed signal module Transfers parameters (data sets 0 or 1) from SDBs 100 to 129 to the addressed signal module Transfers any data set to the addressed signal module
Reading out diagnostic information SFC59 RD_REC Reads the diagnostic data
A-120
Appendix
Addressing S5 Modules
You can access S5 modules as follows: By connecting an S7-400 to SIMATIC S5 expansion racks using the interface module IM 463-2 By plugging in certain S5 modules in an adapter casing in the central rack of the S7-400
How you address S5 modules with SIMATIC S7 is explained in the "S7-400, M7400 Programmable Controllers, Hardware and Installation" Manual or the description supplied with the adapter casing.
A-121
Appendix
A.7
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.
Assigning parameters to modules SFC15 DPWR_DAT Reading out diagnostic information SFC13 DPNRM_DG SFC14 DPRD_DAT Reads the diagnostic information (asynchronous read access) Reads consistent diagnostic data (length 3 or greater than 4 bytes) Transfers any data set to the addressed signal module
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. The entire DP diagnostic information can be read with SFC14 DPRD_DAT by specifying the diagnostic address of the DP standard slave.
A-122
Appendix
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, M7-300 Programmable Controllers, Module Specifications" Reference Manual "S7-400, M7-400 Programmable Controllers, Module Specifications" Reference Manual
A-123
Appendix
Examples of parameter blocks: Startup behavior Cycle MPI Diagnostics Retentive data Clock memory Interrupt handling On-board I/Os (only for the S7-300) Protection level Local data Real-time clock Asynchronous errors
SFC55 WR_PARM Transfers the modifiable parameters (data set 1) to the addressed signal module SFC56 WR_DPARM SFC57 PARM_MOD SFC58 WR_REC Transfers the parameters (data set 0 or 1) from the corresponding SDBs to the addressed signal module Transfers all parameters (data sets 0 and 1) from the corresponding SDBs to the addressed signal module Transfers any data set to the addressed signal module
A-124
Appendix
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, M7-300 Programmable Controllers, Module Specifications" Reference Manual "S7-400, M7-400 Programmable Controllers, Module Specifications" Reference Manual
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, M7400 Programmable Controllers Module Specifications" Reference Manual).
A-125
Appendix
Clock Memory
The clock memory is a memory byte that changes its binary state periodically at a pulse-pause 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).
A-126
Appendix
Possible Frequencies
Each bit of the clock memory byte is assigned a frequency. The following table shows the assignment:
Bit of the Clock Memory Byte Period Duration (s) Frequency (Hz) 7 2.0 0.5 6 1.6 0.625 5 1.0 1 4 0.8 1.25 3 0.5 2 2 0.4 2.5 1 0.2 5 0 0.1 10
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, on-delay 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.
A-127
Appendix
A-128
Index
Absolute and Symbolic Addressing 7-1 Access Rights 16-3 Access Rights to Blocks and Source Files 9-3 Accessible Nodes 16-1 Displaying 16-1 Accessing the Peripheral Data Area A-119 Accessing the Process Data Area A-118 ACT_TINT 4-28 Activating 7-9 Display of Symbols in the Block 7-9 Test using Program Status 30-14 Activating the Display of Symbols in the Block 7-9 Actual Parameters 4-18, 4-19 Adding a New Display Device 27-65 Adding Associated Values in Messages 27-72 Adding Associated Values to Messages 27-72 Adding Associated Values to the Box 27-70 Address Areas A-19, A-20 Address Assignments Checking 2-15 Address Priority Setting 7-12 Setting (Symbolic/Absolute) 27-18 Addresses Entering and Editing in Ladder Elements 27-33 Inserting in a Variable Table 18-4 Overwriting in Ladder Elements 27-33 Rewiring 27-19 Without Symbols 12-12 Addresses and Data Types Permitted in the Symbol Table 7-6 Addresses Without Symbols 12-10 Addressing 7-1 Absolute 7-1, 7-2 Symbolic 7-1, 7-2, 7-4 Addressing Modules A-118 Addressing S5 Modules A-121 ANY A-52, A-60, A-61, A-62, A-63, A-64, A-65, A-66 Application Exiting 27-9 Archive CPU Messages 14-21, 14-22, 14-23 Archive Program 32-8 Setting 32-8 Archiving 32-9 Procedure 22-7 Projects and Libraries 22-5 Requirements 22-7 STEP 7 V.2.1 Projects with Global Data Communication A-77 Uses 22-6 ARRAY A-41, A-44, A-45, A-46, A-47 Assigning System Attributes in the Declaration Table 27-29 Assigning and Editing Block-Related Messages 14-6 Assigning and Editing Symbol-Related Messages 14-15 Assigning Data Types to Local Data of Logic Blocks A-67 Assigning Memory in the L Stack A-23 Assigning Message Numbers 14-6 Assigning Parameters to the PG/PC Interface 2-14 Assigning Symbolic Names A-84 Assigning System Attributes to Function Block Parameters 27-76 Assigning WinCC Attributes to Data Blocks 27-77 Assignment List 12-6 for Inputs Outputs and Bit Memory (I/Q/M) 12-7 for Timers and Counters (T/C) 12-8 Asynchronous Errors 21-26 Delayed Processing A-117 Disabling and Enabling A-116 OB81 21-26, 21-27, 21-28, 21-29 Using OBs to React to Errors 4-36 Attributes 27-8 Attributes for Blocks and Parameters 8-14 Authorization 2-1 First Installation 2-3 Guidelines 2-5 Handling 2-5 Installing 2-2, 2-3 Losing 2-1 Original Diskette 2-1 Removing 2-5 Restoring 2-4 Transferring 2-1 Uninstalling 2-1
Index-1
Index
Upgrading 2-4 Authorization Diskette 2-1, 2-2, 2-3, 2-4, 2-5 Authorization Program 2-4 Authorizations Number 2-7 AuthorsW 2-2 AUTHORSW.EXE 2-1 Avoiding Errors when Calling Blocks 9-26 B Stack Data saved in the B Stack A-25 Nested Calls A-25 Background OB Priority 4-35 Programming 4-36 Background OB (OB90) 4-35 Background Organization Block (OB90) 4-35 Basic Information on Data Blocks 10-1 Basic Information on Programming in STL Source Files 11-1 Basic Procedure for Determining the Cause of a STOP 21-14 Planning an Automation Project 3-1 when Printing 22-2 Basic Procedure for Creating Logic Blocks 9-1 Battery Backup A-29 BCD A-39 Binary Coded Decimal A-39 Bit Memory 12-6, 12-7 Assignment List 12-6, 12-7 Bit Messaging 14-1, 14-2 Blank Rows Inserting in Variable Declaration Tables 27-24 BLKMOV A-17 Block Opening from the B Stack List 31-5 Opening from the I Stack List 31-5 Opening Online 30-10 Setting the Call Environment 30-12 BLOCK A-52, A-53, A-54 Block Calls 4-10 Block Comment 9-14 Block Comments Entering 27-30 Block Folder 5-14, 5-15 Block Folder Object 5-14 Block for Changing the Pointer A-57 Block Properties 8-12, 8-13, 8-14, 9-1 Setting 27-17 Block Property Time Stamp 13-1 Block Stack A-15, A-25 Block Title 9-14
BLOCK_DB A-53 BLOCK_FB A-53 BLOCK_FC A-53 BLOCK_SDB A-52 Blocks 4-2, 4-3 Access Rights 9-3 Attributes 8-14 Comparing 27-18 Creating with S7 Graph 8-7 Creating with the Incremental Editor 27-15 Creating with the SIMATIC Manager 27-15 Deleting on the Programmable Controller 17-12 Entering in STL 9-12 Printing 32-1 Reloading in the Programmable Controller 29-2 Rewiring 27-19 Saving 9-25 Uploading from an S7 CPU 17-9 Blocks Folder 8-10 Blocks in the User Program 4-2 BOOL A-32 Area A-32 Boxes Positioning 9-17, 9-21 Removing Changing 9-21 Breakpoint Bar 19-6 Breakpoints Testing with 30-15 Browser 5-29 Buttons in the Toolbar 5-21 BYTE A-32 Area A-32 Call Hierarchy in the User Program 4-10 Calling 31-3 the Module Information for Any Module 31-3 the Module Information from a Project 31-2 the Module Information from the Project View (Online) 21-6 Calling the Help Functions 5-4 Calling the Quick View 21-4 CAN_TINT 4-28 CFC 8-10 CFC Program 24-1 CFC Programming Language 8-2 Changing 27-5 Properties of a Symbol Table 27-5 the Default Reference Data View 27-63 the Reference Data View 27-61 Window Arrangement of Symbol Tables 27-14 Changing Operator Control and Monitoring Attributes with CFC 15-4
Index-2
Index
Changing the Behavior and Properties of Modules A-123 Changing the Column Width of Declaration Tables 27-29 Changing the Operating Mode 16-4 Changing the Window Arrangement 5-30 Changing WinCC Attributes of CFC Block Parameters 27-77 CHAR A-32 Checking 11-15 Consistency in STL Source Files 11-15 Checking Scan Cycle Times to Avoid Time Errors 21-16 Choosing a Messaging Method 14-3 Clock A-125 Parameter Assignment A-125 Synchronizing A-126 Clock Functions A-125 Clock Memory A-126, A-127 Closed Parallel Branches Opening in Ladder Networks 27-38 Closing 27-9 Symbol Table 27-9 Code Section 9-1, 9-4, 9-5 Editing 9-11 Search Function for Errors 9-15 Structure 9-11 Coils Positioning 9-17 Column Width Changing 27-29 Column Widths Setting in a Declaration Table 27-23 Combination Box Definition 5-22 Comment Character 18-4 Comment Line 18-4 Comment Lines Inserting 18-8 Comments for Blocks 9-14 for Networks 9-14 Communication Attribute 27-8 Editing 27-8 Communication Error (OB87) 21-40 Communication Error Organization Block 21-40 Comparing 27-18 Blocks 27-18 Compatibility A-77 Compiling 11-16 STL Source Files 11-16 Complex Data Types A-41, A-44, A-45, A-48
Compressing 29-6 the Memory Contents of an S7 CPU 29-6 Compressing the User Memory 17-12 Compressing the User Memory (RAM) after Multiple Delete or Reload Operations 17-12 Configurable Memory Objects in the Work Memory A-30 Configurable Modules A-123 Configuration Data 15-1, 15-2 Transferring 14-20, 15-5 Configuration Diagram Creating 3-10 Configuration Table 32-3 Printing 32-3 Configuring CPU Messages 14-23 Configuring Operator Control and Monitoring Attributes via the Symbol Table 15-3 Configuring Operator Control and Monitoring Attributes with Statement List Ladder Logic and Function Block Diagram 15-2 Configuring the Hardware 26-3 Configuring Variables for Operator Control and Monitoring 15-1 Connection Table 6-5, 6-6 Printing 32-7 Connection to the CPU Establishing 18-12 Context-Sensitive Help 5-4 Continuous Function Chart 8-2, 8-10 Converting A-77 Project with Global Data Communication A-77 Converting Version 1 Projects A-74 Converting Version 2 Projects A-75 Copy Protection 2-1 Copying 27-6 from the Symbol Table to the Variable Table 30-4 Library 27-21 Objects 26-4 Part of a Library 27-21 Selected Areas to the Clipboard 30-4 Symbol Rows to the Clipboard 27-6 Variables in Declaration Tables 27-28 Copying a Project 26-2 Copying Part of a Project 26-2 Copying S7 Programs with Message Attributes 33-2 Correcting the Interfaces in a Function 9-26 Function Block or UDT 9-26 COUNTER A-53, A-54 Memory Area
Index-3
Index
Retentive A-28 Counters 12-8 Assignment List 12-8 Upper Limits for Entering 18-7 CPU 20-1 Operating Modes A-1, A-2, A-3 Performing a Memory Reset 29-7 Resetting 17-11 Simulating 20-1 CPU Hardware Fault (OB84) 21-38 CPU Hardware Fault Organization Block 21-38 CPU Messages Archive Size 14-22 Displaying 14-21 CPU Redundancy Error (OB72) 21-33 CREAT_DB A-16 Creating A-90 a Closed Branch in Ladder NetworksLadder Network Creating a Closed Branch 27-37 Data Blocks (DB) 27-16 FB for the Motor A-86, A-87, A-88, A-89 FC for the Valves A-90, A-91, A-92 Library 27-20 Network Templates 27-30 New Branches in Ladder Networks 27-36 OB1 for the Sample Industrial Blending Process A-92 Objects 5-23 Parallel Branches in Ladder Networks 27-36 STL Source Files 27-53 Symbol Table 27-1 T Branches in Ladder Networks 27-40 T Branches with Coils in Ladder Networks 27-39 User Programs 9-1 Variable Table 18-2 Creating a Configuration Diagram 3-10 Example of Industrial Blending Process 3-10 Creating a Project 6-3 Creating a Project Manually 26-1 Creating a Project Using the Wizard 26-1 Creating a Sample FB for the Industrial Blending Process A-86 Creating a Sample FC for the Industrial Blending Process A-90 Creating an I/O Diagram for the Motors 3-6 Creating an I/O Diagram for the Valves 3-7 Creating an Input Diagram for the Motors 3-6 Creating an Input Diagram for the Valves 3-7 Creating an Output Diagram for the Motors 3-6 Creating an Output Diagram for the Valves 3-7 Creating and Editing User-Defined Diagnostic Messages 14-16
Creating and Opening a Variable Table 30-1 Creating Block-Related Messages 14-10 Creating Blocks 27-15 with the Incremental Editor 27-15 with the SIMATIC Manager 27-15 Creating Connections in FBD Networks 27-43 Creating Symbol-Related Messages 27-68 Creating T Branches in FBD Networks 27-43 Creating the Software in the Project (General) 26-3 Creating User-Defined Diagnostic Messages 27-71 Cross-Reference List 12-2, 12-3 CRST/WRST A-6, A-7 CTRL_RTM A-126 Cutting Selected Areas to the Clipboard 30-4 Cycle 4-5 Cyclic Interrupt Rules 4-30 Starting 4-30 Cyclic Interrupt Organization Blocks (OB30 to OB38) 4-30 Cyclic Interrupts 4-30, 4-31 Cyclic Program Execution 4-3 Data Block Shared 4-24, 4-25 Structure 4-24 Data Block (DB) A-28 Instance Data Blocks 4-22 Retentive A-28 Data Block Register A-25 Data Blocks 10-1, 10-2 Basic Information 10-1 Data View 10-3 Declaration View 10-2 Editing Data Values in the Data View 10-8 Format Table 11-14 Resetting Data Values to their Initial Values 10-8 Saving 10-9 Data Blocks (DB) 4-2 Creating 27-16 Instance Data Blocks 4-19 Data Blocks in STL Source Files 11-23 Example 11-23, 11-24 Data Set Accessing A-120, A-123 Reading A-120 Writing A-120 Data Type 8-12 ARRAY 27-27 DINT A-33 DWORD A-39 INT A-33 S5TIME A-40
Programming with STEP 7 V5.0 C79000-G7076-C562-02
Index-4
Index
STRUCT 27-26 User-Defined 8-11, 8-12 WORD A-39 Data Type ARRAY Entering in the Declaration Table 27-27 Data Types A-31, A-63, A-65 BOOL A-32 BYTE A-32 Complex A-41 DATE_AND_TIME A-42 Description A-32 Double Word (DWORD) A-32 Elementary A-32 FB SFB 4-19 REAL A-34 Word (WORD) A-32 Data Types (Elementary) Entering in the Declaration Table 27-24 Data Values 10-8 Editing in the Data View of Data Blocks 10-8 Resetting to their Initial Values 10-8 Data View of Data Blocks 10-3 DATE_AND_TIME A-41, A-42, A-43, A-44 DB 4-24, 4-25 Deactivating 30-14 Test using Program Status 30-14 Time-of-Day Interrupt 4-27 Declaration Table Assigning System Attributes 27-29 Entering a Multiple Instance 27-25 Entering Data Elements of the Data Type STRUCT 27-26 Entering Data Type ARRAY 27-27 Entering Elementary Data Types 27-24 Setting Column Widths 27-23 Declaration Tables Changing Variables 27-29 Copying Variables 27-28 Deleting Variables 27-28 Declaration Type Changing 9-7 Declaration View of Data Blocks 10-2 Declaring Local Variables A-92 OB for the Sample Industrial Blending Process A-92 Declaring Parameters A-90 FC for the Sample Industrial Blending Process A-90 Default Settings for the LAD/STL/FBD Program Editor 9-3 Defective CPU Operating Mode A-1
Defining 7-10 Individual Symbols 27-2 Symbols when Programming 7-9 the Trigger for Modifying Variables 18-16 the Trigger for Monitoring Variables 18-14 Defining Logic Blocks A-82 Delayed Processing of Interrupts and Asynchronous Errors A-117 Example A-117 Delaying Start Events 4-38 Deleting 27-3 a Force Job 30-9 in the Integrated EPROM 29-8 Library 27-21 Objects 26-5 Part of a Library 27-21 S7 Blocks on the Programmable Controller 1712 STEP 7 Objects 5-23 Symbol Rows 27-3 Variables in Declaration Tables 27-28 Deleting a Display Device 27-65 Deleting a Project 26-2 Deleting Associated Values 27-73 Deleting Associated Values from the Box 27-70 Deleting in the RAM of the Programmable Controller 29-7 Deleting Part of a Project 26-3 Deleting User-Defined Diagnostic Messages 27-71 Describing the Individual Functional Areas 3-4 Describing the Operator Console Example of Industrial Blending Process 3-9 Describing the Required Operator Displays and Controls 3-9 Detectable Errors 21-25 Determining the Cause of a STOP 21-14 Diagnosing Hardware 21-1 Detailed Diagnostic View 21-8 Quick View 21-4 Diagnostic Buffer A-26, A-27 Contents 21-22, A-26, A-27 Definition A-26 Displaying A-27 Evaluating A-26 Reading 21-17 Diagnostic Data on Modules 21-20 Diagnostic Event 21-22 Diagnostic Functions 21-22 Diagnostic Interrupt (OB82) 21-36 Diagnostic Interrupt Organization Block 21-36, 21-38 Diagnostic Message
Index-5
Index
Sending to Nodes 21-21 Writing Your Own 21-21 Diagnostic Status Data 21-20 Diagnostics Symbols 21-2, 21-3 in the Online View 21-2 Dialog Boxes 5-22, 5-23 Differences Between Saving and Downloading Blocks 17-2 DINT A-32, A-33 DIS_AIRT 4-38 DIS_IRT 4-38 Disabling Interrupts and Asynchronous Errors A-116 Example A-116 Disabling Texts 27-67 Display Device 27-65 Display Language 14-17 Displaying 27-5 Accessible Nodes 16-1 Addresses Without Symbols 12-12 Block Information for LAD FBD and STL 12-10 Cross-References for Addresses with Overlapping Address Areas 27-63 Data Structure of Data Blocks Referencing an (Instance DBs) 10-5 Deleted Blocks 12-6 Lists in Additional Working Windows 12-12 Maximum Local Data Requirement in the Tree Structure 12-5 Missing Symbols 12-12 Module Information 21-1 Overlapping Access 27-63 Program Structure 12-12 Properties of a Symbol Table 27-5 Reference Data 12-11, 12-12, 12-13 Shared or Local Symbols 7-4 the Force Values Window 30-9 Unused Addresses 12-12 Displaying and Hiding Columns in Variable Tables 30-3 Displaying CPU Messages and User-Defined Diagnostic Messages 14-21 Displaying Stored CPU Messages 14-24 Displaying the Operating Mode 16-4 Displaying the Transfer Log 27-80 Displaying/Hiding Columns 30-3 Distribution of the Memory Areas A-15 Dividing a Process into Tasks and Areas for Example of Industrial Blending Process 3-2 Dividing the Process into Tasks and Areas 3-2 DMSK_FLT 4-38
Documentation 5-5, 22-1, 22-2, 26-3 Double Integer (32 Bit) A-33 Double Word (DWORD) A-32 Area A-32 Download Methods Dependent on the Load Memory 17-5 Downloaded Blocks Saving on Integrated EPROM 29-2 Downloading A-18 Requirements 17-1 User Program A-16 User Programs 17-3 Without Project Management 29-1 Downloading via EPROM Memory Cards 29-3 DP Standard Slaves A-122 DPNRM_DG A-122 DPRD_DAT A-122 DPWR_DAT A-122 DWORD A-32, A-39 Editing 7-10 Addresses or Parameters in Ladder Elements 27-33 Communication Attribute 27-8 Data Values in the Data View of Data Blocks 10-8 Operator Control and Monitoring Attribute 27-7 S7 Source Files 27-53 the Symbol Table 7-9, 7-10 Uploaded Blocks if the User Program is Not on the PG/PC 29-6 if the User Program is on the PG/PC 29-5 Variable Tables 30-3 Editing a Project 6-9 Editing Block-Related Messages 27-64 Editing Uploaded Blocks in the PG/PC 17-10 Editor Settings for STL 9-3 Elementary Data Types A-32 Elements in Dialog Boxes 5-22 Emergency Authorization 2-1 EN_AIRT 4-38 EN_IRT 4-38 Enabling Interrupts and Asynchronous Errors A-116 Example A-116 Engineering Tools 1-16 Entering 10-5 Addresses or Parameters in Ladder Elements 27-33 Block Comments and Network Comments 27-30 Data Structure of Data Blocks Referencing an FB (Instance DBs) 10-5
Index-6
Index
Data Structure of User-Defined Data Types (UDT) 10-6 Elementary Data Types in the Declaration Table 27-24 FBD Elements 27-40 Shared Symbols in a Program 9-13 Single Shared Symbols in a Dialog Box 7-9 Entering a Multiple Instance in the Variable Declaration Table 27-25 Entering Addresses or Parameters in FBD Elements 27-41 Entering and Displaying the Data Structure of Data Blocks Referencing an FB (Instance DBs) 10-5 Entering and Displaying the Structure of Data Blocks Referencing a UDT 10-7 Entering Comments in STL Statements 27-45 Entering Data Elements of the Data Type ARRAY 27-27 Entering Data Elements of the Data Type STRUCT in the Declaration Table 27-26 Entering Ladder Elements 27-32 Entering Multiple Shared Symbols in the Symbol Table 7-10 Entering Shared Symbols 7-8 Entering Statements in STL Source Files 11-2 Rules 11-2 Entering STL Statements 27-44 Entering Symbols 7-10 Entering the Data Structure of Shared Data Blocks 10-4 EPROM A-28 EPROM Area A-16 EPROM Memory Card Erasing 29-8 Erasing 17-11, 29-8 EPROM Memory Card 29-8 Load/Work Memory 17-11 Erasing the Load/Work Memory and Resetting the CPU 17-11 Error Detection OB-Types OB81 21-25 Sample Programs Substitute Values 21-29 Using Error OBs to React to Errors 4-36 Error Handling Organization Blocks (OB70 to OB87 / OB121 to OB122) 4-36 Error OB 21-25, 21-26, 21-27 OB Types OB121 and OB122 4-37 OB70 and OB72 4-36 OB80 to OB87 4-36 Using Error OBs to React to Events 4-36
Error OBs 4-37, 4-38 Error OBs as a Reaction to Detected Errors 21-25 Error Search in Blocks 9-15 Establishing Online Connection via the "Accessible Nodes" Window 16-1 Online Connection via the Online Window of the Project 16-2 Online Connections 16-1 Establishing a Connection Without a Project 28-2 Establishing a Connection from a Project With Configured Hardware 28-1 Establishing a Connection from a Project Without Configured Hardware 28-1 Establishing a Connection to the CPU 18-12 Establishing the Safety Requirements 3-8 Evaluating the Diagnostic Buffer A-26 Evaluating the Output Parameter RET_VAL 21-24 Example 11-18 Entering a Contiguous Address Area 18-9 Entering Addresses in Variable Tables 18-8 for Disabling and Enabling Interrupts and Asynchronous Errors (SFC39 and SFC40) A-116 for Masking and Unmasking Synchronous Errors A-112 for the Delayed Processing of Interrupts and Asynchronous Errors (SFC41 and SFC42) A-117 of Data Blocks in STL Source Files 11-23 of Function Blocks in STL Source Files 11-21 of Functions in STL Source Files 11-19 of Organization Blocks in STL Source Files 11-18 of User-Defined Data Types in STL Source Files 11-24 Example of Working with Address Locations 12-15 Examples 18-9 Entering Modify and Force Values 18-9 of Declaring Variables in STL Source Files 11-17 Excel File 27-10 Importing into the Symbol Table 27-10 Exiting 27-9 Application 27-9 Symbol Editor 27-9 Exporting 27-11 Source Files 27-56 Symbol Table 7-12, 27-11 Exporting User Texts 27-74 Extended Uses of the STEP7 Standard Package 1-14
Index-7
Index
External Source Files 27-55 Inserting 27-55 Faults 21-2 Locating 21-1 FB 4-19, 4-20, 4-21, A-41 FBD 8-4, 8-5 Displaying Block Information 12-10 Rules 9-21 FBD Elements 9-21 Entering 27-40 Entering Addresses or Parameters 27-41 Inserting from the Catalog 27-41 Overwriting 27-42 Representation 9-20 Rules for Entering 9-21 FBD Layout 9-20 FBD Networks Creating Connections 27-43 Creating T Branches 27-43 Selecting in 27-42 Splitting and Joining Connections 27-44 FC 4-18, 4-19 FC12 A-101 FEPROM A-28 File Formats for Importing/Exporting a Symbol Table 7-13 Filtering 27-4 Symbol Table 27-4 Filtering Reference Data 27-60 Filtering Symbols 7-11 Finding Address Locations in the Program Quickly 12-14 Flash-File System 2-10 Floating-Point Numbers A-34, A-35, A-36, A-37 Flow of Diagnostic Information 21-17 FM Performing a Memory Reset 29-7 Folder 8-10, 8-11 Blocks 8-10, 8-11 Force Job Deleting 30-9 Setting Up 30-9 Force Values 18-9 Examples of Entering 18-9 Force Values Window Displaying 30-9 Forcing Variables 18-18 Introduction 18-18 Safety Measures 18-21 Formal Parameters System Attributes and Message Blocks 14-8
Format of the Data Type DATE_AND_TIME A-42 Format of the Data Type DINT (32-Bit Integers) A-33 Format of the Data Type INT (16-Bit Integers) A-33 Format of the Data Type REAL (Floating-Point Numbers) A-34 Format of the Data Type S5TIME (Time Duration) A-40 Format of the Data Types WORD and DWORD in Binary Coded Decimal Numbers A-39 Format of the Parameter Type ANY A-60 Format of the Parameter Type POINTER A-54 Format of the Parameter Types BLOCK COUNTER TIMER A-54 Format Table of Data Blocks 11-14 Format Table of Function Blocks 11-12 Format Table of Functions 11-13 Format Table of Organization Blocks 11-11 Formats for Blocks in STL Source Files 11-11 Function Correcting the Interface 9-26 Function (FC) A-90 Function Block Correcting the Interface 9-26 Function Block (FB) A-86 Function Block Diagram 8-4 Function Block Diagram Programming Language (FBD) 8-4 Function Block Diagram(FBD) 8-2 Function Blocks 11-12 Format Table 11-12 Function Blocks (FB) 4-3, 4-19 Actual Parameters 4-20, 4-21 Application 4-19 Function Blocks in STL Source Files 11-21 Example 11-21 Functions 22-3 Format Table 11-13 Functions (FC) 4-2, 4-18 Application 4-18 Functions in STL Source Files 11-19 Example 11-20, 11-21 Gaps in the User Memory (RAM) 17-12 GD Communication A-77 General Notes on Variable Declaration Tables 9-8 General Tips on Entering Symbols 7-9 Generating 27-55 Reference Data 12-13 STL Source Files from Blocks 27-55 Generating and Displaying Reference Data 12-13 Global Data Communication A-77
Programming with STEP 7 V5.0 C79000-G7076-C562-02
Index-8
Index
Global Data Table 32-2 Printing 32-2 Globale Symbols Entering in a Program 9-13 Handling Errors 21-24 Hardware 21-1 Configuring 26-3 Diagnosing 21-1 Hardware Interrupt 4-32 Priority 4-32 Rules 4-32 Starting 4-32 Hardware Interrupt Organization Blocks (OB40 to OB47) 4-32 Hardware Interrupts 4-32 Headers and Footers 22-3, 22-4 Help (Online) Calling 5-5 Topics 5-4 Hierarchical Structure of Libraries 8-17 HiGraph 8-3 HOLD CPU Operating Mode A-1 HOLD Mode A-14 Hot Restart A-5, A-6, A-7, A-8, A-9, A-10, A-11 Automatic A-6, A-7, A-8 Manual A-6, A-7 Human Machine Interface 1-19 I Stack Description A-25 I/O Address Areas A-118, A-119 I/O Access Error (OB122) 21-41 I/O Access Error Organization Block 21-41 I/O Data A-119 I/O Redundancy Error (OB70) 21-32 I/O Redundancy Error Organization Block 21-32, 21-33 ID Number Entering 2-10 Identifiers for Assigned System Attributes 27-29 Illegal Logic Operations in Ladder 9-19 Importing 27-10 Excel File into the Symbol Table 27-10 External Source File 6-6 Source Files 27-56 Symbol Table 7-12, 7-13, 27-10 Importing User Texts 27-74 Incompatibility A-77 Incomplete and Non-Unique Symbols in the Symbol Table 7-7 Incremental Editor 27-15 Creating Blocks 27-15
Indirect Parameter Assignment A-123 Industrial Blending Process A-86, A-90, A-92 Information Functions 21-11 Information Functions in the Diagnostic View 21-8 Information Functions in the Quick View 21-5 Inputs 12-7 Assignment List 12-6 Process Image A-21 Insert/Remove Module Interrupt (OB83) 21-37 Insert/Remove Module Interrupt Organization Block 21-37 Inserting 27-3 Additional Ladder Networks 27-35 Addresses or Symbols in a Variable Table 18-4 Blank Rows in Variable Declaration Tables 27-24 Block Templates in STL Source Files 27-54 Comment Lines 18-8 Contents of Other STL Source Files 27-54 External Source Files 27-55 Modify Values 18-5 Source Code from Existing Blocks in STL Source Files 27-54 Substitute Values for Error Detection 21-29 Symbol Rows 27-3 Inserting a Contiguous Address Area in a Variable Table 30-5 Inserting a Network Template in a Program 27-31 Inserting a New Display Device 27-65 Inserting a Station 26-1 Inserting Additional FBD Networks 27-43 Inserting Additional STL Networks 27-45 Inserting an S7/M7 Program 6-6 Inserting Block Templates in STL Source Files 27-54 Inserting FBD Elements from the Catalog 27-41 Inserting Operator Station Objects 27-78 Inserting Source Code from Existing Blocks in STL Source Files 27-54 Inserting Stations 6-5 Installation Errors 2-10 Installation Procedure 2-10 Installation Requirements 2-8 Installing STEP 7 2-8, 2-9 Installing and Removing the Authorization 2-1 Installing STEP 7 2-8 Installing the Authorization after Setup 2-1 Installing the Authorization during Setup 2-1 Instance 4-22, 4-23, 4-24 Instance Data Block A-28 Retentive A-28 Instance Data Blocks 4-22
Index-9
Index
Creating Multiple Instances for an FB 4-19 Time Stamps 13-4 Instance DB 4-22, 4-23, 4-24 Instructions from the Program Element Catalog 94 INT A-32, A-33 Integer (16 Bit) A-33 Interrupt Assignments Checking 2-13 Interrupt Obs 4-27 Using 4-27 Interrupt Stack A-15, A-25 Interrupt-Driven Program Execution 4-3 Interruptions 21-1 Interrupts A-116, A-117 Delayed Processing A-117 Disabling and Enabling A-116 Introduction A-31 Introduction to Forcing Variables 18-18 Introduction to Testing with the Variable Table 18-1 Jumping 27-61 from the Cross-Reference List to a Location in the Program 27-61 from the Program Structure to the Part of the Program 27-62 Junction in Ladder Networks Splitting 27-38 Key Combinations for Access to Online Help 5-36 for Menu Commands 5-33 for Moving the Cursor 5-34 for Selecting Text 5-35 Key Combinations for Toggling between Windows 5-36 Keyboard Control 5-32 L Stack A-23, A-24 Assigning Memory to Local Variables A-23 Overwriting A-23 Storing Temporary Variables 4-19 LAD 8-4 Displaying Block Information 12-10 Ladder Elements Entering 27-32 Entering and Editing Addresses 27-33 Entering and Editing Parameters 27-33 Overwriting 27-34 Overwriting Addresses Ladder Elements Overwriting Parameters 27-33 Representation 9-16 Ladder Layout 9-16 Ladder Logic 8-4 Guidelines 9-17
Ladder Logic (LAD) 8-2 Ladder Logic Programming Language (LAD) 8-4 Ladder Networks 27-35 Creating New Branches 27-36 Creating Parallel Branches 27-36 Creating T Branches 27-40 Creating T Branches with Coils 27-39 Opening Closed Parallel Branches 27-38 Selecting in 27-35 Splitting a Junction 27-38 Language for Display 14-17, 14-18 Language Editors Starting 8-2 Libraries 6-7 Archiving 22-5 Hierarchical Structure 8-17 Rearranging 25-1 Working with 8-15 Library 5-9, 27-20 Copying 27-21 Creating 27-20 Deleting 27-21 Using 27-20 Library Object 5-9 Linear Programming 4-3 List Box 5-22 Listing In/Outs 3-6 Listing Inputs 3-6 Outputs and In/Outs 3-6 Listing Outputs 3-6 Lists of User Texts 14-17, 14-18 Load Memory 17-4, 17-5, A-15, A-16 Load Memory and Work Memory A-16 Load Memory and Work Memory in the CPU 17-3 Local Data Requirements 12-4 Local Data Stack A-15, A-23, A-24 Locating Faults 21-1 Locking Attributes 27-66 Locking Texts 27-67 Logic Blocks A-82 in the Incremental Editor 9-1 Saving 9-25 Structure 9-1 Time Stamps 13-2 Lost Authorization 2-1 M7 Program 6-8 M7 Programming Optional Software 24-3, 24-4 M7-300/M7-400 Operating Systems 24-1
Programming with STEP 7 V5.0 C79000-G7076-C562-02
Index-10
Index
M7-300/M7-400 Operating Systems 24-6 Managing Objects 5-23, 5-24, 5-26, 5-27, 5-28 Masking Start Events 4-36 Masking Synchronous Errors A-112 Example A-112 Memory A-30 Configurable A-30 Memory Area A-28 Memory Area Retentive A-29 Memory Areas A-15 Address Areas A-19 Load Memory A-15 Retentive A-28, A-29, A-30 Special Features with S7-300 A-16 Special Features with S7-400 A-16 System Memory A-15 Work Memory A-15 Memory Card A-17, A-18 Assigning Parameters 2-12 Memory Reset A-5 Merging Several S7 Programs into One 33-1 Message Example 14-5 Parts 14-5 Message Blocks Overview 14-6 Message Configuration SIMATIC Components 14-4 Transferring Data to WinCC 14-20 Message Numbering 14-2 Message Report 32-3 Message Template 14-9 Message Templates and Messages 14-9 Messages 32-3 Printing 32-3 Message-Type Block 14-10 Messaging Numbers 14-6 Assigning 14-6 Mnemonics Setting 9-23 Mode Transitions A-2, A-4 Modify Initialize CPU in STOP Mode with Preset Values 30-7 Modify Values 18-9 Examples of Entering 18-9 Inserting 18-5 Modifying Basic Procedure 18-2
Peripheral Outputs when the CPU is in STOP Mode 30-8 Program Settings 27-14 Modifying Variables Defining the Trigger 18-16 in Program Status 30-14 Introduction 18-15 Once and Immediately 30-7 with a Defined Trigger 30-6 Module 20-1 Parameter Assignment A-123, A-124 Simulating 20-1 Module Exists/Type Monitoring Startup OBs 4-33 Module Information 21-2 Calling 31-3 Calling from a Project 31-2 Calling from the Project View (Online) 21-6 Displaying 21-2 Printing 32-2 Updating 21-10 Module Information Functions 21-8 Module Parameters A-123, A-124, A-125 Transferring with SFCs A-123 Transferring with STEP 7 A-123 Module Start Address A-118 Module Status 21-8, 21-11 Information Functions 21-8 Monitor Format Selecting 30-2 Monitoring Basic Procedure 18-2 Monitoring Times 4-34 Monitoring Variables 18-14 Defining theTrigger 18-14 Introduction 18-13 Once and Immediately 30-6 with a Defined Trigger 30-5 Motors 3-6 Creating an I/O Diagram 3-6 Moving Object 5-23, 5-24, 5-25, 5-26, 5-27, 5-28 Objects 26-5 MPI Card for PG/PC 2-13 MPI Interface 2-8 MPI-ISA Card (Auto) 2-13 MSK_FLT 4-38 Multiple Instance 4-19, 4-22 Entering in the Variable Declaration Table 27-25 Multiple Instances Rules 9-10 Usage 9-9 Multi-User Configuration 23-1
Index-11
Index
Multi-User Configuration in Windows NT 23-1 Naming Conventions 15-2 for Configuration Data 15-1 Nested Calls of Logic Blocks A-25 Effects on the B Stack and L Stack A-25 Nesting A-25 Nesting Depth 4-10 Network Comment 9-14 Network Comments Entering 27-30 Network Server 23-1 Network Template Inserting in a Program 27-31 Network Templates Creating 27-30 Network Title 9-14 Networks 8-4 Ladder Logic 9-17 Non-Volatile RAM A-28 Notes on STEP 7 V.2.1 Projects with GD Communication A-77 Number Notation A-31 NVRAM A-28, A-29 OB 4-3, 4-4, 4-5, 4-6, 4-8 OB 86 21-39 OB1 A-92, A-93, A-94, A-95, A-110 OB1 and OB80 A-105 OB10 A-103, A-104 OB20 A-108 Object Copying 26-4 Copying 26-4 Creating 5-24 Cutting Copying Pasting 5-26 Deleting 5-28, 26-5 Managing 5-23 Moving 5-27, 26-5 Opening 5-24 Properties 5-25, 5-27 Renaming 5-26, 5-27 Selecting 5-29 Object Hierarchy 5-5, 5-6 Building 5-24 Object Lists 32-5 Printing 32-5 Object Tree 32-4 Printing 32-4 Objects 5-6, 5-7 as Carriers of Functions 5-7 as Carriers of Properties 5-6 as Folders 5-7
Printing 32-4 Objects and Object Hierarchy 5-5 Online Connection Establishing via the "Accessible Nodes" Window 16-1 Establishing via the Online Window of the Project 16-2 Online Help Calling 5-4 Changing the Font Size 5-5 Topics 5-4 Online View 21-2 Diagnostic Symbols 21-4 Opening 31-5 Block from the B Stack List 31-5 Block from the I Stack List 31-5 Closed Parallel Branches in Ladder Networks 27-38 Symbol Table 7-10, 7-11, 27-2 the Block for a Diagnostic Buffer Entry 31-4 Variable Table 18-2, 18-3 Working Windows for Reference Data Already Displayed 27-62 Working Windows for Reference Data Not Yet Displayed 27-62 Opening the Block Online 30-10 Operating Mode A-2, A-4 Displaying and Changing 16-4 HOLD A-1, A-2, A-3, A-4 RUN A-1, A-2, A-3, A-4 STARTUP A-1, A-3, A-4, A-5, A-10, A-11, A-12 STOP A-4, A-5 Operating Mode of an S7 CPU 28-2 Switching 28-2 Operating Mode STOP 21-14 Stack Contents 21-14, 21-15 Operating Modes Priority A-4 Operating Modes and Mode Transitions A-1 Operating Philosophy 5-20 Operating System Tasks 4-1 Operator Console 3-9 Operator Control and Monitoring Attribute 27-7 Editing 27-8 Operator Control and Monitoring Attributes 15-1 CFC 15-4 Configuring with STL LAD FBD 15-2 Configuring with Symbol Table 15-3 Operator Displays and Controls Example of Industrial Blending Process 3-9
Programming with STEP 7 V5.0 C79000-G7076-C562-02
Index-12
Index
Operator Station Object Inserting 27-78 Optional Package 20-1 Optional Software for M7 Programming 24-4 Organization Block (OB) 4-35 Background OB (OB90) 4-3 Organization Blocks 11-11 Creating an OB for the Sample Industrial Blending Process A-92 Definition 4-3 Error Detection OB122 Substitute Values 21-29 Format Table 11-11 Priority Classes 4-4, 4-5, 4-6 Reacting to Errors 4-36 Organization Blocks (OB) 4-2 Organization Blocks and Program Structure 4-3 Organization Blocks for Interrupt-Driven Program Processing 4-27 Organization Blocks in STL Source File 11-18 Example 11-18 Output Parameter 21-24, 21-25 Evaluating RET_VAL 21-24 Outputs 12-7 Assignment List 12-6 Process Image A-21 Overview 12-1 of the Available Reference Data 12-1 Overview of STEP 7 1-1 Overview of the Available Reference Data 12-1 Overview of the Standard Libraries 8-17 Overwrite Mode 9-15 Overwriting Ladder Elements 27-34 Overwriting Addresses or Parameters in Ladder Elements 27-33 Overwriting FBD Elements 27-42 Overwriting the L Stack A-23 Page Format Setting 22-4 Parameter Assignment A-125 Clock A-125 Indirect A-123 with SFCs A-124 with STEP 7 A-124 Parameter Types A-52, A-63 Parameters 8-14 Attributes 8-14 Entering and Editing in Ladder Elements 27-33 Overwriting in Ladder Elements 27-33 Parent/Child Structure 12-4, 12-5, 12-6 PARM_MOD A-120, A-124
Part of a Library 27-21 Copying 27-21 Deleting 27-21 Part Process Image A-21 Parts of a Message 14-5 Password 16-3 Password Protection for Access to Programmable Controllers 16-3 Pasting Areas from the Clipboard into the Variable Table 30-4 PCS7 Message Configuration 14-13, 14-14 Performing a Memory Reset on CPUs/FMs 29-7 Peripheral Data A-119 Permitted Block Properties for Each Block Type 11-7 Permitted Data Types when Transferring Parameters A-69 PG/PC Interface 2-15 Parameter Assignment 2-14 Phase Offset 4-31 Planning an Automation Project Basic Procedure 3-1 Creating a Configuration Diagram 3-10 Creating an I/O Diagram for the Motors 3-6 Creating an I/O Diagram for the Valves 3-7 Describing the Individual Function Areas 3-4 Describing the Required Operator Displays and Controls 3-9 Dividing the Process into Tasks and Areas 3-2 Establishing the Safety Requirements 3-8 Listing Inputs Outputs and In/Outs 3-6 PLC-OS Assignment 27-75 POINTER A-52, A-55 Positioning Boxes 9-21, 9-22 Positioning the Toolbar 27-12 Power Flow 9-19 Power Supply Error (OB81) 21-35 Power Supply Error Organization Block 21-35 Printer Setting Up 22-3 Printing 32-1 Blocks 22-2 Blocks and STL Source Files 32-1 Configuration Table 22-2, 32-3 Connection Table 32-7 Diagnostic Buffer Content 22-2 Global Data Table 22-2, 32-2 Messages 32-3 Module Information 32-2
Index-13
Index
Object Lists 32-5 Object Tree 32-4 Objects 32-4 Reference Data 22-2, 32-6 Symbol Table 22-2, 32-6 User Text Lists 32-4 Variable Table 22-2, 32-7 Printing Project Documentation 22-1 Priority Background OB 4-35 Hardware Interrupt 4-32 Time-Delay Interrupt 4-30 Time-of-Day Interrupt 4-27 Procedure 22-7 for Archiving/Retrieving 22-7 for Entering Statements 9-12 for M7 Systems 24-1 Process Dividing into Tasks 3-2 Process Image A-21 Clearing 4-34 Inputs/Outputs A-21 Process Monitoring 15-1, 18-2 Process-Image Input/Output Tables A-21 Program Creation General Procedure 1-1 Program Elements Inserting 9-4 Program Elements Catalog 9-4 Program Execution Cyclic 4-3, 4-4, 4-5, 4-7, 4-8 Interrupt-Driven 4-3 Program Measures for Handling Errors 21-23 Program Processing 4-27 Interrupt-Driven 4-27 Program Sequence Error (OB85) 21-38 Program Sequence Error Organization Block 21-38 Program Settings 27-14 Modifying 27-14 Program Status Activating and Deactivating the Test 30-14 Modifying Variables 30-14 Setting the Display 30-11 Testing with 19-1 Program Status Display 19-3 Program Structure 12-4, 12-5 Displaying 12-12 Programmable Controller Reloading Blocks 29-2 Programmable Module Object Folder 5-11 Programming Background OB 4-35 Transferring Parameters 4-19
Using Data Blocks 4-19 Programming Error (OB121) 21-41 Programming Error Organization Block 21-41 Programming Language Selecting 8-2, 8-3 Programming Languages 1-6, 1-8 Function Block Diagram (FBD) 8-4 Ladder Logic (LAD) 8-4 S7 CFC 8-10 S7 Graph 8-7 S7 HiGraph 8-8 S7 SCL 8-6 STL 8-5 Programming Steps S7 1-4 Programs in a CPU 4-1 Project 5-7, 5-8 Copying 6-9, 26-2 Creating Manually 6-3, 26-1 Creating the Software (General) 26-3 Creating Using the Wizard 6-3, 26-1 Deleting 6-9, 26-2 Opening 6-9 Renaming 5-23 Project Documentation 26-3 Printing 22-1 Project Object 5-7 Project Structure 6-2 Project View 6-1 Project Window 6-1, 6-2 Projects 22-5 Archiving 22-5 Rearranging 25-1 QRY_TINT 4-28 Querying Time-of-Day Interrupt 4-27 Quick View of the Diagnostic Information 21-4 Rack Failure (OB86) 21-39 Rack Failure Organization Block 21-39 RAM A-15, A-28 RAM Area A-16, A-29 RDSYSST 21-17, 21-19, A-27 READ_CLK A-125 READ_RTM A-126 REAL A-32, A-34 Rearranging Projects and Libraries 25-1 Reference Data 12-1 Application 12-1 Changing the View 27-61 Displaying 12-11, 12-12, 12-13 Filtering 27-60 Generating 12-13
Index-14
Index
Opening Working Windows for Reference Data Already Displayed 27-62 Opening Working Windows for Reference Data Not Yet Displayed 27-62 Printing 32-6 Representation 27-60 Searching 27-59 Sorting 27-59 Updating Automatically On Compilation 27-63 Reference Data View Changing 27-63 Relationship between the Variable Declaration Table and the Code Section 9-6 Reloading Blocks in the Programmable Controller 29-2 Renaming A-77 Objects Object Renaming 26-5 Project 5-24, 5-25, 5-27, 5-28 STEP 7 V.2.1 Projects with Global Data Communication A-77 Representation FBD Elements 9-20 Ladder Elements 9-16 STL 9-23 Requirements 17-1 Archiving 22-7 for Downloading 17-1 Resetting 10-8 Data Values to their Initial Values 10-8 the CPU 17-11 Restoring Authorization 2-1 Window Arrangement 5-31 Retentive Memory Areas on S7-300 CPUs A-28 Retentive Memory Areas on S7-400 CPUs A-29 Retentivity A-5 Retrieving 32-9 Procedure 22-7 Rewiring 27-19 Addresses 27-19 Blocks 27-19 Rights of Use 2-1 Ring Buffer (Diagnostic Buffer) A-26 RPL_VAL 21-29 Rules 7-13 Cyclic Interrupt 4-30 FBD 9-21 for Declaring Multiple Instances 9-10 for Declaring Variables in STL Source Files 11-3 for Entering Statements in STL Source Files 11-2
for Exporting the Symbol Table 7-12 for Importing the Symbol Table 7-12 for Setting Block Properties in STL Source Files 11-5 for Setting System Attributes in STL Source Files 11-5 Hardware Interrupt 4-32 Ladder Logic 9-17 Statement List 9-23, 11-2 Time-Delay Interrupt 4-29 Time-of Day-Interrupt 4-27 Rules for Block Order in STL Source Files 11-4 Rules for Entering FBD Elements 9-21 Rules for Entering Ladder Logic Elements 9-17 Rules for Entering STL Statements 9-23 RUN CPU Operating Mode A-1 RUN Mode A-13 Run-Time Meter A-125 Run-Time Software 1-18 S5 TIME A-32 S5TIME A-40 S7 CFC Programming Language 8-10 S7 Graph 8-3, 8-7 S7 Graph Programming Language (Sequential Control) 8-7 S7 HiGraph 8-8 S7 HiGraph Programming Language (State Graph) 8-8 S7 Program Inserting 6-8 MergingMerging Several S7 Programs into One 33-1 S7 Programs Merging 33-1 S7 SCL Programming Language 8-6 S7 Source Files 27-53 Editing 27-53 S7/M7 Program 5-13 S7/M7 Program Folder 5-13 S7/M7 Program without a Station or CPU 5-19 Safety Measures When Forcing Variables 18-21 Safety Notes A-23 Overwriting the L Stack A-23 Safety Requirements 3-8 Example of an Industrial Blending Process 3-8 Sample Program A-82, A-84, A-89, A-90, A-92, A-94, A-112, A-116, A-117 Sample Program for an Industrial Blending Process A-80 Sample Programs A-78, A-86 FB for the Industrial Blending Process A-86 FC for an Industrial Blending Process A-90
Index-15
Index
Industrial Blending Process A-80 Creating a Configuration Diagram 3-10 Describing the Individual Functional Areas 3-4 Describing the Individual Tasks and Areas Creating an I/O Diagram 3-6 Describing the Operator Displays and Controls 3-9 Describing the Safety Requirements 3-8 Dividing the Process into Tasks and Areas 3-2 Inserting Substitute Values 21-29 OB for the Sample Industrial Blending Process A-92 Reaction to Battery Error 21-25 Substitute Values 21-29 Sample Projects A-78, A-79 Saving 27-9 Blocks 9-25 Data Blocks 10-9 Downloaded Blocks on Integrated EPROM 29-2 Logic Blocks 9-25 STL Source Files 11-15 Symbol Table 27-9 Uses 22-6 Variable Table 18-3 Window Arrangement 5-31 SCAN Message 14-15, 27-68 SCL 8-3, 8-6 Scope of the Module Type-Dependent Information 21-11 Search Function for Errors in the Code Section 9-15 Searching 27-5 for Specific Strings 27-5 the Reference Data 27-59 Searching and Deleting Breakpoints 30-16 Selected Areas Copying to the Clipboard 30-4 Cutting to the Clipboard 30-4 Selecting 27-6 Editing Method 8-1 in Ladder Networks 27-35 Monitor Format 30-2 Programming Language 8-2, 8-3 Symbol Rows 27-6 Selecting in FBD Networks 27-42 Selecting Objects in a Browser 5-29 Selecting Text Areas in STL Statements 27-45 Sending Your Own Diagnostic Messages 21-21 Sequential Control 8-7 Session Memory 5-30 SET_CLK 4-29, A-125 SET_RTM A-126
SET_TINT 4-28 Setting Address Priority 7-12 Address Priority (Symbolic/Absolute) 27-18 Block Properties 27-17 Default Target Directory 32-8 Preferred Archive Program 32-8 Search Path for Archive Programs 32-8 Size of a Window for Display 27-13 Sort Mode in the Symbol Table 27-4 the Call Environment for a Block 30-12 Time and Date 16-5 Virtual Work Memory 25-2 Setting Column Widths in a Declaration Table 27-23 Setting the Display (Quick View or Diagnostic View) 31-1 Setting the Display for Program Status 30-11 Setting the Mnemonics 9-23 Setting the Mode for the Test 30-13 Setting the Operating Behavior A-122 Setting the PG/PC Interface 2-13 Setting the Search Path for Archive Programs 32-8 Setting the Window Split 27-22 Setting the Workstation Configuration 33-1 Setting Up a Force Job 30-9 Settings for Function Block Diagram Programming 9-20 Settings for Ladder Logic Programming 9-16 Settings for Statement List Programming 9-23 Setup Entering ID Number 2-10 Flash-File System 2-10 Memory Card Parameters 2-12 SFB 4-25, A-41 SFC 4-26 SFC 0 SET_CLK A-125 SFC 1 READ_CLK A-125 SFC 2 SET_RTM A-125 SFC 3 CTRL_RTM A-125 SFC 4 READ_RTM A-125 SFC 26 UPDAT_PI A-21 SFC 27 UPDAT_PO A-21 SFC 44 RPL_VAL 21-29 SFC 48 SNC_RTCB A-125 SFC 51 RDSYSST 21-17, 21-18, A-26 SFC 52 WR_USMSG 21-21 SFC13 DPNRM_DG A-122 SFC14 DPRD_DAT A-122 SFC15 DPWR_DAT A-122 SFC20 BLKMOV A-16 SFC22 CREAT_DB A-16 SFC28 SET_TINT 4-27
Programming with STEP 7 V5.0 C79000-G7076-C562-02
Index-16
Index
SFC29 CAN_TINT 4-27 SFC30 ACT_TINT 4-27 SFC31 QRY_TINT 4-27 SFC32 SRT_DINT 4-29 SFC36 MSK_FLT 4-36 Example in LAD A-112 Example in STL A-112 SFC37 DMSK_FLT 4-36 Example in LAD A-112 Example in STL A-112 SFC38 READ_ERR Example in LAD A-112 Example in STL A-112 SFC39 DIS_IRT 4-36 Example in STL A-116 SFC40 EN_IRT 4-36 Example in STL A-116 SFC41 DIS_AIRT 4-36 Example in STL A-117 SFC42 EN_AIRT 4-36 Example in STL A-117 SFC55 WR_PARM A-119, A-123 SFC56 WR_DPARM A-119, A-123 SFC57 PARM_MOD A-119, A-123 SFCs A-22 Using A-21, A-22 Shared and Local Symbols 7-2 Shared Data Blocks 10-4 Entering the Data Structure 10-4 Time Stamps 13-3 Shared Data Blocks (DB) 4-24 Short Circuit Ladder Logic Illegal Logic Operations 9-19 Signal Module 20-1 Simulating 20-1 SIMATIC Components 14-4 SIMATIC Manager 5-1, 5-2 Creating Blocks 27-15 Simulating a CPU or Signal Module 20-1 Simulation Program 20-1 Single Terminal Configuration 33-1 Single-Step Mode Testing in 30-16 SNC_RTCB A-125 Sorting 27-4 Reference Data 27-59 Symbol Table 27-4 Sorting in the Cross Reference List 12-2 Sorting Symbols 7-10 Source File Folder 5-18 Source File Folder Object 5-18 Source Files 27-56
Access Rights 9-3 Exporting 27-56 External 6-8 Importing 27-56 S7 Graph 8-7 Source Files(External) 27-55 Inserting 27-55 Special Note on Printing the Object Tree 22-4 Splitting 27-13 a Junction in Ladder Networks 27-38 Table Window 27-13 Splitting and Joining Connections in FBD Networks 27-44 SRT_DINT 4-29 SSL 21-18 Stack Contents in STOP Mode 21-14 Standard Libraries 8-17 Overview 8-17 Standard Library 6-6 Start Address A-119 Start Events Delaying 4-36 Masking 4-38 Startup OBs 4-33 Starting Cyclic Interrupt 4-30, 4-31 Hardware Interrupt 4-32 Time-Delay Interrupt 4-29 Time-of-Day Interrupt 4-28 Starting STEP 7 Installation 2-10 Starting STEP 7 with Default Start Parameters 5-2 Starting the Transfer Program 27-78 STARTUP CPU A-5, A-6, A-7, A-9, A-10, A-11, A-12 CPU Operating Mode A-1 STARTUP Mode A-5 Startup OBs 4-33 Module Exists/Type Monitoring 4-34 Start Events 4-33 Startup Organization Blocks (OB100 / OB101 / OB102) 4-33 Startup Program 4-33 State Graph 8-8 Statement List 8-5, 9-23 Representation 9-23 Rules 9-23, 11-2 Statement List (STL) 8-2 Statement List Programming Language (STL) 8-5 Statements Entering Procedure 9-12 Statements from the Program Element Catalog 9-4 Station 5-10, 5-11
Index-17
Index
Inserting 6-5, 6-6, 26-1 Uploading 17-9 Station Object 5-10 Status Bar 27-12 Example 5-21 STEP 7 Error OBs Reacting to Errors 4-36 Errors During Installation 2-10 Installation 2-8 Removing 2-16 Standard Software 1-6 Starting the Software 5-1 Uninstalling 2-16 User Interface 5-21 STEP 7 Mini 1-1 STEP 7 Programming Languages 1-6 STL 8-5 Displaying Block Information 12-11 Entering Blocks 9-12 STL Editor Settings 9-3 STL Source File 11-11 Formats for Blocks 11-11 STL source files Creating 27-53 STL Source Files 11-1 Basic Information on Programming 11-1 Checking Consistency 11-15 Compiling 11-16 Example of Data Blocks 11-23 Example of Function 11-19 Example of Function Blocks 11-21 Example of Organization Blocks 11-18 Example of User-Defined Data Types 11-24 Examples of Declaring Variables 11-17 Generating from Blocks 27-55 Inserting Block Templates 27-54 Inserting Source Code from Existing Blocks 27-54 Inserting the Contents of Other STL Source Files 27-54 Printing 32-1 Rules for Block Order 11-4 Rules for Declaring Variables 11-3 Rules for Setting Block Properties 11-5 Rules for Setting System Attributes 11-5 Saving 11-15 Structure of Blocks 11-8 Structure of Data Blocks 11-9 Structure of Logic Blocks 11-8 Structure of User-Defined Data Types 11-9 Syntax for Blocks 11-11
Troubleshooting 11-16 STL Statements Entering 27-44 Entering Comments 27-45 Selecting Text Areas 27-45 STOP CPU Operating Mode A-1 STOP Mode A-4, A-5 Stopping 30-17 Test using Breakpoints 30-17 STRING A-41, A-44 STRUCT A-41, A-44, A-48 Structure 8-11, 8-12 Blocks in STL Source Files 11-8 Cross-Reference List 12-2, 12-3 Data Blocks in STL Source Files 11-9 Load Memory A-16, A-17, A-18 Logic Blocks in STL Source Files 11-8 of the Code Section 9-11 of the User Program "Time-of-Day Interrupts" A-99 UDT 8-11 User-Defined Data Type (UDT) 8-11 User-Defined Data Types in STL Source Files 11-9 Structure and Components of the Symbol Table 75 Structure of the User Program "Time-Delay Interrupts" A-106 Structure of the Variable Declaration Table 9-7 Structured Control Language 8-6 Structured Program 4-2 Structured Programming 4-3 Substitute Value Using SFC44 (RPL_VAL) 21-29 Switching 28-2 Operating Mode of an S7 CPU 28-2 Switching the Programming Language 27-23 Symbol Editor 27-9 Exiting 27-9 Symbol Rows 27-6 Deleting 27-3 Inserting 27-3 Selecting 27-6 Symbol Table 7-4 Closing 27-9 Copying to the Variable Table 30-4 Creating 27-1 Displaying and Changing Properties 27-5 Exporting 27-11 File Formats for Importing/Exporting 7-13 Filtering 27-4 for Shared Symbols 7-4
Programming with STEP 7 V5.0 C79000-G7076-C562-02
Index-18
Index
Importing 27-10 Importing an Excel File 27-10 Opening 7-10, 27-2 Permitted Addresses 7-6 Permitted Data Types 7-6 Printing 32-6 Saving 27-9 Sorting 27-4 Structure and Components 7-5 Symbolic Addressing 7-4 Sample Program A-84 Symbolic Names A-84 Assigning A-84 Symbol-Related Messages Assigning to Symbol Table 14-15 Signals 14-15 Symbols 7-1, 7-2, 7-4 Defining 27-2 Defining when Programming 7-9 Entering 7-10 Filtering 7-11 for the Program Structure 12-4, 12-5 Inserting in a Variable Table 18-4 Local 7-3 Shared 7-3 Sorting 7-10 STEP 7 Objects 5-5 Unused 12-9 Synchronizing A-125 Clock A-125 Synchronous Errors A-112 Masking and Unmasking A-112 Using OBs to React to Errors 4-36 Syntax for Blocks in STL Source Files 11-11 System Attributes Assigning in the Declaration Table 27-29 for Message Configuration 14-8 for Parameters 9-4 Symbol Table 7-5, 7-6 System Data 21-19 System Diagnostics Extending 21-21 System Error 21-22 System Function Blocks 4-25 System Function Blocks (SFB) 4-3 System Function Blocks (SFB) and System Functions (SFC) 4-25 System Functions 4-25 System Functions (SFC) 4-2 System Memory A-15, A-19 System Parameters A-122 System Status List 21-18, 21-19, 21-20 Contents 21-18
Reading 21-19 Table Window 27-13 Splitting 27-13 Tabs in Dialog Boxes 5-23 Target Directory 32-8 Setting 32-8 Tasks Example of Industrial Blending Process 3-2 Tasks and Areas Example of Industrial Blending Process 3-4 Test Activating and Deactivating using Program Status 30-14 Setting the Mode 30-13 Stopping using Breakpoints 30-17 Testing 18-1 in Single-Step Mode 30-16 using Breakpoints 30-15 using Program Status 19-1 using the Simulation Program (Optional Package) 20-1 with the Variable Table 18-1 Testing in Single-Step Mode 19-5, 19-6 Text Lists see Lists of User Texts 14-17 The Message Concept 14-1 The STEP 7 Standard Package 1-6 Time A-32 Reading A-125 Setting A-125 Time and Date 16-5 Setting 16-5 Time Error (OB80) 21-34 Time Error Organization Block 21-34 Time Format A-125 TIME OF DAY A-32 Time Stamp Conflicts 13-1 Time Stamps 13-3 as a Block Property 13-1 in Instance Data Blocks 13-3 in Logic Blocks 13-2 in Shared Data Blocks 13-3 Time stamps in UDTs and Data Blocks Derived from UDTs 13-4 Time-Delay Interrupt Priority 4-30 Rules 4-29 Starting 4-30 Time-Delay Interrupt Organization Blocks (OB20 to OB23) 4-29 Time-Delay Interrupts 4-29 Time-of-Day Interrupt Changing the Time 4-29
Index-19
Index
Deactivating 4-28 Priority 4-28 Querying 4-28 Rules 4-27 Starting 4-28 Time-of-Day Interrupt Organization Blocks (OB10 to OB17) 4-27 Time-of-Day Interrupts 4-27 Structure A-99 TIMER A-52, A-53, A-54 Timers 12-8 Assignment List 12-8 Upper Limits for Entering 18-6 Timers (T) A-126 Memory Area Retentive A-28 Titles for Blocks 9-14 for Networks 9-14 Toggling between Programming Languages 27-23 Toggling between Windows 5-36 Toggling the Status Bar On/Off 27-12 Toggling the Toolbar On/Off 27-12 Toolbar 27-12 Buttons 5-21 Positioning 27-12 Transfer Log 27-75 Displaying 27-80 Transferring Configuration Data to the Operator Interface Programmable Controller 15-5 Transferring Configuration Data to the Programmable Controller 14-20 Transferring Parameters Saving the Transferred Values 4-19 Transferring the Configuration Data 27-75 Transferring the Data 27-79 Transferring to IN_OUT Parameters of a Function Block A-74 Translating and Editing User Texts 14-17, 14-18 Translating User Texts 27-73 Tree Structure 12-4, 12-5 Trigger Conditions for Recording the Program Status 30-12 Trigger for Modifying Variables Defining 18-16 Trigger for Monitoring Variables Defining 18-14 Trigger Frequency 18-13 Trigger Point Setting 18-13 Troubleshooting 21-1 Sample Programs 21-25
Troubleshooting in STL Source Files 11-16 Types of Interrupt 4-4 UDT 8-11, A-41, A-51, A-52 Uninstalling Authorization 2-1, 2-2, 2-3, 2-4, 2-5 Uninstalling STEP 7 2-16 Unmasking Start Events 4-36 Unmasking Synchronous Errors A-112 Example A-112 Unused Addresses Displaying 12-12 Unused Symbols 12-9 UPDAT_PI A-22 UPDAT_PO A-22 Updating A-21, A-22 Process Image A-21, A-22 Reference Data Automatically On Compilation 27-63 Updating Block Calls 9-24 Updating the Window Contents 16-4 Upgrading Authorization 2-1 Uploaded Blocks Editing in the PG/PC 17-10 Uploading 29-5 Blocks from an S7 CPU 17-9 Blocks to a Different Project on the Programming Device 29-4 Blocks to a New Project on the Programming Device 29-5 Blocks to the Corresponding Project on the Programming Device 29-4 Station 17-8 Uploading from the Programmable Controller to the PG/PC 17-6 Upper Limits for Entering Counters 18-7 Upper Limits for Entering Timers 18-6 User Data A-119 User Interface 5-21 User Memory 17-12 Compressing 17-12 User Program A-16 Downloading A-16 Elements 4-2 in the CPU Memory A-16 Tasks 4-1, 4-2 User Programs Downloading 17-3 User Rights 2-1 User Text Lists 32-4 Printing 32-4 User Texts
Programming with STEP 7 V5.0 C79000-G7076-C562-02
Index-20
Index
Exporting/Importing 14-17 Requirements 14-17 Translating and Editing 14-17 User-Defined Data Type Correcting the Interface 9-26 User-Defined Data Types A-41, A-51 User-Defined Data Types (UDT) 8-11 Entering the Structure 10-6 User-Defined Data Types in STL Source Files 11-24 Example 11-24 User-Defined Diagnostic Messages Creating and Editing 14-16 Displaying 14-21 Uses for Saving/Archiving 22-6 Using 27-20 Library 27-20 Using Arrays to Access Data A-45 Using Clock Memory and Timers A-126 Using Complex Data Types A-44 Using Multiple Instances 9-9 Using Older Projects A-74, A-75 Using SFCs A-21 Using Structures to Access Data A-48 Using the Clock Functions A-125 Using the Parameter Type ANY A-63 Using the Parameter Type POINTER A-55 Using the System Memory Areas A-19 Using the Variable Declaration in Logic Blocks 9-4 Using User-Defined Data Types to Access Data A-50 Valves 3-7 Creating an I/O Diagram 3-7 Variable Declaration Table 9-1, 9-4, 9-5, 21-28 Assigning System Attributes 27-29 Code Section 9-6 Entering a Multiple Instance 27-25 Entering Data Elements of the Data Type STRUCT 27-26 Entering Data Type ARRAY 27-27 Entering Elementary Data Types 27-24 FC for the Sample Industrial Blending Process A-90 for OB81 21-25 OB for the Sample Industrial Blending Process A-92 Purpose 9-4 Structure 9-7 System Attributes for Parameters 9-5 Variable Declaration Tables Changing Variables 27-29 Copying Variables 27-28 Deleting Variables 27-28
Inserting Blank Rows 27-24 Variable Table 32-7 Copying from the Symbol Table 30-4 Creating 30-1 Creating and Opening 18-2 Editing 18-4, 30-3 Example 18-4, 18-5 Example of Entering Addresses 18-8 Inserting a Contiguous Address Area 30-5 Inserting Addresses or Symbols 18-4 Maximum Size 18-5 Opening 30-1 Pasting Areas from the Clipboard 30-4 Printing 32-7 Saving 18-1, 18-3 Syntax Check 18-5 Using 18-1 Variables 15-1, 15-2 Copying in Variable Declaration Tables 27-28 Deleting in Declaration Tables 27-28 Modifying 18-15, 18-16 Monitoring 18-13 Operator Control and Monitoring 15-1, 15-2 Version 1 Projects A-74, A-75 Converting A-74 Version 2 Projects A-75, A-76 Converting A-75 View Zooming 27-22 Viewing the Device Properties of a Display Device 27-66 Viewing the Properties of a Display Device 27-66 Virtual Work Memory Setting 25-2 Warm Restart Automatic A-5 Manual A-5 Warning A-23 Overwriting the L Stack A-23 What Are the Different Messaging Methods? 14-1 What You Should Know About HOLD Mode 19-7 What You Should Know About Testing in SingleStep Mode/Breakpoints 19-5 What You Should Know About the HOLD Mode 19-7 What's New in STEP 7 Version 5.0? 1-10 Which Message Blocks Are Available? 14-6 Which Message Blocks Exist? 14-6 WinCC Attributes 27-77 Window Setting the Size 27-13 Window Arrangement 5-21
Index-21
Index
Changing 5-30 Restoring 5-31 Saving 5-31 Window Arrangement of Symbol Tables 27-14 Changing 27-14 Window Contents 16-4 Updating 16-4 Window Split 27-22 Setting 27-22 Windows 5-36 Toggling 5-36 Windows NT 23-1 WORD A-32, A-39 Word (WORD) A-32 Area A-32 Work Memory 17-4, A-15, A-16, A-17 Working Windows 27-62 Opening for Reference Data Already Displayed 27-62 Working with Libraries 8-15 WR_DPARM A-120, A-124 WR_PARM A-120, A-124 WR_USMSG 21-21 Zooming Out 27-22 Zooming the View 27-22
Index-22
From: Your Name:............................................................................................................................... Your Title: ................................................................................................................................. Company Name:......................................................................................................................... Street: ................................................................................................................................. Country: .............................................................................................................................. Phone: ................................................................................................................................
Please check any industry that applies to you: Automotive Chemical Electrical Machinery Food Instrument and Control Nonelectrical Machinery Petrochemical Pharmaceutical Plastic Pulp and Paper Textiles Transportation Other....................................................
"
Programming with STEP 7 V5.0 C79000-G7076-C562-02
Remarks Form Your comments and recommendations will help us to improve the quality and usefulness of our publications. Please take the first available opportunity to fill out this questionnaire and return it to Siemens.
Please give each of the following questions your own personal mark within the range from 1 (very good) to 5 (poor).
1. Do the contents meet your requirements? 2. Is the information you need easy to find? 3. Is the text easy to understand? 4. Does the level of technical detail meet your requirements? 5. Please rate the quality of the graphics/tables:
o o o o o
Additional comments: .............................................................................................................................................. .............................................................................................................................................. .............................................................................................................................................. .............................................................................................................................................. .............................................................................................................................................. .............................................................................................................................................. .............................................................................................................................................. .............................................................................................................................................. .............................................................................................................................................. .............................................................................................................................................. .............................................................................................................................................. ..............................................................................................................................................