s Preface, Contents Introducing the Product and Installing the Software 1 Installation 2 Working Out the Automation Concept 3 Basics of Designing a Program Structure 4 Startup and Operation 5 Setting Up and Editing the Project 6 Editing Projects with different Versions of STEP 7 7 Defining Symbols 8 Creating Blocks and Libraries 9 Creating Logic Blocks 10 Creating Data Blocks 11 Parameter Assignment for Data Blocks 12 Creating STL Source Files 13 Displaying Reference Data 14 Checking Block Consistency and Time Stamps as a Block Property 15 Configuring Messages 16 Controlling and Monitoring Variables 17 Establishing an Online Connection and Making CPU Settings 18 Downloading and Uploading 19 Debugging 20 Testing Using Program Status 21 Testing using the Simulation Program (Optional Package) 22 Diagnostics 23 Printing and Archiving 24 Working with M7 Programmable Control Systems 25 Tips and Tricks 26 Appendix A Index SIMATIC Programming with STEP 7 V5.3 Manual This manual is part of the documentation package with the order number: 6ES7810-4CA07-8BW0 Edition 01/2004 A5E00261405-01 Copyright © Siemens AG 2004 All rights reserved The reproduction, transmission or use of this document or its contents is not permitted without express written authority. Offenders will be liable for damages. All rights, including rights created by patent grant or registration of a utility model or design, are reserved. Siemens AG Bereich Automation and Drives Geschaeftsgebiet Industrial Automation Systems Postfach 4848, D- 90327 Nuernberg Disclaimer of Liability We have checked the contents of this manual for agreement with the hardware and software described. Sin ce deviations cannot be precluded entirely, we cannot guarantee full agreement. However, the data in this manual are reviewed regularly and any necessary corrections included in subsequent editions. Suggestions for improvement are welcomed. ©Siemens AG 2004 Technical data subject to change. Siemens Aktiengesellschaft A5E00261405-01 Safety Guidelines This manual contains notices intended to ensure personal safety, as well as to protect the products and connected equipment against damage. These notices are highlighted by the symbols shown below and graded according to severity by the following texts: ! Danger indicates that death, severe personal injury or substantial property damage will result if proper precautions are not taken. ! Warning indicates that death, severe personal injury or substantial property damage can result if proper precautions are not taken. ! Caution indicates that minor personal injury can result if proper precautions are not taken. Caution indicates that property damage can result if proper precautions are not taken. Notice draws your attention to particularly important information on the product, handling the product, or to a particular part of the documentation. Qualified Personnel Only qualified personnel should be allowed to install and work on this equipment. Qualified persons are defined as persons who are authorized to commission, to ground and to tag circuits, equipment, and systems in accordance with established safety practices and standards. Correct Usage Note the following: ! Warning This device and its components may only be used for the applications described in the catalog or the technical description, and only in connection with devices or components from other manufacturers which have been approved or recommended by Siemens. This product can only function correctly and safely if it is transported, stored, set up, and installed correctly, and operated and maintained as recommended. Trademarks SIMATIC®, SIMATIC HMI® and SIMATIC NET® are registered trademarks of SIEMENS AG. Third parties using for their own purposes any other names in this document which refer to trademarks might infringe upon the rights of the trademark owners. Programming with STEP 7 V5.3 A5E00261405-01 iii Preface Purpose This manual provides a complete overview of programming with STEP 7. It is designed to support you when installing and commissioning the software. It explains how to proceed when creating programs and describes the components of user programs. The manual is intended for people who are involved in carrying out control tasks using STEP 7 and SIMATIC S7 automation systems. We recommend that you familiarize yourself with the examples in the manual "Working with STEP 7 V5.3, Getting Started." These examples provide an easy introduction to the topic "Programming with STEP 7." Basic Knowledge Required In order to understand this manual, general knowledge of automation technology is required. In addition, you must be familiar with using computers or PC-similar tools (for example, programming devices) with the MS Windows 2000 Professional or MS Windows XP Professional operating system. Scope of the Manual This manual is valid for release 5.3 of the STEP 7 programming software package. You can find the latest information on the service packs: • in the "readme.wri" file • in the updated STEP 7 online help. The topic "What's new?" in the online help offers an excellent introduction and overview of the newest STEP 7 innovations. Preface Programming with STEP 7 V5.3 iv A5E00261405-01 STEP 7 Documentation Packages This manual is part of the documentation package "STEP 7 Basic Information.“ The following table displays an overview of the STEP 7 documentation: Documentation Purpose Order Number STEP 7 Basic Information with • Working with STEP 7 V5.3, Getting Started Manual • Programming with STEP 7 V5.3 • Configuring Hardware and Communication Connections, STEP 7 V5.3 • From S5 to S7, Converter Manual Basic information for technical personnel describing the methods of implementing control tasks with STEP 7 and the S7-300/400 programmable controllers. 6ES7810-4CA07-8BW0 STEP 7 Reference with • Ladder Logic (LAD)/Function Block Diagram (FBD)/Statement List (STL) for S7-300/400 manuals • Standard and System Functions for S7-300/400 Provides reference information and describes the programming languages LAD, FBD, and STL, and standard and system functions extending the scope of the STEP 7 basic information. 6ES7810-4CA07-8BW1 Online Helps Purpose Order Number Help on STEP 7 Basic information on programming and configuring with STEP 7 in the form of an online help. Part of the STEP 7 Standard software. Reference helps on STL/LAD/FBD Reference help on SFBs/SFCs Reference help on Organization Blocks Context-sensitive reference information. Part of the STEP 7 Standard software. Preface Programming with STEP 7 V5.3 A5E00261405-01 v Online Help The manual is complemented by an online help which is integrated in the software. This online help is intended to provide you with detailed support when using the software. The help system is integrated in the software via a number of interfaces: • There are several menu commands which you can select in the Help menu: The Contents command opens the index for the Help on Step 7. • Using Help provides detailed instructions on using the online help. • The context-sensitive help offers information on the current context, for example, an open dialog box or an active window. You can open the context-sensitive help by clicking the "Help" button or by pressing F1. • The status bar offers another form of context-sensitive help. It displays a short explanation for each menu command when the mouse pointer is positioned on the menu command. • A brief explanation is also displayed for each icon in the toolbar when the mouse pointer is positioned on the icon for a short time. If you prefer to read the information from the online help in printed format, you can print out individual help topics, books, or the entire online help. This manual, as well as the manuals "Configuring Hardware with STEP 7", "Modifiying the System During Operation via CiR" and "Automation System S7 400H - Fault-tolerant Systems" is an extract from the HTML-based Help on STEP 7. For detailed procedures please refer to the STEP 7 help. As the manuals and the online help share an almost identical structure, it is easy to switch between the manuals and the online help. You can find the electronic manuals after installing STEP 7 via the Windows Start menu: Start > SIMATIC > Documentation. Further Support If you have any technical questions, please get in touch with your Siemens representative or agent responsible. You will find your contact person at: http://www.siemens.com/automation/partner Training Centers Siemens offers a number of training courses to introduce you to the S7 automation system. Please contact your regional training center or our central training center in D 90327 Nuremberg, Germany for details: Telephone: +49 (911) 895-3200. Internet: http://www.sitrain.com Preface Programming with STEP 7 V5.3 vi A5E00261405-01 A&D Technical Support Worldwide, available 24 hours a day: Beijing Peking Nuernberg Johnson City Worldwide (Nuernberg) Technical Support 24 hours a day, 365 days a year Phone: +49 (180) 5050-222 Fax: +49 (180) 5050-223 E-Mail: adsupport@ siemens.com GMT: +1:00 Europe / Africa (Nuernberg) Authorization Local time: Mon Fri. 8:00 to 5:00 PM Phone: +49 (180) 5050-222 Fax: +49 (180) 5050-223 E-Mail: adsupport@ siemens.com GMT: +1:00 United States (Johnson City) Technical Support and Authorization Local time: Mon Fri. 8:00 to 5:00 PM Phone: +1 (423) 262 2522 Fax: +1 (423) 262 2289 E-Mail: simatic.hotline@ sea.siemens.com GMT: -5:00 Asia / Australia (Beijing) Technical Support and Authorization Local time: Mon Fri. 8:00 to 5:00 PM Phone: +86 10 64 75 75 75 Fax: +86 10 64 74 74 74 E-Mail: adsupport.asia@ siemens.com GMT: +8:00 The languages of the SIMATIC Hotlines and the authorization hotline are generally German and English. Preface Programming with STEP 7 V5.3 A5E00261405-01 vii Service & Support on the Internet In addition to our documentation, we offer our Know-how online on the internet at: http://www.siemens.com/automation/service&support where you will find the following: • The newsletter, which constantly provides you with up-to-date information on your products. • The right documents via our Search function in Service & Support. • A forum, where users and experts from all over the world exchange their experiences. • Your local representative for Automation & Drives. • Information on field service, repairs, spare parts and more under "Services". Preface Programming with STEP 7 V5.3 viii A5E00261405-01 Programming with STEP 7 V5.3 A5E00261405-01 ix Contents 1 Introducing the Product and Installing the Software 1-1 1.1 Overview of STEP 7 1-1 1.2 The STEP 7 Standard Package 1-5 1.3 What's New in STEP 7, Version 5.3? 1-9 1.4 Extended Uses of the STEP 7 Standard Package 1-11 1.4.1 Engineering Tools 1-12 1.4.2 Run-Time Software 1-14 1.4.3 Human Machine Interface 1-15 2 Installation 2-1 2.1 Automation License Manager 2-1 2.1.1 User Rights Through The Automation License Manager 2-1 2.1.2 Installing the Automation License Manager 2-3 2.1.3 Guidelines for Handling License Keys 2-4 2.2 Installing STEP 7 2-5 2.2.1 Installation Procedure 2-6 2.2.2 Setting the PG/PC Interface 2-9 2.3 Uninstalling STEP 7 2-11 2.3.1 Uninstalling STEP 7 2-11 3 Working Out the Automation Concept 3-1 3.1 Basic Procedure for Planning an Automation Project 3-1 3.2 Dividing the Process into Tasks and Areas 3-2 3.3 Describing the Individual Functional Areas 3-4 3.4 Listing Inputs, Outputs, and In/Outs 3-6 3.5 Creating an I/O Diagram for the Motors 3-6 3.6 Creating an I/O Diagram for the Valves 3-7 3.7 Establishing the Safety Requirements 3-7 3.8 Describing the Required Operator Displays and Controls 3-8 3.9 Creating a Configuration Diagram 3-9 4 Basics of Designing a Program Structure 4-1 4.1 Programs in a CPU 4-1 4.2 Blocks in the User Program 4-2 4.2.1 Blocks in the User Program 4-2 4.2.2 Organization Blocks and Program Structure 4-3 4.2.3 Call Hierarchy in the User Program 4-8 4.2.4 Block Types 4-10 4.2.4.1 Organization Block for Cyclic Program Processing (OB1) 4-10 4.2.4.2 Functions (FC) 4-15 4.2.4.3 Function Blocks (FB) 4-16 4.2.4.4 Instance Data Blocks 4-19 4.2.4.5 Shared Data Blocks (DB) 4-21 4.2.4.6 System Function Blocks (SFB) and System Functions (SFC) 4-22 Contents Programming with STEP 7 V5.3 x A5E00261405-01 4.2.5 Organization Blocks for Interrupt-Driven Program Processing 4-23 4.2.5.1 Organization Blocks for Interrupt-Driven Program Processing 4-23 4.2.5.2 Time-of-Day Interrupt Organization Blocks (OB10 to OB17) 4-24 4.2.5.3 Time-Delay Interrupt Organization Blocks (OB20 to OB23) 4-26 4.2.5.4 Cyclic Interrupt Organization Blocks (OB30 to OB38) 4-26 4.2.5.5 Hardware Interrupt Organization Blocks (OB40 to OB47) 4-28 4.2.5.6 Startup Organization Blocks (OB100 / OB101 / OB102) 4-29 4.2.5.7 Background Organization Block (OB90) 4-31 4.2.5.8 Error Handling Organization Blocks (OB70 to OB87 / OB121 to OB122) 4-32 5 Startup and Operation 5-1 5.1 Starting STEP 7 5-1 5.2 Starting STEP 7 with Default Start Parameters 5-2 5.3 Calling the Help Functions 5-3 5.4 Objects and Object Hierarchy 5-4 5.4.1 Objects and Object Hierarchy 5-4 5.4.2 Project Object 5-5 5.4.3 Library Object 5-6 5.4.4 Station Object 5-7 5.4.5 Programmable Module Object 5-8 5.4.6 S7/M7 Program Object 5-10 5.4.7 Block Folder Object 5-11 5.4.8 Source File Folder Object 5-14 5.4.9 S7/M7 Program without a Station or CPU 5-15 5.5 User Interface and Operation 5-16 5.5.1 Operating Philosophy 5-16 5.5.2 Window Arrangement 5-17 5.5.3 Elements in Dialog Boxes 5-18 5.5.4 Creating and Managing Objects 5-19 5.5.5 Selecting Objects in a Dialog Box 5-24 5.5.6 Session Memory 5-25 5.5.7 Changing the Window Arrangement 5-25 5.5.8 Saving and Restoring the Window Arrangement 5-25 5.6 Keyboard Operation 5-26 5.6.1 Keyboard Control 5-26 5.6.2 Key Combinations for Menu Commands 5-27 5.6.3 Key Combinations for Moving the Cursor 5-28 5.6.4 Key Combinations for Selecting Text 5-30 5.6.5 Key Combinations for Access to Online Help 5-30 5.6.6 Key Combinations for Toggling between Windows 5-30 6 Setting Up and Editing the Project 6-1 6.1 Project Structure 6-1 6.2 Setting Up a Project 6-2 6.2.1 Creating a Project 6-2 6.2.2 Inserting Stations 6-4 6.2.3 Inserting an S7/M7 Program 6-5 6.2.4 Editing a Project 6-7 6.2.5 Checking Projects for Software Packages Used 6-8 6.3 Managing Multilingual Texts 6-9 6.3.1 Managing Multilingual Texts 6-9 6.3.2 Types of Multilingual Texts 6-11 6.3.3 Structure of the Export File 6-12 6.3.4 Managing User Texts Whose Language Font is Not Installed 6-13 6.3.5 Optimizing the Source for Translation 6-14 6.3.6 Optimizing the Translation Process 6-15 [...]... system: S 7- 3 00 S 7- 4 00 Engineering Tools • Borland C/C++ • CFC • DOCPRO • HARDPRO • M7 ProC/C++ • S7 GRAPH • S7 HiGraph • S7 PDIAG • S7 PLCSIM • S7 SCL • Teleservice Run-Time Software • Fuzzy Control Programming with STEP 7 V5.3 A5E0026140 5-0 1 1) + + + STEP 7 M 7- 3 00 M 7- 4 00 o + 3) + C 7- 6 20 + + 2) + + 2) o 1) + + + + + + + + + + + + 1-1 1 Introducing the Product and Installing the Software STEP 7 M 7- 3 00 M 7- 4 00... part of the SIMATIC industry software There are the following versions of the STEP 7 Standard package: • STEP 7 Micro/DOS and STEP 7 Micro/Win for simpler stand-alone applications on the SIMATIC S 7- 2 00 • STEP 7 for applications on SIMATIC S 7- 3 00/S 7- 4 00, SIMATIC M 7- 3 00/M 7- 4 00, and SIMATIC C7 with a wider range of functions: - Can be extended as an option by the software products in the SIMATIC Industry... Offline A-109 Using the Clock Functions A-110 Using Clock Memory and Timers A-111 Index Programming with STEP 7 V5.3 A5E0026140 5-0 1 xix Contents xx Programming with STEP 7 V5.3 A5E0026140 5-0 1 1 Introducing the Product and Installing the Software 1.1 Overview of STEP 7 What is STEP 7? STEP 7 is the standard software package used for configuring and programming SIMATIC programmable... A -7 1 Defining Logic Blocks A -7 3 Assigning Symbolic Names A -7 4 Creating the FB for the Motor A -7 6 Creating the FC for the Valves A -7 9 Creating OB1 A-81 Example of Handling Time-of-Day Interrupts A-86 Example of Handling Time-of-Day Interrupts A-86 Structure of the User Program "Time-of-Day Interrupts" A- 87 FC12 A-88 OB10... 7. 2 Expanding DP Slaves That Were Created with Previous Versions of STEP 7 7- 1 7. 3 Editing Current Configurations with Previous Versions of STEP 7 7- 3 7. 4 Appending SIMATIC PC Configurations of Previous Versions 7- 4 7. 5 Displaying Modules Configured with Later STEP 7 Versions or Optional Packages . 7- 5 8 Defining Symbols 8-1 8.1 8.2 8.3 8.4 8.5 8.5.1 8.5.2 8.5.3... . 9-4 Statement List Programming Language (STL) . 9-5 S7 SCL Programming Language 9-5 S7-GRAPH Programming Language (Sequential Control) 9 -7 S7 HiGraph Programming Language (State Graph) 9-8 S7 CFC Programming Language 9-9 Creating Blocks 9-1 0 Blocks Folder 9-1 0 User-Defined Data Types (UDT) 9-1 1 Block Properties 9-1 2 Displaying Block... Resetting the CPU 1 9-1 6 Deleting S7 Blocks on the Programmable Controller 1 9-1 7 Compressing the User Memory (RAM) 1 9-1 7 Gaps in the User Memory (RAM) .1 9-1 7 Compressing the Memory Contents of an S7 CPU 1 9-1 8 Testing using the Simulation Program S7 PLCSIM (Optional Package) .2 2-1 Programming with STEP 7 V5.3 A5E0026140 5-0 1 Contents 23 Diagnostics 2 3-1 23.1 23.2 23.3... Procedure for M7 Systems 2 5-1 Optional Software for M7 Programming .2 5-2 M 7- 3 00/M 7- 4 00 Operating Systems 2 5-4 Operating Modes A-1 Operating Modes and Mode Transitions A-1 STOP Mode A-3 STARTUP Mode A-5 RUN Mode A-11 HOLD Mode A-12 Memory Areas of S7 CPUs A-13 Distribution of the Memory Areas A-13 Load... S 7- 3 00 S 7- 4 00 • M7-DDE Server • M7-SYS RT • Modular PID Control • PC-DDE Server • PRODAVE MPI • Standard PID Control Human Machine Interface • ProAgent • SIMATIC ProTool • SIMATIC ProTool/Lite • SIMATIC WinCC C 7- 6 20 + + + + + + o o = obligatory + = optional 1) = recommended from S 7- 4 00 upwards 2) = not recommended for C 7- 6 20 3) 1.4.1 = not for C programs Engineering Tools Engineering Tools are task-oriented... SIMATIC S7, SIMATIC M7, and SIMATIC C7 It automatically controls the data flow across the MPI interface An M7 DDE server (Dynamic Data Exchange) can be used to link Windows applications to process variables in SIMATIC M7, without additional programming effort Programming with STEP 7 V5.3 A5E0026140 5-0 1 Introducing the Product and Installing the Software Real-Time Operating System • 1.4.3 M7-SYS RT contains . 2 3- 2 3 23. 9 .3 Inserting Substitute Values for Error Detection 2 3- 2 7 23. 9.4 I/O Redundancy Error (OB70) 2 3- 2 9 23. 9.5 CPU Redundancy Error (OB72) 2 3- 2 9 23. 9.6 Time Error (OB80) 2 3- 3 0 23. 9 .7. (OB81) 2 3- 3 1 23. 9.8 Diagnostic Interrupt (OB82) 2 3- 3 2 23. 9.9 Insert/Remove Module Interrupt (OB 83) 2 3- 3 3 23. 9.10 CPU Hardware Fault (OB84) 2 3- 3 4 23. 9.11 Program Sequence Error (OB85) 2 3- 3 4 23. 9.12. (OB86) 2 3- 3 5 23. 9. 13 Communication Error (OB 87) 2 3- 3 6 23. 9.14 Programming Error (OB121) 2 3- 3 6 23. 9.15 I/O Access Error (OB122) 2 3- 3 7 24 Printing and Archiving 2 4-1 24.1 Printing Project Documentation