First Fir st Steps Steps with STEP 7 Lite Lite V3.0 V3.0
SIMATIC STEP 7 Lite V3.0 Edition 04/2004
simatic
4
Erstellen Sie ein ei n Programm im OB1
SIMATIC Software
First Steps with STEP 7 Lite V3.0 Getting Started
04/2004 A5E00293886-01
Introduction
Safety Guidelines This manual contains notices intended to ensure personal safety, safety, as well as to protect the products and connected equipment against damage. These notices are highlighted by by the symbols shown below and graded according to severity by the following texts: Danger indicates that death, sev severe ere personal injury injury or substantial property property damage will result if proper precautions precautions are not taken. Warning indicates that death, sev severe ere personal injury injury or substantial property property damage can result if proper precautions precautions are not taken. Caution indicates that minor personal personal injury can result result if proper precautions precautions are not taken. taken. Caution indicates that property property damage can result if proper precautions precautions are not taken. taken. Notice draws your your attention to particularly particularly important information information on the product, product, handling the product, 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 are authorized authorized to commission, commission, to ground and to tag circuits, circuits, equipmen equipment, t, and systems in in accordance accordance with established safety practices and standards.
Correct Usage Note the following:
0.2
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 have been approved or recommended by Siemens. This product product can only only function function correctly correctly and safely safely if it is transpo transported, rted, stored, set up, up, and installed installed correctly, and operated and maintained as recommended.
Trademarks SIMATIC®, SIMA SIMATIC®, SIMATIC TIC HMI® and SIMATIC SIMATIC NET® are registered trademarks trademarks of SIEMENS AG. AG. Third parties using for their own purposes any other names in this document which refer to trademarks might infringe upon the rights rights of the trademark trademark owners. owners.
Copyright © Siemens AG 2004 All rights reserved
Disclaimer of Liability
The reprodu reproduction, ction, transmi transmission ssion or use use of of this document or its contents is not permitted without express written authority authority. Offenders will will be liable for damages. damages. All rights,, includin rights including g rights created by patent grant grant or registration registr ation of a utility utility model model or design, are reserved. reserved.
We have have checked the contents contents of this manual for agreement agreement with the hardware hardwar e and software described. described. Since deviations deviations cannot be precluded entirely entirely, we cannot guarantee guarantee full agreement. agreement. Howev However er,, the data in this manual are reviewed regularly and any necessary corrections correction s included in subsequent editions. Suggesti Suggestions ons for improvement are welcomed.
Siemens AG Bereich Automation and Drives Geschaeftsgebiet Industrial Automation Systems Postfach Pos tfach 4848, D- 90327 Nuernberg Nuernberg ______________________________________________________ Siemens Aktiengesell Aktiengesellschaft schaft
Getting Started STEP 7 Lite A5E00293886-01
©Siemens AG 2004 Technical data subject to change. ______________________________________________________ A5E00293886
Welcome to STEP 7 Lite ... the SIMATIC SIMATIC software for generating generating PLC programs in LAD LAD, FBD or STL for SIMA SIMATIC S7-300 (including SIMATIC SIMA TIC C7), ET 200S and ET 200X. STEP 7 Lite is designed for the newcomer newcomer to SIMATIC SIMATIC as well as for the user editing projects offline. You will need basic STEP 7 software or STEP 7 Professional if you want to implement a SIMATIC SIMATIC S7-400 PLC, PL C, distr distribute ibuted d I/O, I/O, CP communic communication ation modules modules,, FM functio function n modules, modules, or systems systems consis consisting ting of of more than than one CPU.
Information on STEP 7 Lite STEP 7 Lite is a software software not only designed for newcomers, newcomers, but also for the expert who primarily programs medium performance performance systems. With STEP 7, programs created in STEP STEP 7 Lite can be imported/exported for further use. use. Comp Compared ared to STEP 7, we went new ways ways in designing designing the user user interface. interface. Enhanc Enhanced ed Explorer Explorer functions funct ions,, trans transparent parent project project overviews overviews and the usual Windows Windows operating operating philosophy philosophy,, all of which will offer optimal support to you for getting started and working with our SIMATIC Software.
Information on this Getting Started Here you will will get to know the basics of STEP 7 Lite. Lite. We shall shall guide you through practical exercises exercises introducing you to essential on-screen dialogs and operating procedures, prepared in such a way way that you can start at almost any chapter. chapter. Descriptions and operating procedures you should refer refer or which you must follow are highlighted in red color color.. Brief ex excursio cursions ns to associated associated topics are reference referenced d inblue in blue color.
Prerequisites for working with this Getting Started What you need to work through the practical STEP 7 Lite exercises in this Getting Started: • a SIM SIMA ATI TIC C PG PG or or a PC PC,, • the STEP STEP 7 Lite Lite softwa software re package package and the authori authorization zation disk, • a SIM SIMA ATI TIC C S7 S7-3 -300 00 PL PLC C. Please Pleas e note the Order No. No. table in Chapter Chapter 1.
Further Documentation •
Afterr inst Afte instal alla lati tion on of of ST STEP EP 7 Lit Lite e, se sele lect ct Start > Simatic > Documentation on your CD to open and print the electronic manual "Programming with STEP 7 Lite".
Have Hav e lots of fun and succe success! ss! SIEMENS AG
Getting Started STEP STEP 7 Lite A5E00293886-01
0.3
Introduction
Overview of the Getting Started Sample Projects After installing your STEP 7 Lite software, software, unless you have have selected another directory, directory, go to :\Siemens\S7lite\E :\Siemens\S7lite\Examples\English xamples\English ... to find the programming samples to follow. follow.
This Getting Started refers to these samples:
•
first_stepd_stl.k7p
•
first_steps_fdb.k7p
•
first_steps_lad.k7p
All sample programs are identical, identical, differing only in the programming language you choose to work with.
0.4
Getting Started STEP STEP 7 Lite A5E00293886-01
Contents
Part 1: 1: Getti Getting ng started started with STEP STEP 7 Lite Lite - Essent Essential ial basics basics Overview Over view and and installat installation ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 What are you you going to learn? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Interactionbetween Interaction between hardware hardware and software software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Guide to STEP 7 Lite Lite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.6 Installing STEP STEP 7 Lite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.8
Starting and operating. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Opening a sample sample project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Project handling handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6 Calling help help functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8
Part 2: 2: How to devel develop op an autom automation ation solu solution tion with STEP STEP 7 Lite Lite Implementing the the task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Task - Motor bench. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Splitting the process process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4
Module configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 What happens during during configuration? configuration? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Creating a new project project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Working Workin g in the hardware hardware configuration configuration view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Module parameter parameter assignment assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.12 Saving configuration configuration data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.14 Downloading hardware configuration configuration data data to the CPU . . . . . . . . . . . . . . . . . . . . . . . . 4.16
Creating the symbol symbol table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Absolute programming programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Symbolic programming programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4
Getting Started STEP STEP 7 Lite A5E00293886-01
0.5
Introduction
Getting Getti ng started started with with programm programming ing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Choosing Choo sing LAD LAD,, FBD or STL STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 6.2 Working Wo rking in the block editor editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4 Programming OB1 in LAD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6 Programming OB1 OB1 in STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.12 Programming OB1 in FBD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.18 Displaying Displayi ng cross-references cross-references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.24 6.24
Using function blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Generating and opening function blocks (FBs). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 Programming FBs FBs in LAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6 Programming FBs FBs in STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.8 Programming FBs FBs in FBD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.10 Generating instance data blocks and modifying actual actual values values . . . . . . . . . . . . . . . . . . 7.12 Programming block block calls in LAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.14 Programming block calls in STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.16 0.6
Programming block block calls in FBD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.18
Using functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Creating and opening opening functions functions (FCs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.2 Programming functions functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.6 Calling functions functions in OB1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.8
Using global data blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Creating and opening opening global global data blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2 Programming DB variables variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4
Getting Started STEP STEP 7 Lite A5E00293886-01
Part 3: Downl Downloadi oading, ng, Testi Testing ng and Diagn Diagnosin osing g Downloading programs programs to the CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Establishing an Online connection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2 Resetting CPU memory and downloading downloading the the program . . . . . . . . . . . . . . . . . . . . . . . 10.6 10.6
Program test test run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Performing Per forming a program test run with program program status . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Monitoring and and modifying variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.6
Error diagnostics diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 A quick glance glance at hardware diagnostics diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.2 Module status and error history. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.5
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
0.7
Getting Started STEP STEP 7 Lite A5E00293886-01
0.8
Getting Started STEP STEP 7 Lite A5E00293886-01
4 1 e t e 7 L i t S T E P
ErstellenSie Erstellen Overview Sie ein Proein Proand an d gramm im gramm im installation OB1 OB 11 OB1 OB
Overview and installation
What are you going to learn?
1.2
Practical exercises in this manual will show you how easy it is to handle the programming languages LAD (Ladder logic), FBD (Function (Function block diagram) diagram) and STL (Statement list) in STEP 7 Lite. Start by creating creating a project. Name it “Getting Started”. Next, you will create create a PLC PLC program in this project, project, using the the simple binary logical logic al operation operations s AND, AND, OR, MEMO MEMORY RY CIRCUIT. You are then going to enhance this PLC program to operate a motor testing bench.
Getting Started STEP STEP 7 Lite A5E00293886-01
Basic know-how Our programming examples are based on three fundamen fundamental, tal, binary logical operations:
Series circuit Key 1 Key 2
The first binary logical operation you are then going to program is an AND function. The AND function can be demonstrated by an electrical circuit that is equipped with two pushbuttons. The lamp is lit when pushbutton 1 AND 2 are pressed.
Key 3
Parallel circuit The second binary logical link is the OR function which can also be demonstrated in an electrical circuit. The lamp is lit when pushbutton 3 OR 4 is pressed.
Key 4 1.3
Memory circuit (Set/reset flipflop) Key S
The third binary logical operation is the memory circuit. In an electrical circuit it responds to certain voltage levels and outputs these accordingly. Press pushbutton pushbutton S. S. The lamp remains remains lit until pushbutton R is pressed.
Key R You are going to program all three binary logical operations to form a practical sample circuit – a motor bench. You will learn how to handle folfollowing STEP 7 Lite program elements: Organization Organizatio n blocks, blocks, function blocks, instance insta nce data data blocks, blocks, func function tions, s, glob global al data blocks.
Getting Started STEP STEP 7 Lite A5E00293886-01
Overview and installation
Interaction between hardware and software Transfering a project Progamming device
STEP 7 Lite Software
Machine to be controlled (can be simulated with S7-PLCSIM)
Power supply
1.4
either an MPI cable between PG/PC and PLC PL C
Memory module
or a PC adapter and zero modem cable (RS-232) Using the STEP 7 Lite Lite software, software, you are going to create your user program in a project.
Power supply module
The programmable controller (PLC) cons co nsis ists ts of of a rack, a power supply, a CPU and input or output modules.
CPU
Input module
Output module
Getting Started STEP STEP 7 Lite A5E00293886-01
The PLC monitors and controls your machine mach ine with with the help help of the user user program. I/O modules are addressed in the user program via I/O addresses.
Component Checklist You require the following components to create the sample project described above.
PLC station
1 Order numbers:
Power supply (PS 307 2A) 6ES7307-1BA00-0AA0 CPU (CPU 315) 6ES7315-1AF03-0AB0 Dig Di git in inpu putt (S (SM3 M32 2DI 16 16xD xDC2 C24 4V) 6ES ES7 7321 21--1BH0 H02 2-0A 0AA0 A0 Digital output (SM322 DO 16xDC24V/0,5A) 6ES7322-1BH01-0AA0 Backup batter y (Li) 3,4V 6ES7971-1AA00-0AA0 Profile rail 480 mm 6ES7390-1AE80-0AA0
Computer
2
SIMATIC PG www.ad.siemens.de/ Power PG, Fi F ield PG or simatic-pg Commonly available PC with CP 5611 Operating system Windows 2000 or Windows XP Home or Professional Edition Internet Inte rnet Explore Explorerr as of V6.0
Software
STEP 7 Lite lets you program components nen ts of the S7-3 S7-300, 00, ET 200S and ET 200X series. series. The modules modules used in the the sample project are listed in brackets. Of cour course, se, you are free to use use other other modules mod ules of of thes these e series series..
We recommend you use our SIMATIC PGs. These units can can withstand withstand harsh industrial environments. You will need an additional interface cable if you decide decide to use a commonly available PC. This interface interface is already already integrated in SIMATIC PGs.
1.5
3
Notes on installation are found on the CD,, in STEP7Lite CD STEP7Lite\Disk1\README.WRI. \Disk1\README.WRI.
Software STEP 7 Lite (Floating License) License) 6ES78106ES7810-3CC07-0Y 3CC07-0YA5 A5
Documentation
4
First Steps with STEP 7 Lite V3.0
Options package Simula Simu lati tion on so soft ftw war are e S7 S7-P -PL LCS CSIM IM (Floating License) Sim Si mul ulat atio ion n soft softw ware S7 S7-P -PL LCSI SIM M (Upgrade)
5 6ES7 6E S784 8411-0C 0CC0 C044-0Y 0YA5 A5 6ES ES7 7841 41--0CC CC0 044-0 0YE5
This ”First Steps with STEP 7 Lite” manual is supplied with a software CD that also contains the electronic manual ”Programming with STEP 7 Lite” and the Online Online Help. Help. S7-PLCSIM simulates a connected PLC. PL C. S7-P S7-PL LCSIM is is helpful helpful if you wan wantt to run a program test without having local access to hardware.
Guide to
Getting Started STEP STEP 7 Lite A5E00293886-01
Overview and installation
STEP 7 Lite Configuring Designing the solu solution tion of an automation automation task chapter 3
Creating a project chapter 4
Configuring the hardware chapter 4 1.6
Creating a program chapter 5 – 9
Transfering program to CPU chapter 10
Testing the program chapter 11
Getting Started STEP STEP 7 Lite A5E00293886-01
A project represents the central element in STEP 7 Lite. Within this project you solve all your automation tasks task s – startin starting g at the hardware hardware configuration and working your way to the program test run.
We recommend you configure your hardware first before you you run large programs programs with many I/Os. I/Os. In this case, you will have have the advantage advantage that STEP 7 Lite displays available addresses in Hardware Configuration. When you choose to start by writing the program, you would rather have to determine available addresses addresse s by yourself yourself according to the selected selected component, compone nt, as in this case you you could not not call them via STEP 7 Lite. Hardware Configuration not only lets you specify addresses, addresse s, but also allows allows you to edit edit module parameters and characteristics. If you prefer prefer to start start programming right away away you you can skip hardware hardware configuration configuration,, as this ”Getting ”Getting started” project requires requires only only very very few I/Os.
Überblick
Getting Started STEP STEP 7 Lite A5E00293886-01
1.7
Overview and installation
Installing STEP 7 Lite
te e 7 L i t S T E P
1.8
For the installation you need: – the ST STEP EP 7 Lite Lite CD CD conta containi ining ng the the installation instructions in
STEP7Lite\Disk1\Readme.WRI, and – the corre correspon spondin ding g license license ke key y (user (user authorization).
1
Insert the STEP 7 Lite CD. The installation programm programm is started automatically or via drive>:\setup.exe. Follow the installation instructions.
Getting Started STEP STEP 7 Lite A5E00293886-01
When prompted prompted to do so, so, insert the data carrier containing the license key. Follow the on-screen instructions for installing the license key. Remove the data carrier before restarting the computer.
Desktop after installation
2
3
4
After installation installation is completed, completed, STEP 7 Lite will be displayed on the desktop and in the Start menu. Any additional SIMATIC software you install can be called via this SIMATIC directory. You can find the printable STEP 7 Lite documentation under Simatic > Documentation.
1.9
Transfer license keys
If no valid license license key key is installed installed for STEP STEP 7 Lite, Lite, a trial license key key is used, which is supplied supplied and installed by default together with STEP 7 Lite. Howev How ever er,, STEP 7 Lite can only only be use used d for 14 14 days day s with this this license license key key.. Whe When n STEP 7 Lite is started the first time without a valid license key, the trial license is activated.
Getting Started STEP STEP 7 Lite A5E00293886-01
Overview and installation
To transfer the license key from one computerr to another, compute another, proceed as follows: 5
Start the Automation License Manager.
User Interface for the Automation License Manager
1.10
6
7
Access the drive on which the license key to be transferred is located.
Select the license key key, and then select the License Key > Transfer menu Transfer menu command. In the dialog dialog that is then displa displayed, yed, on the target computer select the drive to which you want to transfer the license key.
Getting Started STEP 7 Lite A5E00293886-01
4 2
ErstellenSie Erstellen Starting Sie ein Proein and an dProgramm grammim im operating OB1 OB1 OB 1
Starting and operating
Opening the sample project
2.2
How to open the sample project in LAD STEP 7 Lite is installed on your computer. This chapter contains the most important information relating to the user interface. 1
Getting Started STEP STEP 7 Lite A5E00293886-01
Start STEP 7 Lite via Start menu or desktop icon.
2
Go to the sample program directory :\Siemens\S7Lite \Examples\English \Examples \English ...
3
Select the LAD sample file. first_steps_lad.k7p
4
Open the project file. Open the project as a copy to avoid overwriting the sample project supplied by mistake.
The selected project is opened
5
The project window displays ”first_steps_lad”.
The left project window represents the centrall navigation centra navigation tool tool of STEP 7 Lite Lite.. From here, here, you can open all all STEP 7 Lite views via the project elements ”Hardw ”Ha rdware are”, ”, ”Sy ”Symbo mboll table” etc etc..
6
Double-click on each elements Double-click elements.. The views are opened in the gray working area, while the the menu bar bar on top is adapted to the respective view. view.
Double-click on the project elements to open all STEP 7 Lite views one after the other. other. Close any windows not required anymore in order to maintain your overview.
Getting Started STEP STEP 7 Lite A5E00293886-01
2.3
Starting and operating
Menu bar* Working area* Libraries**
Projec Pro jectt win window dow Online connection between PG and CPU (now on “ON”) CPU control panel Toolbar*
5
4
2.4
3 2 1
Data on the SPS (for an online connection) Data on the PG
Program elements Project elements
Getting Started STEP STEP 7 Lite A5E00293886-01
LAD,, FBD commands LAD commands** **
Completed program elements
Status bar (CPU currently on Stop)
*
depend depe ndin ing g on on sel selec ecte ted d prog progra ram m element ** dep depend ending ing on progr programm amming ing language
The user interface The user interface is split into five areas:
1
2
3
Project window All project elements you require are already created when you generate a new project. Libraries The included blocks are found under ”Libraries”. ”Libra ries”. LAD and FBD FBD block instructions are found under ”Commands”. Working area The views in which you can edit your project can be opened here.
4
CPU operator panel Represents the CPU front panel with its displaying and operating elements.. Lets you change ments change operating operating states.
5
Menu bar Contains all menus available in STEP 7 Lite Lite – e.g. e.g. with opened opened block, menu comm command and View > LAD for changing the programming language.
Click on the expansion icon to show or hide the CPU operator panel. Click on the pin needle to lock or unlock the view view of of the project project window and and libraries libraries.. When unlocked, unlock ed, you can increas increase e or reduce the size size of the working working area by dragging it with the mouse pointer towards the edge.
Getting Started STEP STEP 7 Lite A5E00293886-01
2.5
Starting and operating
Project handling
2.6
What is a project? The project project data of a STEP STEP 7 Lite Lite projectt includes projec includes all data data of a SIMA SI MATI TIC C S7-30 S7-300, 0, C7 or of of a modular Distributed I/O System ET 200X or ET 200S (stand-alone). Projects serve the purpose of saving all data acquired during the creation of an automation automation soluti solution on in a managed file system.
Getting Started STEP STEP 7 Lite A5E00293886-01
Project handling Project elements are linked to the following tasks:
1
Creating and saving a project
2
Hardware configuration, Hardware configuration, modul module e parameter assignment and hardware error diagnostics
3
Specifying symbols for symbolic programming
4
Running program tests, Running tests, monit monitoring, oring, controlling and forcing addresses in the CPU
5
Evaluation of Evaluation of the program program structur structure e and addresses used
6
Individual arrangem Individual arrangement ent of of program documentation
7
Using blocks to create an SPS user program.
File handling Save the project under its name and file format ... .k7p. .k7p. STEP 7 Lite lets you open only one inst in stan ance ce of a .k7p file. file.
Risk of accident – accident – When there is an online connection between the PG and CPU,, you can use the CPU CPU CPU operator panel to trigger motions motions in a plant, for example. example. Thus, nev Thus, never er select select ”RU ”RUN” N” if you cann cannot ot entir entirely ely exclude personal risk.
Getting Started STEP STEP 7 Lite A5E00293886-01
2.7
Starting and operating
Calling help functions
2.8
Windows Help You will find it easy to handle the STEP 7 Lite Lite Help system system ifif you have have previously worked with Microsoft programs.
1
Press F1 F1:: The detailed basic help pops up.
2
Press Shift + F1: F1: Then, positi position on the question question mark cursor on a button and click it to open direct help on this button. You can also choose to access these two help systems via Help in the menu bar.
Getting Started STEP STEP 7 Lite A5E00293886-01
The three Help sections 1
Quick help Withoutt clicking, Withou clicking, positi position on the cursor on the STOP button button,, for exampl example. e. A quick help on the button is displayed when you position the cursor on the button and leave it there for a moment.
2
3 The online help is called.
Direct help Click on the small arrows to open direct help as well. Basic help Click on the link. link. Detai Detailed led basic help help on the selected topic pops up in a separate window. Note: The different link icons identify the type of help called called in the basic basic help. help. Leaf = Backgrou Background nd informat information ion List Li st = Hand Handli ling ng ins instru truct ctio ions ns 2.9
Getting Started STEP STEP 7 Lite A5E00293886-01
Starting and operating
Further help 1
2
3
2.10
Help on menu commands Press SHIFT + F1 to open a pulldown menu. menu. Click on a menu menu command. comm and. The help help on this comcommand is displayed.
Help on error messages You can also call help on error messages which are displayed in the status bar. bar. RightRight-click click on the error message to call Help Help..
Reference help Press SHIFT + F1 and then click on S_IMPULS,, for exam S_IMPULS example ple.. The reference help pops up in a separate window.
The reference help provides help on the selected instruction or block.
The reference help opens.
Here you can also call programming samples, sampl es, for example example..
4
Getting Started STEP STEP 7 Lite A5E00293886-01
Close the the copy copy of the sample sample project project after you have have familiarize familiarized d yourself with the operation operation of STEP 7 Lite. Lite.
3
ErstellenSie Erstellen Implementing SieProein Proein the task gramm grammim im OB1 OB1 OB 1
Implementing the task
Task – Motor bench
3.2
Using our ”Moto ”Motorr bench” bench” exam example, ple, we are going to show you the most important steps to implementing this task in an automation solution.
Light barriers lead to OFF Operator station Diesel engine with ON/OFF switch and tachometer
Petrol engine with ON/OFF switch and tachometer
Task A controller for a motor bench is to be developed dev eloped.. In the first step step,, we will will only only develop the global circuit for the actual testing circuits:
Fan with ON/OFF switch
Fan with ON/OFF switch
Getting Started STEP STEP 7 Lite A5E00293886-01
1. A petrol engine and a Diesel engine on a bench is to be switched on and off indi individual vidually ly..
2. A light light barrier barrier on each each engin engine e secures sec ures the are area a of haz hazard ard.. Thi This s barrier triggers an EMERGENCY EMERGENCY-OFF cir circui cuit, t, ind indepe epende ndent nt of of the sample program. program. 3. An elect electric ricall ally y drive driven n fan is also switched swit ched on or or off with the the engine. engine. 4. The fan fan’s ’s off del delay ay is four four sec seconds onds.. 5. The operator operator will will receiv receive e a signal signal indicating that the engines have reached their speed setpoint: Petrol engine = 1.500 U/min Diesel en engine = 1.200 U/min
Solution Here the solution beforehand: OB1 in the sample programs contains the signal ”Preset_Speed_Reached”, realized in 1 2
– Network 4 for the Petrol engine. and in – Network 5 for the Diesel engine.
Further information is found in Chapter 7, sectio section n ”Programming ”Programming block calls”. calls”.
You could now use the ”Preset_Spee ”Prese t_Speed_Re d_Reached” ached” signal to initiate initiat e a testing process, process, e.g e.g.: .: – St Start art of a exh exhau aust st ga gas s com compa pari riso son n test – St Start art of of a spe speed ed st stabi abili lity ty me meas asur ureement. Howev How ever er,, thi this s is not not part part of our sample program.
Getting Started STEP STEP 7 Lite A5E00293886-01
3.3
Implementing the task
Splitting the process Defining function range
1
Specifying safety requirements
2
Specifying operating and display elements
3
Determining Inputs/Outputs
4
3.4
To create a program, see subsequent chapter
Split the process before you start programming. A basic procedure you can use in any configuration is shown above. Every step can be split into subsections. Higherr granularity Highe granularity of the split split process process considerably simplifies the user program structure.
Getting Started STEP STEP 7 Lite A5E00293886-01
Function range Related devices __________________________________________________ Function range A
Function range B
1
Describing function areas: – Split Split the pro proces cess s into into rel related ated groups. – Spe Specif cify y the elem element ents s control controllin ling g this this area. – Sp Spec ecif ify y elect electri rica cal, l, me mech chani anica call and logical I/Os for all tasks. – Spe Specif cify y lock locks s and and depe depende ndenci ncies es between the tasks.
= Petrol engine = Tachometer = Fan = D ie s e l e n g in e = Tachometer = Fan
2
Specifying safety requirements: In our sample this is the emergency off circuit. circui t. In the real world, world, howe however ver,, programming this task is much more complex.
3.5
3
Defining operator and display elements:
Every process requires an operator and monitoring system that enables human control con trol of the proces process. s.
4
Specifying I/Os: Even for our small sample Even sample project, you need three physical Inputs and Outputs for the petrol engine PE The symbol table in Chapter 5 offers you a good good overview overview of all I/Os. I/Os.
Getting Started STEP STEP 7 Lite A5E00293886-01
Implementing the task
We invite newcomers to participate in the SIEMENS SIEM ENS training training courses courses.. Here Here,, they are are shown shown practical examples on how to automate processes using a SIMATIC system.
3.6
Getting Started STEP STEP 7 Lite A5E00293886-01
4
ErstellenSie Erstellen Module Sie ein Proein Proconfiguration gramm grammim im OB1 OB1 OB 1
Module configuration
What happens during configuration?
4.2
During hardware configuration you develop dev elop an image image of the PLC PLC station on on your programming device. You can copy this configuration to other STEP 7 Lite Li te proje project cts s and, if re requ quir ired, ed, mo modi dify fy and download it to other existing stations.. During the PLC tions PLC startup routine, routine, the CPU compares the default configuration created in STEP 7 Lite with the actual actual configurat configuration ion of the system. system. This way any existing errors can then be detected and reported immediately. 1
2
Getting Started STEP STEP 7 Lite A5E00293886-01
The hardware element in your project window shows a graphic representation of a rack. rack. Her Here, e, spe specif cify y all all mod module ules s you you have integrated in the PLC station. At a later later point, you are going going to edit edit the user program in the program element for precisely this hardware configuration.
Hardware configuration overview
Opening the project
1
Configuring
2
Parameterizing
3
Create your hardware configuration within a project. project. Projec Projects ts and programs programs always belong together together,, since you ...
... also assign assign the I/O address address areas in your hardw hardware are config configuratio uration. n. And, you subsequently specify these addresses in your program.
You can modify modify some some of the modules modules for the Siemens factory settings. However Howev er,, this is not required in most cases.
4.3
Testing and saving
4
Loading to CPU
5
You can then you perform a consistency check for your hardware configuration and save your entries.
Download the hardware configuration from your PG to the CPU. So that, - the CP CPU U can can recog recogni nize ze all all exi exist stin ing g modules and their addresses, - mo modu dule le pa para rame mete ters rs ca can n be be enabled.
Getting Started STEP STEP 7 Lite A5E00293886-01
Module configuration
Creating a new project
4.4
1
Your “Getting Started” project must have your existing hardware configuration and not the one in our samples.
In this chapter you are going to create a new ”Gettin ”Getting g Started” Started” proj project ect,, sho shown wn here at top entry level. In the subsequent chapters you will continue to develop this project.
You can follow the sample projects also installed when configuring your hardware. hardware. The sample sample projects are under : Drive:\Siemens\S7Lite\Examples\English... The hardware configuration is the same in all three sample projects.
Getting Started STEP STEP 7 Lite A5E00293886-01
How to create a new project STEP 7 Lite is opened
1
Start STEP 7 Lite with a double-click.
2
Open a new project.
3
Save the project as ”Getting Started”
4
5 After double-clicking hardware
Click on the pin needle to hide the libraries.
If yo you u wan wantt to to use use one one of of ou our r configuration config urations s as a guideline, guideline, also open one one of the include included d sample sample projects in a second instance of STEP 7 Lite.
4.5
6
Double-click on Hardware. The hardware configuration windows opens in the working area.
You can copy hardware configurations from one projec pro jectt to another another.. For examp example le,, if you want want to continue contin ue immediately immediately with Chapter Chapter 5, open one of the included sample projects and copy the Hardware eleme element nt to your ”Getting ”Getting Started” projec projectt (see Step 5).
Getting Started STEP STEP 7 Lite A5E00293886-01
Module configuration
Working in the hardware configuration view Graphical view of hardware configuration
Configuration table
Hardware catalog
4.6
Parameterizing modules
Hardware element Differential icons
Display differences between SPS station and CPU (only when an online connection to CPU exists)
Display technical problems on modules (only when an online connection to CPU exists)
Getting Started STEP STEP 7 Lite A5E00293886-01
Choose SIMATIC system
Overview After opening the hardware element with a double-click in your project window,, the ”Hardwa window ”Hardware” re” view is shown shown at the right side in the working area. Select the modules Select modules of your PLC PLC station station from the hardware catalog here.
How to configure the hardware The following modules are stored in the sample programs: 1 Power ower S Supply = Power supply module 2 CPU = SPS module 3 Digital Input = Digit input module 4 Digital Output = Digital output module
l y p p u S r U e P w o C P
Order numbers are imprinted on the module front panels.
t t u p u p t n u O l I l a t i t a i i g i g D
Configure your module as described below.
D
1
2
Click on CPU CPU..
Go to CPU 315 and click on the ”+ ”+” icon to view all earlier versions of CPU 315. 4.7
3
Another window opens
Drag the CPU to the rack using a dragand-drop. and-dro p. A lock sign indicates indicates slots which are not permitted according to the slot rules. Proceed in the same way with all modules. We shall continue with Chapter ”Module ”Modul e parameter parameter assignment” assignment” on Page Pag e 4.12. Refe Referr to the next page page for more details.
Of cou course rse,, if you late laterr want want to dow downlo nload ad the hardware configuration to your CPU you must configure your hardware, and not necessarily the one in our sample project.
Getting Started STEP STEP 7 Lite A5E00293886-01
Module configuration
Input module Byte 0
Output module Byte 4
Input module Byte 1
Output module Byte 5
Abs A bsol olut ute e ad addr dres ess: s: Q 4. 4.1 1 Output
Byte 4
Bit 1
Configuration results 4
5
4.8
Working from left to right, Working right, insert the power supply modul module, e, CPU CPU,, input module, modul e, output module module.. Modules must be inserted without leaving empty slots between them. Otherwise, Otherw ise, they cannot cannot be supplied with power via backplane bus. Exception in STEP Exception STEP 7 Lite: Slot 3 is reserved for the interface module (IM) you can use to connect racks stacked on top top. If mod module ules s are ins inserted erted only only in in the lowest lowest rack, you can leave leave a space space in the configuration.
6
Getting Started STEP STEP 7 Lite A5E00293886-01
The address specification bytes have been set automatically in the I/O address co colu lumn mns s of th the e configuration table.. They are table are a major compone component nt of address specification for programming.
Tips – Inserting modules 1
2
3
Improve your screen overview by hiding module information, information, e.g. if you wa want to perform a directed search for order numbers. Insert modules modules,, for exam example, ple, by rightclicking the module to open the pop-up menu and select Insert module. module.
You can insert new modules between two existing existing modules. modules. The modules modules are shifted to available slots on the right side.
Two projects are opened
4
5
6
Using the Shift key key,, you can highlight any number number of modul modules es in the rack and and then copy them or move them by a drag-and-drop operation.
Open another project in a second inst in stan ance ce of of ST STEP EP 7 Lit Lite e. Th Then en,, fo for r example, exam ple, drag the complete complete hardware configuration from one project to another by a drag-and-drop operation. To delete a module, module, right-click on the module to open the context-sensitive menu and select delete.
Feel free to try out all functions you have used in other Windows applications. We have implemented many Windows functions in STEP STEP 7 Lite Lite,, e. e.g. g. pop pop-up -up menu menus, s, dra drag-an g-andddrop operation, operation, workin working g with shortcut key key etc.
Getting Started STEP STEP 7 Lite A5E00293886-01
4.9
Module configuration
1
4
5
Example of a maximum configuration
8
For demonstration purposes we have created a large configuration with some errors. 1
Call the troubleshooting routine via: Options > Check Consistency. Consistency .
2
An existing configuration error is displayed in this view.
3
Left-click on the expansion icon to display all errors. Existing errors:
4
An interface module (IM) is missing in Rack Rac k 3. As a result result,, the there re is no conne connecction to Rack 3. Racks 1 and 2 are equipped with interface modules.
5
Free slots are not allowed.
6
This is a C7 compact system (highlighted in yellow background color in the configuration config uration table). table). The module module on the right side is incompatible.
4.10
After you have eliminated the errors, perform another consistency check.
And otherwise: 7
8
Getting Started STEP STEP 7 Lite A5E00293886-01
STEP 7 Lite allows only one CPU per project. projec t. The CPU is always always inserted inserted in Rack 0. The top slots slots are not not used.
Please note how the address areas are incremented in the configuration table.
Online Help: F1 – Under Under Cont Content ent > Conf Configur iguring ing the the hard hardwar ware e> Configuring modules in the Help on STEP 7 Lite you can find global configuration rules. – Under Under Index Index > Slot rules, rules, you can fin find d the most important rules on insertion.
Browsing the hardware catalog with MLFB The MLFB number represents the Siemens order number. If you kno know w the MLFB MLFB num number ber of of a modul module e you you want to look up in the selected hardware catalog, you can enter this MLFB via ”Find text” text” dialog box in the tool toolbar bar.. The Then, n, pres press s Return to display the module.
4.11
Getting Started STEP STEP 7 Lite A5E00293886-01
Module configuration
Module parameter assignment
4.12
What is parameter assignment? You can customize the operating charact char acteri eristi stics cs of of som some e of the anal analog og and digital digital modules, modules, as well as those those of the CPU: we refer to this as ”Parame ”Parameter ter assignment”. Examples of param Examples parameter eter assignm assignment ent to a CPU:
Getting Started STEP STEP 7 Lite A5E00293886-01
1
– You can can interrup interruptt the the CPU’ CPU’s s proprogram cycle via watchdog interrupt.
2
– Spec Specif ify y a name name for for the the CPU CPU.. In thi this s case, cas e, it is ”Mozart”. ”Mozart”.
3
– You can also also pass passwo word rd protec protectt your your CPU against MPI read/write access.
Assign parameters to CPU 315 1
Highlight CPU 315. Click on Highlight on the module parameters button.
2
In the Processing module parameters dialog dia log,, ente enterr ”Moz ”Mozart” art” in the Name box.
3
Confirm your entries with OK OK.. The window is closed.
All basic parameters are factory set and match almost any standard functions. If anyth anything ing goes wrong wrong after you have have made made changes – do not worry – the hardware catalog still contains the basic settings for all modules.
Online Help: F1 CPU parameters are often related to organization blocks. In the Index under under Cyclic Cyclic interrupt, interrupt , yo you u can can therefore find the description of Organization of Organization blocks for cyclic interrupts (OB30 to OB38) .
Getting Started STEP STEP 7 Lite A5E00293886-01
4.13
Module configuration
Saving configuration data
4.14
How to check configuration data Before you you save save your configuration, you should always perform a consistency check. 1
Call menu item Options > Check consistency.. consistency This is to check whether your configuration data can be generated using your entries. Confirm the message ”The configuration config uration is error-free error-free.” .” with OK OK..
continues without errors
Getting Started STEP STEP 7 Lite A5E00293886-01
How to save configuration data 2
Select File > Save, Save , or click click on the the disk disk icon in the tool bar. This does not only save your hardware configuration config uration,, but rather all all project elements.
3
When you select the menu command Edit > Apply, Apply, your config configuration uration data (always (alwa ys the content content of the activ active e window) is saved to a temporary file. This file saving method is recommended if you intend intend you to undo undo modificatio modifications ns later. Afterr only applying Afte applying data, you are prompted to save your changes when you close the project.
4.15
Getting Started STEP STEP 7 Lite A5E00293886-01
Module configuration
Downloading hardware configuration data to the CPU
4.16
How to prepare the download With this download you transfer all configuration data to the CPU. Note that you must first establish an ”Online connection” between the CPU and the PG. Details on this topic are found in Chapter 10. ”Connect Online” essentials: 1
2 Ready for download
Getting Started STEP STEP 7 Lite A5E00293886-01
After you have connected the cables and performed a CPU memory reset, click on Connect Online. In the CPU operator panel, set the CPU to STOP mode. The footer displays a red STO STOP P ico icon. n.
3
Right-click on Hardware to select the Download to CPU function. Hardware configuration data is now downloaded to the CPU. Parameters are assigned to the modules.
Online/Offline comparison 4
Click on the Hardware Comparison tab.
The view “Hardware Comparison ” is opened
5
Here you can verify consistency between configuration data on your PG (Offline) to data downloaded to the CPU (Online). 4.17
6
Existing data inconsistencies are indicated in pictograms and details are returned in the delta list.
For more details on screen
Using the instruction Upload to Programming Device (PG), (PG) , you can can upload a hardware hardware configuration config uration from from the CPU to the PG. PG. This is a typicall service action typica action if you want want to access access a switching cabinet with a PG in order to analyze an error.
Getting Started STEP STEP 7 Lite A5E00293886-01
Module configuration
Comparison table: comparison compa rison of online/ online/offline/ offline/physi physics cs
Module-related differential icons
4.18
Overview ...displays the difference between the configuration entered on the PG in the Project tab (offline) and the configuration downloaded to the CPU. CPU.
1
... displa displays ys the difference between between the configuration configuration entered and the physical hardware inserted.
2
...displays the difference between the configuration loaded and the physical hardware inserted.
3
Getting Started STEP STEP 7 Lite A5E00293886-01
In the Hardware Configuration tab, enter your hardware as described above. If error errors s have have occ occurred urred,, per perform form a consistency consis tency check check of config configuration uration data via Hard Hardware ware Comp Comparis arison on tab tab.. Det Detail ails s on this topic will follow. If prob problem lems s persist persist,, it could could well well be that that modules are defective defective.. Perform a check via Hardware Diagnostics tab tab.. Det Detail ails s are found in Chapter 12 under ”Error diagnostics”.
How to detect errors: You have downloaded the configuration to the CPU and called the Hardware Comparison tab. In your project window, Hardware is marked with a collective pictogram. pictogram . This indicates that one or several modules do not match. Pictograms on the Rack modules identify these modules.
Compare: Offline - Online
Online: Config Online: Configuration uration which which was downdownloaded to the CPU. Offline: Confi Configuratio guration n on the PG. PG. When you click on Hard Hardwar ware e Comp Compariarison, the Comparison: Offline-Online button is selected selected by by default. default. The Delta list displays the differences in your configuration and parameter assignment. 4.19
Compare: Offline - Physics Compare: Online - Physics
Physics: Refe Physics: Refers rs to the configuration configuration a CPU will recognize automatically, automatically, without prior configuration download. Click on the corresponding button to compare the Online/Offline configuration with the physics.
Getting Started STEP STEP 7 Lite A5E00293886-01
Module configuration
Symbols These are are the essential essential icons icons of the hardware configuration. The configured module does not match the module module of the Online Online CPU. CPU. The physically inserted module matches the configured configured modul module, e, howe however ver,, it has been assigned different module parameters. The module module is configured, configured, but does not exist online.
Operating mode RUN
Operating mode STO STOP P
Operating mode HAL HALT T
Error
Symbolizes a ”Possibly identical module”. The type of of the physicall physically y inserted module module matches the configured configured module module.. It cannot be determined whether the order numbers also match.
4.20
Symbols (Icons) For more information on symbols use the quick info icon. Under F1 > Index > Symbols (Icons), Under F1 (Icons) , yo you u can can find an overview overview of icons which which can be displaye displayed d in the project window window,, rack and comparison table.
Getting Started STEP STEP 7 Lite A5E00293886-01
4 5
Erstellen Sie Creating the ein Pro- table symbol gramm im OB1
Grafik kommt nach
Creating the symbol table
Absolute programming
Input module Byte 0
Output module Byte 4
Input module Byte 1
Output module Byte 5
5.2
Abs A bsol olut ute e ad addr dres ess: s: I 0. 0.5 5 Input
Byte 0
Bit 5
How to assign addresses Chapter 4 describes how absolute addresses are assigned during hardware configurat configuration. ion. As a reminder: reminder: I 0.5 Q 4.2 I 1.0 I 1.1
Q 5.0
I 1.2
Q 5.1 Q 5.2
Getting Started STEP STEP 7 Lite A5E00293886-01
Due to the hardware hardware structure, structure, ev every ery input and output is assigned a default absolute address. The absolute address can be replaced by a freely selectable (symbolic) name (e.g. (e .g. Q 4.2: Aut Automat omatic_ ic_mod mode). e). Symbols are assigned independent of the programming programming language, language, that is, LAD,, FBD or STL. LAD STL.
Symbol table and absolute addresses
Window is opened for project selection
1 “Getting Started” is opened
Open STEP STEP 7 Lite. Lite. In the Open project window window,, Click on the ”Getting ”Getting started.k7p” project you you have have created in Chapter 4.
Your project currently consists only of default project elemen elements ts and of the program element OB1 OB1.. 2
In the project window, window, doubledouble-click click on the element Symbol table. table .
The symbol table currently consists only of of the default default organiz organization ation block block OB1.
Additional entries are not required if you choose to work with absolute addresses address es in your your program. program. Simpl Simply y close the window again. Symbolic programming is used for the sample project. project. Proceed as as described described in the pages below.
You should only use absolute absolute programming programming if you have hav e to address only only a small number number of I/Os in your STEP 7 Lite program.
Getting Started STEP STEP 7 Lite A5E00293886-01
5.3
Creating the symbol table
Symbolic programming Change sorting order by clicking in the header
Filterr table (e.g. displ Filte display ay outputs only)
Elaborate comments possible
Copy symbol table between projects 5.4
Symbols
Absolute addresses
The symbol table In the symbol symbol table, table, assign a symbolic symbolic name and data type to all absolute addresses you want to address in your program, progr am, e. e.g. g. ass assign ign the ”Automatic_O ”Auto matic_On” n” symbo symboll to input I0.5”.
Q 4.2 Automatic_Mode I 0.5 Automatic_On Q 5.0 PE_On I 1.0 Switch_On_PE I 1.1 Switch_Off_PE
Q 5.1 PE_Preset_speed Q 5.2 PE_Fan_On
I 1.2 PE_Fai PE_Failure lure Getting Started STEP STEP 7 Lite A5E00293886-01
These names, names, referred to as as global symbols, symbol s, apply to the complete complete project. project. Symbolic programming can considerably consid erably improv improve e readability readability of your program.
Filling out the symbol table 1
In the Symbol colu column, mn, ent enter er ”Automatic_O ”Auto matic_On” n” for address address ”I0.5”. In the Comment col column umn,, ente enterr the comment as shown to the left. During input Return = Ctrl + z =
2
One row d own Undo
Save your entries via File > Save. Save .
How to copy the symbol table Since quite a large number of symbol symbols s are used in your ”Getting Started” project,, copy the project the symbol symbol table from one one of the included included sample project projects. s. A second instance of STEP 7 Lite is opened
3
4
5
6
Also open the project “first_steps_l “first_s teps_lad.k7p” ad.k7p” in a second second instanc ins tance e of STE STEP P 7 Lite. Lite.
In the ”fi ”first_ rst_step steps_l s_lad” ad” proj project ect,, righ righttclick on Symbol table to open the pop-up popup menu. Sel Select ect Copy Copy..
In the ”Gett ”Getting ing Started Started”” proj project ect,, rig right ht click in the project window to open the pop-up popup menu. Sel Select ect Paste Paste.. You are prompted to confirm overwriting.. Confirm with ”OK”. writing
Close the project ”first_steps_lad”. Save Sav e your ”Getting ”Getting Started” project via via File > Save. Save.
Getting Started STEP STEP 7 Lite A5E00293886-01
5.5
Creating the symbol table
Data types Data types determine the type of signals a CPU has to process. STEP 7 Lite uses, STEP uses, amo amongst ngst other others, s, the data types shown on the left.
BOOL BYTE WORD DWORD - Data of of thi this s type type consis consists ts of bit comb combinat ination ions. s. 1 Bit (T (Type BOOL) up to 32 bit (DWORD).
CHAR - Data of this type uses uses exactly exactly one ASCII character character..
INT DINT REAL
5.6
- Data of this type type is available available for for processing processing numerical numeri cal values (e.g. (e.g. for calculating calculating arithmetic expressions).
S5TIME TIME DATE TIME_OF_DAY - Data of this type represent represent different different time time and date values within STEP STEP 7 Lite (e.g. (e.g. for setting setting the date or input of the time value).
You will find more information on data types (e.g. permissible permissi ble ranges ranges of values and and application application samples) by clicking the help pointer on a data type and then jump to Introduction to data types and parameter types .
Getting Started STEP STEP 7 Lite A5E00293886-01
6
Erstellen Getting Sie ein Pro-with started gramm im programming OB1
Getting started with programming
Choosing LAD, FBD or STL
6.2
Page 6.12 to 6.17 Statement list (STL Statement (STL)) is appropriate for users e.g.. in the inform e.g information ation industry.
Page 6.18 to 6.23 Function block diagram (FBD) is appropriate for users e.g e.g.. in circuit circuit engineering.
Page 6.6 to 6.11 Ladder logic (LAD) is appropriate for users e.g.. in the indust e.g industrial rial electrical sector. In STEP 7 Lite you always create your program in the same programming interface, interfa ce, namely the block editor, editor, regardless whether you choose LAD, FBD or STL. STL. The user user interface interface is adapted according to the programming language you have selected. For examp example le,, if you choos choose e to program program in LAD, LAD, refer to the information information on Page 6.6 to 6.11.
Getting Started STEP STEP 7 Lite A5E00293886-01
Opening OB1
The dialog box for selection is opened.
1
Open STEP 7 Lite.
2
In the Open project dia dialog, log, clic click k on the ”Getting ”Getting Started.k7p” project project.. You have already generated this project as described in Chapter 4 and filled out a symbol table for this project as described in Chapter 5. If thi this s is not not the the case, case, sim simply ply open open a ”New project” project” and copy copy the symbol symbol table from from one of the included included sample sample projects.
STEP 7 Lite is opened.
3
4
You can work in the block editor.
Double-click on OB 1 to open the block editor in your working area.
Click on View View.. This menu shows you the currently selected programming language; LAD LAD,, FBD or or STL STL.. He Here re yo you u can also change the view. Note: Some of the instruction instructions s cannot cannot be displayed in all three programming languages. language s. These are always always displayed displayed in STL. You wil find information on the individual commands commands in LAD LAD,, FBD and STL via F1 > Index > Language Descriptions.. Descriptions
Getting Started STEP STEP 7 Lite A5E00293886-01
6.3
Getting started with programming
Working in the block editor The most important commands for LAD and FBD
Change vie Change view w of the programming language Show/hide CPU control panel
Variable declaration table
Insert new network
Switch symbolic/ absolute programming
6.4
Project element “Program” All commands for LAD and FBD Program element “OB 1” A click with the help pointer calls the reference help
Title and comment area on network Network for program input
Specify block properties: e. g. chan change ge symb symboli olic c name name
Getting Started STEP STEP 7 Lite A5E00293886-01
You always program blocks in the block editor. We hav have e inserted a view of LAD to represent the programming languages.
Project element “Program” STEP 7 Lite user programs are split into blocks, blocks, thus allowing allowing you easy easy management managem ent of large programm programming ing projects. 1
2
These blocks are displayed below the project element Program Program..
A new project only contains OB1 that STEP 7 Lite generates automatically. Later on in your your project, project, you are going to add other other blocks, blocks, e.g e.g.: .: OB = DB = FB = FC =
Organi Orga niza zati tion on bl bloc ocks ks Da t a bloc ks Fun unc ction block cks s Fu n c t i o n s
The organization block OB 1 is the CPU’s operating system and it contains the main program. program. Addit Additional ional blocks blocks are mostly called in OB 1 and the specific parameters necessary for controlling the processs are assigned here too. 6.5
You can rename blocks using the Rename comman com mand d of the pop-up pop-up m menu enu.. Newcomers may require more information on working with with blocks. Access this information information with left-click on the project window and then press F1 > Index > Blocks in the user program. program .
Getting Started STEP STEP 7 Lite A5E00293886-01
Getting started with programming
Programming OB 1 in LAD
6.6
In the following section you will program a series series circuit, circuit, a parallel parallel circuit and the set/reset memory function in LAD (Ladder logic). Specify the programming language to be used in programming and opening OB1 in future: 1
Double-click on OB1 OB1..
2
Click on Properties Properties..
3
Select LAD LAD.. As of now, OB1 will be opened in LAD LAD.. Exit the Properties dial dialog og box. box. LAD is is now marked in the View me menu, nu, to too o.
Getting Started STEP STEP 7 Lite A5E00293886-01
How to program a series circuit in LAD 5
6
7
Under View,, sel Under View select ect symbo symbolic lic representation.
At OB1 OB1,, enter “Periodic “Periodically ally processed processed main mai n program program”. ”. At Network 1, 1, en ente ter r ”Connecting in Series”.
Click on the empty circuit to highlight it.
Insert three program element elements, s, using different methods: 8
Click on the NO contact icon to insert it immediately.
9
Right-click on the circuit to open the pop-up menu. menu. Select NO NO contact. contact.
10
Drag the coil to your circuit using the drag-and-drop operation.
9 The addressi addressing ng of the NO contact contacts s and the coil is still missing in the series circuit:
11
Click on ??.? ??.?.. Enter the symbolic symbolic name “Key_1” “Ke y_1” (with quotation marks). Or Or,, click on ??.? to open the symbol selection list and select the name. Confirm with Return Return.. Enter the symbolic symbolic name “Key_2” “Key_2” for your second NO contact. Enter the coil name “Green_Light”.
Getting Started STEP STEP 7 Lite A5E00293886-01
6.7
Getting started with programming
The series circuit program is completed. 12
If no other icons are are display displayed ed in red red color,, click on the disk icon color icon to save your entries. Not only your entries in OB1 are saved, but rather all project elements.
13
When you select Edit > Apply, Apply, your entries (alwa (always ys the the content content of the active window) are saved to a temporary file. This file saving method is recommended in case you intend to undo changes later later.. After applying data, you are prompted to save your changes when you close the project.
6.8
Symbols are displaye Symbols displayed d in red color, color, for example example,, if not included included in the symbol table or if a syntax error has occurred. In this case you cannot cannot save save your entries, entries, and the lower lower section of the editor display displays s a plain text messag message e informing informing you you of appropriate procedures.
Getting Started STEP STEP 7 Lite A5E00293886-01
How to program a parallel circuit in LAD 1
Highlight network 1.
2
Insert a new network. This action can also be performed via an icon in the toolbar, toolbar, via contextcontextsensitive menu or CTRL+R.
6 7
3
Again, Agai n, highlig highlight ht the circuit. circuit.
4
Insert a NO contact contact and a coil. coil. Name them ”Key_3” ”Key_3” and ”Red_Light” ”Red_Light”..
5
Highlight the left circuit.
6
Insert a parallel branch and add another NO contact to it.
7
5
8
Close the branch-off branch-off via icon icon or dragging the double arrow tip that is visible after you have inserted the NO contact. The only thing our parallel branch is now still missing missing is addressing addressing.. Enter a name as shown in the figure. figure. Sav Save e your entries.
Assign distinctive short-names to your circuits. This makes it easier to scroll through large programs via scroll scroll bar on the the right side side of the window.. The names are displayed when you window scroll the view.
Getting Started STEP STEP 7 Lite A5E00293886-01
6.9
Getting started with programming
How to program memory functions in LAD 1
Highlight network Highlight network 2, insert another another network and enter the title ”SR Memory Function”.
2
Again, Aga in, highlig highlight ht the circuit. circuit.
3
In the Command Command tab, go to Bit logic and SR element. element. Inse Insert rt this elemen element. t.
4
Insert a NO NO contact contact upstream upstream of input S.
5
Enter following symbolic names:
6
6.10
– Upper NO contact: contact: ”Autom ”Automatic_On” atic_On”,, – Input Input R: ”Manual ”Manual_On”, _On”, – SR element: element: ”Auto ”Automatic_M matic_Mode”. ode”.
6 4
Getting Started STEP STEP 7 Lite A5E00293886-01
Save your entries with File > Save. Save.
How to adapt the programming interface You can use STEP 7 Lite menu commands to customize your programming interface.
View menu - Examples:
1
2
For symbolic addressing in LAD: Enable View > Display with > Symbolic Represent Representation. ation.
For absolute addressing in LAD: Disable View > Display with > Symbolic Represent Representation ation Changing the programming language: View > LAD/FBD/STL
Menu command Options > Settings Example: 3
4
7
Specify a line break in symbolic addressing, address ing, betwe between en the 10th 10th and 24th character: Options > Settings > LAD/FBD > Address field width
Modify the color color setting setting of a circuit: circuit: Options > Settings > LAD/FBD > Selected element
Close the block via Windows icon Close.. Close
Especially menu item Options > Settings offers a wide wide range range of options for the custom cus tomizat ization ion of of col colors ors,, fon fonts ts,, addr address ess fiel field d width width etc.. of the STEP etc STEP 7 Lite Lite user user interfa interface ce..
Getting Started STEP STEP 7 Lite A5E00293886-01
6.11
Getting started with programming
Programming OB1 in STL
6.12
Using the programming language STL (Statement (Statem ent list), you are now going going to program an OR and an AND instruction, instructi on, as well well as a set/reset set/reset memory functions.
Specify the language you want to use to program and subsequently open OB1:
Getting Started STEP STEP 7 Lite A5E00293886-01
1
Double-click on OB1 OB1..
2
Click on Properties Properties..
3
Select STL STL.. As of no now w, OB OB1 1 wil willl be opened in STL.
4
Exit the Properties dialog. STL is also marked in the View View..
How to program AND instructions in STL 5
6
7
8
Select Symbolic representation from the View menu.
At OB1 OB1,, specif specify y ”Periodical ”Periodically ly ProcesProcessed Master Program” Program”.. At Network 1, enter ”AND Instruction”.
Click on the input area.
Enter ”A” ”A” (for AND) in the first first program line,, follow line followed ed by an empty string string and the ”Key_1” ”Key_1” symbo symboll (with quotation quotation marks). Close the row with Return. The cursor moves to the next row.
9
In the the nex nextt row row, ente enterr an ”A ”A”” onc once e again. This time time,, right-cl right-click ick on the the input input area. Right-click to open the pop-up menu. Select the menu command Insert symbol.. Sel bol Select ect ”Key_ ”Key_2” 2” from the the list list and insert it. In the nex nextt line, line, ente enterr ”=”, and then then ”Green_Light” ”Green_L ight” either via the keyboar keyboard d or the pop-up menu.
You do not have to start making your entries at the beginni beginning ng of an input input row. row. No matter matter where where you start, STEP 7 Lite arranges arranges the instruction instructions s clearly and in rows.
Getting Started STEP STEP 7 Lite A5E00293886-01
6.13
Getting started with programming
The program for your AND instruction is completed. 11
If no other text is highlighted highlighted in red color,, click on the disk icon color icon to save your entries. Not only your entries in OB1 are saved, but rather all project elements.
12
When you select Edit > Apply, Apply, your entries (this is always the content of the active window) are saved to a temporary file. This file saving method is recommended in case you want to undo cha nges later. Afterr applying Afte applying only data, you are prompted to save your changes when you close the project.
6.14
Symbols are displaye Symbols displayed d in red color, color, for example example,, if not included included in the symbol table or if a syntax error has occurred. In this case, case, you cannot save save your your entries and the lower lower section of the editor display displays s a plain text messag message e informing informing you you of appropriate procedures.
Getting Started STEP STEP 7 Lite A5E00293886-01
How to program an OR instruction in STL 1
Highlight network 1.
2
Insert a new network. This action can also be performed via icon in the toolbar and via right-click or CTRL+R.
3
Again, Agai n, click on the the input area. area.
4
Enter an ”O” Enter ”O” (fo (forr OR), fol follow lowed ed by the the ”Key_3” ”Ke y_3” symbo symboll (analog to AND). AND).
5
Complete the OR instruction and save your entries.
6.15
Assign distinctive short-names to your circuits to make it easier to scroll through large programs via scroll scroll bar on the right right side side of the window window.. The names are displayed when you scroll the view.
Getting Started STEP STEP 7 Lite A5E00293886-01
Getting started with programming
How to program memory instructions in STL 1
Highlight network Highlight network 2. Add another another network.
2
Again, Aga in, click on the the input area. area.
3
4
In View > Display with > Symbolic Representation , yo you u can swit switch ch between symbolic and absolute representation.
In the first line, enter an ”A” ”A” instructi instruction on with the symbolic name ”Auto mode ON”. Compl Complete ete your your memory instrucinstruction as follows: Symbolic: A ”Automatic_On” S ”Automatic_Mode” A ”Manual_On” R ”Automatic_Mode”
6.16
5
Save your entries via File > Save. Save.
6
If you switched switched the view view in step step 3, enter the following: Absolute: A I0.5 S Q4.2 A I0.6 R Q 4.2
Getting Started STEP STEP 7 Lite A5E00293886-01
How to adapt the programming interface
STEP 7 Lite allows you to customize your programming interface.
Menu View menu - Examples: 1
2
For symbolic addressing in STL: Enable View > Display with > Symbolic Represent Representation ation
For absolute addressing in STL: Disable View > Display with > Symbolic Represent Representation ation Changing the programming language View > LAD/FBD/STL
Menu command Options > Settings Example: 3
Changing the color of instructi Changing instructions: ons: Options > Settings > STL Syntax highlight
7
Close the block via Windows icon Close
The menu item Opti Options ons > Settin Settings gs offers many options for the customization of STEP 7 Lite colors, colors, fonts etc. etc.
Getting Started STEP STEP 7 Lite A5E00293886-01
6.17
Getting started with programming
Programming OB1 in FBD
6.18
Using FBD (function block diagram), you are now going to program AND/OR/memory functions.
Specify the language you want to use to program and subsequently open OB1:
Getting Started STEP STEP 7 Lite A5E00293886-01
1
Double-click on OB1 OB1..
2
Click on Properties Properties..
3
Select FBD FBD.. As of no now w, OB OB1 1 wi will ll be opened in FBD.
4
Exit the Properties dialog box. FBD is also marked in the View menu.
How to program AND functions in FBD 5
Under the View menu, select symbolic representation.
6
At OB1 OB1,, enter ”Periodic ”Periodically ally Processed Processed Main Mai n Program” Program”.. At Network 1, en ente ter r ”AND Function”.
7
Click on the input area.
Use different methods to insert two program elements: 8
Click on the AND icon to insert it immediately.
9
Drag the instruction to the graphic fram fr ame. e. If yo you u miss miss thi this s targ target et,, th the e instruction is indicated below the AND box. 6.19
10
Alternative to pasting per drag-anddrop: Highli Highlight ght the frame frame and doubledoubleclick on the assign icon.
Now, the only thing still missing in your Now, AND function is addressing: 11
Click on ??.? ??.?.. Enter the symbolic symbolic name ”Key_1” ”Ke y_1” (with quotation marks). Or Or,, click on the the question question mark, right click click to select Insert symbol and then insert a name from the list. Enter “Key_ Enter “Key_2” 2” for the the input input of of the AND AND box. Assign the name ”Green_Li Assign ”Green_Light” ght” to the function.
Getting Started STEP STEP 7 Lite A5E00293886-01
Getting started with programming
The AND function program is completed. 12
After no more symbols are displayed in red color, color, click on the disk icon icon to save your entries. Not only your entries in OB1 will be saved, sav ed, but rather all project elements. elements. When you select Edit > Apply, Apply, your entries (this is always the content of the active window) are saved to a temporary file. This file saving method is recommended in case you want to undo changes later. later. After entering entering only data, you are prompted prompted to save save your your changes when you close the project.
6.20
Symbols are displaye Symbols displayed d in red color, color, for example example,, if not included included in the symbol symbols s table or ifif a syntax error has occurred. In this case, case, you cannot save save your your entries and the lower lower section of the editor display displays s a plain text messag message e informing informing you you of appropriate procedures.
Getting Started STEP STEP 7 Lite A5E00293886-01
How to program OR functions in FBD 1
Highlight network 1.
2
Insert a new network. This action can also be performed via icon in the toolbar and with right-click or CTRL+R.
3
Again, Agai n, highlig highlight ht the input area. area.
4
Insert an OR function and an assign instruction.
5
Only addressing addressing is still missing missing.. Enter a name as shown in the left left figure. figure. Sav Save e your entries. 6.21
Assign distinctive short-names to your circuits to make it easier to scroll through large programs via scroll scroll bar on the right right side side of the view view.. These names are displayed when you scroll the view.
Getting Started STEP STEP 7 Lite A5E00293886-01
Getting started with programming
How to program memory functions in FBD 1
2
3
Highlight network Highlight network 2. Insert an additional network. Again, Aga in, highlig highlight ht the input area. area.
In the instructi instruction on list, list, go to Bit logic and select SR element. element. Insert the element.
4
Enter following symbolic names:
6.22
– Set Set ”A ”Auto utomat matic ic_O _On” n”,, – Re Rese sett ”Manu ”Manual al_O _On” n”,, – Se Set/R t/Res eset et mem memory ory func functi tion on ”Automatic_Mode ”.
5
Getting Started STEP STEP 7 Lite A5E00293886-01
Save your entries via File > Save. Save.
How to adapt the programming interface The STEP 7 Lite menu commands allow you to customize your programming interface.
Menu View View – – Examples:
1
For symbolic addressing in FBD: Enable View > Display with > Symbolic Represent Representation ation
2
For absolute addressing in LAD: Disable View > Display with > Symbolic Represent Representation ation
Changing the programming language View > LAD/FBD/STL
6.23
Menu Options > Settings – Settings – Examples: 3
4
6
Line break in symbolic addressing, between the 10th and 24th character: Options > Settings > LAD/FBD > Address field width Changing the view colors: Options > Settings > LAD/FBD > Selected element Close the block via Windows icon Close.. Close
Especially the Options menu offers many options for the custom customization ization of colors colors,, fonts fonts,, address field field width etc. in STEP 7 Lite. Lite.
Getting Started STEP STEP 7 Lite A5E00293886-01
Getting started with programming
Displaying cross-refere cross-references nces Filters address display Jumps to location
Defines new filters
Displays cross-references for an address
6.24
Displays call hierarchy of blocks Displays Displa ys assignment assignment of used bits, byte bytes, s, timers and counters
Lists used addresses and jumps to location Use the views “Cross-reference list”, “Addres Addresses ses used” and “Program structu stru cture” re” to get get an ove overview rview of how to to use address addresses, es, me memory mory areas, areas, blo blocks cks etc. You can get to the cross-references by double-clicking the “Cross-references” symbol in the project window.
Getting Started STEP STEP 7 Lite A5E00293886-01 A5E00142300-01
7
ErstellenSie Using Erstellen function SieProein Proein blocks gramm grammim im OB1 OB1 OB 1
Using function blocks
Generating and opening function blocks (FB)
7.2
Function blocks are used in function programming program ming if you hav have e to sav save e intermediate results or operating settings and operating modes until the next call. For this reason, reason, they are also also referred to as ”Blocks with memory”. In your sample sample project, project, you program program function block FB1 under the symbolic name ”Engine”. Use the programming language you used in programming OB1.
Your ”Getting Started” projec projectt should contain contai n a copy copy of the symbol symbol table table before you continue with this chapter (see Page 5.5).
Getting Started STEP STEP 7 Lite A5E00293886-01
The dialog box for project selection is opened.
1
If req requir uired, ed, open STE STEP P 7 Lit Lite. e.
2
In the Open project dia dialog log,, double double-click on ”Getti ”Getting ng started” to open tthe he project.
3
In your project project window, window, click on Program.
4
Select menu command Insert > Block, Block , or right-click to open the pop-up menu and select the New > Block command.
The dialog box for creating new blocks is opened.
5
Highlight Function block. Select the language you want to use for your programming in the Created in language drop-down list box.
6
Confirm with OK OK..
The block is inserted and opened immediately.
7
The new block is inserted and opened immediately in your project window. window.
Getting Started STEP STEP 7 Lite A5E00293886-01
7.3
Using function blocks
How to edit the variable declaration table We are going to show you how to program a function block that uses two data blocks to monitor and control a petrol and a diesel engine.
Project wi window
Code se section
All ”engine ”engine-speci -specific” fic” signal signals, s, namel namely y the the block parameters parameters,, are transferred transferred between the organization block and the function block. Thus,, they must Thus must be declared declared in the variable declaration table as I/O parameters (Declar (Declaration ation ”in” and ”out”) ”out”).. This defines define s the ”Interface” ”Interface” for calling calling your function block in the program.
Variable declaration table Libraries
1
Next thing to do is to edit the variable declarat decl aration ion table table of the FB, FB, bef before ore you you continue to program instruction elements.
7.4
2
Enter the variables as shown in the figure. Click on a cell and enter a respective name and comment as shown in the figure.
3
Select Type from Elementary types via the pop-up pop-up menu menu by rightright-cli clickin cking g the mouse button. Press Return to move the cursor to the next column or to insert a new row.
Getting Started STEP STEP 7 Lite A5E00293886-01
1. Editing the variable declaration table Only letters, letters, numer numeral al and underscore underscore can be used to name block parameters in the variable declaration table.
2. Help on the variable declaration table? More information is found via F1 > Content > Programming Programmin g blocks > Creating logic logic blocks and Editing the variable declaration table .
3. Tips on the chapters below In the following chapters you are going to program an ON/OFF switching circuit and a speed monitoring circuit. When is the engine switched on and off? - The engine engine is switched switched on ifif the signal signal status of variabl var iable e #Switch #Switch_On _On is ”1” ”1” AND ifif the signal signal status stat us of var variabl iable e ”Automat ”Automatic_ ic_Mod Mode” e” is ”0”. - The engi engine ne is swit switched ched off off if the sign signal al status status of of vari va riabl able e #Swit #Switch_ ch_Off Off is ”1” ”1” OR if th the e signa signall status of variabl variable e #Failure #Failure is ”0”. How does the comparator monitor the speed of the engine? - The comparator compares the variables #Actual_Speed and #Preset_Speed. The result is written to variable #Preset_Speed_Reached (Signal status ”1”).
Depending on the language you have selected for programming your OB 1, go to: Page Pag e 7.6 to to 7.7, for LAD LAD Page Pag e 7.8 to 7.9, 7.9, for STL STL Page Pag e 7.10 to 7.11, for FBD. FBD.
Getting Started STEP STEP 7 Lite A5E00293886-01
7.5
Using function blocks
Programming FBs in LAD
7.6
How to program an engine On/Off circuit 1
2
3
Getting Started STEP STEP 7 Lite A5E00293886-01
Highlight network Highlight network 1. 1. Open Libraries > Commands.. Insert a series circu Commands circuit it consis con sistin ting g of a NO conta contact, ct, NC conta contact ct and an SR flip-flop.
Next, highli Next, highlight ght the circuit circuit upstream in front of of the R input and insert insert another NO contact. Highlight the left Highlight left circuit circuit upstream upstream of the NO contact. contact. Insert a NC contact contact in in parallel to the NO contact.
4
5
6
Check whether the symbolic representation is enabled.
Highlight all ??.? ??.?.. Enter the respecti respective ve name in your variable declaration table (# is assigned automatically).
Assign the symbolic name ”Automatic_Mo tic _Mode” de” to the the NC cont contact act of the series circuit.
How to program a speed monitoring circuit 7
Insert a new network and highlight the circuit.
8
In the command command library, library, select Comparator and insert GE_I GE_I.. Also insert a coil in this circuit. 7.7
9
Again, highli Again, highlight ght the question marks. marks. Assign a name to the coil and to the comparator according to the variable declaration table. Save your entries.
Local block variables are identified by # and they apply only in the the block. Global variable variables s are in quotation quotatio n marks, they are defined defined in the symbol table and apply apply to the entire program. program. The signal signal status ”Automatic ”Automatic_Mode _Mode”” is specified specified in OB1 (Network (Netw ork 3, compa compare re Page 6-10) by by another RS element and is now queried in FB1.
More information is found via F1 > Content > Programming Programmin g blocks > Creating logic logic blocks and Editing LAD elements. elements.
Getting Started STEP STEP 7 Lite A5E00293886-01
Using function blocks
Programming FBs in STL
7.8
How to program an engine On/Off circuit
Getting Started STEP STEP 7 Lite A5E00293886-01
1
Check whether the symbolic representation is enabled.
2
Enter these STL instructions in network 1.
How to program speed monitoring
3
Insert a new network. network. Enter these these STL instructions. Save your entries.
Local block variables are identified by a # character and apply to this block only. only. Global variables variabl es are in quotation marks, marks, and are defined in the symbol table and apply to the entire program.. The signal program signal status ”Auto ”Automatic_ matic_Mode” Mode” is specified specif ied in OB1 (Network (Network 3, compa compare re Page 6-16) 6-16) by another RS element and is now queried in FB1.
More information is found via F1 > Content > Programming Programmin g blocks > Creating logic logic blocks and Editing STL statements. statements .
Getting Started STEP STEP 7 Lite A5E00293886-01
7.9
Using function blocks
Programming FBs in FBD
7.10
How to program an engine On/Off circuit
Getting Started STEP STEP 7 Lite A5E00293886-01
1
Insert an SR function in network 1 via command library.
2
Assign an AND box to input S (Set) and and an OR box to input R (Reset).
4
5
6
Check whether the symbolic representation is enabled.
Highlight all ??.? ??.?.. Enter the respecti respective ve name in your variable declaration table (# is assigned automatically)..
Use the symbolic name ”Automatic_ ”Auto matic_Mode” Mode” to address an AND AND function input. Invert Inv ert the ”Automatic_M ”Automatic_Mode” ode” and #Failure #Fa ilure inputs, inputs, using a corresponding corresponding symbol from the toolbar.
How to program a speed monitoring circuit Insert a new network network.. Highli Highlight ght the circuit. 7
8
In the command command library library,, go to Comparator and enter GE_I enter GE_I.. Ad Addr dres ess s the inputs with a name from the variable declaration table. Assign an assign function to the comparator compa rator.. Use a name from the variable declaration table to address this function. Save your entries.
Local block variables identified by a # character apply to this block only only.. Global variables are in quotation quotatio n marks, and are defined defined in the symbol symbol table and apply apply to the entire program. program. The signal signal status ”Automatic ”Automatic_Mode _Mode”” is specified specified in OB1 (Network (Netw ork 3, compa compare re Page 6-22) by by another RS element and is now queried in FB1.
More information is found via F1 > Content > Programming Programmin g blocks > Creating logic logic blocks and Editing FBD elements. elements.
Getting Started STEP STEP 7 Lite A5E00293886-01
7.11
Using function blocks
Generating instance DBs and modifying actual values
7.12
Inserting data blocks To be able to program the call (CALL) of FB1 in OB1 OB1 later later,, you must gener generate ate a corresponding data block. The FB is to control or monitor a petrol or diesel engine engine.. The different different speed setpoint values for the engines are stored in two two separate separate DBs, that is, is, by modifying the respective actual value (#Preset_Speed). You reduce your effort by programming a single, single, centra centrall FB. FB.
Getting Started STEP STEP 7 Lite A5E00293886-01
1
2
3
Right-click on the project window to open the pop-up menu. menu. Select New > Block.. The New block dialog pops up. Block
Highlight Data block. block. Ent Enter er FB1 FB1 as the assigned function block (as shown in the figure).
Confirm with OK OK.. DB1 is is inserted inserted in in your ”Gettin ”Getting g Started” project and opened immediately.
The block is inserted.
4
5
Enable Data view. view. You can edit edit the DB DB only in this view.
For the petrol engine, verify that you have hav e entered the value value ”1500” in the Start value column.
The block is inserted.
6
7
Analogousl Anal ogously y, insert a DB2 ”Diesel”. ”Diesel”.
For the diesel engine engine,, enter the Start value ”1200” in the the column column.. Save your entries.
To program the FB call in OB1 in your selected programming language, continue at the respective chapter relating to LAD LAD, FBD or STL. STL.
By setting the actual values you have completed your preparations for controlling two engines with the help help of a single single function function block. block. You only hav have e to generate the respective data blocks to control further engines.
More information is found via F1 > Content > Programming blocks > Creating data blocks .
Getting Started STEP STEP 7 Lite A5E00293886-01
7.13
Using function blocks
Programming block calls in LAD
7.14
The entire function block program will be ineffective unless it is called in OB1. To control both engines, engines, one DB is used per FB call.
Getting Started STEP STEP 7 Lite A5E00293886-01
1
Open OB1 and insert network 4.
2
Drag FB1 from the project window to network netwo rk 4. All engine-speci engine-specific fic variables variables will be displayed.
3
Click on ??.? The symbol selection list pops up.
4
5
In this symbol symbol selection selection list, selec selectt data block ”Petrol”. Again, address all Again, all other FB parameparameters, using correspondin corresponding g symbolic symbolic names. Engine-specific I/O variables (Declaration ”in” and ”out”) are are displayed displayed in FB ”Engine”. All variable are assigned a ”PE_xxx” signal for the petrol engine.
The call for the diesel engine is still missing
6
Insert network Insert network 5. Aga Again, in, drag FB1 FB1 from from the project window to the network. Analog An alogous ously ly,, prog program ram the the call of FB ”Engine” ”Engin e” (FB1) with DB ”Dies ”Diesel” el” (DB2) (DB2).. Assign all variables Assign variables a ”DE_xxx” signal for the diesel engine. Save your entries and close the block. 7.15
When you create program structures which include OBs, FBs and and DBs, DBs, you must must declare declare the the call of of the lower lower lev level el block block (e.g. (e.g. FB1) in in the higher lev level el block (e.g (e.g.. OB1). This procedu procedure re is always alwa ys the same same.. In the symbol symbol table, table, you can can also assign symbolic names to the different blocks (e. (e.g. g. FB1 ”Engine ”Engine”” and DB1 DB1 ”Petrol”) ”Petrol”).. You can always print block programs via File > Print.. Further information Print information on printing printing is found via via F1 > Content > Printing project documentation.. documentation
Getting Started STEP STEP 7 Lite A5E00293886-01
Using function blocks
Programming block calls in STL
7.16
A function block program will be ineffective unless it is called in OB1. To controll both engines, contro engines, one DB is used per FB call.
1
2
3
Getting Started STEP STEP 7 Lite A5E00293886-01
Open OB1. Insert network network 4.
Declare ”Engine”, ”Petrol” in the CALL instruct instruction. ion. Confirm the entry with Return. Return. All engine-specif engine-specific ic variable are displayed. Right click click next to ”:=” ”:=” to open the popup menu. menu. Selec Selectt the insert insert symbol command. comm and. The symbol symbol selection selection list pops up.
4
Again, addres Again, address s all other FB parameters, parameters, using corresponding symbolic names. Engine-specific variables (Declaration ”in” and ”out”) are display displayed ed in FB ”Engine”. All variables are assigned a ”PE_xxx” signal for the petrol engine.
The call for the diesel engine is still missing.
6
Analogously,, insert network 5 and Analogously program FB ”Engine ”Engine”” (FB1) to cal calll DB ”Diese ”Di esel” l” (DB (DB2). 2). All variables are assigned a ”DE_xxx” signal for the diesel engine. Save your entries and close the block.
7.17
When you create program structures which include OBs, FBs and and DBs, DBs, you must must declare declare the the call of of the lower lower lev level el block block (e.g. (e.g. FB1) in in the higher lev level el block (e.g (e.g.. OB1). This procedu procedure re is always alwa ys the same same.. In the symbol symbol table, table, you can can also assign symbolic names to the different blocks (e. (e.g. g. FB1 ”Engine ”Engine”” and DB1 DB1 ”Petrol”) ”Petrol”).. You can always print block programs via File > Print.. Further information Print information on printing printing is found via via F1 > Content > Printing project documentation.. documentation
Getting Started STEP STEP 7 Lite A5E00293886-01
Using function blocks
Programming block calls in FBD
7.18
A function block program will be ineffective unless it is called in OB1. To control both engines, engines, one DB is used per FB call.
1
Getting Started STEP STEP 7 Lite A5E00293886-01
Open OB1. Insert network network 4.
2
Drag&drop FB1 from the project window to to network network 4. All engineenginespecific variables will be displayed.
3
Click on ??.? to open the symbol selection list.
4
5
Select DB ”Petrol” ”Petrol” from the symbol symbol selection list. Again, address all Again, all other FB FB parameters, param eters, using correspondin corresponding g symbolic names. Engine-specific variables (Declaration ”in” and ”out”) are are displayed displayed in FB ”Engine”. All variables are assigned a ”PE_xxx” signal for the petrol engine.
The call for the diesel engine is still missing.
6
Insert network Insert network 5. Aga Again, in, drag drag&dr &drop op FB ”Engine” ”Engin e” (FB1) from from the project project window and program it to call DB ”Diesel” (DB2). All variables are assigned a ”DE_xxx” signal for the Diesel engine. Save your entries and close the block. 7.19
When you create program structures which include OBs, FBs and and DBs, DBs, you must must declare declare calls of a lower lower level level block (e.g (e.g.. FB1) in the higher lev level el block (e.g (e.g.. OB1). This procedu procedure re is always alwa ys the same same.. In the symbol symbol table, table, you can can also assign symbolic names to the different blocks (e. (e.g. g. FB1 ”Engine ”Engine”” and DB1 DB1 ”Petrol”) ”Petrol”).. You can always print block programs via File > Print.. Further information Print information on printing printing is found via via F1 > Content > Printing project documentation.. documentation
Getting Started STEP STEP 7 Lite A5E00293886-01
Using function blocks
7.20
Getting Started STEP STEP 7 Lite A5E00293886-01
8
ErstellenSie Using Erstellen functions SieProein Proein gramm grammim im OB1 OB1 OB 1
Using functions
Creating and opening functions (FCs)
8.2
Functions are used if FC programmi Functions programming ng does not require require of you to save save interintermediate results results,, mode settings settings or operating modes until the next block call. This is why why they are also also referred to as ”Blocks without memory”. Your ”Getting Started” projec projectt should contain contai n a copy copy of the symbol symbol table table before you continue with this chapter (see Page 5.5).
Getting Started STEP STEP 7 Lite A5E00293886-01
The dialog box for project selection is opened.
1
2
3
4
If req requir uired, ed, open STE STEP P 7 Lit Lite. e.
Click on on ”Getting ”Getting started” in the Open project dialog to open your project.
Click on Program in the project window.
Select menu command Insert > Block, Block , or right-click to open the pop-up menu and select New > Block. Block.
The dialog box for creating new blocks is opened.
5
Highlight Function. In the Created in Language box, select the language you have used to generate gener ate your ”Getting ”Getting Started” projec project. t.
6
Confirm with OK OK..
The block is inserted and opened immediately.
7
The new block is inserted into the project window and opened immediately.
Getting Started STEP STEP 7 Lite A5E00293886-01
8.3
Using functions
Contrary to FBs, withi Contrary within n a function you cannot cannot declare static data in the variable declaration table. You can refer to symbolic names from the symbol table to program the function in the way as you are used to.
8.4
Getting Started STEP STEP 7 Lite A5E00293886-01
Further information is found via F1 > Content > Basics of designing designing a program program > Blocks in the the user program. program.
8.5
Getting Started STEP STEP 7 Lite A5E00293886-01
Using functions
Programming functions
8.6
In our next example you are going to program a timer function. When the timer timer is switched, switched, the timer function simutaneously switches on a fan which runs for 4 seconds after the engine has been been switche switched d off (off delay)
Variable declaration table
1
Getting Started STEP STEP 7 Lite A5E00293886-01
Analogous to the FB, Analogous FB, start by declaring declaring the function’s I/O parameters (Declaration ”in” and ”out”) in the variable variable decladeclaration table. Right-click to open the pop-up menu Parameter types. types . Sel Select ect TIME TIMER. R.
How to program timer functions in LAD 2
3
4
Go to Libraries > Commands > Timers.. Sel Timers Select ect eleme element nt S_OFFDT and insert it in network 1. Insert an additional NO contact and a coil. For ??.?,, enter the names For ??.? names from from the variable variabl e declaration declaration table. These are automatically marked with a # character.. Enter the timer ter timer constant TV S5T#4s. S5T#4 s. Sav Save e your your entries entries.. Close the block.
How to program timer functions in STL 2
Declare the instructions as shown at the side. side. Sav Save e your your entries entries.. Close the block.
How to program timer functions in FBD 2
Same as in LAD: LAD: Cop Copy y the instructions instructions from the library library to your network, network, fill all ??.? and declare the timer constant. Save Sav e your entries. entries. Close the block. block.
Input parameter parameter ”#Engin ”#Engine_on” e_on” starts ”#Timer_Fun ”#Tim er_Function” ction”.. On subsequent calls calls in OB1, the petrol or Diesel engine parameters are assigned to the function according accordingly ly (e.g. (e.g. T1 for “PE_Follow_On“).
Getting Started STEP STEP 7 Lite A5E00293886-01
8.7
Using functions
Calling functions in OB1
8.8
FC1 is called in OB1 in the same way as a function function block. For function function parameters OB1 provides corresponding address data for the petrol or Diesel engine.
An address address is part part of a STEP 7 Lite Lite instruction instruction which specifies a function the CPU uses for processing. proces sing. Addres Addressing sing can be absolute absolute or symbolic.
Getting Started STEP STEP 7 Lite A5E00293886-01
Opening OB1 1
2
Open the ”Getti ”Getting ng Started” projec projectt which you have have generated in in LAD, LAD, FBD or STL. STL. Ope Open n OB1. OB1.
Insert Network 6 for the petrol engine and Network 7 for the Diesel engine.
This is how it looks after programming in LAD ...
How to program block calls in LAD 3
Drag&drop FC1 to Network 6 and Network 7.
4
Edit all ??.? as shown. Save and close the block.
8.9 ... how it looks in STL,
How to program block calls in STL 3
Enter the STL instructions as shown.
4
Save and close the block.
... how it looks in FBD.
How to program block calls in FBD 3
Drag FC1 to Net Network work 6, petrol engine engine.. Drag FC1 to Network Network 7, Diese Diesell engine engine..
4
Edit all ??.? as shown. Save and close the block.
Getting Started STEP STEP 7 Lite A5E00293886-01
Using functions
1. Your screen differs from our screen shots? Set symbolic programming via View > Display with > Symbolic Representation. Representation .
2. You want to see more on-screen information? Enable View > Display with > Symbol Information to obtain information on specific network addresses. To display several several networks networks on-screen, disable View > Display with > Comment an and, d, if required, View > Display with > Symbol Information.. Information Under View Under View > Zoom factor , you can can adjust adjust the the on-screen on-scr een size size of the networks networks..
3. You need information on the programming languages LAD, STLL or FBD? 8.10
Further information is found via F1 > Content > Calling Reference Helps > Language descriptions and block help.
4. You do not always want to call the function? In our example we have programmed an absolute function functi on call, call, that is, is, the function function is alwa always ys going going to be processed. processed. Depend Depending ing on requirements requirements for your automation automation task, task, you can also also program conditional condit ional FC FC or FB calls: e.g e.g.. via enable enable signal signal from an input input or series circuit. circuit. The EN input input or ENO output output of the box box are both availab available le for programming conditional calls.
Getting Started STEP STEP 7 Lite A5E00293886-01
9
ErstellenSie Erstellen Using global SieProein Proein data blocks gramm grammim im OB1 OB1 OB 1
Using global data blocks
Generating and opening global data blocks (DBs)
9.2
You can save selected data to a shared data block block if the CPU CPU cannot cannot store anyanymore because because it has run out of of internal memory bits (memory cells). Data of a shared shared DB are availabl available e to any other block. An instance instance DB DB,, on the the other hand, hand, is assigned assigned to a specific specific function functi on block. block. Its data are are only available locally in this FB (compare Chapter 7, 7, How to generate generate instance instance DBs and modify actual values). Your ”Getting Started” projec projectt should contain contai n a copy copy of the symbol symbol table table before you continue with this chapter (see Page 5.5).
Getting Started STEP STEP 7 Lite A5E00293886-01
The dialog box for project selection is opened.
1
If req requir uired, ed, open STE STEP P 7 Lit Lite. e.
2
Double-click on ”Gettin Double-click ”Getting g Started” in the Open project dialog to open your project.
3
In the project project window, window, click on Program.
4
Select menu command Insert > Block, Block , or right-click to open the pop-up menu and select the menu command New > Block.. Block
The dialog box for creating new blocks is opened.
5
6
7
Highlight Data block. A ”3” is written written automatically automatically to the DB field, fie ld, and ”S_ ”S_Data Data”” to the Symbol field.
Here,, select ”Globa Here ”Globall DB”.
Confirm with OK OK..
The block is inserted and opened immediately.
8
The new block is inserted into the project window and opened immediately.
Getting Started STEP STEP 7 Lite A5E00293886-01
9.3
Using global data blocks
Programming DB variables
9.4
1
2
In the Name col column umn,, ent enter er ”PE_Actual_speed”.
Right-click to open the pop-up menu. Select the Type under under Elementary Elementary types > INT. INT . Complete the list as shown above. Save Sav e your entries. entries. Close the block. block.
Further information is found via F1 > Content > Programming blocks > Creating data blocks .
Getting Started STEP STEP 7 Lite A5E00293886-01
10
Erstellen Sie Downloading ein Proprograms to gramm im the CPU OB1
Downloading programs to the CPU
Establishing an Online connection Power supply on/off
Mode selector switch Programming device with STEP 7 Lite software E 0.3 A 4.1
E 0.4
220 V
24 V 10.2
Power supply P
We shall use your ”Getting Started.k7p” project to show you how to download the program to the PLC. PLC. Feel free to use one one of the included included sampl sample e programs instead.
MPI cable
Comb connector
Next thing to do is to make some preparations.
Memory module*
Construct a test assembly
Back-up battery* Rack Test assemb assembly ly Parallel circuit
*= Not absolutely necessary
Getting Started STEP STEP 7 Lite A5E00293886-01
1
To test your sample program, program, you require a test assembly which allows you to set inputs inputs (e.g. (e.g. with pushbuttons).
2
Perform a program check If you decide decide to use your your ”Getting ”Getting Started” Sta rted” proj project ect,, you shou should ld at least least have configured your hardware (Chapter 4) and programmed the parallel circuit (Chapter 6).
3
Perform a hardware check Assemble your hardware and check once again: -
-
Are the Are the bus bus conne connect ctors ors pl plugg ugged ed into into the modules? Are Ar e the the mo modul dules es att attach ached ed to th the e profile rail, rail, swun swung g down and screwscrewtightened? Is th the e 220 220 V pow power er su supp pply ly connected? Is th the e com comb b con connec necto torr ins inserte erted? d? If exi xist st,, ha hav ve you in inse serte rted d th the e backup battery and memory module? 10.3
4
Establish the Online connection To establish an Online connection means to interconnect the CPU and PG. -
Interc Int ercon onnec nectt the the CP CPU U and and the PG via MPI cable.
At the CPU: - Switch on the power supply - Se Sett tthe he mo mode de se sele lect ctor or sw swit itch ch to to STOP.. STOP
At – – –
the PG: Switch on the master switch. Run Ru n STE STEP P 7 Li Lite te.. Open Ope n ”Ge ”Gett tting ing St Starte arted.k d.k7p 7p”” or on one e of the sampl sample e project projects. s.
Getting Started STEP STEP 7 Lite A5E00293886-01
Downloading programs to the CPU
Going Online 5
When started, started, STEP 7 Lite immediate immediately ly attempts to go Online. The Online button must be lit in green color.. The status bar indicates color indicates the Online connect connection ion status, status, follo followed wed by CPU mode STOP STOP.. If STEP STEP7 7 Lite fails fails to to connect connect to a CPU,, it remains CPU remains Offline and the status status bar indicates the connection status Offline.. Offline In this this case case,, eli elimin minate ate the the cause cause of the Online connection connection failure failure (e.g. (e.g. a cable is not properly plugged in or the CPU is switched off) and then click on the Online button. You can always click on this button to go online or offline.
10.4
6
Verify tha t Control the CPU Online is indi in dicat cated. ed. If ye yes, s, the bu butt ttons ons on the the CPU operator panel are enabled.
7
Check: The status bar bar now displays displays the actual CPU operating mode.
8
Try out: You can now toggle Offline view Project and Online view Online CPU.. CPU
The Online CPU tab shows all blocks of th the e CPU CPU..
Icons on your project window will indicate data inconsistency between PG and CPU CPU if you have have not not yet downdownloaded your program to the CPU.
Getting Started STEP STEP 7 Lite A5E00293886-01
You can also establish Online connections and perform tests tests (Chapter (Chapter 11) if you use other than the hardware displayed on Page 10.2. You merely have to comply with I/O addressing conventions. Further information information on the assembly assembly of PL PLC C modules is found in the ”S7-300 – Hardware Hardware and Installation” Installation” manual manual.. Further information on establishing online connections is found in the Online Help via F1 > Content > Establishing an Online Connection. Connection.
10.5
Getting Started STEP STEP 7 Lite A5E00293886-01
Downloading programs to the CPU
Resetting CPU memory and downloading the program
10.6
The CPU operator panel Reset CPU memory prior to program download. downloa d. You can use the CPU CPU operator panel in STEP 7 Lite or directly at the CPU.
CPU operator panel in STEP 7 Lite CPU operator panel on the CPU
CPU operating modes are also set on the operator panel. Due to safety reasons reasons,, howe however ver,, the STEP 7 Lite operator panel only lets you select the operating mode set at the CPU.
Getting Started STEP STEP 7 Lite A5E00293886-01
Example: – At th the e CPU CPU:: Sw Swit itch ch is se sett to to RUN At the STEP 7 Lite operator panel: STOP instructions can be enabled. – At th the e CPU CPU:: Sw Swit itch ch is se sett to to STOP At the STEP7 Lite operator panel: RUN instructions cannot be enabled.
In danger situations you can also set the CPU to STOP mode via STEP 7 Lite.
CPU memory reset at the CPU Before you download your program to the CPU, CPU, delete all old old data and programs on the CPU via reset memory instruction. instruction. To do this: 1
2
CPU on on..
Mode selector switch to STOP position (if not alread already y in STOP STOP posit position) ion).. The LED is lit in red color.
3
Turn the mode selector switch to MRES position. positio n. Hold it there there for at least three three seconds until the red STOP LED flashes at a slow rate.
4
Release the mode selector switch. Within three three seconds, seconds, set the switch switch once again to MRES position and hold it there until the STOP LED flashes at a fast rate.
3 sec 3 sec
You have now completed CPU memory reset.
Getting Started STEP STEP 7 Lite A5E00293886-01
10.7
Downloading programs to the CPU
CPU memory reset in STEP7 Lite You can also choose to reset CPU memory via STEP 7 Lite. 1
At the CPU: CPU: Set the mode mode selector selector STOP position.
2
In STEP7 STEP7 Lite: Lite: Click on the MRES button.
3
Confirm with YES with YES.. CPU mem memory ory is is reset.
You are prompted to confirm your action.
10.8
Information on operating states is found in the STEP 7 Lite Help via F1 > Content > Appendix > Operating Modes. Modes . Note: It is of adva advantage ntage to be famili familiar ar with CPU CPU operating modes when you program startup or test routines for the controller, controller, as well as for error diagnostics.
Getting Started STEP STEP 7 Lite A5E00293886-01
How to download the program to the CPU
+
1
Verify that: During program program download the mode selector switches at the CPU and in STEP 7 Lite must be set to Stop position.
2
Download the complete project to the CPU: Select the ”Getting ”Getting started” started” project from the project window.
3
Right-click on the project to open the context-sens conte xt-sensitiv itive e menu. Select Download to CPU. CPU. All project data are downloaded to the CPU,, includin CPU including g the hardware hardware configuration.
You can also choose to download only specific blocks or only the hardware configuration to the CPU. 4
In this example, example, we have have selected the hardware configuration for download. 10.9
5
In this example, example, we have have selected a single block for download.
5
Depending on the selected elements, STEP 7 Lite lets you perform an Upload to Programming Device (PG) .
6
Click on Online CPU. CPU. You are shown all CPU data.
The view “Online CPU” has changed.
– Project (Offline view) = Data on the PG – Online CPU (Online view) = Data on the CPU
Getting Started STEP STEP 7 Lite A5E00293886-01
Downloading programs to the CPU
How to switch on the CPU and check its operating status 1
Set the mode selector switch to RUN-P mode. mod e. The gree green n RUN LED is on and the red STOP LED is off. The CPU CPU is ready for operation.
The cyclic program processing is displayed.
2
Check the CPU: When the green green LED is is lit, you can start your program test run. The LED LED stays stays red red if an error has occurred occ urred.. Cli Click ck on the ”DIA ”DIAG” G” but button ton to view the diagnostics buffer for error evaluation (also refer to the section ”Module ”Modul e status and error history”, Page 12.5).
3
10.10
Getting Started STEP STEP 7 Lite A5E00293886-01
Check in STEP 7 Lite: STEP 7 Lite follows a CPU transition to RUN-P mode mode.. Cycl Cyclic ic program processing is indicated by a green background.
Memory reset: System function blocks (SFBs) and system functions (SFCs) are retentive in the CPU, irrespect irres pectiv ive e of mem memory ory reset. reset. The CPU provid provides es these operating system functions. functions. You neither have hav e to download them, them, nor can you delete delete them.
How to download specific blocks: You can increase error response under live conditions by downloading single blocks to the CPU.. To enable block CPU block downloads, downloads, the mode selector switch at the CPU must have been set to ”RUN-P ”RU N-P”” or ”STOP” ”STOP” pos positi ition. on. Blo Blocks cks downloa downloaded ded in ”RUN-P” mode are enabled instantaneously. instantaneously. Here, Her e, note that that:: If error-fre error-free e blocks are overw overwritten ritten by by faulty blocks,, the result blocks result is a malfun malfunction ction of your system system..
The CPU goes goes into STOP STOP mode if you neglect neglect the order in which blocks blocks are loaded (e.g. (e.g. a block that does not yet exist on the CPU is called in OB1.
CPU 31xC: The mode mode selector selector of a CPU 31xC does does not ship with a rotary switch, switch, but a toggle switch switch and there is no RUN-P RUN-P mode. mode. Howe However ver,, the memory memory reset procedure is the same. same. You wil find information information on Micro Memory Cards via: F1 > Index > Micro Memory Card. Card .
Getting Started STEP STEP 7 Lite A5E00293886-01
10.11
Downloading programs to the CPU
10.12
Getting Started STEP STEP 7 Lite A5E00293886-01
11
Erstellen Sie Program test ein run ru n Programm im OB1
Prog Pr ogra ram m te test st ru run n
Performing a program test run with program status
11.2
STEP 7 Lite lets you perform a program test run on the PLC. PLC. Followi ollowing ng test run options are available: 1. Test run with program program status – for monitoring the program cycle (see Page 11.3 to 11.5). 2. Test run with variable variable table – for monitoring and controlling addres add resse ses, s, e. e.g. g. in input puts, s, out outpu puts ts,, memory bits (see Page 11.6 to 11.10). Requirements for test run with program status: The complete complete program program must must have been downloaded to the CPU.
Getting Started STEP STEP 7 Lite A5E00293886-01
Preparations 1
Establish an Online connection.
2
Set the key switch on the CPU to RUN or RUN-P mode.
3
For network 1: Wire the series series circuit. For network 2: Wire the paral parallel lel circuit circuit (see the graphic)
4
Open the the ”Getti ”Getting ng Started” Started” proj project, ect, or one of of the samp sample le proje projects cts,, you hav have e downloaded to the CPU. Open OB1.
Monitoring 5
6
Call the monitoring function via Test > Monitor . This function function is only only available available after you ”Connect Online”. The black network circuits are now displayed in color. GREEN circuit circuit:: Current flow. flow. RED circuit: No cu cur re rent flflow
7
Now close all pushbutton contacts in your test assembly assembly,, one after the other and monitor: -
In ST STEP EP 7 Lit Lite: e: Ho How w the the ci circ rcui uits ts change their color.
-
At th the e mod modul ules es:: Ho How w the the LE LEDs Ds of the I/O modules are switched on and off.
Getting Started STEP STEP 7 Lite A5E00293886-01
11.3
Prog Pr ogra ram m te test st ru run n
Testing in LAD 1
Leave all pushbutton contacts open. In network network 1 and 2, the current circuit circuit is close closed d upstrea upstream m of pus pushbu hbutton ttons s 1, 3 and 4. This circuit circuit is indicated indicated in green color.. There is no current flow downcolor downstrea st ream m of pus pushb hbut utto tons ns 1, 1, 3 and and 4; th this is circuit is indicated in red color. The coloration indicates that the logical operation result is correct up to this position.
2
Now close close pushb pushbutt utton on contact contacts s 1, 2, 3 and 4. All circuits are now under current. If you hav have e opened opened one of our sam sample ple projects, project s, you can follow follow the comments comments to see which diodes should be lit on the I/O modules.
11.4
Testing in STL 1
Leave all pushbutton contacts open. STL shows in a table listing the – Logi Logical cal oper operatio ation n resu result lt (RL (RLO) O) – St Stat atus us bi bitt (ST (STA) A) – Ac Accu cumu mulat lator or (A (ACC CCU1 U1). ).
2
Getting Started STEP STEP 7 Lite A5E00293886-01
Now close close pushb pushbutt utton on contact contacts s 1, 2, 3 and 4. The logical operation result is correct at all positions.
Testing in FBD 1
2
3
Leave all pushbutton contacts open.
Now close close pushb pushbutt uttons ons contac contacts ts 1, 2, 3 and 4. The coloration indicates that the logical operation result is correct up to this position.
Disable Test > Monitor . Cl Close ose th the e window.
11.5
Under Options > Settings > Block editor you Under Options can modi modify fy the the type type of pre present sentatio ation n of test results. Further information is found via F1 > Content > Debugging > Testing using program status .
Getting Started STEP STEP 7 Lite A5E00293886-01
Prog Pr ogra ram m te test st ru run n
Monitoring and modifying variables Start modify
Start monitor Monitor addresses
Modify addresses
Monitor/Modify expand or reduce
11.6
Call monitor/ modify Input area for creating the variable table
Display area for status value e.g. “true” “tru e” or “fals “false” e”
Input area for modify value
Getting Started STEP STEP 7 Lite A5E00293886-01
You can monitor addresses by writing them to the variable variable table. table. Conditi Condition on is here that you are Online to the CPU. You can modify modify addresses by specifying a modify modify value and then then checkmark checkmark them.. Als them Also o req require uired: d: Onl Online ine connecti connection on and CPU in RUN-P mode.
How to create the variable table 1
Open your your ”Getting ”Getting Started” Started” project project.. Double-click on Monitor/Modify Monitor/Modify..
2
In the Variable table fiel field, d, crea create te a new table under the name ”VAT 1”.
3
Enter all variables for the ”Getting started” sample sample,or ,or only the the variables variables you want to modify. To do this: Enter Ent er ”I01.1 ”I01.1”” in the Address column. Press Return Return to have ”Key_1” ”Key_1” automati automati-cally inserted from the symbol table. Complete the table as in our figure. You can also position the cursor in the address column and select the address from the list via shortcut Ctrl + j. j.
You can also copy the variable table from one of the sample sample project projects. s. 4
5
Open one of the sample sample projects projects in in a second instanc instance e of STEP 7 Lite. Lite. Again, Ag ain, clic click k on Monitor/Modify to open VAT 1. 1. Highlight the complete table via Ctrl + a and copy it to the clipboard via Ctrl + c. c.
Go to your your ”Getting ”Getting Started” project project.. Paste the data from the clipboard to your file via Ctrl + v
Getting Started STEP STEP 7 Lite A5E00293886-01
11.7
Prog Pr ogra ram m te test st ru run n
How to monitor variables When monitoring monitoring the variables, variables, you can perform program test runs as well as check your hardware for error-free functioning. 1
2
3
11.8
4
Getting Started STEP STEP 7 Lite A5E00293886-01
Close contac contacts ts ”Ke ”Key_1” y_1” and ”Ke ”Key_2” y_2” in your test assembly.
Click on Monitor . Now,, the status value is highlighte Now highlighted d on a blue background color and the variables are monitored.
You can monitor, -
how th the e dis displ play ayed ed va valu lue e in in the the Status value column is toggled from ”F ”FALS ALSE” E” to ”TRU ”TRUE” E” and
-
at th the e sam same e tim time e, ho how w I/O I/O mo modu dule le LEDs LED s are switch switched ed on or off when you press press any any of the pushbutto pushbuttons ns on your test assembly.
For your program or hardware test run, perform a check the plausi plausibility bility of your combination status – Pu Push shbu butt tton on con conta tact ct op open en/c /clo lose se – LE L ED on/o f f – Variable tr ue/false.
How to modify variables While you you are modifying modifying variables, variables, you can assign them values in order to simulate specific program runtime situations.
Example: 1
2
3
For modifying, modifying, your CPU must must also be set to RUN-P RUN-P mode. mode. In this case, case, Monitor stays Monitor stays enabled.
In the Modify value col column umn,, ent enter er the value val ue ”TRUE” ”TRUE”,, for examp example le.. Thi This s modify value is not yet enabled.
Checkmark the options box to enable the modify value. value. This box box is displayed displayed immediately after you have entered the modify value. 11.9
4
Click on Modify Modify..
5
Monitor the effects of the modified Monitor modified variables in the Status value column.
Getting Started STEP STEP 7 Lite A5E00293886-01
Prog Pr ogra ram m te test st ru run n
You can control binary as well as nonbinary addresses addresses.. For the the latter latter,, you should first select the display format and then enter a respective modify value. 6
7
If you specify specify DEC for for controlling controlling speed setpoints in the Display format column,
you can enter the speed modify values ”1200” ”120 0” and ”1500 ”1500”” in decim decimal al format. format. A cell highlighted on a red background color indicates that you have entered a value which is incompatible to display forma fo rmat. t. In this this case case,, th the e Modify value column does not display the option boxes anymore.
8
11.10
You can change change the display display format format of a variable,, after you have variable have clicked clicked on the type in the Display format column.
Expanded view Monitor/Modify 9
You can choose between dif ferent monitoring and modifying modes in the expanded view Monitor/Modify Monitor/Modify e.g. you can choose whether the control value: – should should be set set only only whe when n the the cycli cyclic c statu st atus s of OB OB1 1 is defin defined ed,, e.g .g., ., wh when en the cycle starts or – or im imme medi diate ately ly in th the e mid middl dle e of of a running program.
Getting Started STEP STEP 7 Lite A5E00293886-01
12 1
Erstellen Sie Error ein Prodiagnostics gramm im OB1
Error diagnostics
A quick glance at HW diagnostics 6
Diagnosable modules are displayed 7
Global module data – with status information
Open project via File
1
2
8
Connect online
Detailed data – with detailed error descriptions 9
Show diagnostic buffer
12.2
3
All information on ordering orderin g par ts
Note operating mode CPU
Note hardware group error messages
4
10
View: call hardware hardware diagnostics diagnostics
5
STEP 7 Lite offers extensive error diagnostics at a glance after a hardware error has occurred in the PLC station. The code number number will will indicate the diagnostics diagnostics path. This view view is only available in online mode.
Getting Started STEP STEP 7 Lite A5E00293886-01
An error has occurred? The status status of a PLC PLC in your your plant has has changed to STOP. The CPU key switch is set to RUN position. A hardware error has occurred.
Troubleshooting Set the key switch to STOP position.
1
2
3
4
5
6
Open the project which belongs to this PLC station and in which the hardware configuration error has occurred.
Establish an Online connection between the PG and the PLC (compare Chapter 10).
You already know that the CPU has changed to STOP STOP mode. You need this informat inf ormation ion,, for exampl example, e, in situation situations s not allowing visual contact to the CPU during commissioning.
Double-click on Hardware Hardware,, on the the lef leftt side of your project project window window.. Open the Hardware Diagnostics view
A pictogram identifies the defective module in in the rack. Click on this module.
Getting Started STEP STEP 7 Lite A5E00293886-01
12.3
Error diagnostics
8
You will receive a plain text message: – Module O. K. – Fau ault lty y mo modu dule le..
9
12.4
Getting Started STEP STEP 7 Lite A5E00293886-01
If you need need further further informatio information, n, please click on Expa Expanded nded diag diagnost nostics ics information.. information
Module status and error history STOP ST OP, RUN, HAL HALT T, ...
OK,, er OK erro rorr, .. ....
Call additional data to CPU
1
Diagnostic buffer
2
Details on marked events in diagnostic buffer 12.5
3
Filter for events to be displayed in the diagnostics buffer
Save diagnostic buffer in TXT format
Help on displayed event
Before you go ahead and remove a module you you consider to be faulty, faulty, call the Module information function (Call, see Page 12.4) to check its status. The diagnostics buffer buffer,, for example, example, records errors and all CPU events. events. You will need this information especially in situations requiring the distinction between a sequential error and the actual error event.
Further information is found via F1 > Index > Calling the module information information..
Getting Started STEP STEP 7 Lite A5E00293886-01
Error diagnostics
If a wire break has occurred: Check the wiring or whether any measuring range modules are inserted incorrectly. When the CPU goes to STOP: Evaluate message output from the diagnostics buffer.. The fastest possible way to access this buffer buffer is to click click on the ”DIAG” ”DIAG” button in the the CPU operating panel. With faulty module: Switch off load voltage voltage before before you remov remove e the module.
12.6
Getting Started STEP STEP 7 Lite A5E00293886-01
13
Index
Index
A
E
Absolute address Absolute address 4.8, 4.8, 5.2 Absolute programming 5.2 Address 0.2 App A pply ly 4. 4.15, 15, 6. 6.8, 8, 6. 6.14 14,, 6. 6.20 20 Assigning module parameters 4.6 Automation License Manager 1.10
Editing the variable declaration table 7.4 Engine Engi ne On/Off circu circuit it 7.6 Error diagnostics 12.2 Error history 12.5 Error messages 2.10 Establishing an Online connection 10.4
B
F
Backup battery 10.2 Basic help 2.9 Block calls 7.14 Block editor 6.4
FB 6.5 FBD 6.2 FC 6. 6.5, 5, 8.2 File handling 2.7 Flip-flop 1.3 Function 8.2 Function block 7.2 Function block diagram 6.2
C
13.2
Changing the programming language 6.4 Circuit 6.9 Comb connector 10.2 Component checklist 1.5 Computer 1.5 Configuration errors 4.10 Connect Online 10.3 Control 11.9 Copying the symbol table 5.5 CPU memo memory ry reset reset 10.6 10.6,, 10. 10.7, 7, 10. 10.8 8 CPU operator panel 2.5 Creating a variable table 11.7 Cross-references 6.24 Customize the programming interface 6.11
G Global data block 9.2
H Hardware catalog 4.6 Help 2.8 Hardware comparison 4.18 Hardaware configuration 4.6 Hardware diagnostics 12.2
I D Data types 5.6 DB 6.5 Defining safety requirements 3.5 Diagnostics buffer 12.2 Diesel engine 3.3 Direct Help 2.9 Documentation 1.5 Downloading a program to the CPU 10.9 Downloading the hardware configuration 4.16 Downloading the program 10.6 Downloading specific blocks 10.11
Getting Started STEP STEP 7 Lite A5E00293886-01
Input 5.4 Inserting a new network 6.4 Inserting modules 4.9 Installation 1.8 Instance data blocks 7.12 Instant control 11.10
L LAD 6.2 Ladder logic 6.2 Libraries 2.5 License Key 1.8
M Memory array 1.3 Memory module 10.2 Modifying variables 11.9 Module configuration 4.2 Module parameter assignment 4.12 Module racks 10.2 Module status 12.5 Monitor Moni tor 11.3, 11.3, 11. 11.8 8 Monitoring Moni toring variables variables 11.6, 11.6, 11.8 Motor bench 3.2 MPI cable 10.2
N New block 7.13 New project 4.4
O OB 6.5 Off de dela lay y 8.6 8.6 Offline 4.19 Online 4.19 Online/Offline comparison 4.17 Ordering numbers 1.5 Overview 1.6
Program status 11.2 Program test run 11.2 Project window 2.4 Purpose Purpos e of STEP 7 Lite 0.3
Q Quick Help 2.9
R Rack 4.2 Reference Help 2.10
S Save 4. Save 4.15 15,, 6. 6.8, 8, 6. 6.14, 14, 6. 6.20 20 Saving configuration data 4.14 Series circuit 1.3 Simulation software 1.5 Statement list 6.2 STL 6.2 STOP 12.5 Switching over symbolic/absolute programming 6.4 Symbolic programming 5.4 Symbolic representation 6.7 Symbols 4.20 Symbol table 5.5
P T Parallel circuit 1.3 Parameter assignment 4.13 Petrol engine 3.3 Physics 4.19 Pictograms 4.6 Pin needle 4.5 Power supply 10.2 Program download 10.6 Programming a function 8.6 Programming a timer function 8.7 Programming block calls 8.9 Programming language 6.2 Programming samples 2.3 Program speed monitoring 7.7
Test assembly 10.2 Testing 11.4 Timer function 8.6
V Variable Vari able declaration table 8.6
W Wire break 12.6
Getting Started STEP STEP 7 Lite A5E00293886-01
13.3
13.4
Getting Started STEP STEP 7 Lite A5E00293886-01
(6&&<$
Siemens Aktiengesel Aktiengesellschaft lschaft Bereich Automation and Drives
Geschaeftsgebiet Industrial Automation Systems Systems Postfach 4848, D-90327 Nuernberg www.siemens.com/automation
Order No. 6ES7810-3CC07-0YA05
A5E00293886-01