Download as pdf or txt
Download as pdf or txt
You are on page 1of 468

ID
A Practical Guide to Implementing
S7-300/S7-400
Programmable Controllers
This book is dedicated to my friend,
Russell Briskey

II

ID
A Practical Guide to Implementing
S7-300/S7-400
Programmable Controllers

First Edition

C.T. Jones
Copyright© 2006 by C .T. Jones

All rights reserved

Printed in the United Stotes

ISBN l-689101-03-6

No port of this publication may be reproduced in any form o, by any means, nor be
translated or converted in a ny form. or stored in o dotobose. without written permission from
the copyright holder. Moking copies of ony port of this book witho ut permission is o violation
o f United Stoles copyright lows and is subject to penalty.

This book is sold as is, without •,vorronty o f any kind. either express or implied. respecting the
conten ts of this book, inc lud1ng but not limited to implied warranties for the book's quality,
performance. merchantability. or fitness for a ny particula r p urpose. This book is no t intended
to be. nor should ii be. used as a uthority fo r design. implementation. or ins1altotion of any
con trol systems. Such tasks should only be undertaken by trained professionals using curre ntly
accepted design and engineering p ractices. a nd the guidance of required user manuals.

Trademarks:

ET-200, S?-300, S7-400. HiGroph, HMI. SIMATIC. SIMATIC HMI. SIMATIC NET. SINEC, SOFTNET.
STEP, a nd WinCC, a re Siemens registered trademarks. O ther product names mentioned in this
book may be trademarks o r regis1ered trode marks of their respective companies. ond is the
sole property of their respective owners and should be treated as such. Furthermore. use o f o
term in this book should not be regarded as affecting the validity of a ny trade ma rk or service
mark.

With the exceptio n of screen captures. this book wos done entirely in Microsott Word. Screen
captures in this book were created using Full Shot 6.02. lnbit Inc .. Mountain View. CA.

IV
About the Author
C.T. Jones, rec eived his Bachelor of Science in Elec trical Engineering from Howard University,
ond hos mode his career in the Industrial Automation Industry for over twenty-five years.
During this time, he hos served bolh os o PLC user and in marketing, applica tions
engineering. and technical training roles for several automation vend ors. II was in the role of
Control Syslems Engineer, for Procter and Gamble, where his fasc ination wilh PLCs and their
endless p ossibilities in ou tomolion, drew him info this field. w hich he hos pursued since.
Early on as o Controls Engineer, he b ecome a cutely aware of the unique position of end-
users. who hove the tough balancing -act or keeping the pion! opera tional and sta ying
abreast of automation technologies. As o result, he authored two books on p ro grammable
conlrollers. including lhe first PLC book "Programmable Logic Controllers Concepfs ond
App lico fions." and "Programmable Logic Con trollers: The Complete Guide fo the
Technology." While serving eight years a s ap plications engineer and Technical Instruc tor for
SIMATIC equipmen t. he devoted much or his time lo developing step-by-step application
no tes and other educa tional materials for users.

For several yea rs now. C .T. has b een a SIMATIC consultant and freelance technical writer. In
this role. he hos worked with software companies in the develop men I of user
documentation, training and tu torial coursewore. and in product development involving
Integra tion with STEP 7. He also provides applic allons consulting a nd on.site training for end
users.

Acknowledgement
Garon Hort. Graphic Designer and friend. hos worked with me in the developmen t of books
since I started writing in 1984. Writing a book. Jokes o lo t of lime and involves mony costs.
along the way, for whic h writers usually cannot offer compensation. Garon, nonetheless. has
always been very generous with his time. skills, and know ledge. To put It simply. he has always
helped make it possible tor me to p roduce a new book. Thonks Garon!

I also extend thanks to Claude Kouokou, software developer and friend. During the
development of this book. I encountered many problems related lo early choices I hod
mode for the book's layou t and title. Claude, who during the tim e o f the books development
was writing cod e to integrate STEP 7 with ano ther software p a cka ge. was always my
sounding board. He always hod on uncanny way of making simple. that wtiich appeared lo
be insurmountable. Thanks Cloudel

V
About This Book
This book is organized in seven practical areas associa ted with getting the job done
efficiently. It is a task-oriented guide to configuring, programming, deploying,
troubleshooting, and maintaining S7-300/S7-400 PLCs and SIMATIC Networks. Each of the
seven ta sk areas is introduced with a brief tu torial that is fallowed by a number of ac tual
tasks. Each losk is presented in on identical two-page layout. On the left-hand page. a task is
briefly described under the headings - Basic Concept, Essential Elements, and Appllca tlon
Tips. On the right-hand page. the task is presented in a s1ep-by-step format.
At the time this bool:: was developed. STEP 7 was at version 5.2 and 5.3. Its usefulness.
however. should serve well into the future of new releases. This is true since the tutoria l
discussions at the beginning of each chop ler and for each losk example. ore based on
orchltecturol and operaHonol features and concepts, inherent to S7-300 and S7-400 PLCs
and SIMATIC Networks.

Step 1 Getting Started


Chapter 1 introduces you lo the S7-300/S7-400 hardware structure and the STEP 7 basic and
optional software tools. You learn to insta ll the software and configure preferences, to
configure the programming workstation and establish S7 Online connection.

Step 2 Working with Projects and Libraries


Chapter 2 lntroduces the concept of STEP 7 projects and libraries. Th e SIMA TIC Monoger is
introduced along the basic STEP 7 objects and hierarchy. The Standard library is reviewed,
ond Finally several example losks of working with projec ts and libraries ore presenled.

Step 3 Working with Hardware Configurations


Chapter 3 introduces basic princip les of using the Hardware Configuration Tool to configure
S7-300/S7-400 hardware. After reviewing basic navigatio n, several example ta sks or lypicol
arrangements of the S7-300/S7-400 ore covered, including modular. compact, and intelligent
DP sl aves. Example tasks a lso include defining parameters for C PU s. CPs. SMs, and !Ms. Finally,
addressing is described in detail for bo th digital and analog 1/0.

Step 4 Working with STEP 7 Programs and Data


Chapter 4 introduces the basic principles of STEP 7 programming including design princip les,
block types, order of processing. data types ond rormats, addressing memory, and using the
LAD/FBD/SQ editor. Each inslruc tion category and inslruction of LAD/FBD is described, and
examples of programming block lypes and every instruction is covered.

Step 5 Managing Online Interactions with S7 CPUs


Chapter 5, '"'ill show you how to access the CPU online with or without o project. and how to
won: with standard online operations, such as compare online/off-line programs,
upload/download program. c lear memory. compress memory, switch CPU operating modes.
and access password protecled CPUs.

Step 6 Working with Monitoring and Diagnostic Tools


Chapter 6 expands C PU online operations to include monitoring a nd diognoslic tools. You
will learn to evaluate the S7 Program ond data, using Debug Monitor, Monitor/Modify
Variables, and Forcing tools. In addition, you will learn to diagnose problems in the program,
lhe hardware. and in the process. using the various STEP diagnostic tools.

Step 7 Working with SIMATIC NET Networks


Chapter 7 in troduces the basic principles of configuring SIMATIC NET networks, using the
NetPro Network Config urati on Tool. After reviewing navigation of lhe configuration tool.
example tasks of MPI. Profibus, and Ethernet networks from the lop-down are covered. You
will learn how lo insloll and configure subnets, communications processors, address and
attach stations to the network, and to download network configura tions.

VI
Preface
It is easy ta say tha t this new book is for anyone involved wi th S7-300/S7-400 and SIMA TIC NET
networks, but in foci . this is the case. If you ore o controls engineer, responsib le for design
and programming, o maintenance technician, a n applications engineer, or sales
representa tive, you'll find that this book provid es much usefu l information. The book offers
significant cove-rage of configura tio n concepts. addressing memory and 1/0, programming
in STEP 7, defining network configurations, as we ll os a guide to using the tools for monitoring
the p rogram, and diagnosing problems In lhe hardware, software. or in the process.
II you ore a controls or applications engineer, your work will likely involve both configuring
the hardware and p rogramming for 57-300/57-400 and SIMATI C networks. You 'll find
examples of the most typical conflguro lions. os well as on explonolion tor various module
parameters. In most coses, you 'II find that the default parameters are g enerally usable, but
you will learn how to ob tain different operational behavior in the C PU and other modules.
The Chopler on Working with STEP 7 Programs ond Do to is a great re ference for learning
about program d esign. data types and forma ts, instru c tion sets. and how lo write cod e tor
Functions (FCs) and Func tion Blocks (FBsJ. You 'll also learn the basics for slruc luring a
program and call1ng blocks.

If you are responsible for maintaining on S7-300 or 57-400 system, then you should certainly
rea d chapters one and two to gain o basic underslonding of S7 hardware and STEP 7
software - especially navigating the SIMATIC Mana ger. Chapters Sand 6 o ffer many of the
tasks tha t will likely serve your needs, and in Chapter 3, you con gain on understanding of
how to configure new hardware and address the 1/0 system. While wrillng p rograms and
configuring networks may not b e your main concern, these topics are presen ted in on easily
understood format. So. don' t hesitate to use Chaplers 4 and 7. to broaden your knowledge
of STEP 7 program operation, the instruc1ion sefs, and how your p lant network is configured.
Much considera tion wen t into the content and the design for this book. I hove o ften heard
users speak of their difficulty in quickly getting their orn1s around the S7 implementa tion and
in determining where to look for pertinent information: so. my first goal was lo determine the
ta sks tha t as a user. you would eventually need to perform. Then. to present each of these in
a manner tha t would cover lne basic concepts of the task, the essential elements involved,
and then to present the task in a brief and ea sily understo od fa shion. The idea was lo gather
and e xplain in one place, topics essential to allowing you to get righl to the task.
Finally, how you should c onsid er using this book is largely linked to its design. Not every task
hos been included; how ever, you will likely find wh at you ore looking for. Should you read the
book from cover-lo-cover? You may if you'd like. but tha t is not necessary. If you ore a new
user, the tu torial at the b eginning of each chapter will be a good start. As your p roject c alls
for a sp ecific ta sk. turn to the appropriate chapter lo g el o quick introduc tion. Step-b y-step
procedures for several common rosks ore provided in every chapter. You con also use the
ind ex to quickly find and use a sp ecific task, and the Appen dices lo iind other useful
information.

vu
..
Contents
STEP 1: GETTING STARTED WITH STEP 7 ............................................................. 1
S7-300/S7-400 PROGRAMMABLE CONTROLLER STRUCTURE , ,.,,,,,,,., "" tctP ttttC t ..... "" "2
The Com o.n ents ............................................................................................................................................ 2
THE STEP 7 PRO,IEGT MANAGEMENT SYSTEM 4
Standard Tools and Utilities I Sltle: cntr 5 511 I 5111 e: r El Fl , re NEIil 4
0 tio-nal L-a n ua e Tools .................................... , u . . ..... .. . . . , . . . H u , . . . . . . .. . . . . . H . ...... . .... . . . . . . . . . . . . . . . ....... . . . . . . . . . . . . . . . . . . . . . . . . . . 6

COMMENTS ON GEUfNG $TARTED WIIH STEP 7 s111e: I 11 1 I El Fl 111 fl 11


Checklist: Gettin Started with STEP 7 ····••U••·····........................ u , , . u •• , •••• • •• u . . . . . . .. . . . . . ... u . , ••• • •• • , . .. HH••· 11
INSTALLING IHE STEP 7 SOFTWARE. I El I I 111 I El I 12
INSTAI I ING AND REMQVJNG $TEP 7 AUTHORIZATIONS, "" " "" "" " " t" "" "t 14
OPENING SIMATIC SOFTWARE COMPONENTS,, .. t"
"" " "" " " *' " " '" '* " " "t 16
CONFIGURING A SIMATIC WoRKSJAIION " " t"
"" """ ""' " " *' " " "" "t 18
DEFINING STORAGE PATH PREEERENGES, " t t t ' t ' t t t t 20
DEFINING LANGUAGE PREFERENCES 22
DEFINING ARCHIVING PREFERENCES 24
ESIABI ISHING A D IRECT CPU PROGRAMIJING CONNECTION 26
SETTING THE PGIPC INTERFACE FOR PC ADAPTER .... , " " " " , ", t" ,,,,, ""' " " .... 28
STEP 2: WORKING WITH STEP 7 PROJECTS AND LIBRARIES ................................ 31
THE SIMATIC MANAGER ... ,..... , , , , , , . . , , , , , , , . ., , , tcf ,,,,,,,.,,,,,,,..,,,,,,. ttttc t ,,,,,.,,,,,,, """ ..... ,,,., .. ,,,.,.,,,, 32
A Pro'ect and Libra er ...................· ••u••· . ....... .. ......... ....... . ....... , ......... . ....... , ......... . ....... .. ....... , . • 32

SIMATIC Mana er Menu and Too1bar ............................................................................................... 35


Pro·e.c t Windows .................................. ,.. u . . . . . . . . . . . . . . . .......... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ... .......... . . . . . . . . . .. . . . . . . . . . .......... . . . . . . . . . . . 36
COMMENTS ON WoRKING WITH $TEP 7 PRO,IECTS AND LIBRARIES 37
Checklist: Work.in with STEP 7 Pro'ects and Libraries................................................................... 37

NAVIGATING THE STEP 7 PROJECT $TRUCJ1JRE ... ,.........,. ................................,. ............. ,.........,. ••• , ...... , 38

NAVIGATING SIMATIC MANAGER MENUS AND TootBAR ..... ,,............................,. ...............,. ......,. .. ,,....... 40

FINDING STEP 7 PROJECTS AND LIBRARIES .............. ·•·•·•·..................................................................... · 42

CREATING A PROJECT USING THE NEW PROJECT W IZARD t t 44


CREATING A PROJECT USING THE 'NEW' COMMAND 46
ADDING A NEW STATION TO A PROJECT t t 48
ARCHIVING A PROJECT OR LIBRARY t t 50
RETRIEVING AN ARCHIVED PROJECT OR LlBRARY 52
STEP 7 in 7 Steps

STEP 3: WORKING WITH HARDWARE CONFIGURATIONS...... ,.. ,.., ....................... 55


S7-3QO{S7-400 HARDWARE CoMPONFNIS CYEBYIEW 56
Racks 56
Interface Modules (IM) ..................................................................................................................... 57
Power Supply (PS)........................................................................................................................... 58
Central Processing Unit (CPU) ........................................................................................................ 58
Signal Modules (SM) ........................................................................................................................ 59
Function Modules (FM) .................................................................................................................... 59

Communications Processors CP ...... ............................................................................................. 59

Mu.lti.Point Pro rammin lnterfa.ce MPI ......................................................................................... 59


THE HABD~\!ARE CONFIGURATION TOOL 60
Conti urin- the Hardware .......................... .................................... · • • n• .... ........ ,H ou .. . . .... . ... ........ .. ... . .. . 60

Menus and Tool bar ..........................................................................................................................60


Hardware Catato Window ... ................ .. .........n••·······......................................................................... 61

Station Window - Rack Arran ement Pane ..................................................................................... 62


Station Window - Confi uralion Tables Pane ................................................................................. 62
COMMENT$ ON WoRKING WITH HARDWARE CONFIGIIRATIONS 63
Checklist: Working with Hardware Configurations ........................................................................... 63

NAVIGATING THE HARDWARE CATALOG . .. .. .. . .. .. . .. .. .. .. .. .. .. .. . .. . .. .. . . .. . .. .. .. . 64

NAVIGATING THE HARDWARE CONFIGURATION MENU ANO TOOLBAR . .. . . .. .. .. .. .. . .. .. . .. .. . 66


VIEWING STATION CONFlGURATION DETAIi $ 68
Buu DING A STATION CONFIGLIRAT!ON 70

DOWNI OAD!NG A STATION CONfiGI !RATION 72


LIPI OADING A STATION CONEIGLJRAT!ON 74
ASSIGNING 5YMBO( IC ADDRESS m INPl£IIQIITPIJT MODIU es 76
CON FIGURING AN S7-300 CENTRAL RACK ........ , .. ... . • . .... .. .. .......... ., , .. . ................ , ............. 78
CON FIGURING S7-300 LOCAL l/0 EXPANSION ................ ., .. .. ...... , .... ., , .. . . ............................ 80
CONFIGURING S7-300 SINGLE·IIEB 1/0 EXPANSION .. , ..... , ............ ., .... .. • 1 tctet>t t l te u t I I ..... ,. .. 82
CONFIGURING AN SZ-300 AS DP MASTER ............. . • C • t • ct • t t • Ct • C .... . .8~
CONFIGURING ANO ATTACHING MODULAR DP SLAVES ...... • C • Ct • C • t t • Ct • C U " Ct t ,86
CONFIGURING ANO ATTACHING COMPACT DP SLAVES . .. .. . .. • Ct • C • t t • Ct • C U " Ct t ,88
CONFIGURING THE S7-31 x-2 DP AS AN INTELLIGENT DP SLAVE ... • Ct • C " • • Ct t C II U " Ct t .. . 90
CONFIGLIRING THE CP-342-5 AS AN IW:EI I !GENT OP S1 AVE 92
CONFIGURING THE ET-200X (BM 147/CPU) AS AN INTELLIGENT DP SLAVE ............................................ 94

CONFIGLIRING MASTfB•INTEI I IGENT S1 AVE QAJA EXCHANGE AREA 96


CONFIGIIRING DATA EXCHANGE EQB CP 342-5 !NIEi I IGENT $1 AVE 98
CON FIGURING SZ-300 CPU GENERAL PROPERTIES. 1111 Cl I .. 100
CON FIGURING SZ-300 CPU START-UP PROPERTIES 1111 Cl I .. 102
CON FIGURING SZ-300 CPU CYCLE AND ClOCK MEMORY , 1111 . 104
CON FIGURING SZ-300 CPU BECENJIYE MEMORY . .. .. 1111 Cl I .. 106

X
Contents

CONEIGIIBING 57-300 CPU I OCAI MEMORY 108


CONEIGIIBING 57-300 CPI) 0 )AGNOSI!CS AND Cl OCK PBOPEBIIES 110
CONEIGIIBING 57-300 CPI) Access PBTTECIION 112
CONEIGI 18 ING 57-300 CPI I INJFBBI IPI PBOPEBIIES 114
CONEIGIIBING 57-300 CPU IIME-OE-DAY INJEBBIIPIS 116
CONFIGURING S7-300 CPU CYCLIC INTERRUPTS ....... . . .......... . ........... . ... .. tlfl<I t I I I I t tiff 118
CONFIGURING S7-300 DIGITAL INPUT MODULE PROPERTIES ... ..... . ... ... ........ , ....... ,. ..... . ...... 120
CONFIGURING S7-300 INTERRUPT INPUT PROPERTIES... . ..... ..... . ...... ... . , . ...... ,.,. ..... . ...... 122
CONFIGURING S7-300 DIGITAL OUTPUT MODULE PROPERTIES .... I I It n t trnlcf t f .. .................... 124
CONE!GllBING 57-300 DIGITAL 1(0 ADDRESSES 126
CONE!GllBING 57-300 ANALOG INPUT MODULE PBOPERTJES 128
CONE!GllBING 57-300 ANALOG INPUT S!GNAL PABAMFTERS 130
CONE!GllBING S7-300 ANALOG OUTPUT MoouLE PROPERTIES 132
CQNF!Gl!RING 57-300 ANAi OG !/0 ADDRESSES 134
CQN EIGl IRING AN $7-400 CENTRAi RACK 136
CQNEIGl lRING AN 57-400 M1 n II-GOMPIIIING GENIBAI RACK 138

CONFIGURING THE S7-400 AS A DP MASTER ,.... , ........... ,........ ,.... ,.. ,............ ,.... ,.......... , ......... , ...... , .. 140
CONFIGURING S7-400 LOCAL 1/0 EXPANSION.... , .......... ,.. ,...... ,.... ,.... ,............, .. ,.......... , .................... ,.. 142
CONFIGURING S7-400 REMOTE 1/0 EXPANSION .... , ....... ,.. ,................ ,.... , .... , ......................... ,.... ,........ 144
CONFIGURING S7-400 CPU GENERAl PROPERTIES ......................................................,,,,. .... ,,.,.,. ....... 146
CONE!GtfRING 57-400 CPI/ 5IARI•I/P PRQPfRilfS , " t '"" ''''"' 148
CONEIGI IRING 57-400 CPI I Cyc1 E AND CtQCJ< MEMORY .. ' t t t " t '
150
CONFIGURING 57-400 CPI/ RETENIII/E MEMORY ' " t t t
t '
152
CONFIGURING 57-400 CPI/ I OQAI lli1EMORY .. t t t t t ' t t " '
154
CONFIGURING S7-400 CPU DIAGNOSTICS ANO CLOCK PROPERTIES, .......... ,.,. .......... ,.,.., ......... ,..,. .. 156
CONFIGURING S7-400 CPU Access PROTECTION ............ ,..,. ...... . ,,,,.,,.,, 111 ·· 1,1111P1111110 ·· 111 t1P1:1:1u1 ·· 1 158
CONFIGURING S7-400 CPU INTERRUPT PROPERTIES ........ ,.,. ........ I I t f ' I I I I t f l f t .. I t I I tf P 111 I I t f l ·· I t I tf PI t IC 1101 I 160
CONFIGURING S7:400 CPU I IME-QF-DAY INTEBBLJ PTS 11111 !!Pit 11111111111111111100111111111111111S1111111111111neo11 1 1 6 2

CONFIGURING S7:400 CPU CYCLIC INTERRUPTS flllllltllllll ,, .. ,. tl'IIIIIIZ'llltt tl'IIIIIIZ'lllllltlfflllllltllllll flfllll 164
CONE!GllRJNG S7-400 DJGITAL INPUT MODULE PROPERTIES 166
CONE!GllRJNG S7-400 INIEBRl!PI INPUT PROPERTIES 168
CONE!GllRJNG S7-400 DJGITAL OUIP!IT MODULE PBOPEBIIES 170
CONF!GJIRING $7-400 DJGITAI 1/0 AODRESSES 172
CCNE!GI IRING $7-400 ANAi OG INPI IT MODI II E PBQPEBilfS 174
CCNE!GI IRING $7-400 ANAi OG INPI IT SIGNAi PARAMEIFBS 176
CCNE!GI IRING $7-400 ANAi OG 0! !IP! II Mon1/I f PBOPERTIES 178
CONFIGURING S7-400 ANALOG 1/0 ADDRESSES,.,.,,. .... ,.,,, , ......... ,, ........ ,,,.,.,,,. ,.,..,.,.,,. .... ,.,. ,.,.,,, 180
CONFIGURING 1/0 MODULES FOB MULTI-COMPUTING OPERATION .. ,,, ...... ,. -,.,.,,,.,,,,.,,, , ..,. .... ,.,,, , .. ,. 182

'
XI
STEP 7 in 7 Steps

STEP 4: WORKING WITH STEP Z PROGRAMS AND DATA ..... ,.. ,.., ..................... 185
INTROQLJCDDN IQ STEP 7 PROGRAMMING PRINGIPI Fs 186
Program Design Strategy............................................................................................................... 186

Developing the Control Logic ......................................................................................................... 187


STEP Z Bt QCK IYEES 188
System Blocks (SFB, SFC, SOB) .................................................................................................. 18.8

0 anizatlon Blocks OB 188


Function Blocks FB ...................................................................................................................... 190

Functions FC ............................................................................................................................... 191

Data Blocks DB ........................................................................................................................... 192

SZ PBQGBAf,1 PBOOESSING, : t n 11::0 1 : c t t 1 e, q qq • t t 1 pqqq , t : 1 : t n Ol:n(t t 1 : 1 r -,.,q 1 : : t t r :> tt ilil c 194


The Normal CPU C cle .................................................................................................................. 194

the N·o nnal CPU C cle ................................................................................................... 194


ADDRESSING S7 MEMORY AREAS ,,,.,.,.,..,, ., ..,., ., ,.. ,. ,,.• ,,,,.,., ... ,. ,,....... ,,,...,,,.,.,.,..,, ., ..,,,.,.,.,.., .....,....... ,. . 196
Input Memory (1) ................................................•................•...............................................•.•......... 196

Out ut Memo Q ........................................................................................................................ 196


Bit Memo M .............................................................................................................................. 197

Peri heral Memo PI/PQ ............................................................................................................ 197

T[mer Memory (TI .......................................................................................................................... 198


Counter Memory (C} ...................................................................................................................... 198

Local Memory (L) ........................................................................................................................... 198

Summary or S7 Memory Addressing ............................................................................................. 199


$7 DATA TYeES AND FORMATS " " " 200
Elementary Data Types .................................................................................................................. 200

Com lex Data T es ................................................... ................. ................................................... 206

Parameter Data T es ........................................................ ,........ ................. ................................. 208

oYEBYI ew OE IHE LAD/EBD/STL EOIJOB "" .. d cc ut /o, tt l t i t · 1111ett1>te etcOt\tl e ltltCtt\ d cc ut,t,tec tt \ ,I cc .. 209
lnfraductlon ,209
Menus and Toolbar 209
Program Elements/Call Structure Window..................................................................................... 210

Block Window 211


Details Window 211
STEP 7 (NSTB\IGIIQN $FT OVfRYlfW 212
Bit ic Instructions - Basic O erations ...................................................................................... 212

Bil L ic Instructions - S ecial O erations .................................................................... ,.............. 213

Cn11otec lnstn1cUans 214


Timer Instructions ........ ""' "'"" " ""' "'"""' " "t "'"" " ""' "'"" " """' ""' "'"""' ""' ""' ,,,,. 215
conversion Instructions .............................................,,, .......... ,,, .......................... . ,,.. ,216
Integer and Real Arithmetic Instructions ........................................................................................ 218

Compare Instructions ..................................................................................................................... 220

..
XII
Contents

Program Flow Control Instructions ................................................................................................. 221

Status Bit lostwclioos 222


Word Lo ic Instructions ·······..·············•·n••···H••······..·····4••··············4'···············•n••·············..····••n••· 223
Sbifl-Botala aod Mova lostcuetioos 224
COMMENTSONWORK1NGWITH STEPZ PBOGRAMSANODATA.,.,., ................................................ 225
Checklist: Working with STEP 7 Programs and Data .................................................................... 225
YIEWfNG AND EDITING SYMBOLIC ADDRESSES ...., ,., , .. .. .. .. , , ... , , .. , .. , ., ...., , 226
CREATING A DATA 61 QCK 228
EDITING A DATA BLOCK ...... , ............... , ...... .,. ...... .,, I t5Clttr:ttll ► ttt :r Jtttll+Oltft&CF JOttll+Ollltl+<nJttltlHl+ltll:r Jr± 230
GENERATING A NEW Cope BLOCK ...... , .. , ,. ........ ..,,. ............ .,,, .. .. ,. .. ., ..,,. .. ,. • , .... ., ..,. .. ,. ....... ., ..., .... .,. .. 232

NAVIGATING THE LAD/EBD(SIL EDITOR , , ...,.,. .. .,. ...... ,., ........ ,. ... ,. ,....... ,. .. .., .... .,.,. .. ,........ ., ..., ......,., 234
OPENING, EDITING. AND SAVING A B LOCK .. .. ......... .. .. .. ...... ............................. ......... ......... ........ ... ...... .... 236

DOCUMENTING A CODE BLOCK ,...... ,. ..... ,.. .,.,. .. ,....,. .. ,. ...., .... .,. ...... ,. ........ ,. ..... ,........ ,. ....,., .. ., ..., ......,., 238

PROGRAMMING AN FC WITHOUT FORMAL PARAMETERS , t t ' t t t t t ,240


CALLING AN FC WJTHOUT FORMAL PARAMETERS , .. t t ... 242
PROGRAMMING AN FC WITH FORMAL PARAMETERS , ,, , , , , t t ' t t t t ' ,244
CAI I ING AN EC WITH FORMAi PARAMETERS 24-6
PBOGBAMMING AN FB WffHOIJI FORMAi PARAMETERS 248
CAI I ING AN FB WJIHOIII FORMAi PARAMETERS 250
PBOORAMMING AN FB WITH fOBMAJ PARAMETERS 252
CAI I ING AN EB WJIH FORMAi PARAMETFRS 254
PROGRAMMING BASIC B1J-LOGIC OPERATIONS, ......,. .... ,.,. .... ,., ........,.,.,., ......................................... 256

PROGRAMMING SET-RESET OPERATIONS ........................... ., ............ ., ............................... 258

PROGRAMMING EDGE EVALUATION OPERATIONS ................................. ., ................................ 260

PROGRAMMING COUNTER 0pfRAJIDNS t t t t t t 262

PROGRAMMING llMER OPERATIONS 264


PROGRAMMING CONVERSION OPERATIONS 266
PROGRAMMING COMPARE 0pfRAIIONS 268

PROGRAMMING INTEGER ARITHMETIC OPERATIONS 270


PROGRAMMING REAi ARITHMETIC OPERATIONS 272
PROGRAMMING IBJGONOMETRIC AND OTHER MATH f!JNCTIONS 274
PROGRAMMING JUMP, LABEL, AND RETURN O PERATIONS ...... ............. ..................... ............. .. ,......... ..... 276

PROGRAMMING MCR OpERAJIONS , , 278

PROGRAMMING WORD LOGJC OPERATIONS 280


PROGRAMMING SHIFT AND ROTATE OPERATIONS. 282
PROGRAMMING STATUS BIT OpfRATIONS, 284

PROGRAMMING THE Move OPERATION IO READ AND WRITE DATA 286


ACCESSING DATA IN A DATA 61QCK 288
PROGRAMMING ORGANIZATION B LOCK 1 (OB 1) ......................................... .................... ................. ..... 290

xiii
STEP 7 in 7 Steps

STEP 5: MANAGING ONLINE INTERACTION WITH SZ CPUs ............................. 293


ESTl\81 JSHING ON! INE CQNNECTIQNS l/SING STEP 7 294
The Standard Ph sical Connection................................................................................................ 294
Usin the Online Pro·ect w ·indow ........................................................................... 40 . . . . . . . .... . . . . 4 ••• • • 294

Usin the Accessible Nodes Window ............................................................................................ 295


SI ANDARDONUNEOPEBAIIONSWITH STEP7 .,, ....... ,.. ,,, , .... ,,, ,. .. ,,, , .... ,. , .. ,,, ..... ,, ....... ,.... ,, ,,,295
Downloading the User Program to the CPU .................................................................................. 296

Com Online/Offline Pr rams ·········••h••··············~•o••····································. ················. ····· 296


Com Offline Pro rams - Path 1/Palh 2 .............................................................................. 297
Providin CPU Access Protection .................................................................................................. 297
Accessing CPU lnfonnation and Operating Characteristics .......................................................... 298
COMMENTSONMANAGING0NUNE0PERATIDNSWITHS7CPUs........ .... • ... .. ............... 299

Checklist: Mana in Online O erations with S7 CPUs ................................................ ................. 299


ACCESSING ONLINE OPERATIONS WJTHDI/I A PROJECT 300
YIEWJNG CPU R esouaces AND PERFORMANCE DATA 302
YIEWJNG AND CHANGING CPU OPERATING MODES 304
RESETTING MEMORY FROM THE SJMATIC MANAGER 306
ACCESSING A PASSWORD PROTECTED C PU, .......... , . ,,, , .......... tt t O t tot P I tt t O et ♦ t I I U ... 308
SETTING THE CPU DATE AND I IME .... t t " ,,,,, ""' " " " " , " , t ,,,, t "'
,,,,, t ,,,
" " .. 310
COMPRESSING CPIJ MEJ,AORY 312
D OWNLOADING THE sz PROGRAM OR SE] ec1eo B JOCKS ........................... ,,, ..................................... 314
UPI OAQING THE S7 P ROGRAM OR $ Fl ECTFD B1QCKS .. .. 316
COMPARING OFFUNE/ONUNE PROGRAM$ ............................... ,, ...... ,.............................. ,......... 318
COMPARING TINO PROGRAMS (PATH 1/ PATH 2) .................................................................................... 320

STEP 6: WORKING WITH MONITORING AND DIAGNOSTIC TOOLS ..................... 323


TOOi S FOR MONIIORJNG PROGRAMS AND DATA 324
Usin the Debu Monitor to Evaluate the Pr ram Status ............................................................ 324
Usin Variable Tables ........................ u , . . . .. . . . . . . . . . . . . . . . .. . . . . . . . . 04 . . . . . . . . . . . . . . . , u,- ............ 04 . . . ..... . . . .. . u •• . ••.• 3 24
Monitorin and Modi in Variables ............................................................................................... 324
Forcin 1/0 and Memo Variables ................................................................................................ 324
l lSING $TEP 7 P ROGRAM REFERENCE DATA 324

Assignments List. ........................................................................................................................... 325


Program Structure .......................................................................................................................... 325
Program Cross Reference Data ..................................................................................................... 325
Unus.ed S mbol·s List ..................................................................................................................... 325
Addre·ss·e.s without S mbols ....................... ........................................................... ......................... 326
DETERMINING THE CAUSE OE CPU STOP , ti IC , ,, ,, , ,, ,, IC ,, , ti IC , ,, ,, , 326
Using the CPU Diagnostic Buffer...... ................. ................. ................. ................. ......................... 326
Diagnosing S7 Hardware Online ....... ........................................................... .................................. 326
Diagnosing Program-Related Faults Using the CPU Stacks ...... ................. ................. ................. 326

XIV
Contents

COMMENTS QN WORKING W[TH MQNIJQRfNG AND D tAGNQSDCTaal $ 327


Checklist: Working with Monitoring and Diagnostic Tools ............................................................. 327
MQNUQRING PRQGRAM SJATI 15 WJIH A PBQIECI 328
MONITORING PROORAM SJATIJS WiIHOl/J A PROJECT 330
CREATING AND EDITING VARIABLE TABLES A TS ............................................................................... 332
MQNITOR(NG AND MODIFYING VARIABLES 334
FORCING 1/0 AND MEMORY VABIABI ES 336

USING D:1E HARD~/ARE DIAGNOSTICS UTILITY.. 11:lcl t It I 11 1111 I tt f I \ 11 1111 t tt f I I I t tnlt 11:lcl t I t n l t f ttrnlcf 338
LI SING JHE CPI l 01AGNQSIIC 6UEEf8 t t t 340
USING THE cpu $JACKS TO D IAGNOSE PROGRAM FA( ti TS 342
GENERATING AND DISPLAYING PROGRAM REFERENCE DATA It ti I I t n t f :I I t f It f n I t It 11 1 .. 344
STEP 7: WORKING WITH SIMATIC NET NETWORKS ........................................347
INIBQDUCIION IQ SIMATIC NET NETWORKS .....,......... ,.. ...................... .,. ................... .., ..................... 348
Netwodss and Subnets 348
CaMMl INICAJ1QNS CONNECTION$ ANO SERVICES 350
Communicallon Connections t t t t t t t
"'''' ''"' " 350
Comm11nicatioo Services 351
PRQFtaUS COMMUNICAIIQNS PROCESSORS ......... ,., .........................................................................,., 357
Profibus GPs for S7-300 and SZ-400 Stations .. .357
Profibus GPs for PC and PG/PC Stations . 358
ETHERNET COMMUNiCAIJONS PROCESSORS ...................... . " " Cf " " t
.. ......................................... 359
Ethernet CPs for S7- 300 and S7-400 Stations 359
Ethernet CPs for PC and PG/PC Stations 360

THE NETWORK CONFIGURATION TOOL ........... .................... ., .......... .,., ............................... 362
Configuring the Network ................................................................................................................ 362
Menu and Toolbar, ...... ... . . .. ..... . ............... ,, ..... . ... , ...... . ........... . ... 362
Network Com onents Catal Window ......... u• .... . . . . . . .... . .. .... . . . . . . .... . . . ... . . . . . . . .... . .. .. .. . . . . . . .. . . . ...... . . . . . 36-3
Configuration Window - Network layout ....................................................................................... 364
Confi uration Window - Connection Table.................................................................................... 364
Comments on Workin with SIMATIC NET Networks ................................................................... 365
Checklist: Workin with SIMATIC NET Networks .......................................................................... 365
BUILDING A NETWORI< CONFIGURATION USING NEJPRO .......................................... . ...................... 366
DOV~NI OAQING A NETWORK CoNFIGIIBAI(ON IJslNG NEJPBO 368
AQQING AND CoNflGI IRING AN MPI Sl lRNFT 370
6110 PING AN MPI NETWORK WITH PEER S7-300/S7-400 STATIONS 372
CONFIGURING A PROGRAMMING S TATION (PG/PC) ON MPI ....•................•........................•.. ..............•.. 374

CQNEIGURING GLOBAL DATA COMMUNICATIONS ON MPI ..................................................................... 376


ADDING ANO CONFIGURING A PBOEIBUS SUBNET , , ,,, .,, , l:S :CCC , l:S ,, , , • " • ,,, .,, , ,, 378
INSTAUING. CONFIGURING. ANO ATTACHING AN S7-300 PROFIBUS CP ................................................. 380

Bun DING A PROJECT WITH S7-300 PEER PROEIBUS STATIONS ., .. . t<t C :Cit C Ot <> ttC,,c t tt > t ltC .382
INSTALLING, CONFIGURING, AND A TTACHING AN S7-400 PROFIBUS CP ................................................. 384

61111 DING APROJECI WITH S7-400 PEER PROFIRLJS STATIONS. . . 386


CONFIGURING A PROGRAMMING STATION PG/PC ON PROFIBUS ......................................................... 388

CONEIOLIRING PBOflBUS COMMUNICATIONS CONNECTIONS 390


ADDING AND CONFIOIIBING AN ETHERNET SURNET 392

xv
STEP 7 in 7 Steps

INSTALLING, CONFIGURING. AND ATTACHING AN S7-30 0 E THERNET CP ................................................ 394

BUILDING A PROJECT WITH S7-300 PEER ETHERNET STATIONS.. . . . . . . . . . .................. 396


INSTAUING. CONFIGURING, AND A TTACHING AN S7-400 ETHERNET CP •.•........•....... •.....•.•••.... •.•.....•.••.. 398
61111 DING A PRP. IECT WITH $7,400 PEER FTHERNEI $TATIQNS 400
CONFIGURING A PROGRAMMING STATION PG/PC ON ETHERNET........................................ ................. 402

CQNEIGl fRING EIHERNEI CQMMflNICAJ!QNS CQNNFCJIQNS 404


APP ENQIC ES •, t tee , t t ,,, ♦ e ee et et e t e e et t tee t tee, t e , et ♦ e et et, e e t e, et t t t ♦
et e e e e t , e e ♦ t e , et e e, tee, st e e et tee e ♦ t 407
A STANDARD LIBRARY - 0RGANIZAJIQN BLOCKS 408
B STANDARD LIBRARY - SYSTEM BLOCKS (SFBS, SFCS) ................................................................. 41 0

c ASCII CHARACTER CHARI 414


D EXAM Pl FS OF MD□ IFYJNGIEQRCING l/0 AND MEMORY VARIABl FS 416
E CONDITION CODES CCO ANO CC1 AS RESULT BITS. ... .. .. • .. n t ti :I I I t n tttf n I t It 11 1 ..418
F ANAIOG INPUT/OLITPUT OIGITAI REPRESENTATION .. ...... ,, ... . . ..... .,,, .. .. ., .... ,, . . ... ...... ,419
G COMMON ABBREVIATIONS ANO ACRONYM$ ... .,,........................................ , .............................. .,, ... 420
G1 ass ARY ...............................................................................................4 2 1
IN DEX •, 11 ♦ , , , •••• , , ••• , , , . , •••••• I I ••• , , , I♦ •• I I •• , , , , . , •• , ••• , , ••• I f , , ••• , ••• , ♦I, •••• , 11 ♦ ,, , ••••• , , •••••••••• 43

XVI
Getting Started
with STEP 7
.... .... ....
Objectives

• Introduce S7-300/57-400 PLC Slructure

• Introduce STEP I Basic Package

• Install ond Remove STEP 7 Authorizo1ion

Introduce Stondord and Oplionol Tools

Configure lhe STEP 7 Workstation

Customize STEP 7 Operating Preferences

Establish Direct CPU Programming


Connection via PC Adopter

Use t11e PG/PC Interface Ulility for Se tting or


Switching lhe STEP 7 Online In terface
STEP 7 in 7 Steps

S7-300/ S7-400 Programmable Controller Structure


The S7-300/S7-400 family o f controllers consists of a range o f PLCs. covering a span of
requirements from simple to very complex. Though different in size and in overall capabilities.
these controllers ore alike in operationol chorocterislics, memory organiza tion. data
structure. addressing. programming languages and instruction sets. Programs crea ted for on
S7-300 are por1ed to on S7-400 with litlfe or no changes. They shore the STEP 7 programming
fac ilities. support the same local area networi<.s (LANs). and integrate easily with common
systems like operator panels (OPs). HMls. and third-party 1/0 systems.

The Components
The S7-300 and S7-400 systems are both modular in nature, each built-up from the same
basic types of components. These components. listed below. o re briefly described later in
Chapter 4. The programming device provides the common user interface for creating.
storing, troubleshooting, and managing control programs. Each o f these component types
represent the various porls from which your S7-300/S7-400 system will be configured.

Tab e 1- 1. S7-300 and S7-400 Basic Comoonents.


Component Abbrev. lrlef Description
Rocks Mounting base for ins1olling va rious user-selected modules.
Power Supply PS Supplies intern al operating voltages to rocks and modules.
Central Processor CPU Stores and p rocesses the user contro l program and data.
Signal Modules SM Digital/Analog 1/0 interfaces to field sensors and actuators.
Function Modules FM Intelligent modules th at execute control tasks independent
of the CPU (e.g., PIO, stepper-positioning. servo-positio ning).
Communication CP Used lo establish networking among S7 PLCs a nd other
Processors stations or point-to-point serial links 1o other devices.
Interface IM Used lo make vario us local and remote in terconnections
Modules between the S7-300 and S7-400 central and expansion
ro cks.
Programming PG/PC PG is a PC pre-configured with facilities for developing and
Device managing STEP 7/SlEP 5 programs; PC is a user-configured
PC programming system.
Multi-Poin t MPI low-performance network a nd multi-poin t programming
Interface interface lo components with MPt port (e.g., CPUs. CPs.
FMs. opera to r panels (OPs)] .
-
Distributed 1/0 DP 1/0 subsystems (or OP-slaves). connected to a DP-master
a ccording to Prortbus DP standard EN 50170 Volume 2.
-

2
Gelling Started with STEP 7

Component S7-300 S7-400

Roil/RAC K

Power Supply

ln tertoce Modules

CPUs

CPs

FMs

SMs

0
S7 Station

- I1
II! :I- 11111
Figure 1-1. S7-300 and S7-400 Programmable Controller Structure.

3
STEP 7 in 7 Steps

The STEP 7 Project Management System


STEP 7 is comprised of mony components tha t moke it the basis for development.
management. and maintenance of SIMATlC automation systems. These systems include
PLCs. HMls. numerical controllers. electric d rives. networks, and others. Furlh ermore, STEP 7
provides many standard and optional tools including p rogram development la nguages,
utilities for program conversion, monitoring and diagnostics, hardware configuration, network
configuration, remote access service, and many other operations.

Standard Tools and Utilities


Standard software tools and utilities ore immediately available for use, after the installation of
the STEP 7 Basic package. Many of these tools, which ore part of fhe STEP 7 Windows
Program Group, may be launc hed by proceeding from the Start Menu button, selecting STEP
7, and finally clicking on the desire d tool as shown above. Other standard toots a re d irectly
available from the SIMATIC Manager, as w ill be introduce d later.

~Jew Office ll0CiJrnffl:

Ollen Offlee 00clJMent

Windows ul)dato

~ •. Proo.d not.es •
.. SIMAIIC NET ►

~ 57[P 7 ► NCM 57 ~ I El:heroet ►

,.'-J
SIMAllC Mllllbger NCM S7 PRO!'lllUS
If,~ Prl)O'ams • •
• 57 1'.o,:p.ds
11'1-l
• 1z::1 Corl1QUrc Slt-'-ATIC Wori<sp:,ce
'
~ Oocume~
•..==-------- iffl Conf,guf'fl/1 Networl<s
,!,;, Corr,,;rtlng SSfi'el:
\ll> settnos • W ln>teled softw«e
~ 5-.fl • .I) Me1110<Y C..dP11rM1eltt ~ r t
• Hclp 0 PID Control Por,mete, Assi9rvnont
~ Settt,g the l'(;.PC Irlerfl!Cc
~ Run ...
t!l TI 405-57 G:nVl!rtlno TI Fil~s
Iii TI 505-57 ConvmlnQ Tt Fles
{s Notes
@!I ':il Pl.GIN Srnuletlnq ModJ.es

Figure 1-2. SIMATIC Start Menu with Standard Software Tools.

~
SIMATIC Manager
The SIMATIC Manager is the top-level toot for managing SIMATIC automation
projects. Other standard software components. for example the hardware and
ne twork configura tion tools and optional lang uage editors, once installed, may b e
la unched from the SIMATIC Manager.

C onfiguring SIMATIC Work space


The SIMATIC Workspace Utility is used to set opera ting parame ters re q uired for
working with STEP 7 in a multi-user configuration. Ne two rking parameters suc h as
protocols, addressing. and single- or multi-user environment ore defin ed.

4
Gelling Started with STEP 7

Configuring Networks
Th e Ne/Pro configuro tion toot allows graphical configuration o f the MPI. Profibus,
and Industrial Ethernet subnets. The tool depicts network stations. communications
interfaces. and physical connectio ns: it a lso supports setting of module a nd network
parameters and the creation of communications connections between partners.

Converting S5 Flies
The STEP S to STEP 7 Conversio n Utility allows existing STEP S programs to be converted
to equiva lent STEP 7 code. T11e purpose of the utility is to convert as muc h o f the
instruction set o f existing STEP 5 programs as possible to STEP 7. The conversion resu lt is
presented as Statement List (STL) instructions.

LAD/ FBD/ STL Programming Editor


LAD/FBD/STL is the standard programming tool for S7-300/S7-400 CPUs. This 3-in-l
e ditor allows total development in a ny of the three language representations or o
combination o f the lang uages. LAD represents Ladder Diagram; FBD, or Function
8/ocl< Diagram. is a graphic language tha t uses Boolean gale logic representa1ion;
and STL represents Statement Ust, o lext-bosed assembler-like language.

[I] Memory Card Parameter Assignment


Th e Memory Cord Pa rameter Assig nment Utility is used to set p arame ters o f optio nal
S7 me mory cords. The user determines what EPROM or Flash file drivers o re used and
what LPT port to use for connec ting external EPROM programming devices.

PIO Control Parameter Assignment


This utility provides templa tes for defining PID con trol parameters tor use with S7-
300/S7-400 standard PID functions (FB4 1 a nd F6421, for continuous and , tep
controllers respectively. User-defined instance data b locks serve as the d a ta
interface for turning controller functions o n or off and for defining con trol values.

Setting the PG-PC interface


This utility is used to select the interface pa rameter set to establish an S7 online
connection, and tor installing or removing communications adapters and p rotocols.

Tl-405 Converting Flies


The Tl -405 Conversion Utility allows SIMATIC Tl405 program code to be converted to
e q uivale nt STEP 7 programs or blocks. The utility produces one o r more STEP 7
Statement List (STL) text files that are subsequently edited and/or compiled.

Tl-505 Converting Flies


This conversion u tility allows SIMATIC Tl505 programs lo be converted to equivalent
STEP 7 programs or blocks. The utility p roduces o ne or more STEP 7 Statement Lisi ISTLI
text files that are subsequently edited and/or compiled. SIMATIC Tl Special Function
Programs (SFPGMS} require the SCL optional STEP 7 language package.

5
STEP 7 in 7 Steps

Optional Language Tools


Optional tools for STEP 7 suppor1 code development using either graphic elemenls or lext-
based source files. To accommodale typical programmable control. the languages include
support for functions such os 1/0 access. b inary signal manipulation. timers, counters, os well
o s standard functions for communications and data manipulation. In either c a se, Iha results
may be combined with code developed using the slondord editor (LAD/FSD/STL).
An odvonloge of these oplionol tools is that lhey olfer language c hoices that may be
matched to user skills and preference. and that may be selected to better suit code
development based on the operolions and requirements ot the application. These tools,
whic h must be installed offer STEP 7, ore generally accessible from the STEP 7 Program Menu
and from within the SIMATIC Manager.

(s NOIS7 Jrdum,laJ,,,no, •
(s NP,~7 PROFl~S •
li'9 confll,Jro SIM'ITIC W-0115paco
~ conn~~ fl«wo<t,
/4 conweono SSfil!<
<i> ln,lc/led..i..-,....
li',i: I.JIO, S'l1., F!IO- l'ro9,_'9 S1 ll>crJ
lllJ M!,nor/ Ca,dPar-ter " 6 - ( "

E[°J ,_OIFi:e ~
12:l PIO Ccrbol P;,,•mct•• A s l ~
~ S.tu,g tho PG.pc: '"""'"'"
OpM Offlce 00clffl!r.t w Tl iOS-57 C:""...tlno lI FIOf
fl nsos-57conwetlno TI FI.,
\t,lrdow, ~ · (s NOl>\t •
(st,.Jtt,«:,W •
(s 0-....tooon
(sJ l'fC<MtnollbS ► iii S7HGlaphVS•l';<)l1"«m>no-•u4fl,s
► ca S!>'AllC t.Ef • ~ CfC • Wt<c,..- bb!~
~ S7 ~ • "'o;r- ,ng S7 lliclOS
•'1 s;J,'AllC 11'"""11e<
""Ill"""' •(a S7 .,..,..,., •
~ Oocun<ru •
'$ 5"~.lilQ!( I

~ S!!fch •


-~
t1d,,

/<uo ...

-!iJl Shl..l.~...

Figure 1-3. SIMATIC Start Menu wilh Standard and Op tional Tools

6
Gelling Started with STEP 7

S7-CFC
S7-CFC, or Continuous Function Chart, is o graphical programming tool. suited for
writing the code for operations thot ore continuous in na ture. CFC programs, also
referred to as charts, ore characterized by the interconnecting of canned
operations having d efined inputs and outputs. New functions may be created.
however most commonly required functions including arithmetic and logic, timers
ond counters. comparisons and conversions. trigonome tric functions and many
others ore already available. CFC allows complex programming of process
operations without focusing on the d e tails of the programming method.

~Cf[ · [Control•· Z&IIM_OI _CfC\ 57 Pt01Jram{l)\,.J 11!!1~ El


fiill Ch:lrt l:.dt Insert PlC Oebuc) Yiew Optons wndcw, HOl11-

CJl~lci] ii, JF©l@l ,IIDJs .:!l ~ j..i I ~111• 1


s 1~1.JtC!:il~I ~ mJI!] 11 ::J ~1a1 ~(s!rn! ~
tl/01 fl)(~ t;(lnl«ltS O(: 'lnlerfa!ie'
f ace=.;=;,,;;..---- i--r.N""'ij_
=::':l~nt:.::er7 lT1_ e ~ - ~ - - - - - - - - - - - - - - - - - - - - - , I
I Q-IN UIN
& our o "'o.LJT
,.,. ,..------------------------11
& u,_ou, u, IN_ovr

Pro~•tt '"uo11er
S..uu>_ AVI corrr_c
Si1dt av•r.a ♦ Conc"ln\l.ou, tt:D
l BO IN -UO BO - BO 11.Ul 011
11 I N OUT JI
30 re n

0.

Prossf l f(,,hdp, =====;====~--------


A/Sheet I 10635
:i1
Test\!

Figure 1-4. Window w ith Continuous Function Chart (CFC) programming.

7
STEP 7 in 7 Steps

S7-Graph
S7 Graph is o llowchort•like lang uage involving sequences lhot describe the
operations of a machine or process as individual steps and lhe transitions between
each step. It is especially suited to sequen tial operations. A sequence may consist
of bo th sequential and concurrent palhs. The code describing the operations of a
step and the transitions between steps may be programmed in lhe lang uage of
c hoice (e.g ., LAD, FBD. STL. or SCL).

• FBJ,DBJ (Sequencer 1) •• NewP1ant\ STRA'01 \CPUJlS-2 DP(I)~...

D 1'Cl1ARGC 3TRAlrD l 0-IIL; • T'Ol\ L O.If& D 11.LJ:T


·COlrl'l\Ot. t. 1!71:1\
· AI.I. ST OPPI:P. 3Tl\A?ID l

---------------.,. ---- :Stl~pl.


I
IC
I Sl
Seop.l I'
Is l"BH"

•• ••
,_ - l
~ II II -----------· ~an•l.
-. ----
Soes,l
S2
3ti<ep2 I\ "Dt:SUS'B"
I\ "DDSrTV''
. I\ "3CJ:TV\J'U
2
~ I I
............ -.

------
SJ
St:cp~
13oep3
S !"SCCTV\J" I
3
~ II 11 I ----·······- lt l::&J\!1 3

------
S4 ::,o•v•
3t.ep4 I\ ''SCtT\111''
I\ 11 DbLT1 II

~ II 11 I . --------. --

ss ...... ,.,:-e-,p-j-
.. 0-B_L_T_
l -
' '- - - - - - , ,


'
"
.
..,.
Figure 1-5. Window w ilh S7 Graph programming.

8
Gelling Started with STEP 7

S7-SC L
Structured Con trol Language (SCL) is a textual high-level language which supports
PASCAL-like operations like FOR-NEXT Loop, IF-THEN -ELSE, CASE, DO-WHILE statements,
and variable declarations. S7-SCL simplifies the programming o f loops and
conditional branches. and is quite suited for formula calculations, complex
optimization algorithms, or th e management of large quantities of data. S7-SCL
supports developmenl o f sourc e files Iha! ore c ompiled into bloc ks lhol c on be
combined in an S7 p rogram with other blocks.

Ii Measv06 -- 2EN05_01 _S7SCL_Measv06\ SIMATIC S7-300 (enQlish) Cf> .

FlfNCTl:OH SQUARE: I MT

This f"unc,:;ion =pplies the square of the inpu1;. 11alue as a ti.m~ion v


case of an ove r flov, the w;.xu,um value t hat can be represented as an
.. ,........~-~---~~······*~·····•~**~••*••·······'··~---~·-·······~-
VlUl l:NPVT
value INT;
ENJI VlUl

BEGDI
l:F value -<a 181 T HEN
SOUAI\E := value ~ value; //C alculates fun~1on value
ELSE
SQUAI\E - 32_7 6 7; // Sets ~aximUJD value if overflov
EJ\111 l:11 ;

ENJI FUNCTl'.ON

(Pl####l#f#l####l#l#IOll#########l########O#f####I#«########
Ne~t bloci< #1######### ##### ## #########1######## # #
### # # J
#############################################~############•)

l?UNCTl'.O?l BLOCll: llVJ.LUATll

J>or~ l : Sore cyclic buffer uich ~easured values


Pare 2 : TriqQer ca.lculacion of resulcs

CONST
LIMIT :~ 7 ;
END CONST

VlUl XN OUT
sortbu ffer · ARRAY ( □ . LIHI TI OE I MT;
END Vllll

VlUl OUTPUT
cAlcbu f far lUlllY IO.• Lil!IT I OF
STRlfCT

Figure 1-6. Window w ith S7-SCL (Structured Control Language); a text-based language.

9
STEP 7 in 7 Steps

S7-HIGraph
S7-HiGroph is a graphical language. based upon what is known as the "stole
machine" or "sla te diagram" method of programming. HiGraph is especially suited
for asynchronous operations. With this method. o system is broken down into
au tonomous functional units, each of which con accept various slates. The actual
behavior of each functional unit is described by what is called a stole graph. and
transitions ore defined to control the switching among these sla te graphs.

t1,, tdt 1·-wrt Ile. r~ ~ ... ~ ,.'M1rl ftot,.

fil~I 1$11111!!l . P.lll•I • l ·I E~t•I .J I •Itel ollillt'tl J...El.:!:.l l:ll~lslrnt ®I ~I


t!.lt..ec. ,ill .... ,.


"'...., 1lf'fll'- 1
1' A\4,.,VU')'ft.two•

"""''
•w_o_·"
~-~~( ..
° ___.,,.
,-.,_-_
.... ..
~

' !IMO•• - ..:n;

••
'
11,• ..,• •:.v-41 n,1.1 ,,_ .,.._.
t ,II.lb• 0


r
.!.C
Figure 1-7. Window w ith S7 Hi-Graph; a slate machine programming language.

10
Gelling Started with STEP 7

Comments on Getting Started with STEP 7


In your initial working with STEP 7 certain tasks when performed up fronl, will help to ensure
gelling off to a good start. Whether your project is small or Jorge. proper p lanning of your
software installation, storage locations for projects, libraries, and archives is important for
good organization In maintaining and protecting your work. Items you should consider
performing before you get started o re outlined below. Examples of each o f these tasks hove
been p resented, in a step-by-step manner. in the remainder of this chapter.

Once you hove installed your software. become somewha t familiar with navigating the
SIMATtC Manager software. and performed some of these important p reliminary tasks. you'll
be ready lo proceed to the first step of Working with your STEP 7 Project.

Checklist: Getting Started with STEP 7


• Ensure sufficient disk space is on the some drive of the PC programming
system, for bofh STEP 7 Basic and optional fools.

• lnsloll NCM for Industrial Ethernet and NCM for Profibus. during lhe Installation
ff these networks will be lnstolled.

• Install outhorizo lion key for the STEP 7 BASIS software.

• Install Avthorlzafion keys for NCM Industrial Ethernet and NCM Profibus, if
these packages were installed.

• Configure /he STEP 7 workstation environment to support single-user or multi-


user project development,

• create Windows folders lor holding STEP 7 projects, Ubrories, and archives.

• From the SIMATIC Manager, define STEP 7 language, storctge path, and
archiving, and other operating preferences.

• Establish a ph~ical connection between the CPU, of your initial work, and
the programming system (PG/PC} vsing serial cable ond PC Adopter
(adapter only for PC),

• Set the PG/PC interface to PC Adopter, for STEP 7 online connections to the
programming system.

11
STEP 7 in 7 Steps

Installing the STEP 7 Software


Basic Concept
STEP 7 is pre-installed on SIMA TIC PGs. b ut must be ins Iailed on PCs intended for use as a
programming system. Suitable PCs include Pentium-based PCs, having a Windows operating
system (95/98. NT/2000. XP, ME). The STEP 7 Basic package contains the LAD/FBD/STl
programming e d itor. w hich supports Ladder, Func tio n Block Diagram. a nd Statem ent Lisi
languages for programming S7 controllers. Oplional languages and tools. which must be
installed ofter STEP 7 is ins ta lled, must be considered since they should be installed on the
some d rive.

Essential Elements
In addition to the Basic STEP 7 package, STEP 7 releases ofter 5.0 include: (1) A crobat Reader,
softwa re for o pe ning and viewing user manua ls, a nd other rela ted documenta tion; (2/ NCM
for Industria l Etherne t , the Ethernet config uratio n software; (3) NC M for Pro/ibus, the Profibus
configuration software; and (4) Au thorsW, the Windows program for installing and removing
authorizatio ns for sta ndard and optional toots.

Application Tips
If Ethernet and Profibus network m odules ore no t visib le from the SIMATIC Ma nager projec t
tree or ovoilobte In lhe hardware configura tion, then it m ay be tha t NCM Profibus and
Ethernet p ackages have not been installed. Re member, a lthough included on the standard
CD, a sepa rate license must b e p urchased for these NCM packages.

Components

Programs to be iMtalled

~ Acrobat Reeder 5.0 20 MB The Acrobat Ae4der is uied to


@ STEP 7 ¥5 .2 290 MB reed the electtonic manuals.
lia NCM 57 ·Ind. Ethernet VS.2 20 MB
@ NCM 57 • PROFJBUS V5.2 29 MB
@ 57-SCL VS,1 incl. SP'I '14MB
@ S7·GRAPH YS, 2 incl. SP! 40 MB
~ 57-PLCSIM \15,2 18 MB Eslimaled instaOation time:
Iii'.] Authors~\/ \12.5 incl. SP! 10 MB 00-30 (hh:mm)
Ae-Qwed on C: 471 Mb)Aes
Avaiable on C: 6003 Mb)Ae:

·. ;___<_J!_ook
_ _,[__ _
ll_e_
x t_
>_ _.! __c_an_c:e_l_...l
Figure 1-8 . STEP 7 Setup dialog for selecting Install components.

12
Gelling Started with STEP 7

r Setupsprache: Deutsch
f.' Setup language: f.nglsh
r langue d'll'lstallation; Frani;ais
C" lcioma de instalaci6n; E~ai\ol
r Lingua di installazione: !taliano

SIEMENS
-
_ _«_[ a
_~______l. __N
_e11_t_> _ ..., _ _ l
c_an_c_a_.....
Figure 1-9. STEP 7 setup d ia log for selecting native languages to install.

Quick Steps: Installing the STEP 7 Software

ACTION
1

1 Logon as Administrator or Power User. to insta ll STEP 7 under Windows NT/2000.

2 If the installation is on upgrade to a STEP 7 versio n o lder than V3.2. then the previous
version and all optional packages must be removed prior to the new installation.

3 Ensure tha t your PC hard d rive hos a dequate space for the installa tion. Depending
o n your component selection from 200-380 MB will be required.

4 From the Windows Explorer navigate lo the SETUP.exe installa tion program on the
STEP 7 CD and double -c lick on th e p rogram to start the installa tion.

5 From the STEP 7 Setup d ialog Setup Language, c lick and select the language o f
c ho ice to use for the STEP 7 installatio n se tup d ia logs.

6 From the STEP 7 Setup dialog Components. place a check mark in each box to
select whot software components should be installed.

7 From the STEP 7 Setup d ialog Install Language - Specific Files. p lace a check mark in
the box besides each native language in which STEP 7 should be available.

8 From the STEP 7 Se tup d ialog Start-up Language. click and select the language of
c hoice to sta rt-up with whe n STEP 7 is launc hed.

9 Answer re ma ining questions as the setup program guides you through the
installation.

10 Toward the end of the installation, you will be g iven the option to allow the setup
program to install the STEP 7 authorization. Simply insert the diskette when prompted.

13
STEP 7 in 7 Steps

Installing and Removing STEP 7 Authorizations


Basic Concept
To ru n without interruption the STEP 7 softwore, and all optional packages, must be
a uthorized by instatring the appropriate authorization. An au thorizatio n. w hich acts like a
software key, is required on eoch computer where STEP 7 is used. The program for installing
and removing authorizations, ''AuthorsW." is installed during the STEP 7 installation. Toruno
single license copy of STEP 7 on a diflerenl computer, you must unlnstall or transfer the license
bock to the authorization disk and reinstall ii on the new computer.

Essential Elements
The yellow STEP 7 Authorizatio n disk. provided with STEP 7, supports management of multiple
oulhorizolion keys as shown in the dialogue below. Each optional package requires
au thorizatio n and is p rovided w ith its own au thorization disk if p urchased separa te ly. Once
on authorizatio n is installed on the drive, when later removed it may be moved back to the
STEP 7 mulli•authorizotion d isk for central management.

Application Tips
By default. authorizations ore placed in a hidden folder, C:\AX NF ZZ. This folder must not be
deleted, copied, or moved. Authoriza tions should be removed before performing disk
opera tions such as ghost.imaging or de-fragmenting. If o drive is compressed, authorizatio ns
should be placed o n th e host drive. In the event the authorization for STEP 7 BASIS is lost. a 14-
doy Emergency key is provided on the yellow disk, to be used until the lost key is replaced.

;;! AuthorsW '.:J.gj~


Fill Edt Aut,..,..,.Oon ..,.., fa•,o,tes ~ Het>
- -
&~ , i> ~ 171 .Al ® \' tfl

.:J ~ jw LocolOqk (C;l 3~


Fnxlu:t O>lne< Vakil . Pro"-'<l • C<uoer Vofdii
t Sll<ISIMATICS7•FOIAG v:J.• 0 Unlmt ~ f SIKISIIAATICS7,f'I.CSIM VS.2 1 Urmilod
CSIK/SIMAT ICS7,POIAG V4 • 0 llnim1 t $ll:!Slt.!ATICS!EP 7,FASIS V5 2 1 1lnbvt•d
I::,. SIK/SIMATICS7.f0:AG i/5 • 0 Un\m, ~
.(,t SIK/SIW.TIC S7-f'I.CSIM 1 U1tkni
f!j, SIK/SIMO.TI: 57·1'\.CSIM 1/4 • I Uniml ~
.; S I ► iSIMi\ TIC •; 7 f\.CSH•' VS::! 0 Un\ml
.C, SIK/SIW.TIC S7-f'I.CSIM V5.x 0 Urumi ~
.C, SIK/SIMAI ICS7•SCL V3, 0 Unlm,
l1, SIK/SIMATICS7-SCLV4, 1 Un\mi
{; SIK/SIMATIC Sl·SCL 1/50 0 Unimi
fI, SIK/SIW.TICS7-SCL VS I I Unlml
L SIK/SIMATICSTEPSISTBASIS V7.x 0 Unlml
LSIK/SIW.TIC STEP 7•8"SIS \13.x 0 Un\ml
r:, SIK/Slk!O.TICSTEP 7•8ASIS -./4.x 0 Unlmt
C SIK/SIMATIC STEP 7•8"51S v5.0 0 Uniml
J.t SIK/SIMATICSTEP7-B"SISVS 1 1 Unimi
Jl SIK/SIW.TIC STEP 7-BASISIIS.1 ' 14 . 1 140,
.; 0 Unimi
t;SIMlllMI IC leloSCMccVJ• 0 un:.n
C SIK/SIMAllt 1 e.b!:e-mce YS:x 0 Un'1n1
Jl SIK/SIMATICUPOr•de STEP7-BASIS ... 1 Unlmi
SIK/Sll<IATK:UparodoSTEP7• IS. 0
Un!f
• .!.l
46Auihiidza1ioni,J l2AIAhtrii~•I

Pre»Fl /w help. 1 , - 1 ® .j,;;; \J /4


Figure 1-10. Authorization dialog for installing and removing software authorizations.

14
Gelling Started with STEP 7

Quick Steps: Installing and Removing STEP 7 Authorizations

ACTION

Install Authorization:

1 Place lhe STEP 7 o ulhorizotion disk in the d isk d rive.

2 From 1he Windows Start (bu llon) , selec t SIMATIC, ► AuthorsW folder. ► AuthorsW.

3 Selec1 1he Transfer tab. to lis-1lhe authorizalion keys fo und on lhe diskette. if It is nol
already displayed. The counter value lor the key must be " l " on the d iskelte.

4 To install the authorizatio n on the hard drive, find and select from the window
displaying 1he aulhorizalions. the correct version of STEP 7-BASIS for unlimited use.

5 With 1he key selected. press the install b utton -+ lo p loce the authorizatio n on lhe
hard drive.

6 Remove lhe aulhorization d isk from the d rive and store until required again.

Remove Authorization:

1 Place the STEP 7 authoriza tion disk In the disk d rive.

2 From the Windows Start (bu tto n). selec t SIMATIC ;.AuthorsW.

3 Select lhe Transfer tab. lo lisl lhe aulhorizalions, ir it is not already displayed.

4 To remove lhe authorization from th e hard drive, select lhe STEP ?-BASIS key from the
window displaying the aulhorizations round on lhe hard d rive. The coun ler value for
lhe key must be "O" on the d lske lte and " 1" on the ha rd drive.

5 Press the remove button ~ to return the authorization to the aulhorization d isk.

6 Remove the a uthorization disk from the d rive a nd store until required again.

15
STEP 7 in 7 Steps

Opening SIMATIC Software Components


Basic Concept
Once STEP 7 is installed. a SIMATtC program group is p laced in the Windows Start menu and is
accessed from the Stori button. The SIMA TIC !older contains the main componen ts ol the
STEP 7 BASIC package, which is also presented as o menu ot items th at may be selected.
These items include component folders AulhorsW. Documenlotion, Product Notes , SIMATIC
NET. S7 Manuals, and a shortcut for launching the S/MATIC Manager.

Essential Ele m e nts


From the S1MATIC menu. the Au lhorsW raider contains the AuthorsW program for installing
and removing licenses for standard and optional tools. The Documentation folder presents
language-based folders lhal con la in shortcuts lo documents and manuals available in lhe
installed languages. Product Noles p resents language-based folders, which contain shortcuts
lo product information not included in user manuals. SIMA TIC NET presents selec tio ns for PC
configuration software tools. for Industrial Ethernet and ror Profibus. Th e STEP 7 !older presents
a menu of installed standard and optional tools. The S7 Manuals folder presents other related
manuals that hove been insta lled (e.g., optional software tools); and finally. selecting
SIMATIC Manager launches the main project management tool.

~ New Office Document

'1 Open Office Document

ij. Wlndows Update

~ AuthorsW
,:U Documentation ► II English
WlnZ'ip Cs Product notes ► D Deutsch
. ...
~" Ji
Te.mp ►
SJMATIC NET
STEP 7

~
• ~!~:1 Progr-ams ►
.~ 57Manuals
SJMATIC Manager

~ Documents ►

~ Settings ►

Search ►

~ Help

• ~ Run .. .
-
Figure 1-11. Opening SIMATIC Software Components from Windows Siert Menu.

16
Gelling Started with STEP 7

Name ...
mFms:l Steps with S7 Graph
~ S7 Graph · Progianming Sequential Control Sl'$(ems
;!\'g S7-GRAPH • Fir~ Steps wrth S7 Graph
,:J s7-PLCSIM • Tetting Your S7-CPU Programs · manu~
l
· ~ S7-SCL · Working with S7-SCL
ffl s7-SCL for S7-300 and 57-400 • manual
ffls TEP 7 • Conliguling Haidware with STEP 7
. STEP 7 · From 55 to S7
STEP 7 · Function Block Diagram for S7·300 and S?-400
STEP 7 · Laddel Logic for S7-300 and S7-400
~ STEP 7 • Modifyr,g the SY$1em During Operation via CiR
ffl STEP 7 · PID Contiol
lj STEP 7 · PIO Ternperature Control
.m STEP 7 · Programming with STEP 7
. ~ STEP 7 · Stetement Li$l for S7•300 end S7-400
;11 STEP 7 · System 11nd Standard Functions lor S7-300 and S?-400
ffl sTEP 7 • System end Standard Functions for Tl·S7·Converle1
m STEP 7 · Working with STEP 7 ...
~ fi•
j22 ob,eeUs) Lf.J
My Co~er
Figure 1- 12. Shor1cu1s to typicol ins1olled S7/STEP 7 documenlotion.

Quick Steps: Opening SIMATIC Software Components

■ 1
ACTION

Click Start ► SIMATIC ► AuthorsW ► AuthorsW to open the u tilily is used 10 install ond
remove software ou1horizations.

2 Click Start ► SIMATIC ► Documentation ;.. English (or Deutsch, French, Italian. Spanish)
lo locale STEP 7 documen1otion in one of lhe installed no1ive languages.

3 Click Start ;. SlMATIC ► Product Notes ► English (or Deutsch, French, Italian. Spanish) 10
locale Important product notes not inclu ded in the user manual a t release.

4 Click Start ► SIMATIC NET; lo a ccess configuration or diagnostic tools for Industrial
Ethern et. Profibus. or other installed SIMATIC NET componen ts.

5 Click Start ► SIMATIC :.- STEP 7 ► to access standard editors and u tnities (e.g.
LAD/ FBD/ STL) or op tional editors (e.g., CFC) and utilities if they have been installed.

6 Click Start ► SIMATIC ► SIMATIC Manager; or from your desktop double•c lick on the
SIMATI C Manager icon lo open lhe SIMATIC Manager program.

7 Click Start ► SI.MATIC ► S7 Manuals lo locale other rela ted user manuals that hove
been installed (e.g., optional packages).

17
STEP 7 in 7 Steps

Configuring a SIMATIC Workstation


Basic Concept
You may configure o STEP 7 workstation for use in o single- or multi-user environmen t. Single-
user mode is the delaull configuration arter the STEP 7 installation. Configuring workstations in
a multi-user environment allows several users to access and work concurrently on a p rojec t.

Essential Elements
The multi-user configuration is possible for workstations on NT and Novell networks, ofter each
workstation is configured using the Configure SIMATIC Workspace utili1Y. to operate in o multi-
user environment. Shored projects may be p laced on a local drive. o f one workstation and
accessed by all other stations. or on a network server. where other workstations access the
server. Shored projects may also be distribu ted among the local drives and one or more
network servers. and all works ta tions have access to all projects.

Application Tips
The multi-user configuration is possible for workstations on NT and Novell networks. ofter each
workstation Is configured using the Configure SIMA TIC Workspace utility. to operate in a multi-
user environment. The shored project or projects may be p laced on o local drive of one
workstation and accessed by all others; or on a network server. and other workstations
access the server; or distributed among the local drives and one or more network servers.
and all workstations hove access to all projects.

i) !'n_ , i l li

CorJiguration Notes W01krtation Cor{tgt.1ation J TCP/IP Conliguration fo, Mutiple Node S~tems l
Network Topology Configuration Settlnge

You m.a_y configure you, sysll!lll ~ • ~ $Ingle 01 multiple node sysll!lll. When coolig.Jring a multiple node
sy;lem. ~ is important to ensure Iha! the prope, ne(work prolocol end ackli= ae used

- Workstation- - - - - - - - - - - ~ - Use Protocol w~ l,lijj-T erminal Systems- - - ~

!i:!_1
~ r Single node sy~em
M NetBIOS

~p r ll¾'SP.I<
~I~ r♦' Mukiple node system
P' 1CPt1P

..
I Seivet was started w~h protocols.

OK I Slop Server j I Default Setli-los j eance1 I Help


I
Figure 1-13. Configure worksta tion dialog; setting single/multiple

18
Gelling Started with STEP 7

i31Ili,i't11ii1f#td-Jii1Mtiffiil·· ) I - - - -----
I
Con/igLriKion Notes W ~ c.orligv,~on TCP/IP ConfQ!la!ion 101 Mutt:>le Node Syiterl\$ j
Cletll aoo Set vet IP P•ameter OonR11111 .tllon
Mutipl,e nelwork ~ ,cl$ ~n be p,-nt i, JIOl.f s;,1lem. ~
rrust lhen be indMcl~ oonf9)1ed Ada ei no.: IPAddtett
Adcftional in/om,olion ii ovaW,lc fn the onlno help.
0 169.254.91.6
1 169 254.150 53
.OB Serve,
r Only u;e Utt host Cldaeu
j
r
08 Cier1t=========================
r. F"nd •~lngs f1om IP p111<!1nele,s ~ 1254 .1
~ -~
r Use the tob.w,g eddieu: ~ - ~ . J:-.l!i 1255

OK ~ ] Stop Sc,vei l Oefauk Sellings I Help I


Figure 1-14. Configure worksta tion dialog: defining IP address parameters

Quick Steps: Configuring a SIMATIC Workstation

II 1
ACTION

From lhe Windows Start bu tton, select SIMATIC ► STEP 7 ► Configure SIMATIC
Workspace to open the workslotion configuration dialog.

2 From the Configuration Workstation dialog, select the Workstation Configuration lob.

3 Select Single Node System. if the workstation will work atone on STEP 7 projects on the
local drive, and not access projects on o centra l server or on other workstations.

4 Select Multiple Node System, if the workstation will opera te as on of multiple


workstations having access lo projects on the local d rive or on o central server.

5 Selecf the communication protocols tha t may be used for communica tion by this
worksta tion (e.g., TCP/IP, Net-BIOS, or /PX/SPX}.

6 If TCP/IP is used, select lhe TCP/ IP Configuration for Multiple Node Systems tab; selec t
the network adapter if multiple cards are installed and set the workstation IP address

7 In the multi-user environment, a DB server facilitates communication between the STEP


7 client and other workstations. If more than one network adopter is available, you
may specify the host address of the network in which lhe DB server should work
exclusively. Under DB Server, p lace o check mor1< in the box Only Use this Host
Address. and then specify the host address o r the network. Otherwise. the default
setting allows the DB server to use all of the installed network adopters.

8 Under the DB Client box, choose the setting Find settings from IP Parameters. to allow
the wor1<.stolion client to obtain its IP parameters dynamically; or use the field
designated Use Following Address, lo set the IP address for lhe c lient. This se tting allows
you to specify the broadcast address to be used for the corresponding subne t when
more than one subnet exists. If several cords exist, adopter O is used to determine the
b roadcast address.

19
STEP 7 in 7 Steps

Defining Storage Path Preferences


Basic Concept
When working wi1h STEP 7 you will creol e projects ond perhops libraries of p rog rams ond
b locks. By de fault. STEP 7 stores all projects in a subfolder named S7Proj, and all libraries in a
subfolder n am ed S7Libs. bo th o f which ore localed in 1he STEP 7 folder. To h ave yo ur projects
and libraries automoticolly stored in defoull loca tio ns o f your choosing, you must first c reate
then specify these locations.

Essential Elements
The Essential Elemen ts of this task involve defining or, if necessary. c reating the d efault
d irectory poths for STEP 7 projects ond libraries. Since b y defoull STEP 7 stores projects in
Siemens\STEP 7\S7 _Pro]. ond libraries in Siemens\STEP 7\S7_lib. you moy wont to ensure that
your project work and tibrories are p laced in the right location in your compuler's file system.

Application Tips
Each newly created p roject and library is crea ted in the defoull poths currently set in STEP 7.
To avoid loss o r pro]ec l data ii is recommended that you ploce project folders on o drive
o1her thon the one where th e Windows swap file is loca ted.

Customize

Language General View I I Columns I Me;,• ~mbele I Archiving j


[ St01age location foe projects/llllAliprojects
j[ilif&iht4ii1-'t•.t:iiiim __B
_,ow_se_.. _. __.I I
St01age location foe tibiaiies- - - - - - - - - - - - = = = = = = = i
jc:\Patrick\57_libraries 81owse ...
I
r Open new object al.iomatically
r Archive automatically on opening project 01 lib1a19

P' Save window arrangement and contents al end of sesmn


f;r Dfftine window r Onin~ window

1 Deactivated system menages: Activate


II
Cancel I j
OK
l Help

Figure 1- 15. STEP 7 Customize dialog for d efining Project/Library storage pa ths.

20
Gelling Started with STEP 7

Quick Steps: Defining Storage Path Preferences


ACTION

1 Create o new folder for your STEP 7 projects (e.g., C:\S7 _Projects). Each newly creeled
projec t is generated in o sub folder. inside of the main project folder that you creole.

2 Creo le o new folder for your STEP 7 libraries (e.g .. C:\S7_libraries). Each newly created
library is generated in o subfolder, inside of the main library folder that you creole.

3 Launch the SIMA TIC Manager and from the menu select Options ► Customize.

4 Open the General lob lo define your default storage path settings.

5 Type a folder path in the "Storage Location for Projects" field. or use the Browse button
to find and select a folder to hold new projects (e.g., folder created in Step I).

6 Type o folder polh in the "Storage location for libraries" field. or use the Browse button
to find and select a I older to hold new libraries (e.g .. folder created in Step 2).

7 Activate the Open New Objects Automatically check box. if you wish to hove each
newly generated objec t (e.g.. stolion. block, or subnet) open automatically in its
associated editor or tool ofter it is created.

8 Place o check in the Archive Automallcally check box. if you wish to hove o backup
copy mode of the los t revision of your project or Obrory on each new opening o f the
projec t or tibrory,

9 Close on STEP 7 tools and the SIMATIC Manager orter any changes to the General tab.
for changes to take affect: then reopen STEP 7.

21
STEP 7 in 7 Steps

Defining Language Preferences


Basic Concept
STEP 7 supports installatio n of multiple native language. a ll of which ore distributed on o
single CD. A ny one, or a combination, of the languages may hove been installed during the
instollolion. The language setting will affect both the native language used on the program's
dialogs, as well as the mnemonics tha t appear in the instructions and addresses of you user
programs. A t any lime later. you may switch to any language o r choice as required.

Essential Elements
This task involves setting th e na tive language to use iF mutliple languages hove been
instatted; and to ensure that address mnemonics to be used in th e p rogram a re set lo your
choice. The mnemonics setting determines whether Germon or English instruction operands
and address identifiers will be used as you create and d isplay your program. If the
mnemonics a re set differently from what you expec t and are using, errors will be reported as
you enter your p rogram.

Application Tips
By default. after initial instoflolion. the language setting for the program mnemonics is
German. English is the only other choice. II any language change is mode. STEP 7 and on of
its components must be closed and restarted for the change to toke affect.

Customize

Language f General] I I
View ] Gok.lmns Message nutrbefs AichM'lg I
Naoonal Language Mnemonics
l!!nglish £><ample 1 E~ample 2
deuttch r Geiman U El.O S A4.0
• r. English
lra~ais A 11.0 S Q4.0
espenol
ila~ano

OK
CT J
Figure 1- 16. STEP 7 Customize dialog for defining Language preferences.

22
Gelling Started with STEP 7

Quick Steps: Defining Language Preferences


ACTION

1 launch the SIMATIC Manager and from the menu select Options ► Customize.

2 Open the Language tab to define your STEP 7 language p references.

3 Under lhe National Language lisl box, if multiple languages were installed you will see
the curre nt setting in the field just above the list box.

4 Setecl the native language of choice (e.g. English) to use within the STEP 7 application.

5 From the group box labeled Mnemonics, select English or German, lo determine what
instruction mnemonics ore lo be used in your programs ( e.g.. set for English I = Inputs.
Q = Outputs; set for Germon, E =Inputs.A= Outputs).

6 Click the OK button to close the dialog.

7 Close all STEP 7 tools and the SIMATIC Manager ofter any changes lo the Language
lob, for changes to take affect then reopen STEP 7.

23
STEP 7 in 7 Steps

Defining Archiving Preferences


Basic Concept
STEP 7 allows the manual or automatic backup of your projects or libraries by a process
known as archiving. Ta archive is to use a compression utility suc h as WinZip or PKZip lo
compress the files in order that they require less storage space. In the course of your STEP 7
development you may wish, at various stages. lo make o backup or your work lo dote.
Selling the archiving preferences will define certain parame ters that that will determine how
STEP 7 handles this operation.

Essential Elements
Setting preferences for archiving involves d efining and. if necessary, crea ting the defa ult
archive d irectory path for storing backups or STEP 7 p rojec ts a nd libraries; and defining lhe
d efault directory path in which projects should be placed upon re trieving and archived
c o py. In addition the program (e.g.• WinZip) to use for a rc hiving projects or libraries must be
specified.

App lic a tion Tip s


For changes to toke affect, after options settings have been modified, STEP 7 and all o f its
componen ts must be completely closed and restarted.

Customize ~.

Long ~ I Generol I View I CDlumn1l Me$soge runbers Arclivjng I


Prele11ed Archiving Program: ,-.Qp!iom
IPKZip 4.0 ['.zip) -=.] CDnliguriig...
I p; Check opl.io~
- Archive Directory dwing w Cheek target ciectory
Arclwing: W Use on retrieval
jC:\Petrick\S 7_Aichive_Proi Brow;e..,
I r Genetote archive path
NomoticaHy
Retrie-mg: W Use W &eate ne, aeh,,.,e
name lf na--r.es conrfot
jC:\Pallick\S 7_Projects I, Br0¥\lse... )
~

OK
Figure 1- 17. Customize dialog for defining Project/Library a rchiving preferences.

24
Gelling Started with STEP 7

Quick Steps: Defining Archiving Preferences


ACTION

1 If you Intend to hove STEP 7 outomoticotty archive your projects, you may wish to
crea te a new folder for this purpose if you have not already done so (e.g.,
S7..Archive_Prol).

2 Launch the SIMA TIC Manager and from the menu select Options ► Customize.

3 Open the Archiving tab lo define your STEP 7 archiving preferences.

4 From lhe "Preferred Archive Program" drop list. select the program to use in creating
archives (e.g .. Win Zip). Use the Configuring button to find and poinl to its location.

5 In the Archiving field. define a target directory and activate the Use checkbox if this
direc1ory should be targeted first for storing archives (e.g., folder crea ted in Step 11. If
the "Use" check box is not activated, then archive projects will be targeted for the
location last used for storing archives.

6 In the Retrieving field, define a target directory and activate the Use checkbox if this
directory should be searched first when retrieving an archive project: If the "Use"
check box is no t activated, the search for archives w ilt start in the directory used lost.

7 Activate the Check Options check box, to cause the archiving dialog to be
presented each time you archive mes. This se tting is ignored if LHARC. PKZIP 2.50. or
WinZip is set as the "Preferred archive program".

8 Activate the check box for Check Target Directory, lo cause o directory selection
dialog presented on each archive retrieval. This dialog allows you to specify o
directory in which lo restore a retrieved archive project. Otherwise, archived projects
and libraries ore restored to their respec tive default STEP 7 projec t or library directory.

9 Activate Iha Generate Archive Pafh Automatically check box. to have the name of
the archive file automatically derived from the name of the project to be archived.
The direc tory selection dialog is not presented.

25
STEP 7 in 7 Steps

Establishing a Direct CPU Programming Connection


Basic C onc ept
II you ore using o PC os the STEP 7 progromming system. lhe PC adopter is requ ired for direct
connec tion to the C PU if you o re establishing a conneclion for the first lime. This connection,
which supporls d irect CPU connection for downloading your o ffline program, will a lso be
required to download your initia l hardware configuration lo the CPU. The conneclion is
between lhe serial port or your PC ond the DP/MPI port on lhe S7-300 or S7-400 CPU. All S7
CPUs hove on MPI port.

Essential Elements
With the PC adapter (PN 6ES7-972-00A22-0X), and the standard serial coble (PN 6ES7-901-
IBFOO-OX) you ho ve all that is required for the online conneclion too CPU via ils DP/MPI port.
An off-the-shelf serial coble w ith 9-pin connectors and the appropria te gender may be
substituted for the previously mentioned serial coble. The PC Adopter perform s the
conversion to allow the sta ndard RS232 serial port on your PC lo support online connection to
the MPI/Profibus-DP port of an S7-300 or S7-400 CPU.

Applic ation Tips


The interlace parameter set (i.e., protocol driver) for the PC Adopter is a utomatically insta lled
d uring the STEP 7 installa tion. as one of the Interfaces available for selection as on S7 o nline
interface connection. All tha t is required, if not a lready done. is that you c hoose the PC
Adopter as the inlerloce to use for the S70NLINE connection. This se tting is mode using the
"Setting the PG/PC Interface" utility. STEP 7 PGs come equipped with an MPI cord w hich
supports either o direct or MPI network connection too CPU. and does not requ ire use of lhe
PC odopler,

PG/PC
S7--400

MPI/DP
Conn~ctor
Serial
Cable

Figure 1- 18. PG/ PC-to-CPU programming connectio n using the PC-Adopter.

26
Gelling Started with STEP 7

Quick Steps: Establishing a Direct CPU Programming Connection

ACTION

1 Se t the slide sw itch on the PC adopter to ei ther 19.2 or 38.4. according to your
required transmission speed. This setting mus! match the transmission set in !he MPI
Poro meters.

2 Connect one end of the serial coble lo the RS-232 connector on the PC Adopter.

3 Connec t the opposite end of the serial coble to the RS-232 serial porl of your PC.

Connect the opposite or cable end o f th e PC Adop ter. marked MPI/DP, to the
MPI/DP port of the CPU to which lhe online connection is being established.

5 With the coble in place the STEP 7 online interface must b e set to use the PC
Adopter.

6 From the SIMATIC Manager menu. select Options ► Set PG/ PC Interface to launch
the utility for setting the online Interface for the PC or PG programming system.

7 Ensure thol lhe lleld labeled "Access Point of lhe Application" ls set as follows:
S70NLINE (STEP 7) ~ PC Adopter.

27
STEP 7 in 7 Steps

Setting the PG/ PC Interface for PC Adapter


Basic Concept
The standard direct connection to on S7 CPU involves use o f the PC Adopter a nd o serial
cable from your PC to lhe DP/MPI por1 on lhe CPU. With the cable in p lace and the
appropriate switch se tting on the adop ter, all lhol is required is to ensure that the
appropriate interface settings hove been made using the "Selling the PG/PC In terface"
utility or STEP 7. This ulilily allows you to select any one of lhe available inlerfoces by which
online connec tion to o CPU con be established. II a lso allows you to define specific protocol
se ttings for these interfaces.

Essential Elements
Setting the PG/PC Interface is to assign on " Interface Poromeler" set to the S70NLINE access
point. The "Access Paint of /he Application.'; is the uniq ue name, known to on application
(in this case STEP 7). tha t g ives ii the connection info rmation b y w hich it makes on o nline
connec tion. The Access Poin t is linked to on Interface Parameter Assignment, which defines
a specific Interface (i.e., pro tocol driver and/or network interface) and its set properties. The
interface parame ter in this case is ''PC Adopter." The assignment the n would be S70NLINE
(STEP7). bound lo the PC Adopter (MPI): the selection is shown as S70NLINE (STEP7) + PC
Adopter (MPI).

Application Tips
A direct connection may also be required ii network connections tha t allowed remote online
connection lo a CPU ho ve been lost. Direct connection is no t o nly possible with the PC
adopter. b ul a lso in the case where the PG/PC hos on installed MPI cord that allows
connection to a CPU's MPI programming port.

5et PG/ PC Interface

Access Palh I
Access Point of the Applic.ition:
I.;,7ilNLIME i&TEP7J pr Adai>1e1tMPI) 3
(S tandard lor STEP 7)

Interface Parameter Assignrnent U$ed


jPC Adaptei(MPI) Properties_, j
~ <None>
(Jj PCAdapte~Auto)
[l9PCAda~ er{lv1Pi)
~ PCAda~e~ROFlBUS) DelJ,te

(Peremeter au ionment of your PC adapter


for an MPI nel work)

~ Interfaces- - - - - - - - - - - - - - - - - - ,
Add/Remove'. Seleel..
l
OK
I Cancel Help
I
Figure 1-19. Dialog for defining PG / PC Interface connection.

28
Gelling Started with STEP 7

Quick Steps: Setting the PG/PC Interface for PC Adapter


ACTION

1 Launch the "Setting the PG-PC lnlerface" utility rrom the SIMA TIC Manager menu.
select Options ► Set PG/ PC Interface.

2 Once lhe Selfing /he PG/ PC Interface dialog Is presented. ensure that the S70NLINE
(STEP 7) access point is displayed in the field labeled "Access Poin t of the
Application."

3 The current setting for the Interlace Parameter Assignment is displayed to the righ1
of the S70NLINE (STEP 7) access point. ofter the symbol (+ ). If no interface hos be-en
selected. w ha l sho uld be displayed is 'S70NLINE (STEP 7) + None'.

4 From the Interface Parameter Assignment Used" list box, click on and selec1 PC
Adapter (MPI) as the interface parameter to se t o s the S70NUNE interface.

5 Once lhe selec tion is made the Access Poin t o f 1he Application will renect the newly
selected interface. The setting should show S70NLINE (STEP 7) + PC Adapter (MPI) .

6 Setec1 the Properties bulion to set opera ting parameters of the PC Adopter
interface (e.g., Transmissio n rote}. This setting must molch the switch setting on lhe
adopter. If you set the adopter to 38.4 K Baud, I hen the d ia log setting must be set to
match.

7 Press OK lo save p roperties and se1 the interface for the new S70NLINE connectio n.

29
Working with STEP 7
Projects and Libraries

Objectives

Introduce STEP 7 Project Concept

• Introduce the SIMATIC Manager Tool

Introduce Objects or a STEP 7 Projecl

• Manage Projects with SIMATIC Manager

Find STEP 7 Projects and Libraries

Archive and Retrieve Projects and Libraries

• Create New Projects and Libraries

Use Copy and Paste as Produclivity


Enhancemenl Tools
STEP 7 in 7 Steps

The SIMATIC Manager


The SIMATIC Manager is the top-level program of STEP 7. and the primary tool used in all
aspects of development and management or S7-300 and S7- 400 projects. As the main tool
for STEP 7, you will use fhe SIMATIC Monoger for much of your work with STEP 7. From this main
tool. you will have access to other standard a nd optional tools and utilities (e.g.. LAD/FBD/STL
programming e ditor and the Ne tPro Network Con figuration tool). which you may launch
from either the SIMATIC Manager menu or toolbar.

A Project and library Manager


The SIMATIC Manager is similar to the Windows Explorer in fhat it supports the management
and stori ng o f files, and the launching of various software tools. The files in this case. are
projects. Instead of working directly wilh files, however. your work with the SIMATIC Manager
is reduced lo the handling of logical objects that correspond lo the various components that
makes up your real-world system. In STEP 7, the main objects of your work will involve either a
Project or Ubrory object. Outside of crea ting storage paths for projects and libraries, in the
Windows Explorer, your work should remain completely inside o f STEP 7.

The STEP 7 Project


As the primary objecl o f your STEP 7 work the Projec t will contain I l) hardware configuration
d ata for PLCs, (21 module parameters and settings. (2) control programs and data (including
documentation), and (4) th e configuration data o t network operating parameters and
communications connections. As you work wilh the SIMA TIC Manager, each project is
opened in its own project window . The objects of the project may be opened a nd viewed,
and edited by opening the object in its associated editor.

In the SIMATIC Manager. multiple projects may be opened simultaneously. Two STEP 7 project
windows ore shown opened below. As seen in the two windows. a p roject may vary in size
from o slngle machine involving one PLC. to on entire p lant involving many PLCs and
networks. Also illustrated ore some of lhe objec ts tha t you will work with under the SIMATIC
Manager [e.g .. SIMATIC PLCs. PG/PC programming systems. and networks.

t,;:i Making_Area -- D:\57 _Proje ... fl~ £{


(ti -{:] Maki'lg__Area i~.\~Tl~_1Q9}..I! IB·~ Warehouse ~-~~f.~'!'.~.~
PG/PQl ) C11uousel_Conveyor
MPl(l) load_Formei_1
- -
Load Forme1 2

So,ter_3
PG/PC(l )
MPl[l J
PROFlBUS[l ]

Figure 2- 1. (a) Project with Single PLC. (bl Project with multiple PLCs and networks.

32
Wor1-ing with STEP 7 Projects ond Ubrories

Project Objects
Under the SIMATIC Manager, the objects of each project are presented in a split window.
Objects contoining other objects ore connected in the tree structure o f !he left pone of the
project window, while i1s contents ore d isplayed in the right-pone. The hierarchy of the
objec ts in the tree is based o n the physical relationship they hove within o real project. The
Project. which contains oil o ther objects, is at the lop. Next is the SIMATIC Station. which
represents o PLC. A project may contain several stations. Each station conloins o CPU; and
each CPU contains on S7 Program. Each p rogram contains o Source Flles and o Blocks
!older. The Source folder contains user-created source text files: the Blocks folder contains
blocks of the user program.

'.ti1 Making_Area -- D:\ S7Course_Projects\ Making_A l!!I~ £1


. .
[3-~ Making__Area SIMATIC 400(1)
B Im! SIMATIC400(1) PG/PC(1)
El"i CPU41 3·1 MPl(1)
EJ @] S7 Program(1 )
!-Ull 5ource File$
L. -@B Blocks

Figure 2-2. Hierarchy of STEP 7 project objects.

The STEP 7 Library


A Library object is used lo store ond mange reusable STEP 7 programs. In essence. lhe library
is like o project stripped of everything except the S7 Program folder. The S7 Program object of
a Library is the some as a program within a Project. except for the foci lhol the library
program i.s not associated with o CPU.

Progra ms in a library ore simply a method of mainta ining code that you wish lo keep and
perhaps use a t another time. Like o project. o library is developed in the SIMATIC Manager.
where you may insert as many program folders as needed. Program folders may also be
copied from o project to o library.

r-. MY _Library -- C:\ Siemens\ Step7\ 571ibs\ Clslib_ l !lliJ El


. . .
El·-~ My_Library S7 Program(1)
e·@J S7 Program(1) S7 Piogram(2)
; t···li:J Sources
• t...(.cl Blocks
El··@) S7 Program(2)
I ui) Sources
i (at Blocks

Figure 2-3. STEP 7 Library containing two S7 programs.

33
STEP 7 in 7 Steps

In addition to libraries that you might creole. there ore also libraries o f conned functions
available for purchase to S7 users. There is olso the so-coiled Standard library. which is
included in lhe STEP 7 Basic package. The Standard Library is shown opened in the window
below. The library hos seven program folders. which hove been renamed according lo the
type of b locks that each contains.

_ox
S t:] Comment
IE @I uirmu,iu,llon Block• ',,1Communlcabxrt Blocks S7Ptcgcm h.ncbcrn (FC) for the d:slrbuted 1/0 and fDL cam(
ff) @I IEC Function Bk>cki SJ IEC Func:lion Blocks S7 Plog,r..-n blocks foi IEC funciicn, (IEC lrlernolionol Elcc~ok
t!l' fill Org,orization Block• ';,I Organizal.,., Blocks S7 Ptcg,rn slandNd orgonrzabon Mock• roe I
[El @I PIO Con!lol Blcct.t
.!!) PIO Conticl Block, S7PlcgMI h.nc6t:n blocks (FD Ifor PIO con!rcl
lfl·@J S5-S7 COl\Vejthl B~k.s
~ uiJ Syttem F~noticn Bloclw
al 55-S7 Conve~ing 81:>d(i S7 Ptogi.m blocks for c0nve1tr,g STEP 5 pro,ramt
IE·@! Tl•S7 Converlfng Bbckt 1f.l Syolern Functi>n Bk!ciu S7 PtC9i""' oytlan lunci!l:lnt (SFCJ ond oyllem functrc.n blocko
:?fl TI-S7Convernr,;i Blocks s1 Proor.m blocks foi conve,tng Tl ~~ams and le, oene,af u
f

Figure 2-4. STEP 7 Standard Library, delivered w ith the STEP 7 Basic package.

Blocks thal ore integrated as port of S7 CPUs. for example organization blocks and system
blocks, ore included in the Standard library so that they may be used during offline
developmenl of your control program. Since these b locks ore actually incorporated in lhe 57
CPU operating system. the library versions of these blocks are nol actually code. The library
conloins the colling interface in the case of System Functions (SFCs) and System Funclion
Blocks (SFBs). and the declaration loble In the case o f orgonlzolion blocks.

Tobie 2- 1. Standard STEP 7 libraries.


Ubrary Program lrfef Description

Communications Blocks Loadable functions for controlling communicalions modules.

IEC Function Blocks Loadable functions lor editing variables w ith complex dolo
lypes (STRING. DATE_AND_TIME).

Organiza tion Blocks Templates for the standard organization b locks; essentially the
required 20-byle variable declaration loble for each OS's start
lnformolion. The ocluol code of on O B is in lhe S7 operoling
system.

PIO Control Blocks Loadable functions for implementing closed-loop control.

S5-S7 Converting Blocks Loadable funclions for 55 -to- S7 conver5ion. The blocks also
replace S5 standard function blocks as port of the conversion.

System Blocks Contains the colling interfaces for S7 System Functions (SFCs)
and System Function Blocks (SFBs), to allow incorporation into
!he user program duri ng offline development.
.
TI-S7 Converting Blocks Loadable functions for the TI 505 -to- S7 conversion. The blocks
replace Tl standard function blocks as part of the conversion.

34
Working with STEP 7 Projects and Ubrories

SIMATIC Manager Menu and Toolbar


The SIMATIC Manager hos lunctionalily similar to most Windows opplicalions, and as such, its
m enu and loolbar looks and feels much the same. Standard Fife opera lions includ e New,
Open. Close, Save As. a nd Delete. The file, of course is a lways the STEP 7 project or library.
The New Project Wizard. also inc luded in lhe Rle Menu. allows a new project lo be created
with assistance from STEP 7. The Edit menu allows standard Cut. Copy. and Paste operations.
on the currently selec led STEP 7 objec t. If lhe Projec t objec t is selected . then Stations. which
ore contained in projects moy be inserted. copied . cu t. p aste or deleted.

Slep 7 Toolbor but tons, os briefly described below, represent the mosl frequently used
operations or tools of lhe SIMATIC Manager. Toolbar buttons are a va ilable for performing File.
PLC, Edil, and window View operations. There ore a lso buttons to launch some of the
important software tools like the Ne/Pro Ne/work Configuration and Find Active MP/ Nodes.

Tab Ie 2•.
2 SIMATC
I Manoaer T00Ibor Icons.
Icon Toolbar Function Icon Toolbar Function

IQ] Create New Project or library


~ Open Prefect Window Online

~ Open Existing Project or Library


~ Display Objects as large Icons

[I!] Find Active MPI Nodes (:8 Display Objects as Small Icons

~ Open Memory Cord Window [g] Display Project Objects as List

00 Cu t Selecled Object [i] Display Objects with Deta il Info

~ Copy Object to Clipboard


rm Aller Project Objects

[i] Paste Object from Clipboard


~ Open Network Configuration Tool

~ Download lo CPU
~ Toggle Simulation Tool ON/OFF

~ Open Project Window Offline


~ STEP 7 Help

35
STEP 7 in 7 Steps

Project Windows
The SIMATIC Manager allows the STEP 7 prajecl and its objects to be opened and displayed.
When navigating downward through the STEP 7 object tree, when on object containing other
objec ls is o selec ted. the object opens as o folder with its contents displayed in the right-
pane. Object a t the lowest level of o container objec t do not con tain other objects. and ore
always listed in the right-pone. Double-clicking on on object a l lhe lowest level of o
container causes the object to open in its associa ted editor. Block objects, wt1ich ore
con tained in the Blocks folder for example, ore opened in the LAD/ FBD/STL editor, unless the
block was compiled from o source editor, in which case the associa ted editor opens.

Offllne Window
The offline window of o project, displays components of the p rojec t thoi ore contained in
o fmne mes slored on your PG/PC. All or lhe documentation associated with lhe programs
and contigurotion data ot a project are stored in the ottline files of the project. Therefore.
when you go online with o CPU program without the use o f the project. offline commen ts
and data ore not generally available. Although in some later CPU. comments and symbol
address information may be stored in the CPU.

_ 0 X
S- . M41""9..A106
tffl,- ·--............_,.,.......,~.....___,......... ,_,....,__, ·-··-·-'--'-•-.................... - ....___._.... ~•....-...............__ -"•···~
El (ij) ~iMA11C 401(1J
S Iii CPl.l41 3·1 "'--1~~!'! ~9~" ::: ..... ... --~;._ -~.Q.!t ••. ... - .!.~9.~.?0~ .!1-~~3 ....:::
0 0 B1 LAO Or!IOr,,l!ljQn .,. 1112.2003 12:24.SO
I?. !ii] S7 f'loo,,rr{l I OF8100 LAO fU'ICli>n Block 1811 tll03 1114,32
I (DJ So,,c.,. O FCI LAD fu>c:6:rn l&.03.2004 21 5l:J9 Sr.ola Ladder Loi
' 0 Block> f"1Clnn 08.112001 14 3803
O fC2 LAD Sr.cle Ladoo, Loi
O FC3 LAD Fr.noc»n 14 40.05
08.11 .tll01 S.rn,le Ladoo, LOj
O FCIO Bo,c_ Ccunt.!-IS LAO ftndion !la032004 15 45<42 UringCo..,.•180
O FC11 Cci_Ccuit en LAO f u>clron 04 01 tll0111 :n25 E~ • Cotn
O FC12 FBD fu,ct;,n 09.03 .004 15 24:07 Uong Timt< Box I
OFCIOO Sfl fr.nocl:m 31. 12.2003 16:39'24 Smile Laddo1 Lo,

~
0 0 910 DB DatoBlock 13.12.2003 122044

Figure 2-5. Ofnine Projec t Window with detoil view.

Online Window
The online window of o projecl is o separate window that displays the projecl components
that are contained in the currentl y selected PLC sta·tion. An online connection is required in
order lo view lhe conlents of o CPU. or lo work with the projec t online. Some o tmne objec ls
ore not ln the CPU and ore not seen in the onllne window (e.g .. Source files). Comments and
d ocumentation associated w ith a block or o hardware objec t and viewed online, ore
actually stored in the offiine files of the projecl. When you go online with a CPU without the
use of the project, otlline comments and data is not ava~oble. In some later CPUs. however,
certain offline comments and documentation may be stored on the CPU.

~ Malclna Area - c:~Patri<k~S7J:ro~ts~Mak!Ji~ ON.INE f • 1cf'x1


9 ~ Makm!l..Area
El lil) SIMATIC 400(1 )
Oheclnam• I Svmbolio M.. I C.•oted ... I T • I t..a,t modihed I Corr • ·

El JjJ CPU413-1
~ System D~a ·- - soa ·- - '

0 0B1 LAD 0190rizdi... 01.09.2004 13:26:03


El CJ S7P1C9am[l1 O FB IOO LAD Func\ior'I ... 18 11.2003 1114 32
iB iEJtll O FC1 LAD Funclioo 25.C8.2C04 11:10.34
OFC2 LAD Funcliai 08 11.2W1 14 3803
O FC3 LAD Function 08.11.2001 14.40.06
O FCIO
OFC!l
8 0ll.. Coo..ntei:
CoJ_COU'lle<3
LAD
LAD
Functt:,-,
Funcoon
25.oa.2004
18,00.2004
10-55.23
15-45'23
-
O FCl2 FBD Function 00.03.2004 15 24·07
1 I I
"
► r;,
Figure 2-6. Online Project Window with detail view.

36
Wor1-ing with STEP 7 Projects o nd Ubrories

Comments on Working with STEP 7 Projects and Libraries


In your project work with S7 equipment. your initial task will be lo creole a software Project.
The project, a container object for all of the S7-related components of your automation
system, is the basis of all the work you will perform. Whether your project contains one or
several SIMATIC S7 PLCs, each is represented os o Station object that contains a CPU object,
and each CPU contains on S7 Program object.

In building lhe project. you ore essentially creating a framework or the bosic container
objec ts whose con tents will be filled as you perform tater tasks such as configuring lhe
hardware, developing the program, and defining a network. These steps, which are outlined
below, ore described in the examples provided in this chapter. Once you hove created the
project and lhe basic componen ts that it will contain, you w ill be ready lo proceed to
Working with the Hard ware Configurolion, the next step of developing the S7 p roject.

Checklist: Working with STEP 7 Projects and Libraries

• If you will be working pr/morlfy with projects /hot already exist, then you moy
use the Open command from lhe SIMA TIC Manager menu or too/bar to
browse your directory structure and open STEP 7 projects.

• If you ore developing STEP 7 projects, you might-start by creating folders on


your progrommfng system (PG/PC) where S7 Pro/eels ond Ubrarles, will oe
stored. This is on optional task since you may also use STEP 7 default folders
"S7Proj" and "S7Ubs," which ore located under the Siemens\STEP 7 folder.

• You moy also wish to creole o separate folder where archive projects and
libraries may be stored.

• If you ore starting by developing your own project, the first step is to,create or
generate the new project conlofner. trom /he SIMA TIC Manager.

• From the 5rMATIC Manager, use the Options/Customize menu to ensure that
you have defined the target storage paths for your S7 Projects and 57
Ubrorfes.

• Create o Project using the New Project Wizard or Using the New Command.

• If you create the project using the New command, you will need to insert on
57-300 or 57-400 station from the SIMATIC Manager menu; if the Project
Wizard is used, you will select the firs/ station from one of the wizard dialogs,

• Open Hardware Conligurotlon Tool dnd, as a minimum to gel started, insert


the required CPU.

• The S7 Program is generafed when the CPU Is inserted.

• The basic framework of the project is essentially complete when there Is al


least one Station, a CPU, and an S7 Program; you may then begin worldng
with configuring your hardware.

37
STEP 7 in 7 Steps

Navigating the STEP 7 Project Structure


Basic Concept
The STEP 7 objects. o ll of which moy be edited. o re presented in o split window of the SIMATIC
Manager where navigation is much like thal of the WindoM Explorer. Since much of your
STEP 7 work will be done from the SIMA TIC Manager, fully understanding the hierarchy of the
objec ls of a project will simplify and expedite your work.

Essential Elements
The Project object, at the top of the tree, contains the projec t' s hardware stations, and
nelworks; the Station. which represents o PLC, contains the configuration doto for lhe
station' s hardware components. The CP U is contained within the station. along w ith other
programmable modules (e.g., CPs and FMs). Eoch CPU contains on S7 Program; each S7
Program con ta ins a Sources folder, a Blocks folder, and a Symbols object. The Sources fo lder
will hold any text source files that you create; the Blocks folder will ho lds individual blocks
[code b locks and data blocks) creoled for lhe user program. The Symbols object opens too
table of symbolic addresses assigned to absolute addresses used in the program.

Application Tips
Double-clicking on on object at !he !owes! level of a container will open that objecl in its
associated editor. Block objects os shown in the window below, ore at the lowest level ol the
Blocks folder o f a p rogram. Blocks, which will be described in the next chapter, contains STEP
7 code or doto . A block is opened in the editor it was created in [e.g.. LAD/FBD/STL).

fJ.sJMATJC Manttg~, - (N~wJuj -- D:\ 57 _Projt!Ct\.\ New_prj) l!!llil £1


~ Ft.o £d• Insert PlC 'llow Optloos V~ndo,, It>\,

8· N..,J>,I Syst•m data


l;3 fill SIIAA11C l)U1J 081
f:l I
CPU J1s FB◄ l
El ~ 57 Prog1~11 F8◄2
Cii:] Seu1= 6 FC1
e; j:fflll OFC2
lil fill SJIAA11C l)U2J O FCJ
O FC10
OFC20
0D89
0D842
GZ>VATI

Prfflfl lO')OI ~ - f ,},


Figure 2-7. Offline Projec t Window, two Stations; Blocks folder of SIMATI C 300(1) selected.

38
Wor1-ing with STEP 7 Projects and Ubrories

Quick Steps: Navigating the STEP 7 Project Structure


ACTION

1 Clicking on the (+) sign o f lhe Project displays Sl-300 or S7-400 Station objecls
already inserl ed in the project; Stations also contain objects.

2 Clicking on the (+)signor o Station objecl, reveals lhe CPU and o ther
p rogrammable modules already inserted in the station; programmable modules
include CPUs. CPs, and function modules (FMs).

3 Clicking the (+) sign of o CPU object reveals an S7 Program object. Each CPU and
other programmable modules contain a p rogram. You will work primarily with C PU
programs.

4 Clicking the (+) sign of the S7 Program objec t displays a !old er for Sources and
Blocks. The Sources folder will hold un-compiled source files {e.g .. created using the
STL or SCL text editors); the Blocks folder, will hold program code and data b locks.

5 Selecting the Blocks fold er o f a Program displays, in th e right pone, any blocks tha t
hove been generated; OB 1 is generated when the program is firs t generated; you
will genera te other b locks as you build your STEP 7 program incrementally.

6 Selecting the Sources folder of a Program displays. in the right pone. any source files
that hove b een developed; this folder is inilially empty and remains empty unless
you cre a te tex1 source files using a standard or oplionol tex1 e ditor.

7 Selecting the S7 Program displays. in the right pane. its Sources folder, Blocks folder.
and Symbols object. Double-clic king on the Symbols object opens the symbols
editor. in w hich symbolic names for absolu te address ore created and edited.

8 Selecting o CPU object in the tree slruc ture displays its S7 Program folder and
Connec tions object in the right pane. Double-clicking on the Connections objec t
opens the network configuration tool, w here communications connections ore
created or edited for the selected CPU.

9 Selecting any Station objecl will display the station's Hardware configuration object,
and any programmable modules (e.g.. CPUs. CPs. and FMs), already inserted in the
station. Double cllcking the Hordwore object opens the station 's hardware
configuration. allowing you to crea te or edit the s1ations c onfiguration.

10 Selecting the Project d isplay its con tents in 1he right pone. SIMATIC 300/ 400 stations,
H-slo tions: S5 stotlons, PG/ PCs. Other stations, and subnets may also be displayed.

11 The name of any object con be c hanged by righ t clicking on the object. and
selectlng Rename . Simply type over the name when ii is highlighted

12 To edit the general information and comments on any objec t. right-click on the
object and select Object Properties.

13 Finally. selecting View ► Expand All. from the menu. opens the folders of all
container objects in lhe project tree; selec ting View ► Collapse All closes oil
container objec t folders.

39
STEP 7 in 7 Steps

Navigating SIMATIC Manager Menus and Toolbar


Basic Concept
Navigating the menus and toolbor of the Hardware Configuration tool is much like
navigating within the Windows' Explorer- ii hos the same look and feel. Instead ol simply
managing files, however. the SIMA TIC Manager is an object-oriented tool allowing you to
easily work with the objects of the STEP 7 world - objects tha t represent PLCs. CPUs, modules.
netwott.s. and so on. The Nef Pro network configuration tool and the hardware configuration
tools are opened automatically when you double click on on object thot was creoted using
that tool.

Essential Elements
The complete of operations or the SIMATIC Manager may be accessed from its menus.
including File. Edit. Insert, PLC, View. Options, Window, and Help. The toolbar, o set of buttons
position d irectly beneath the menus, provide quick access more frequently used operations.
As you move through the project lree. you will notice that the various command and options
of th e menus and loolbors change to reflect lhe c urrent selection.

Application Tips
Multiple projects may be opened simultaneously, each being p laced in its own window.
Simplify using the Copy and Pos1e commands by opening multiple windows displayed
horizontally or vertically. To copy from one project window you may drag and drop objects
or use Cul/Paste. Make sure that before you pas te. Iho t you select the correct objecl to
which you wish to paste. For example to copy a Station select the Projec t object in both
windows. since stations ore con ta ined within the project and may only be copied too
project. Programmable modules (e.g., CPU. CP, FM), seen in the project tree, may o nly be
copied a nd pos1ed while inside the Hardware Configurolion Tool.

Move your mouse tip across the Icon and View b uttons; a tool lip message defines each.
Show objec ts as: Large icons: as Small icons; as a list: or with Detail information.

'
S l '1AT1C Mar1<1oer · N.ewJut l!lf!iJEJ

Dj~!~l'ifil! 3, l~lli!tl ~ ~~ !!!! •;_.. : :;; ~ Ifill I <No Fi~er >


Figure 2-8. SIMATIC Manager Toolbor.

S,New_prj -- 0:\57_Projects\New_prj ONLINE


e-~ New_p11
;. :;. ; .,_; ,; _.; :_______;:==
SIMATIC 300(1)
-1 □I~

El-Iii] SIMATIC 300(1) SIMATIC 300{2)


:'• ~I ~ CPU316
' I B Q S7 Program(l)
l ' @ii Blocks
; l±I· .ffJ:: CP 343·1
l±l··lfill SIMAT IC 300(2)

Figure 2-9. Online Project Window with detail view.

40
Wor1-ing with STEP 7 Projects and Ubrories

Quick Steps: Navigating SIMATIC Manager Menus and Toolbar

ACTION
'

The Ale menu and toolbor options allow you to work with existing projects and libraries
and lo creole and manage new ones.

I By selec ting File ► Open, you may open o project from the detoull project directory
or browse for o project or library in anotner loca tion on your computer.

2 File ► New, allows you to crea te a project or library in the default or in o new p a th.

Edit menu and toolbor options allows properttes of selected objects such as stations.
networks, and blocks lo be edited, os well as copied dnd posted.

3 To copy a Station, you would select the sta tion then select Copy; clic k inside the
projec t window of the some projec t or In another project and then from the Edit
menu. or using the right-click, selec t Paste.

Selec t any object. right-click and select Object Properties to view its properties.

View and Window menus and toolbor options allow projects lo be viewed online and
ofOlne. adjustments lo Jeon size and window o rrangemenl, and detans given on a
selec ted object.

5 With the NewProi window selected. select View ► Online lo open the online window.

6 Selecting Window ► Arrange ► Vertical, places open project windows side-by-side;


Horizon/al is one above another, and Cascade is shifted so the title bar o f eoch is
visible.

The Insert menu allows the insertion or new objec ts into the selected contoiner objec t.
Only objects that ore correct for the se1ecled container object may be Inserted.

7 Selecting the Projec t fold er, allows new Slalfons. Subnets, or Programs lo b e crea ted.

8 Selecting !he Blocks objec t allows new program blocks (e.g., FB. FC ) lo b e creeled.

PLC menu and loolbor buttons supports online CPU/PLC operations.

9 With the otfline Blocks folder o f on S7 Program selected, selecting PLC ;.. Download
trans fers o ffline blocks to the associated C PU.

The Options menu allows you to set SIMATIC Manager operating preferences, and lo
launch standard and optional tools.

10 Selecting Options ► Configure Network, for example, opens the graphical ne twork
configura tion tool.

11 Selecting Options ► Customize opens the dialogue for setting various SIMATIC
Manager opera ting parame ters (e.g .. storage p ol hs, and language preferences).

41
STEP 7 in 7 Steps

Finding STEP 7 Projects and Libraries


Basic Concept
When a project or library is opened for the first lime, it is added to a list, by the SIMATIC
Mana ger, a nd is therea f1er d isplayed in the list whenever the FIie ►Open comm a nd is used.
S7 Projects a nd libraries may reside on a PC but not d isplayed it they hove never been
opened: they also may not appear in the project or library list if they hove been hidden using
the FIie ►Manage option. You may search on entire drive or selected fo lders for STEP 7
projects a nd libraries tho! may exist. but do not appear in the project or library list.

Application Tips
If the searc h a nd find option is used from a programming edito r (e.g., LAD/FBD/STL), then
only user projects may be searched (and not sample projec ts or libraries). You may search
for User projects, sample projects, and libraries from the SIMATIC Manager. User projects ore
projects tha t you creo le yourself; sample projects are the projects tha t were installed during
lhe initial instollo lion of the STEP 7.11 you choose to, you may adopt and expand any of these
sample projec ts. and re-save os user projects.

Open Project

I I l
User piojec!$ Libfaries Sample projects Multiproiecis J

Name Storaae oath


DP_Proj3 C:\Patrick\S7_Projects\DP_Proj
DP_Proj4 C:\ Patrick\S7_Projects\DP_Proj4
Dummy C:\Patrick\S?_Projects\Dummy
Ethr_300 C:\Patrick\S 7_Projects\Ethr_300
Eth,_400 C:\ Patrick\S7_Projects\Ethr_400
Hrdware
lntcpslv
C:\Patrick\S7_Projects\Hrdwaie
C:\Patrick\S7_Projects\lntcpslv
-
Intelligent_S7300_Slaves C:\ Patrick\S 7_Projects\lntdpslv
Making_1 C:\ Patrick\S7_Projects\Making_1
Making_Area C:\Patrick\S 7_Projects\Making_A

Selected
User Projects: r
Lib r.!!lies:
Sample Projects:
n
[J
Multiprojects; n Browse...
I
OK
I Cancel Help
l
Figure 2-10. Dialog for opening STEP 7 projects a nd libraries.

42
Wor1-ing with STEP 7 Projects a nd Ubrories

Uruw,e •

F'ind in d1ectory. Found Selected


C:\ 32
Liiraries: 4
Select
I Saa.,le Ptojeeb: 18 -
1 i l!l \n My Pietures_2 Mul~ojects: 0
I $ LJ MyPSPBF~t u~, projecti ILibrarm I Sanllle llloiects I Mul~ro,ecb l
i i::l My Re'tUlles
, ! EB L] My T1i9I_P1ogr"m, Name IIStora- - ·th

I
If!3 ~ My Video:
EB a
\tiebResearchS luff
~ DP_P,oj3
~DP_P,oj4
C:\P,,uick\S7_P,ojech\O P_Proj
C:\Patrick\S7_P,ojecls\DP_Proi4
J
~ c;) Shared Ooc'-"'lonla
! lp i,.i Local Disk (C!') l.@Durnrrq C:\Pa1Jiok\S7_Pioiect1\Du~
, iE S
DVD/CD.ffi,/ Drive [D :) li)En!'in& C:\P,,1Iick\S7_Piojecls_old\Engine
CB ~ My Helwoik Places
liJ Etl-._300 C:\Patiick\57_P,ojecls\Eth,_300
~ · My Ooc1.1nenls [ii Ell11_400 C:\P,,lriok\S7_P,ojecla\Ethi_400
[ti-·:, Share~o-Web Uplood Foljer ID!! Hrdwaie C:\Patticl\57_P,ojecis\Hui,vare ~
~ 1....---.L, r.,o........,;_L.,c7 0.....:. . . . ,..,1-~.J -
~ I
Siad Search
I
Caricel

Figure 2-11 . Dialog for searching STEP 7 projects and libraries.

Quick Steps: Finding STEP 7 Projects and L.lbrarles


ACTION

1 Launch the SIMATIC Manager and selec t FIie ► Open. The User Projects tabs lists user
p rojec ts currently in the project fist and ore known to the SIMA TIC Manager.

2 Select the corresponding lob lo d ispla y all known S7 libraries or Sample Projects.

3 Click Browse button to searc h for unlisted User Projects. Libraries, and Sample Projects .

4 From 1he Brow;e dia log. select o specific d rive or folder lo searc h through.

5 Press fhe Start Search button.

6 When !he search is completed. lhe number o f User Projects. Ubraries. or Sample
Projects is fisted under the Found column.

7 Select the appropria te fob lo display fo und User Projects. Libraries, or Sample Projects.

8
~ The check mark symbol. shown to the left of the Project/ library, indicates that the
found entry is olreody in the project or lib rary fisl.

9
~ The symbol shown to the lett of the Project/library indicates that the found entry
was marked as " Hidden." but c on be added to th e project or library fist.

10 Select one or more entries lo odd to the project or library fist; confirm !he selec flo n and
close the dia log with OK.

43
STEP 7 in 7 Steps

Creating a Project using the New Project Wizard


Basic Concept
Before working with your ho rdwore configuration. you mus t create o new STEP 7 project.
Projects crea ted using the projec t w izard will creo le a new project that will contain an S7-300
or S7-400 station based o n your selection. The new sta tion will contain the CPU of your
choice, o STEP 7 program with the main organization block (OB 1), ond any o ther
organization blocks you selec t. You will a lso be able lo set the default language (i.e.. LAD,
FBD, or STL) for creating program blocks.

Application Tips
New p rojects ore placed in the default project p ath for STEP 7 or in the path currently set os
the default path. You may won I lo c reate o new STEP 7 project folder or set o new defaul t
project location prior to crea ting your project. Before completing the lost d ialogue of the
wizard, you m oy backup a nd mod ify any of your selections. Modifications are a lso possible
la ter. inside of STEP 7. o fter the project is generated.

~
IJ Which CPU are Jou using in JOUr project? 2{4)

CPU: CPUT~e I Order No I ...


CPU312C 6ES7 312 58000-0ABO
l!mltl 6ES7 312·1AD10-0ABO -
CPU313C 6ES7 313-5BEOO-OABO
CPU313C-2DP 6E S7 31J.6CE 00-0AB 0
CPU313C-2PlP 6ES7 313·68EOO,Oo.BO
CPU) 14 6ES7 31 4·1 AE04-0ABO .=J
~u name: jcPU312(1 ]
MPt add1e$$ j2 .::J ,-W-o-
·rk-mem--o,.v_.1_6_K_B_;0._2_m_s_/1_0_00_ _ _.....,
instructions: MPI comedlon; single bet
cohligvration up to 8 ~es; S7 -=-I
Ptevie,!!!<<

~--,,-....,,..--=====-·
;, S7_P1ol
,-----"'T""------..-----,
Block Neme I Sumboic Name I
El II S11,IATIC 300 Station 0081 Cycle E~ect.'lion
EJ- 1)CPU312(11
R .:.!J S7 P1og,an(1 )
8 Block1

F:rith I Cancel I__ H_e_lp_ _.

Figure 2-12. Project Wizard , Step 2: defining CPU, CPU name, and MPt address.

44
Wor1-ing with STEP 7 Projects ond Ubror/es

Quick Steps: Creating a Project using the New Project Wizard

ACTION

1 Launch the SIMATIC Manager and c lose any open projects.

2 If th e New Project Wizard does not start automatically, from th e menu. select Flle ►
New Project Wizard .

3 Remove the check mark o n the dialog, to disable the Wizard from opening each time
you start the SIMATlC Manager. ond c lick Preview button to open preview window.

4 Click the Next button lo con tinue the New Project procedure.

5 Select from the CPU Type list, the S?-300 or S7-400 CPU lo use in this project. You may
change the default name of the CPU. displayed in the CPU Name field.

6 Selecl on MPI Address for your multlpolnl inlerfoce connection of this CPU, or accept
the default address of 2, temporarily. and change the address later.

7 Click the Next bu11on lo con tinue the New Project procedure.

8 Select. from the Blocks window. organization b locks you wish generated for your first
program. leave OB 1 (the main cyclical block of o STEP 7 prog ram) checked .

9 Select the language represen1ation (LAD. Ladder). (STL Statement List). or (FBD.
Func tion Block Diagrams) you w ish to use for creating the OBs you selec ted.

10 Click the Next button to con tinue the New Project procedure.

11 In the lino! d io log, type o name for your project. Names longer than eight chara c ters
ore used by lhe STEP 7 software, b ut will be shortened to eight charac ters in Windows.

12 Click the Finish button lo generote the new project, otherwise you may press the Back
button to bock up and moke changes or Cancel to oborl the new p rojecl.

13 Use Windows Explorer to find the Project fold er you created. to verify the neWly
created project folder.

45
STEP 7 in 7 Steps

Creating a Project Using the 'New' Command


Basic Concept
A STEP 7 project is generated automatically using the New Project Wizard. or manually using
the New command . When created monually, you must generate the required objects of the
project. The New command creates on empty projec t folder in which you must manually
inser1 the basic objects of the project. These objects, which you will generate, a re oclvolly
con ta iners !hat will eventually hold the various do lo, such as configurations and programs or
the p roject. Upon completion. you w ill have c reated a project. station, and p rogram
conta iners. The program container ho lds a source files container and a blocks con tainer.

Essential Elements
A project generated with the New command is empty excep t f0t a defa ult MPI subnet
objec t. You must insert al least one PLC station. using the Insert ► Station command. Since an
inserted S7-300 or S7-400 station does not generate o C PU objec t, you will have to open 1he
hardware configuration tool a nd configure the station. at least partially. lo include the
appropriate rock and CPU (i.e., central rock). The Program object. which contains source file
and offline block folder, is generated automa tically when the CPU is inserted into the
configuration. The essen tial objects of the projec t are thereby comple ted.

Application Tips
New projec ts are placed in a directory, currently set as the default project path. You may
wont lo creole a new STEP 7 project d irectory or set a new location as the default prior lo
creating your project. Remember, although STEP 7 supports o long name internally, the
Windows Explorer will use the first e ight characters of your long name as th e projec l file
name. To o void possible problems, you should make o il name changes inside of STEP 7.

~!NewProj - D:\ 57 _Projects\ NewProj Rl!J EJ


•--,tj NewP1oj ·I Pl(l 1I
'-·-··--·"

Figure 2-13. Empty Projec t object ofter using New command.

'~ !NewProj -- D:\ 57_Projects\ NewProj fl!l(!J EJ


e ·· NewProj o 0B1
B !iil SIMA TIC 300(1)
B ·!ii CPU 316
B··@J s7 P1og1am{1l
I
i· (w Sowces
i ..~ 1:n-ra1
Figure 2-14. Complete Project structure. after inserting Station and CPU.

46
Wor1-ing with STEP 7 Projects and Ubror/es

Quick Steps: Creating a Project Using the 'New' Command

ACTION

1 Launch the SIMATIC Manager and c lose any open projects.

2 From the menu select FIie ;. New, or press the New Project icon on the toolbar.

3 Type in o name for the new project (e.g.. Ware house), Remembe<. STEP 7 supports
long names. b ut Windows Explorer will only use 8-cha racters for the actual p roject Fite
name.

4 From the menu, select Insert ► Station ► SIMATIC 300 Station (SIMATl C 400 for S7-400).

5 Click on the (+) sign of the project folder a nd then click on the S7-300 Station. The
hardware object of the selected station is d isplayed in the right pone of the project
window.

6 Double-click on lhe Hardware object. to o pen the Hardware Configuration tool.

7 If the Hardware Catalog is not in view on the screen, select View ► Catalog.

8 Click on the(+) sign of the SIMATIC 300 (SIMATIC 400 for S7-400) catalog objecl.

9 Click on the (+) sign of the Rack- JOO (Rack-400 for S7-400) fo lder lo open.

10 Select lhe Rail (CR or UR rack for S7-400) object. d rag, and drop into the upper pone
of the Configuration Window.

11 Click on the(+) sign of the CPU-300 (CPU-400 for S7-400) catalog object lo d isplay the
CPU porls fo lders.

12 Find the CPU folder Iha! matches your CPU hardware and click on lhe (+) sign to open
the folder. Select the CPU port number tha t matches the actual port number for your
hardwore, ond drag and drop in slo l-2 of lhe rac k In th e configurotion window.

13 From the menu, select Statton ► Save to save the configuration.

14 Return lo the StMATIC Manager lo start working with your project.

47
STEP 7 in 7 Steps

Adding a New Station to a Project


Basic Concept
Once you hove generated o project. manually or using the project wizard. each additional
new station within t11e project must be added using the Insert Station command of the
SIMATIC Manager. A station must be inserted before you con create its hardware
configuration using the hardware configuration utility,

Essential Elements
Station objects that may be added to an S7 project include, StMATIC-300 or SIMATIC-400
station; SIMATIC H-Stofion for redundan t configurations; SIMATIC PC-Station. for representing
a PC or Siemens PG programming system; SS Sta tion . lo represent ea ch SS PLC; or Other
Station. lo represent any non-Siemens system. as port of the STEP 7 projec t.

Application Tips
If several stations of the some type ore required. use of the C ut and Paste features or the
SIMATIC Manager will reduce your work. Simply selec t the station, copy and then pas te in the
right-pone of the project w indow. If the stations will be very similar or identical, however. you
may w ish ·to comple te as much as possible of the configura tion o f the one station p rior to
copying ii to new sta tions.

~ SIMATIC Manager - NewProj l!I~ EJ


File Edit Insert PLC View Options Window Help
Station ► 1 SIMATTC 100 st(ltton
Subnet ►
Program ► 3 SIMATIC H Station
'l SIMATIC PC Station
'i7 5oftwor e ► 5 Other stat!Dn
57a!od
l'/17.Softw!l"'e ,► 6 SIMATICSS
7PG(PC
sy,nbo1-,oo11;,
E'xttrnolSoorce .. ,

Figure 2-1 5. Adding new Stations too Project from the SIMATIC Manager menu.

'~ ~NewProj -- 0:\57 _Projects\ NewProj R@E3


0 l l'IMl'le S ale neme T Size A
~ MP1(ll MPI 2816
!ill SIMATIC 300(1) SIMATI C300 Skltion
!iii SIMATIC 300(2) -• Slt,!AT IC 300 SUltion -
!iii SIMATIC lll(3J SIMATIC 300 S14tion
[iii lfil8:~n·~~:~ ~f -··::::~=~=::~::.=:::=~:::~ $.!MA~):£ ~:§~ 9~. . ::-~·. : ::=~::~

◄ .!.J
Figure 2-16. Project window, ofter inserting four new Stations from lhe SIMATIC Monoger.

48
Wor1-ing with STEP 7 Projects o nd Ubror/es

Quick Steps: Adding a New Station to a Project

ACTION

1 From lhe SIMATIC Manager, open the req uired projecl and select lhe project folder.

2 From lhe menu select Insert ► Station ► SIMATIC 300 Station (or SIMATIC 400 Sla tio n); or
rig ht click on the projecl folder, select Insert ► New Objec t, and selecl a slo lion type.

3 Rig hi-click o n the statio n object, then select Object ► Properties to modify the sta tion
name or o ther properties (e.g.. e nter comme nts on station's functio n in this project.)

4 Click in the Authors field and en ter your name.

5 Click in the Comments field and e nter a description of the slation's role in this project.

6 Confirm dialog by pressing the OK button.

7 Wi th the station installed, you ore now reody to install the required rocks a nd the
modules that will be installed in each. Configuration is done using lhe ha rdware
configuration tool.

8 Repeat Step 2 and Step 3 for as many sta tions as required, or consider creating lhe
entire station module contents first, and then using the c ut and posle features if the
slalions will be similar or idenlicol.

Gene,al j 1nter111C81 I Sellings I

Nome, jSIMATIC300ll J

Project p<1th:

Storage location ID:\S7_Projecis\NewProj


ol the project

Author: jc.T.Jones
Oete c:realed: 16.09.2003 11:18:06
Lesl modified: 16.09.2003 11:18:06
Comment This stalion wiR control !he motOJs for the main and catousel lines, as !'iel -
as all ptoduction tracking c1nd accounting for the -enous~

.:J

I, OK 1 I
Figure 2-17. Ge neral Properties dialog for documenting a SIMATIC 300 slo tion.

49
STEP 7 in 7 Steps

Archiving a Project or Library


Basic C onc ept
To archive a projec t or lib rary is to generate a compressed backup of your projec l or library.
Archiving p rovides a simple way or preserving your work as revisions, al various stages of
development or operations. Creating archives also provide on extra measure of p recaution.
The allow you to make changes lo a project. test the changes. and yet hove a way of
quic kly reverting lo a p reviously operating copy or lhe project.

Applic a tion Tips


For good organization and moinlenonce of your projecls and backups. use or a separole
folder for your archive p rojects is recommended. An archived project c an be retrieved and
reslored as a fully expanded project using the Re trieve option from the STEP 7 File Menu.

Archiving -

I
Usei proje,cts J Libraries Sample piojects I
Name
Ethr_300 D:\S7Course_Pr ojects\Ethr_ 300
Ethr_4DO D:\S7Course_Projects\Ethr_400
Making_Area C:\S7_Projects\Making_A
Mul_CPUs D:\S7Course_Projects\Mul_CPUs
Netw01ks D: \S ?Course_Projects\Networks
Prj300_5 D:\S7Course_Projects\Prj300_S
Prof_300 D:\S7Course_Projects\Prof_300
Prof_400 D:\S7Course_Proiects\Prof_400
ProL3 C:\S7_Proiects\ProL3
Warehouse_1 D:\S7Course_Projects\Warehous

Selected
User Ptojects: 11
Libraries; I,
Sample Projects: I Browse,..
I
OK 1 Cancel l I
Figure 2-18. Archiving dialog for archiving STEP 7 Projects or Libraries.

so
Wor1-ing with STEP 7 Projects o nd Ubror/es

!I lti
--
Save in: j8 S7_Aidwe_Projects

~\akilg_t. zip
~Networks.zip
~ Prj300_s.zip
~ S7 _Pro6.zip
~ s7Projects.~
~ Warehoos.zci

Re name: Sm !
Sa\le as type: jWirZip-Archive (•.~) .:] Car.eel j
/4
Figure 2-19. Dia log for se tting archive name and storage location.

Quick Steps: Archiving a Project or Library

II 1
ACTION

Before using the SIMATIC Ma nager "Archive" menu command to store backup copies
of projects, you moy wont to first review STEP 7 p reference settings for Archiving.

2 Open the StMATIC Manager and If lhe project you wish lo archive opens
automoticolly. because it was the lost project open, then you must first close the flfe
before It con be archived.

3 From the SIMATIC Mana ger menu. select Archive ...

4 Select the appropria te tab and the desired file from " User Projects," "Libraries," or
"Sample Projec ts". w hen The STEP 7 Archiving dialog is presented.

5 Press OK lo continue wi th the archiving opera tion on the selected STEP 7 projecl or
library. The Windows dia log "Archiving - Select an Archive" is presented for naming the
archive file ond the fo lder in which the archive should be stored.

6 Either accept the default d irectory and file name, or c hange as required. The storage
location p resented, is either the folder specified for "Arc hiving " or the lost location
where an a rchive was stored.

7 Confirm the archive operation w ith the Save b utton.

51
STEP 7 in 7 Steps

Retrieving an Archived Project or Library


Basic Concept
To re trieve on archived projec t is to uncompress the a rchive file a nd restore it os o fully
expanded p rojec t thal you can open in STEP 7. You should be aware as to whether or not
the target directory a lready has a copy of the projecl. An existing copy of the projec t will be
oveiwri tte n by the uncompressed archive.

Application Tips
It is important when retrieving an archived project that, when promp ted to do so. you ensure
to selec t lhe project folder where you wish lo hove the retrieved projec t stored. When your
d efault storage path is displayed. you must be careful to select the project path and not the
project file.

I I l

Look in: Ie S7_Archive_Proj

.:J57_Pro6 Wareho_l .zip


~MakinQ_l .zip ~Warehou5,zip
•Networks.zip
~Prj300_s.zip
~ 57 _Pro6.zlp
~s7Projects.zip

File.name: jNetworks.zip Open


I
Files of type: IPKZip 4.0-Arcl,ive (•.zip) 3 Cancel
Id
Figure 2-20. Dialog for retrieving an archived project or library.

~tln!ll'1!11!·HMil· II1:al~D - ~
EE D S7_Archive_Proj
&1 CJ S7_Lbr~ries
I ao
1
'' ' DP_Proj
'
;
I
' DP_Proj4
Ethr_300
Ethr_400
Hrdware
J
! Making_1
'•' l'
. ,i.. Making_A
I
MPI_Prj
MPI_Prj2
1 ~··- Mul_CPUs ..:.I
OK.
I Cen~I I l
Figure 2-21. Selecting destination for restored
project or library.

52
Wor1-ing with STEP 7 Projects o nd Ubrories

Quick Steps: Retrieving an Archived Project or Library

ACTION

1 Berore using the SIMATIC Manager "Retrieve" menu command to retrieve o backup
projec t or library, you may wont to review STEP 7 pre ference settings for archiving.

2 Open lhe SIMA TIC Manager and if lhe p roject you wish to retrieve opens
outomoticolly because of being the lost project opened, you must close the p roject
before it con be restored.

3 From the SIMATIC Manager menu. select Retrieve ... the Windows dialog "Retrieving •
Select on Archive'' is presented lor you to select the archive project file lo restore. The
raider presenled is the loco lion specffied in Archive preferences or in which on archive
was lost stored.

4 From the listed files. select the archive projec I or library file to retrieve.

5 Press Open to continue retriev ing the selected 01chive project or library. The target
projec t/library storage path is presented in the "Selec t Destination Directory" dialog,
along with stored projects.

6 Select the !older in which you wish lo hove the project or library restored; do not select
the project file icon of the project you are restoring.

7 The uncompressed archive will be placed in lhe directory specified under the
Archiving tab under Customize options, unless you specify otherwise.

53
Working with
Hardware Configurations
STEP 7 in 7 Steps

S7-300/S7-400 Hardware Components Overview


The S7-300 and S7-400 controllers are both modular in nature. each built-up from the same
basic types of components. These components include rocks. power supplies. central
processing units. interface modules. communica tio ns processors. signal modules. and
function modules. Each o r these component types. briefly described in the following
discussion. represen t the ports from which you will configure S7-300 and S7-400 systems.

Racks
Each S7-300 or S7-400 is built up using one or more rocks Iha! provides the mounting
mechanism for modules. As o system expands. additional rocks ore interconnected using bus
cables and interface modules (IMs). S7 rock systems uses two busses: o high-speed 1/0 signal
bus (P-bus). and o communications bus (C-bus, or K•bus in some documents). which supports
data transfer to and from communications modules and that connects the programming
interface and CPU with installed programmable modules (e.g.. CPs and FMs). Rocks having a
P-bus only (no C-bus) will only support the Installation of signal modules (SMs) .

Tobie 3-1. S7-400 Controller !CR). Universal (UR). and Exoonsion Rocks !ER).
Rack ShOlt Name Brief Description
Roil (UR) S7-300 Universal rock: o DIN standard roil for mounting all modules.

CR2 S7-400 Controller rock: 18-slot with two-segments (10-slot/&slo tJ.

CR3 S7-400 Controller rock: 4-slot, not suitable for redundant P.S.

ERt S7-400 Expansion rock; tS.slot, no C-bus.

ER2 S7-400 Expansion roc k; 9-slol, no C-bus.

URI S7•400 Unlver'sol rock: 18-slot, support for all modules.

UR2 S7-400 Universal rock; 9-slot. support for all modules.

UR2-H S7-400 Universal rack; Two 9-slot segments (18-slots). Supports


compact configuration with standard or redundant PLC systems.
Note: No C-Bus implies that o nly signal modules ore supported in the rack. CR2. ER I, ER2. UR I .
and UR2 ore all available with and wi lhoul support for redundonl power supply.

S7-300 Rack
The S7-300 rock is a standard DIN Rail. The rail is available in d ifferent lengths and is used lo
configure both central and expansion rocks. Before o module is installed. you must insert the
molded U-shoped bus connector, p rovided w ith each module. in1o module's right-edge.
Each module is installed by hooking it onto the top edge of the roil and firmly pressing
downward until snapping into place. With each module in place. the right-edge of the
connec tor, which extends out from the module will insert Into the tell-edge of the next
module. thereby forming the S7-300 backplane bus. The bus is daisy-chained from module-
to-module starting with lhe CPU. In the S7-300, o central rock and three e)(pansion rocks may
be connected. using the appropriate interface modules.

S7-400 Central. Universal, and Expansion Racks


The S7-400 offers three types of rocks from which to selecl. Controller rocks, designated (CR).
allow CPU and all module types to be installed. Expansion rock (ER). having a P-bus only, only
support installation of signal modules. Universal rocks /UR/, as lhe name implies, support all
module types and may serve either as o controller or as on expansion rock.

56
Working with Hordware Configurations

Controller rocks ore designed with o bockplone that is divided in two segments - each
segment having nine slots. The controller rack {CR2). w hich supports both the P-bus a nd C·
bus. will allow a CPU and its associated 1/0 residing in each segment to operate in parallel,
but independently. Universal racks include the UR 1. UR2. and the UR2-H. The UR2-H must be
used In S7-400H systems. but may also be used for standard S7-400 systems.

Interface Modules (IM)


lnlerfoce modules //Ms) allow the S7-300/S7-400 systems to expand beyond the central rack,
forming local or remote configurations. lhe selection of IMs requires a publisher/receiver pair,
os shown in the table below. Pubfisher inferfoce modules are always placed in lhe CPU rack
while receiver interface modules are placed in expansion racks. Each interface module pair
is selected based on the distance that rocks must be localed and whether or not the rocks
must support installation of communications processors (communica tions bus is required).

Table 3-2. S7-300/S7•400 Interface Modules (IMs) ror local and remote 1/0 exoansion.
Interface Module Pair
Brief Description Distance
CPUIM Exp. RacklM
IM 365 IM365 S7-300 Local Expansion (1 -Tier Max. Expansion) I m

IM360 IM 361 S7-300 Local Expansion (3-ner Max. Expansion) 10m

IM 460-0 IM 461-0 S7-400 Local Expansion: No sv transfer. C-bus. Sm

IM4~1 IM461·1 S7-400 Local Expansion with sv transfer; No C-bus 1.5 m

IM 460-3 IM 461-3 S7-400 Remote Expansion; No sv transfer; C-bus 100 m

IM 460-4 IM 461-4 S7-400 Remote Expansion: No sv trans.: No C-bus 600m

IM 463-2 IM 314 S7-400 Remote Expansion using S5 Rocks & 1/0 600m
Note: No C-Bus implies that only signal modules will be supported in the expansion rock.

S7-300 IMs
The S7-300 may be expanded up to a maximum of three additional racks for o total of four
tiers. Expansion lo a maximum of one oddi1ionol lier ftolal of 2) is accomplished using the IM
365- two interface modules permanently attached by a fixed coble length of l meter. One
lnlerface module Is placed in the central rock {CR) and the other in the expansion rock (ER).
A maximum of eight modules may be placed in the expansion rock. Expansion up to three
additional tiers (total or 4) is accomplished using the IM 360/IM 361 combination. A single IM
360 is placed in the central rock (CR) and a single IM 361 in each additional expansion rock
(ER) . A maximum ot three expansion racks may be installed and a maximum of eight
modules may be placed in each expansion rock.

$7-400 IMs
The S7-400 supports centralized 1/0 expansion from 1.5 meters to 3 meters and remote 1/0
expansion up lo 100 meters. using interface modules (!Ms). In Tobie 3-2, both the IM 460-0/IM
461 -0 and the IM 460- 1/IM 461 - 1 publisher/receiver interface module pairs support local
expansion. The IM 460-3/IM 461-3 pair and the IM 460-4/IM 461 -4 pair both suppor1 remote
expansion. S7-400 remo te 1/0 expansion up to 600 meters may also be configured using
existing or newly inslolled SS 1/0 rocks that ore connected using the IM 463-2. Altogether, o
maximum o f six interface modules o f any combination may be p laced In lhe central rack.
The IM 460-3 may be installed in the central ro ck with up to a to tal of six o ther interface
modules to form any combination of local and remote 1/0 ex.pension.

57
STEP 7 in 7 Steps

Power Supply (PS)


The power supply provides lhe inferna l operating voltages required by a rock a nd its
c omp lem ent o f installed m odules. The short name o f S7-300 pow er supplies is PS 307; the S7-
400 hos both PS 405 and PS 407. Like with o ther S7 short names. each of lhese short nam es
represent several port numbers. The PS 307 power sup p lies oil req uire on inp ut supply volta ge
o f 120/230 VAC a nd o utpu ls 24 voe to the C PU and other Installed modules. The unique
features of each power supply co n be determined when the port number is selec ted in the
ha rdware ca ta log . If on S7-400 power supp ly is selec ted for its redundant-use c a pability, it
must be insta lled in o roc k that supports this fea ture. In the hard ware ca ta log these m odules
for the S7-300/S7-400 ore in folders PS-300 and PS-400 respectively.

Ta b le 3-3. S7-300/S7-400 Power Suooly (PS} Mod ules.


Module FamRy Input Outputs
PS 307 S7-300 120/230 VAC 24 VDC/2 A

PS 307 S7-300 120/ 230VAC 24 VDC/5 A

PS 307 S7-300 120/230 VAC 24 VD C/ IO A

PS 407 Sl-400 120/230 VAC 24 VDC/.5 A ; 5 VDC/4 A

PS 407 S7-400 120/230 VAC 24 VDC/ lA; 5 VDC/10 A

PS 407 S7- 400 t 20/230VAC 24 VOC/1 A ; 5 VOC/20A

PS 405 S7-400 24 VDC 24 VOC/ .5 A; 5 VDC/4 A

PS 405 S7-400 24 VDC 24 VDC/1 A; 5 VDC/10 A

PS 405 S7-400 24 VDC 24 VDC/ I A ; 5 VDC/20 A

Central Processing Unit (CPU)


Central processing unit (CPU) modules ore responsible for storing the control p rogram of S7-
300/S7-400 conlrollers in its memory. a nd thereby managing the control o f the associa ted
mac hine or process. In lhe hard ware catalog these mod ules for the S7-300/S7-400 a re in
folders CPU-300 and CPU-400 respeclively. S7-300/S7-400 CPUs o re further grouped into
subfold ers ba se d o n fea ture c ategories a s b riefly described in the table below .

Table 3-4. S7-300/S7-400 Cen tral Processina Unit Mo d ules /CPUs}.


Short Name Brief Descrlpflon

CPU 3l x-x S7-300 Standard CPUs

CPU 31x-x IFM CPUs with integrofed 1/0 Functions (e.g .• d lgftol/analog. HS covnters)

CPU 3l x-x DP S7-300; CPUs w ith integrate d Profibus DP (DP m a ster/DP sla ve p ort I

CPU 31xC S7-300; Compact CPUs with integrated 1/0 Functions

CPU 3 l xF S7-300; Faull Tolerant C PUs with in legrated i/0 Funclions

CPU 4lx-x S7-400 Standard CPUs

CPU 41x-x DP S7-400 Pro fibus DP CPUs; CPUs with in leg rated Profibus DP master.

58
Working with Hordware Configurations

Signal Modules (SM)


Signal modules include the various digital and analog inpu t and ou tput c ircuit cards used to
interface standard current and voltage signals to the S7-300/S7-400. As a whole signal
modules odapt incoming signols or outgoing signals to the proper levels, Both the S7-300 and
S7·400 provide digital inpul (Dl-300/D1-4001 modules. digital outp ut modules (D0-300/D0-
400), onalog input modules (Al-300/Al-400). and analog output modules (A0-300/A0-400).
The S7-300 also offers digital and analog modules that contain both inputs and ou tput circuits
on the some module. In the hardware ca talog these modules ore in folders D1/D0-300 and
AI/A0-300.

Function Modules (FM)


Function modules ore intelllgent 1/0 modules. designed to perform complex or time-critical
1/0 tasks independent of the CPU. Typical function modules included closed-loop PID control
for standard and temperature loops; stepper- and servo positioning conlrol, and high-speed
counter functions. Programming of function modules is simplified though the use of
supplemental software used to configure the application parameters of the module. and the
colling or slondard Function Blocks (FBsJ lrom the user program. tn the hardware catalog
these modules for the S7-300/S7-400 ore in folders FM-300 and FM-400 respectively.

Communications Processors (CP)


Generally, two types ol communicalions processors for es tablishing links between fhe PLC
and other intelligenl devices - including other PLCs. The first class of communication
processors supports local Area Network (LAN) connections, for communication among
multiple S7 PLCs and other devices on the some medium (e.g .. /ndvstriol Ethernel. PROF/BUS.
and AS-I). The second class ot communica tions p rocessor is used to form an end-to-end serial
link between an S7-300 or S7-400 ond one other device. These are called point-to-point CPs,
linking the S7 PLC with devices such as message displays, opera tor workstations. PCs. bar
code readers. p rinters. or even ano ther PLC. In Iha hardware catalog these modvles for th e
S7-300/S7-400 ore in folders CP-300 and CP-400 respectively.

Multipoint Programming Interface (MPI)


The multi-point programming interface (MPI) serves two functions: first. it is the primary
programming interface to all S7 CPUs. communications processors (CPs). and func tion
modules IFMs). Each S7 CPU, CP, FM and operator panel (OP), has an integrated MPI port
which serves in the direct connection for programming these programmable modules. In
addition to being a programming interface. the MP! interface may serve as a low cost
network, supporting small amounts of data exchange among connected MPI nodes, without
lhe need for network modules, As o network MPI supports up lo 32 nodes. uses the some RS-
485 cable components, media. and connection meth ods as Profibvs. By placing a
programming system (PG/PC) on the MPI subnet, all nodes with the MPI interface may be
accessed for programming.

PG/PC $7-400
O P Devices
ca OM

:::
'"
'"
'"

S7·300 S7·300 S7·300

11111,11111 1111111111
Figure 3-1 Mutti-Poinl Interface programming interface and network.
111111111:1
59
STEP 7 in 7 Steps

The Hardware Configuration Tool


In STEP 7. c reating a configuration of the hardware is to create a software model of the
actual hardware components or the 57 system. The configura lion includes the arranging of
local and remote racks. along with their interconnecting interface modules (IMs); the
installing of modules in each rock. including CPUs. CPs. SMs. FMs: and Profibus distributed 1/0
drops. Configuration also involves module addressing and the se tting of module parameters.

Configuring the Hardware


Creation of lhe hardware configuration requires lhe Hardware Configvrotion Tool. which is
storied from the SIMA TIC Manager. After o station is created. the configuration tool is
launched by opening the Sta tion folder and then double-clicking on the hardware object.
With the hardware configura tion tool. an object model of your actual hardware
arrangement is developed. with each component of your hardware installation having o
matching object in the hardware configuration. Once developed, o configuration may be
copied to other STEP 7 projects. modifying it as required.

The completed configura tion is checked for errors. compiled and then saved. The
configuration is saved lo the System Doto object. which is p laced in the ofnine Blocks folder.
The System Doto object may then be downloaded lo the CPU. thereby providing lhe CPU
with comple te information of the hardware configuration. The CPU in turn transfers
con figuration parameters to the installed modules. Once created and downloaded. the
hardware configuration is a powerful diagnostic tool. The status of all configured
components may lhen be viewed online, showing lhe correct or malfunctioning operation.

Menus and Toolbar


Menu headings o f the Hardware Configurol'ion tool include Station. Edit. Insert. PLC. View.
Options, Window, and Help. Station operations allow you to create, open, save, compile and
check the configuration for errors. Standard Cut, Copy. and Paste operations from the Edit
menu or from the righ t click allow racks. modules and other station objects to be edited as
required. Standard online opera lions such os configuration upload and download.
monitoring and diagnostic tools ore supported by PLC operations. View and Window
operations allow components of the configuration window lo be displayed. hidden. or
arranged to your convenience. The toolbar buttons. listed below. represent some o f the most
frequently used menu operations, and buttons tha t launch other STEP 7 software utilities.

a e 35Hd
Tbl • • or wore C on f'iauro I'10n T00lbor Buttons.
Icon Toolbc:w Function Icon Toolbar Function

~ Create New Sta lion in Project


~ Paste Objec t

~ Open Station Olfline Wlndow


-
i] Download Station Configuration

[E... Open Station Online Window


ill Upload Station Configuration
> - e

[!] Save Configuratron


~ View Address Overview of Station

l~r&I Save and Compile Configuration [m]


-
View Hardware Ca talog

~ Pfinl Station Conflgurolion


~ Open Nelwork Contigurotfon Tool

~ Copy Selected Object


~ STEP 7 Help

60
Working with Hordware Configurations

Hardware Catalog Window


The hardware ca talog window con tains the various component objects used to create a
conflgurotion of your oui omo tion solution. When the configurofion tool is opened, the
catalog, which con be hidden fro m view. con be displayed by selecting View ► Catalog
lrom the menu. You Dock and undock the ca talog by double-clicking above lhe word
"Profile" if the w indow is docked or in the titl e bar if un-docked. When undocked. you con be
resize the window and move it around to suit your convenience. You may dock the catalog
on either the left side or the right side or the configura tion window by dragging and dropping
ii on the left or right edge o f the w indow.

The major componen t con tainers of the ca talog. Profibus DP. Pralibus PA . SIMATIC 300,
SIMATIC 400. S/MA11C PC Based Contra(. and S/MATIC PC Stafion, ore p resented in o tree.
Profibus-DP and Profibus-PA containers include port for DP or PA slave devices. The SIMA TIC
300 and SIMATI C 400 containers each contain lolders of the various port numbers for rocks
and modules used lo build on S7-300 or S7-400 configuration. The subfotders of the S7-300
and S7-400 hove similar names and include individual folders that contain communications
processors fCPs) , central processing units (CPUs), function modules (FM). interface modules
IIMs). power supplies (PS), module racks (Rock), and signal modules (SMs) .

.:J
;,
I;. l!!J. FAO'IOUSOP
~RO'lllUSf'\
.e,... ''"";,,; .:l
~N <! I{ ))) ~
(ll :,i CT • 1'110~6~S~
1• ,:) CP·:X:C I- Iii SIii,'>11: Xl)
' 1➔ ·:J CPU•:X:C GI CJ C7
,. ,::::J rw-JOO (:) CJ Co· ).1)
,~a c.~,~ F-Q ceu.x-o
,. :::i ,_.:,;o ~ D fl-1.JOO
L~ :J t.17OOOOOf $ tJ (i, 1(,,-....;>
t--i-2] P$·lXI :!! CJ It.I A.0

1 ➔ W n>i:~.JOO
"'a u;o:1[Hg()r,
hf ZI SM•)XI t---0 l'ri·XO
~ l:.J Rl"i:t•XO
·• Bll $1-<A1" .» s; CJ S~·JJJ
c• ·: J CP·<OO e Ii 111,,.11: .oo
l<f O CPU-COO
•Q cP,l(Q
'" ·:J F1<·100 t- 0 Cl'U•ICll
r➔ Cl J)..MCO
14 ·: J 1-11-fXl OOION ;,. CJ Fl-' <OJ
,. ·::J p;.,oo [',(JIMIC!O
,-·.:J R'-C~-IIO ,;.,.CJ M1(X10f$10N
Ct!. 1:...J SM..._"n
;, U PS,<lll
I ID S'NA1ICPI~Eu..w10.,1ui.3n'atl u, U PACT. ,l(J)
± a S1,t,,1icFCSl,o;,, [,; CJ >'< :))
?:-if SIU.A.Tl: rc&1~Co-11:l:Ol/4Xl
~-8 SIIMTl; F C -

Figure 3-2 (oJ Hardware Catalog Le tt-Docking. (bJ Hardware Catalog Un-Docked window.

61
STEP 7 in 7 Steps

Station Window - Rack Arrangement Pane


As you develop your configuration, the upper pane of the station window will contain the
cen tra l and expansion rocks of o station os well os a ny Prolibus-DP distributed drops. During
sta tion configuration, rocks {including DP/PA slave drops) are selected from the catalog ond
dragged and dropped into the station window. Each rock is rep resented o s a 2-column
table showing the empty slots where modules w ill be Ins lolled. Proribus-DP distributed drops
are shown as symbol objects, based on the type of drop (e.g .. modular or integrated) .

As the configura tion is developed and comple ted, the arrangement pane will show the
interconnection between interface modules in the central rack and in each expansion rack;
P drops will be shown connected too DP master. As the configurotlon progresses. each new
station is opened in o separate station window. Multiple sta tions may be opened
simultaneously and components may be copied and posted between stations.

Station Window - Configuration Tables Pane


When a centra l rack, an expansion rack, or a DP station is selec ted in the upper pone of the
station window, a detailed view of Its contents is displayed in o configura tion table in the
lower pone of the station window. Each slot and the module ii con tains ore listed in o row of
the table. Tne columns include information such as slot. module, order number, address , and
comment. STEP 7 aulomotlcally as.signs module addresses. which may be modified if the
station c an be addressed freely.

~IIW Conflu · S7400_Loc4'_t.xl)4llsa:,n ..r-1£1


!l,t101 f,tf r"~"\ I\( ~ (t) ~r'~ ~'/fllt tiJJ
Dl~ !i ,ja l~~- itolP,I • l• I ~lllll ~~
~ .. ,__, .:J
C, ~Of'SU> o-.;.
-Iii S,IW'-l IC 3)j
moroo:,.P,\ fS --7 IQ) P5 -U'!7 I C,.
!.:f
13 Iii ~"""" .r.J) 3 , 3 :) ,
,
,. Cl CNll
j !J CF'U<L'JJ ',;
5

~
•5 ' ~
• u IM·«IO ~,i.u: >t· G
7 001~2 '' ' '' 6

,'
• ::, ~ --00
I[ ~ M)EXl f'.SCltl
rs- :J M ..t'.O 1\
• OOJWC: L
,-
8
. II '~""'°
8
~

~ 1M <SJ<) t 1!1 IN<&l-CI


8
,~ "61.(J
~Q R/•0:-1);)
lil CJ 511--,UO
r,, 111 Sl""TICl'CO,,.ac-cl
• ~
ill .!I, ~W<TICFCS"'""
. .,... , ,ii U!\2

1~-·
r~:11: CFtldl&I
01d:11MtOCf
-", tW U..tLU~

-
t.£S7t16. - ~
r-- ~fhdchot

3
I ;i,:i::-~, O..dor.ff c.,,.,... I


5
..'8lV
DnQAC l 1'11
6£S 7 <t'O OW1J111,110
«s l <.<"1 ~CflOOOO.O
16:lti:I
Q 1
011&,e,C ,1:,,
'
1
6
001~w.12U\l'rJA.
DO l&i'C lJJ·UI>,'11>\
r.lSl <:!1 U H-
W:Sl 122'51:HOOOISO
as, <.'2&H000'\90
• !
.,
s
"

t-

Figure 3-3. Hardware Con figuration tool with docked catalog window: p rojec t window with
rock arrangement in top pone and configura tion table of selected rack in bolfom pane.

62
Working with Hordware Configurations

Comments on Working with Hardware Configurations


A well-plonned and documented hordwore configurolion will help to ensure o smooth
installation and start-up of your hardware. II will a lso enhance the maintenance task toter.
Tasks associated with configuring your hardware ore truly straightforward ond simple. If done
with o keen eye for detoll, the Hardware Configuration w ill pay huge dividends toter in terms
o f start-up and its ability to provide fast pinpointing of process or system-related roulfs.

Regardless of your actual station hardware or arrangement - you con accomplish the
configuration task using the following checklist. Several configuration examples ore
presented in a step-by-step manner, in the remainder of the chap ter. As you use this chapter
keep in mind that, while there ore examples or practically every type of configuration task.
you only hove to be concerned with your configuration. Once the configuro lion is
comple ted or at least completed to the point needed lo estoblish online communications
with a CPU (e.g., central rock configuration), you'll be oble lo download your configuration
and then proceed lo the next step or Working with the STEP 7 Program.

Checklist. Working with Hardware Configurations


• Add stations as required from the SIMATTC Manager (e.g.• Insert .:,.. Station »
SIMATIC 300) to mdtch the octuol lnsto/lolion.

• Open the Hardware Configvrolion Toot and do /he lo/lowing task.

• Create Centro/ Rock Configuration lo match actual ins to/Jotion.

• Configure loco/ 1/0 racks to match the actual instollation.

• Configure remote //0 rocks -to mo/ch the actual insloflot/on.

• Configure Profibus DP stove drops 1o match actua l ins/a/la/ion.

• Insert ond arrange modules to motch actual inslal/ation


(e.g., PS, CPU. /M, CP, SM, and FM modules}.

• Modify defauJt 1/0 address assignmen/s if required.

• Modify default module parameters If required


(i.e., CPU. CP, SM, and FM).

• Use Symbols editor from the Hardware Conflgurafion too/ for fast assignment
of symbolic addresses lo Input/Output addresses.

• Perform consistency check for errors in hardware configuration.

• Save and compile the hardware configuration of each PLC.

• Download the hardware configuration lo eoch PLC.

63
STEP 7 in 7 Steps

Navigating the Hardware Catalog


Basic Concept
The ho rdwore cotolog con ta ins the component objects used to configure your S7-300/S7-400
systems. As you initially build your configura tion lo match the hardware a rrangement, or as
you edit the configuration to reflect added componen ts. you will select these parts fro m the
hardware ca ta log, Each catalog object is defined by o unique port number tha t is the some
for the ac tual port. As you learn to navigate the catalog you will become increasingly
fa miliar with the application. capability, and nomenclature of S7-300/S7-400 components.

Essential Elements
Like project components, d isplayed in the SIMATIC Manager, components of the hardware
co1olog ore presented in o tree structure comprised of object containers. The major
con ta iners include Prollbus DP, Prollbus PA, SIMATIC 300. SIMATIC 400, SIMATIC PC Based
Control, and SIMATIC PC Statton. When a container is opened, its parts categories are
displayed as fo lders. The SIMATIC 300 container. for example, contains CP-300, CPU-300, FM·
300, IM-300. PS-300, Rack-300, and SM-300 folders. Hoving basically the same categories, the
StMATIC-400 folders will ho ve similar na mes ending in 400 (e.g., CPU-400). As you navigate
toward o specific port, you may actually traverse two or more levels of fo lders that further
categorize the parts. Whenever a cototog folder o r porf is selec ted. a brief description
appears in the bottom pone of the catalog w indow.

liMtit¼SiiidtiiD[,t .!!1
I
E,<4- St.Y'dol d 3 f,o(Je Is,.nd.,d 3
w.-
1E
.±.
-\\l ffiOFlBUS•PA
!iii
IJil
:t IJil
SIMATIC 300
SIMATIC: 400
SIIIIATICFC8asedCon11ot
~=:~~~~i~A
~ PROFIBUS DP

. l±l -CJ C7
13 CJ CP-300
!£ SIIIIATICFC St•lion ooCl CFU-m
l!J CJ FIA -300
lilD G«eWo"J
£:JO IM·:JJO
l!l :::J M7•EXTEHSION
13 0 PS-300
' ~ 1'$307 10/>.
r· PS 307 2A
I'S 3075A
W·CJ AACK-3:0
13-CJ SM-~
8 lifl) SIMATIC ~00
! f:!l-CJ CP-,oo
I w-D CFV-400
I 00 Cl fM-400
tiJ CJ IM•400
Bl-CJ M7-EXT ENSION
SD PS-400
I l!l O AACK--400
i l!l CJ SM-400
!E·lii) SIMATIC PCBa•ed Ccrtrcl
~ -J;il. SIMATIC PC St~ion

~·======--~
.!.I
•I I

f'flOFIBUS•OPll•••• ro,
SIMATIC S7, M7, ,11ld C7
PROflBUS-OP 1low.o l'a
SIMAJlC 57, M7, ond C7
t.S:Uibuled ,dek) lch~Wed r<1c~I

Figure 3-4. Hardware Cotolog, first displaying main object containers,


then displaying opened SIMATIC 300 and SIMATIC 400 object containers.

64
Working with Hordware Configurations

Quick Steps: Navigating the Hardware Catalog

ACTION

1 With the Hardware Configuration tool open. selec ting Vie w ► Catalog displays the
catalog if it is not already onscreen.

2 The co to log may be docked or undocked and positioned for your working
convenience: Double-click on the title bar of the catalog window for un-docking.

3 To dock catalog on the left side. drag and drop onto the main window's left edge.

4 To dock cotolog on the right, drag and drop onto the main window' s right edge.

5 From the hardware colalog. click on the plus sign (+) of the SIMATtC 300 or the
SIMATIC 400 object to access its component folders ond porls.

6 Some folders, for example the CP-300 and C P-400, will hove more lhon one level o f
subfolders to further categorize the components. CP folders include subfolders for
Profibus. Industrial Ethernet. ond Point-to-Point communications processors.

7 Selecting any folder or sub folder displays o brief description of its contents in !he
bottom pane o f the catalog window.

8 Select o specific component in order to view its port number and a brief description
of its features in the bottom p one of the catalog window.

9 Open the Rack-300 or Rack-400 folder. to view and select module rocks. The S7-300
has a single rack type. S7-400 rock types include: CR. for central racks. ER. for
expansion rocks: and UR, for universal rocks (usable as central or expansion rock).

10 View and select power supply modules In the PS-300 or PS-400 folder. Th e S7-400 has
subfolders for Standard and Redundan t power supp lies: ils DC power supplies are
prefixed with PS-405 and AC power supplies are preflXed w ith PS-407.

11 Open the CPU-300 or CPU-400 folder and subfolders. to view and selecl CPUs.
Subfolders con tain , tandord and Profibus DP (DP) CPU modules: !he S7-300 also
contains poinl-to-point (PIP ) and integrated function (IFM) CPUs.

12 View and select interface modules for local and remote rack expansion for the S7-
300 in !he IM-300 folder or for the S7-400 in !he IM-400 folder.

13 Open the FM-300 or FM-400 folder. to view and select function modules. Subfolders
contain modules for Cam. PIO. High Speed Counler, and Positioning control.

14 View and select signal modules in the SM-300 or SM-400 folder. Both folders include
subfolders for digital input (DI). digital outpu t (DO). analog inpul (Al). and analog
outpul (AO). The S7-300 also contains folders for dlgilol inpu l/output (DI/ DO) and
analog inpul/output (Al/ AO) modules.

65
STEP 7 in 7 Steps

Navigating the Hardware Configuration Menu and Toolbar


Basic Concept
The Hardware Configuration tool is on object-bosed tool tha t supporls easy configuring of
hardware sta tions. During use, one or more sta tions may be opened simultaneously for
viewing or tor editing . In addition to facilita ting offline stalion configura tio n. established
configurations may also be opened ontine for monitoring and diagnostic purposes.
Information a nd data on programmable modules Including CPUs. C Ps, and FMs may a lso be
viewed and modified while the sta tio n Is opened online.

Essential Elements
The complete o p erations of the Hardware Configura tion too l ore accessed fro m its main
menus includ ing Station, Edit. Insert. PLC, View, Op tions. Window, a nd Help. Toolbor buttons
allow quick access lo more commonly used commands. Edit operations a llow you to copy
and pasle rocks and mod ules, a nd to edit other object p roperties. The PLC menu supports
online func tions with the CPU and other p rogrammable modules. View and Window me nus
allow manipulation o f fhe main and station windows and p rovid e access to each sta llon's
1/0 address usage. Finally, the Options menu supports customrzing of the configuration tool
and access to optional tools (e.g.. Symbols Editor, and Ne twork Configuration).

Application Tips
Display multiple windows horizontally or vertically. lo simplify use of d rag and drop or111e use
of Copy and Paste. For example to copy a rock select the ra c k a nd paste in the same
station window or drag and drop in another sta tion window. Modules (e.g ., CPU, CP, FM. SM,
and PS) may also be copied and pasted to the some rock or to onolher rack (i.e .• loble).

Station Edit Insert PLC \liew Options Window Help

Dl~l~~lfil l~nl ~ ~l@l • t• I ,Ellmn ~~


Figure 3-5. Hardware Configuration Menu and Toolbar.

[utiW Co<>fiq SIMATIC 300( I) l!f~EJ

l!IGJ El
~ 1s,.nd.¥d ..:1 ::.lstMATI( JOO(I) ([onfigmolion) -- New_p,j
r-==;-;;:,;;:::c--J p (OJUA
r, PROneusoP 1
~ ~- - -
PS :Jl15A
\\' PfflJflBUS.PA 2 CPU316
BIili SIMATICXO )
,: •.'.::) C7
on6l<6C1 l!N
'-. '.::) CP~O
::. ::J CPIJ-:o:J
'
5 D111oo'C12W
6 D0l6'«\C12W/Q5A
"- ::_, fU-300 7 D'.)16,d\Cl 21);/QSA
,£ '.::] G•tE'Nd)I
~
8 Al2t12Bl
• '.::J IM·Dl •
"- ::,i M7-00ENSION
:,: =:J PS-300
:;. CJ RAU·llO ~~ !OJ UR
'+: CJ SM·lOO
!iii SII IATIC400
aijJ SII IATICF'CB••odC
If; Ji SIMATIC FC Sl<>'i:>n
• .tJ 4 D116cAC120V 6£57121-IEHOMIAA
5 0116,ACI 20\I 6ES7 321-IEHOHIAA 4••5
ls 6 00 16'<ACI2(1,// 0. 6ES7322-IEH01·MA i 8...9
PROABUS-0? da,...,,
la, SIW.TICS7. M7.

-
Md Cl (dl!l1il>tted racl(J
7
8
DOl~CIZW/0
Al2'c12Bl
6ES7 :1l2-1EHOHM
6CS7J31·71':B82-0ABO WO. l2'J
12...13
.,
AOSS Fl lOQl!ltlob,

Figure 3-6. Hardware Con figuration Tool: Ca ta log and Station Configuration windows.

66
Working with Hordware Configurations

Navigating the Hardware Configuration Menu and Toolbar


ACTION

The Station menu or toolbar options allow you lo wor1< with exisfing Stolions online or
offllne; to creole new sto1ions and to save and compile completed conligurotions.

I Selecting Station ► Open allows you to open a station configuration rrom the
current project, or browse and open o station configuration from another project.

2 Station ► New, a llows you to create a station in the current or in another project.

3 Press the Online <► Offllne button lo switch the stolion between onllne and offline.

The Edit menu and toolbor op1ions allow copying and pasting of racks and
modules, os well as viewing and editing o f a selected object's properties.

4 To copy one or more modules selecl the modules. then selecl Copy; selecl a slot in
the same rock or in another rack, then select Pa ste from the menu or the right-click.

5 To copy a whole rack. you would click on Its litle bar ond select Copy; click
anywhere inside lhe configuration pane of t11e some sta tion window or inside
another station window, then select Pa ste using !he menu, or the right-click.

6 Select any objecl then right click and Objec t Properties to view its properties.

The PLC menu and toolbar allow configurations to be uploaded or downloaded.

7 Once a station is configured and compiled without errors. selecting PLC ►


Download allows the slotion lo be downloaded over on established connection.

8 Selecl PLC ► Upload lo upload lhe PLC configuration to lhe programming syslem.

The View and Window menus allow viewing of a stollon's assigned addresses. and
the arranging or station windows and rocks to suit your working convenience.

9 If multiple station windows are open. they may be arranged accordingly by


selecting Window ;. Arra nge (Cascade, Vertically. or Horizontally). from the menu.

10 Selecting View. allows you to show or hide the hardware configuration tool's
Ca talog, Taolbor, or the Status Bar.

Options allow Hardware Configuration tool preferences lo be customized and


optional toots like the Symbol Editor and Ne1work Configuration to be launched.

11 Selecting Option s ► Customize. for example, opens the dialogue for setting various
display and operating parameters o f lhe Hardware Configuration tool.

12 Options ► Configure Network opens the tool for configuring networks; Option s ►
Symbol Table opens the symbolic address editor.

67
STEP 7 in 7 Steps

Viewing Station Configuration Details


Basic Concept
A slolion's configuration involves a rrangement of central o nd expansion rocks and modules,
rack and module addressing, and the assigning of p a rameters lo each module where the
defoull poromelers will no t be used. The comple ted configura tion should reflect the actual
orrongement of rocks o nd modules of the reol hardware. The details of a project's hordwore
con figuration can be viewed slallon-by-sta lion. rack-by-rack. module-by-module.

Essential Ele m e nts


The Hardware Configuration tool displays each open station in o separa te window. Each
cenlrol rock. loca l and remote expansion rock. or d istributed 1/0 drop IDP slaves} of o station
is depicted in the top pone of the configuration window. Each rock is shown as o as a lwa-
cotumn fable, whose title bar is labeled with the rack-type and number. Each DP stave is
shown os on o bject labeled w ith its stove type, its o,signed Profibus a ddress, ond that is either
attached or not attached to a DP Moster. When a rock or DP slave is selected in the top
pane, its deta ils are shown os a table in the bottom pane of the station window. The rows of
each table lists the modules contained in the rock, according lo the actual slot,

Applic a tion Tips


The default or assigned properties of any object may be viewed by selec ting that object,
then right-c licking and selecting Object Properties. From the Hardware Configuration, an
overview of addresses assigned to a CPU is obtained by selecting View ;. Address Overview.

;:- 57400_ Vicw_ l _DP (Conli11ur<1lion) •• tlrdwarc "'[!)13


iiii 0JUR2 ii,;fl) ER2 '"'
!ll i'l
- -' R'... ii f)J EA2
1 PS t07 IOA 1 FS ,011at. 1 PS 4071ClA

3 CPU 416·1 3 0 11 6i<AC 120-/


11
i........ _
l
.:.~ .~:::.~~-..J
0116llAC 120\I l 0116»\C 120V
4
5
IM460·3
CP 443-5 E:
4
5
0 11 6xAC 120/
0016".AC.!&120
4
5
Dl16l<AC 120\I
D016l'AC20·120\

5
0116Jo\C 120\I
D016"AC 20-120,I
6 0116,.\,C 1:i 6 0016,AC 20-120 6 0016,.t,.C 20· 12()\ 6 0016,AC 20-120/
7 0l1611AC 1:; 7 7 7
8 0016...C2 8 8 8
9 0016"6.C 2 9 IM 461-'.l 9 IM 461-3 9 1M 461-3

PROFlBUSfl } DP rna1ter .,,,,em fl I

i if3) IM 153-' ii [5) IM 153--


Imm ml]II

- I~ ! 121 ER2
Slci Modlk Orde, nur,ber F1mwa<o MPI addre,. I ad<i .., O«ldieu C«n •.
1 6ES7 ,W,,(JK;b,00,0W)

3 0116,..,C I:iJl\l 6ES7 421-5EHOO-OV>O 1&..17


0116""1: I:iJl\l 6£S7 421·5tHOO-OWI 20. •.21
DO16'cAC 20-120/J2A 6£S7 422-5EHOO-MBO 16...17
0016.AC20-120J 6ES7 422.sEHOO-O\BO ro...21

IM 461·3 6ES7 461·3A/>.OOOl>AO 16312

Figure 3•7. S7 Configura tion: rock-2 selec ted in lop pone, rock-2 modules in bottom pone.

68
Working with Hord ware Configurations

Quick Steps: Viewing Station Configuration Details

ACTION

1 With the desired p rojec t opBn. double click on the Hardware objec t o f the station
you wish to view.

2 With the station window in view. the central roc k is usually p laced firs t in the top
pone. The rock number. always Rock-0. is enclosed in parentheses ond followed by
the rock type. The address is (OJ UR for o universal rock, (OJ CR for o cen tral roc k
type.

3 If expansion rocks ore configured, they too ore displa yed as tables in the top pone.
Each ro ck is assigned according to the roc k typ e ond the nexl ovoilable number.
The d esignation UR is for the universol ro ck typ e and ER for the expansion rock typ e.

4 If expansion racks have b een connected to an interface module (IMJ a line is


shown linking each rack. In the S7-400 . the IM channel connec tions may be viewed
by selecting the IM in the central rack. right-clicking. selec ting Object Properties.
then selec ting the Connection tab. The rocks in this configuration ore all connec ted
on channel-I (C 1). Selecting Cancel or OK closes the view.

S If Profibus-DP sieves ore config ured, each slave object Is shown as b eing either
attached to o DP Moster system or not a ttached . When a ttached. the assigned
Proflb us Address is shown for each DP stove.

6 When any ra ck, is selected in the lop p ane. its d e tails are shown in the table in the
bottom pane. Module details Include Slot. Module description. Order Number,
Firmware version. MP/ address if applicable, Input (/) address. and Output (OJ
address.

7 Detoils of each selected slave may also be viewed by selec ting the DP-objec t. II
the drop. for instance, is o modular drop, its module details ore displayed in the
bottom pone as with o normal rock.

8 You con view the assigned or defoull properties of any configured object (e.g ..
Rock, Module. or DP master system) by selec ting the object, o right-click, then
selecting Object Properties.

9 View assigned addresses of a CPU by selecting View ► Address Overview, from the
menu o f lhe Hard ware Configuration fool.

10 O ther unopened stations of the some project may be opened ror viewing by
selecting Station ► Open from the menu. then selecting the station from the dialog.

11 If multiple station windows ore op en. they may be arranged accordingly by


selecting Window ► Arrange (Cascade, Vertically, or Horizontally) , from the menu.

69
STEP 7 in 7 Steps

Building a Station Configuration


Basic C onc ept
A station configuration is c reated for each S7-300/S7-400 station in a project. The
configuration data , which is eventually develo ped and downloa ded lo the PLC. will contain
a n exact image of each rock. its arrangement o f modules. as well as the parameters se t for
each module. Once loaded lo lhe CPU. the configuration is available for d iagnostic
purposes. On each sfort-up in the S7-400 and in some S7-300s {e.g .. CPU 318·2). the
conllgurolion con be compared to the actual arrangement for a ny d iscrepancies.

Essential Elements
Build ing !he configuration for each PLC involves 11) selecting each compone nt from the
Catalog. and (2) dragging and dropping the componen t info the Sta tion window. Typically a
configuration involves a central rock and perhaps some arrangement o f expansion rocks.
each of which is configured with some combination of modules. Modules may inc lude o
power supply (PS). digilot/onolog signal modules (SM), communications processors (CP), and
funclion modules (FM), all o f which must reflec t the actual p hysical arrangement. Each
module is dragged fro m the catalog lo ils matching slot number in the configuration fable.

Applic a tion Tips


Whe n a hardware configuration is completed, a nd saved using th e save a nd compile
command, the compiled configuration is saved in system data blocks (SDBs). The
configuration dalo, eventually downloaded to the PLC. is represen ted by lhe System Dalo
objecl located in !he offline blocks fold er of the S7 program. After the download, o n online
copy of the System Dalo object is also contained in the o nline b locks folder.

:I:J s1:1oo_Bu1!Jmg_R.iLk ( C:u11f1yu1·al1011) -· W<1ri,hoo,c_l l!l@E'I


~ (OJUR •
1 PS 3075A
2 CPU 31 6
3
4 018xAC2XJV
5 008~eley
6 CP34J.1 ISO
7 FM 355·2 C Tet\'11). Con~ol
8
9
10
11
4
~

4 Dl!IKO.C23W 6ES7 321-1FF01·0AAO 0


5 008xRela 6ES7 322·1HF20-0IIAO 4
6 CP 343-1 ISO 6GK7 343·1BAOO-G<EO 3 288.••303 288..303
.;_~-+-""-'F-'-M:..3.::.::.
55- :...;2::...;C::....Tc.:::em
" 'p
"'-•.::.
Cont:::..:::..ir.::.:
6E:..:cS..:..
7.::.:
355
:.::.·.::.
2C:::.H;..:;OO=-:M
:..""E'0°--1f-----,f----+304
=-"'-"''.31
:..:..::...
9 +30 :.::..4.:;;·•::..:
·3..:..:
19:........+--~

Figure 3-8. A rock selected in lop pane, shows modules d isplayed in the bottom pone.

70
Working with Hordware Configurations

Quick Steps: Building a Station Configuration

ACTION

1 From lhe SIMATIC Manager, open the required projecl and either selec t an exisling
station or create a new slation for which a hardware configuration is to be crea ted.

2 Wilh the stalion selec ted in the left pane or lhe project window, double -clic k on the
sta tion's Hardware object in the right pone, to open the configurotion tool.

3 Maximize the Hardware Configuration window, and if the Hardware Catalog is not
already in view selecl View ► Catalog, from the menu to open lhe catalog.

From the catalog. click on the p lus sign (+) lo open the SIMATIC 300 or SIMATIC 400
objec t to access lhe individual component folders for lhe required PLC.

5 Open the Rack-300 or Rack-400 folder and drag a central rack to the upper
configuration pone (the S7-400 has CR and UR rack options; S7-300 uses the Roil).

6 Open the PS-300 or PS-400 folder. selecl lhe desired power supply and drag the
part to slot- 1 of the central rack.

7 Open the CPU-300 or CPU-400 folder. then the appropriate CPU sublolder to select
lhe desired CPU. Drag lhe selecled CPU lo an acceptable slot in lhe cen tral rock.

8 In a similar fashion, signal modules (SM-300/ SM-400). communic a tions p rocessors


(CP-300/ CP-400). and function Modules (FM -300/ FM-400) Iha! molch lhe actual
part numbers of your S7-300/S7-400 are dragged and dropped into the
configuration table.

9 After completing a stolion. from lhe menu, select Station ► Consistency Check lo
check For errors. The configuration will not compile For downloading unless found
Free or errors.

10 From the menu bar, select Station ► Save to save the configuration; or if done. use
Save and Compile to genera te the System Delo for downloading lo the CPU.

71
STEP 7 in 7 Steps

Downloading a Station Configuration


Basic Concept
After o station's configuration hos been generated. found free of errors, and compiled -
then and only then ma y ii be download lo !he PLC. The configuration will reflecl the station's
local. remote and distributed 1/0 rock arrangement. as well as lhe parameters of all
configurable modules (e.g ., CPU, CPs, FMs. SMs. etc.). Configuration porornelers ore
subsequently transferred lo lhe appropria te modules during the CPU sta rtup.

Essential Elements
For a station configuration to compile for download. certa in perquisites must be met.
Authorizations must be installed for any optional packages used: network modules in a
subnet must hove unique addresses: the stolion hardware and lhe network configuration
must match the actual configuration, a nd be found consistent and free of errors. Once
found free of errors. a System Data object (SDB), containing th e configuration, is generated
a nd placed in the Offline Blocks folder of lhe associo led station [i.e .• CPU program fo lder).

Application Tips
Whether downloading o configuration for the first time or otherwise. the comp lete PLC
configuration is always downloaded to the CPU. A partia l configuration download is not
possible. If the actual station configuration is not yet completed o r will be completed in
stages then you should consider c rea ting a temporary p roject. w hose hardware
configuration is developed in stages, re fl ecting only th e portion of the hardware that is
physlcolly installed to dole (e.g .• central controller rock a nd modules o nly).

Select Destination Module

Desmation Moc!uet:
Aaclu SIDI
CPU 41~-l O 3
CP-t43-1 11 O 7

Select Al

I OK I Help

Figure 3-9. Module Download list wilh all modules


targeted lo receive configuration data by default.

72
Working with Hordware Configurations

Quick Steps: Downloading a Station Configuration

ACTION

Download Configuration: From SIMATIC M·o noger:

1 Fir..l. ensure that o n online connec tion is established from the PG/PC lo the sta tion
to which you wish lo download. A direc l MPI connection is rec ommended.

2 If downloading a configuration for lhe first time, on overall reset of the CPU memory
is recommended before downloading. The CPU should be in the STOP mode.

3 With lhe required project open and the appropriate S7 Program folder expanded.
select the offline Blocks folder; then from the right-pane select the System Doto
ob]ecl. The System Doto is available only If the station configuration was complied.

4 Wilh lhe System Doto objec l selecled, from the menu. select PLC ► Download. or
press the Download icon from the toolbor.

s When prompted to select if the System Doto in lhe C PU should be deleted. confirm
with Yes to overwrile any exis ting configuration.

6 Check the CPU LED indicators; if the downloaded and actual configuration port
numbers match. then no foul! LEDs should be illuminated.

Download Configuration: From Hardware Configuroiion Tool:

1 First, ensure that an online connection is established from the PG/PC to the station
to which you wish to download. A direc t MPI connection is recomme nded.

2 If downloading a configuration for th e first time, on overall reset of the CPU memory
is recommended before downloading. The CPU should be In lhe STOP mode.

3 Atler completing the configuration for o station. from the menu, selec t Station :.-
Consistency Check lo check for errors.

4 When the consistency check reports bock wi th no errors, from the menu. select
Station ► Save ond Compile lo genera te system data b locks (SDBs).

5 With the appropriate sta tion open, from the menu. select PLC ► Download, or press
lhe Download Module icon from the tootbor. A dialog is presented, listing modules
for which download configura tion doto exists.

6 Press the Select ALL button to ensure tha t configura tion data is downloaded to all
modules for which configuration data exists,

7 Check the CPU LED indicators; if the downloaded and actual configuration port
numbers match. then no fault LEDs should be illuminated.

73
STEP 7 in 7 Steps

Uploading a Station Configuration


Basic Concept
Each station configuration is generally built from start to finish, using the Hardware
Configuration tool. In some coses. however, you may wish Jo start the configuration by
uploading a configuration from an existing PLC. Such o case may exist when the hardware is
available and perhaps even installed before any configura tion is storied; or a new station
you wish to creole is similar to or identical to one that a lready exists. An uploaded sta tion is
only meant to serve as o quick start for build ing o new statio n configuration.

Essential Elements
A station may be uploaded to on existing project. however an empty project is
recommended. When performing the upload o new station objecl, based on the uploaded
station, is outomo ticatty generated in the open project- thereby e liminating the possibility of
overwriting or corrupting any offline dola. In the case of the S7-300, the central and all
expansion rock configuration doto is uploaded; in the case of the S7-400, the central rock
and module configuration data is uploaded. but no expansion racks are included. No
configuration data is uploaded for distributed 1/0 drops. Although the uploaded
configuration uses default addressing for both the S7-300 and S7-400, the addressing may be
modified in the S7-400 and in some S7-300 sta tions, depending on th e CPU.

Application Tips
Stations that rely on o dependent relationship lo one or more other stations (e.g.. DP
Moster/Intelligent stove) should always be uploaded together. If dependent stations are not
all uploaded, the station that you ore interested in will remain inconsistent when you attempt
to save and compile. If component port numbers appear incomplete after a station upload,
ii may be lhol the specific parts ore not recognized by STEP 7 and tha t the components do
not appear in the Catalog, You may enter the ·1ncomplete" order numbers when you
configure the hardware using the menu command Options> Specify Module.

Select node .:iddress


Which module do ,11ou ~ to reach?

Rock:

Slot

Target Sta&R (
♦' Local
r- um be reached by melln~ of oatewll)I

MPI adcrass
5

Aocesta11>Je Nodes
5 CPU841-0

Update

OK
I Cancel j
Figure 3-10. Dialog for accessing o station targeted for upload.

74
Working with Hordware Configurations

Quick Steps: Uploading a Station Configuration


ACTION

1 From lhe SIMATIC Manager, open lhe projecl lo w hich the sta tion configuration will
be uploaded (o newly created or empty project is recommended).

2 Ensure that there is on established online conneclion from the PG/PC lo lhe slo lion
you wish to upload (e.g.. via a direct MPI connection, via Profibus, or via Ethernet).

3 From the SIMATIC Manager menu. select PLC ► Upload Station. A dialog box tha t
lists accessible stations on lhe local subne t and thol con be reached via o gateway
is p resented.

4 In the dlolog box, en ter the rock and slot number of the module via which the
configura tion should be read (generally the C PU). Define wheth er the station is on
the local subne t or con be reached via a gateway; if the station can be reached
by way of several modules, selec t th e connec tion method. Confirm with "OK.''

5 When the upload is complete lhe station configuration data is contained in o new
station which hos been given o defoull name. Click on the new sta tion. righ t-click.
and select Object Properties lo assign a new station name and to add descriptive
comments.

6 Click on the new station in the p roject tree, and from the right-pane double-click on
the Hardware object lo open the slotion In lhe hardware configuration tool.

7 Selecl lhe C PU module then right-click and select Object Properties; from the
General lob, press the Properties bulton to assign o new MPI address.

8 Modify o lher MPI addresses, for modules in the slotion, If required (e.g., CPs and
FMs). and network station addresses as required (e.g., Profibus, Industrial Ethernet).

9 Remember, since certain componen ts of the configuration may not have been
uploaded (e.g. expansion racks and modules.) you may hove lo complete lhe
configurolion of fhe new station. using the hardware configuration fool .

10 Where ii appears Iha! o componenl port number is incomplete, double-click on the


component or select Options ► Specify Module from lhe menu - o dialog will
appear from whic h you may select the actual order number; end lhe diolog with
OK and o parameter dialog box is presented for en tering module parameters.

11 When done, from the menu, select Station ► Consistency Check to check for errors.

12 If lhere ore no errors, from the menu. select Save and Compile lo sove the
configuration and to generate the new offline System Dalo objec t.

75
STEP 7 in 7 Steps

Assigning Symbolic Addresses to Input/ Output Modules


Basic Concept
Symbolic oddresses o re olphonumeric names given to the various S7 memory locations. By
assigning names lo addresses. tha t ore similar lo the conlenls of the memory loca tion,
symbol addresses oid in the understanding and troubleshooting of the STEP 7 program.
Symbolic addresses ore generally entered directly into the Symbol Tobie, which is opened
lrom the SIMATIC Manager. You may choose to enter lhe symbolic addresses ror 1/ 0
modules. however, con be e ntered quickly from the Hardware Configuration tool.

Essential Eleme nts


To c reole a symb ol address is to assign a meaningful label of up lo 24-charocters, as a
substitu te address for on absolute oddress. As each d igital input or digital oulpu t module ond
ana log input or outpul module is inserted, a symbolic address may be assigned lo each
individual 1/0 address. The absolute memory a rea for digita l inputs is identified with " I", with
"Q" for digital outputs. with "PIW" for analog inpu ts, and with "PQW" for analog outputs. As
the dialog is opened for each module. the ind ividua l input or output addresses for lhe
module ore listed in the Address column. You enter a sym bolic address in the Symbol column
and its descriptio n is entered in the Comment column.

Applica tion Tips


You may a lso enter symbolic addresses for 1/0 modules from the Symbols editor, which you
may start from th e SIMATIC Manager, by double-clicking on the Symbol Tobie object. A
symbol editor icon is a lso available on the toolbor in the LAD/FBD/STL editor, and in the
Monitor/Modify tool. Symbolic addresses entered in the Symbols editor ore g lobal symbols;
whenever you reference a global symbol. a pound sign must precede ii (e.g.. #TEMP_ 1).

ffldi¾,ll@ti•Jlid:i4if1·itfi•t
I
Address I
0.0
5Ymbol
START_pa_oo
Oata Tv""
BOOL
,~ ~
-
I 0.1 START_pB_OI BOOL I
I 0.2 START..,PB_02 BOOL I
T 0,3 START ...PB_03 8001. I
l 0.1 START_PB_O~ BOOL I
- II. o.s
0.6
START...PB_OS
-··
START_p6_06
BOO!.
-
BOOI. I
1 0.7 10. 7 BOOL I
l 1.0 STOP...PB_OO BOOL I
I 1.1 STOP_pa_ot 800l I
I 1.2 11.2 BOOL I
I 1.3 STOP _pa_ro BOO!. I
- 1 1.1 STOP _pe_O'I BOO!. I ~

I l.5 11.5 800l. I


I 1.6 STOP,Y8_06 BOOL I ~
II Add S.!!mbols
1 D*lc.;,y~o1
I ~orl iAddie,,: A,cending 3
The t)ll1lbcl table ~ updated ,;,ill 'OK' 01 'Apply'
-
Q.K
I ~ ply
I ~ I Help
I
Figure 3-1 1. En tering Symbolic Addresses in lhe Hardware Configuration Tool - Dlgitol 1/0.

76
Working with Hord ware Configurations

~
Address 1 CoMment
PIW 352 DI _spfEO_St' Orive # 1 Speed Setpoi'lt
PIW ss~ D2_spfEO_St' \/,'ORO Dtive #2 Speed SetpoW:
PIW 3S6 01.YSi WORD O<i\le # 1 PSI
PIW lS8 02.YSi WORD O<ive #2 PSI
Pq,N :352 Dl...,5PEEO WOOD O.ive # 1 Speed Controller
Pq,N 35'1 02...,sPEEO WORD O.ive # 2 Speed Controller
Pq,N 356 PQW3S6 WORD
Pq,N 358 PQW353 WORD

I
1he symbd lbble it updAted Vlilh 'OK' or 'Appl?'

.Q<incel

Figure 3- 12. Entering Symbolic Ad dresses in 1he Hardware Configuration Tool - A na log 1/0.

Quic k Steps: Assigning Symbolic Addresses to Input/Output M odules

ACTION

1 Op en the d esired sta tion in the Hordwore Canfigurolion tool. an d then select the
rock containing the m odules lo whic h symbolic addresses should be assigned.

2 To enter symbol addresses for a mod ule, select the module. righ1-ctick and select
Edit Symbollc Addresses. Th e symbol lable is presen ted like a spreadshee t, having o
column for the absolute Address, Symbol address. Data Type o f lhe address, and a
Comment. The absolute addresses assig ned to the open module o re a lready listed
in the absolute A d dress column.

3 Click in the Symb ol field and enler up lo 24-olp hanumeric characters for the
symbolic address o r on input address; enler o commenl using up to o maximum o r
SO-characters. The data type of each absolute address is automatically inserted.

4 Press the Add Symbols button to use the obsolule address in the Symbol field for any
input or output address that you hove no t yet defined wilh a symbol address.

5 Clic k on the Sort d rop a rrow a nd select a method of sorting the symbol a d dresses
(e.g ., Address Ascending , Address Descending, or Symbol Ascending) .

6 Press the Apply b utton to a ccept entries and lea ve dia log o p en to resume with
en tering symbol addresses; when done, confirm your entries with lhe OK butto n.

77
STEP 7 in 7 Steps

Configuring an S7-300 Central Rack


Basic Concept
The central rock is the main rock of on S7-300 station. This rock, sometimes called lhe
con troller rock, will olwoys contain o CPU o nd power supply, and perhaps some
arrangement of o ther modules. You will p robably gel started w ith this rock in order lo
connec t with the CPU ond start wilh your initial p rogromming and configuro tion work.

Essential Elements
As you build the S7-300 central rock configura ti on, remember that the CPU ond power supply
modules you use in lhe configuration, must match the ocluol hordwore orrangemenl. The S7-
300 only hos one rack typ e - it is called a rail. The roil is considered o universal rock since ii
supports oll lypes of S7-300 modules [i.e., CPU, signal modules fSM}, runclion modules (FM),
and communications processors fCP)l.

Application Tips
If you need to connect to the CPU to lest portions of your code, the minimum configuration
you will need to get storied is shown in the figure below. You will also need lo install backup
batteries to the CPU ond connect a source lo the power supply. As you build your hardware
configuration to match your ac tu al hardware arrangement, remember lha t you must install
modules for the S7-300 without leaving any empty slots, The exception is with slot-3, which is
used only by interface modules (IMsj. Slo t-3 is left empty even if only one rock is installed.

1 PS ::Kl75A
\~-- CPU 316 _i
3
4
5
.Li------
7
8
9
10
11

Slo1
1
L
l
(0) UR

Module
PS J075A
Cl'U31s
Orde , ~
6ES7 :.(17-lEAOO-OMO
6ES7 316-IAGOO,OABO
Ml'lodd!eu

2
I eddreu Qed«w Co_,,,
-
3
4
5
6
7
8
9 '
10
11 ~

Figure 3-13. S7-300 Cen tral Rack Configura tion, with CPU and Power Supply.

78
Working with Hordware Configurations

Quick Steps: Configuring an S7-300 Central Rack

ACTION

1 From lhe SIMA TIC Manager open lhe required project. and rrom the project lree
select the S?-300 Station for which a central rock configuration is lo be crea ted.

2 From the righl pone, double click on th e Hardware object to open the station in the
Hardware configuration toot.

3 Open !he Hardware Catalog window, from the View menu, if it is not already
opened.

Open the SIMATIC 300 catalog object to view the S7-300 component folders.

5 Open the Rack -300 folder, select and drog the roil to lhe lop pone of the station
window lo Install the S7-3001/0 roil. The cen tra l rock is labeled O(UR}, since it ls rock-0
and the rail is always a universal rack type.

6 Open the PS-300 folder. select lhe desired power supply and drag the port lo slol- l
of the central rock.

7 Open the CPU-300 folder and then the appropriate CPU subfolder to select the
desired CPU. Drag lhe selected CPU lo slot-2 or the cen tral rock.

8 From the menu. select Station ► Consistency Check, to check for errors. The
configuration cannot be compiled for downloading unless it is found free o f errors.

9 From lhe menu bar. select Station :.- Save lo save the configuration; or if done. use
Save and Complle lo generate the System Doto l hot are downloaded la the CPU.

79
STEP 7 in 7 Steps

Configuring S7-300 Local 1/ 0 Expansion


Basic Concept
The S7-300 supports locol 1/0 expansion o f on S7-300 central rock to allow odditionol 1/0
modules. You may connect up to three a d ditional 1/0 rails to lhe 57-300 central rack, using
componen ts referred lo as interface modules (IMS). Ad ding tocol 1/0 expansion involves
placemen! of o sender interfoce module in the S7-300 central rock and it~ corresponding
receiver In terface in each expansion rack.

Essential Elements
The IM 360 is a sender inlerface module placed in the cenlrol rock of the S7-300. The
c orresponding receiver module of the IM 360 is 1he IM 36 1. which is pla ced in ea ch
additional expansion rock. Interface modules of the S7-300 are olwoys installed in slo t-3.

Application Tips
Up to three odditionol 1/0 racks ore supported by the S7-300 and you may mount them
either horizontally or vertically, A maximum distance of 30 meters is allow ed from th e central
rock to lhe lost expansion rock. The maximum distance between each rac k is 10 meters.
All1lough 1his exp ansion supports thirty-two module slots (stot-4 to slot- 11 in each rack), the
ac tual maximum 1/ 0 coun t remains CPU d ep endent.

~1 57JOO_Lucal _tKpan,iun (Configural1un) •• Warehuu,e _l l!I~ £1


...
PS 307 5.\

IM 361 IM 361 IIA 361


4 4 4 4
5 5 5 5
6 6 6 6
7 7 7 7
8 8 8 8

r~ I
9 9 9
10 10 10
11 11 11


Figure 3- 14. S7-300 Local 1/0 Exp ansion up to 4-ra cks. using IM 360/IM 36 1 p air.
£

80
Working with Hordware Configurations

Quick Steps: Configuring S7-300 Local 1/ 0 Expansion

ACTION

1 From lhe SIMA TIC Manager open lhe required project. ond rrom the projec t lree
select the S7-300 Station for which tocol 1/0 expansion is required.

2 From the righl pone, double click on th e Hardware object lo open the station in the
Hardware configuration tool.

3 Open the Hardware Catalog wind ow, from the View menu. if it is not alrea dy opened.

4 Open the SIMATIC 300 catalog object lo view the S7-300 component folders.

5 Open the Rack-300 folder. selec t and drag the 1/0 rail lo the lop pane of the station
window. If the central rock is olreody Installed it is labeled O(UR); otherwise it must be
configured be fore adding expansion rocks.

6 Ins-toll up to 3 additional expansion rocks. The rocks will be labeled from 1(UR) to 3(UR) .

7 Open the IM-300 folder, lo show lhe S7-300 expansion in terface modules. IMs
designated for sending (S) are installed only in slol-3 or lhe c entral rack. tMs
designated for receiving (RI ore installed only in slol-3 of lhe exp ansion rocks.

8 From the hardware catalog, setecl lhe correcl tM-360 interface module and drag it to
slot-3 of the CPU ro ck.

9 Select the correct IM-361 Interface module and drag lo slot-3 of each expansion rack.

10 Open the PS-300 folder; select lhe required power supply and drag lhe port to slo t-I o f
each e xpansion rock.

11 In o similar fashion. 1/0 signet modules (SM-300 folder). communications processors


(CP-300 folder), and function Modules (FM-300 folder) ore add ed to your rock by
matching the a c tual port numbers with actual physical components.

12 From the menu, select Statton ► Consistency Check. lo check for errors. The
configuration cannot be compiled for downloading unless ii is round free of errors.

13 From the menu bar. select Station ► Save to save the configuration; or if done. use
Save and Compile to generate the System Doto tha t ore downloaded to the CPU.

81
STEP 7 in 7 Steps

Configuring S7-300 Single-Tier 1/ 0 Expansion


Basic Concept
This configuration task involves adding o single rock expansion to on S7-300 central rock
configuration. Upon completion, this will be a fixed configuration. in11olving the central rack
and the one expansion rock. No further expansion beyond this is possible without changing
the interlace module (IM) . The fixed configuration supports up lo 16 1/0 modules. with o
maximum o f eight mod ules in lhe cenlrol rack and in th e expansion rack. The connection
between the central and the expansion rack is o fixed 1-meter coble.

Essential Elements
The IM 365 is a sender/receiver interface module that is placed in the cen tral rack and in one
expansion rock, lo support the fixed-lier configurolion. Interface modules of the S7-300 ore
always installed in slot-3. No additional power supply is required in the expansion rack or this
configuration since power is supplied from the central rack. through the connecting bus
coble.

Application Tips
The two-tier expansion configura tion is typically used on o small installation in which
expansion beyond this fixed amount of t/0 is not expec ted. Only digital and analog sig nal
modules moy be placed in this expansion rock. Loter expansion would require removal of the
IM-365 pair and use of the IM-360/IM-361 cornbination.

:i'J'i730D_ I _r;..,, _FiKed_fKp ([onfiour·ation) -- llrdwan" l!!II!J f.3


.
g (O)UR
1
2
3
I PS 3071(16
CPU 315
IM 365
1
2
3 IM 365
4 ~

5 5
6 6
7 7
8 8
9 9
10 10
11 11

◄ ~
~~ (01 UR

6ES7 3l 5-1Af02-0ABO
6ES7365-0BAO~OAAO 2000
4
5
6
_1 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _.=.J

Figure 3- 15. S7-300 Two-Tier Fixed 1/0 expansion. using IM 365 pair.

82
Working with Hordware Configurations

Quick Steps: Configuring S7- 300 Two-Tier 1/0 Expansion

ACTION

1 From lhe SIMA TIC Manager open lhe required projec t. ond rrom the project lree
select the S7-300 Station for which single lier 1/0 expansion must be added.

2 From the righl pone, double click on th e Hardware objec t lo open the station in the
Hardware configuration toot.

3 Open the Hardware Catalog window, from the View menu. if it is not already opened.

4 Open the SIMATIC 300 catalog object lo view the S7-300 component folders.

5 Open the Rack-300 fold er, selec t and drag the roil to the configuration window. If the
central rock is already Installed ii Is labeled O(UR); otherwise, it must be configured first.

6 Drag ond drop one additional rock Into the configuration window. Th e single
expansion rock will be labeled l (UR) for the first expansion rack.

7 Open the IM-300 folder. lo show lhe S7-300 expansion interface modules. IMs
designated for sending (SJ ore installed in slol-3 only or the central rock.

8 Select the IM-365 interface module from the catalog and drag to slol-3 o f rack O(UR).
the central rack.

9 Select the IM-365 interface module from the catalog and drag it to slot-3 of the
expansion rock 1(UR)

10 Open the PS-300 folder. select lhe desired power supply. Click and drag the port to
slot- 1 of the expansion rock if required. A power supply In the expansion rack is only
required if the main supply is not adequa te to supporl the complele 1/0 combination.

11 From the menu, select Station ► Consistency Check, lo check for errors. The
configuration cannot be compiled for downloading unless ii is found free of errors.

12 From the menu bar, select Station >- Save lo save lhe configurolion; or if done, use
Save and C ompile lo generate the System Doto lhol are downloaded lo lhe CPU.

83
STEP 7 in 7 Steps

Configuring an S7-300 as DP Master


Basic Concept
The S7-300 supports distributed 1/0, using the DP component of Profibus, which operates
much like remote 1/0. The DP configuration may involve one or more DP Master Stations,
each o f which manages the 1/0 o f one or more assigned DP Stove Stations. Depending on
the requirements of your application, as lhe DP master, you may either choose on S7-300
with DP master capability or o Profibus communications processor (CP) with DP capability.

Essential Elements
The DP master con be configured using S7-300 CPU, wi th on fnlegro led Proflbus-DP lnter1oce
(e.g., CPU 31S-2 DP o r CPU 316-2 DP); or using o Profibus communications processor with DP
master capability (e.g., CP342-S or CP342-5 FO. for fiber optic links), in conjunction with a CPU
that supports this feature. In a ny case. the DP master will perform the some function.

In configuring the DP Moster. th e Profibus interface of the DP master must be olloched to the
d esired Profibus Subnet and assigned a unique Profibus Address (e.g.. 3-125). If not previously
set, then the subnet operating parameters (e.g.. transmission ro le. profile) will a lso need to be
set. See configuration task. Chapter 7. Adding and Configuring o Profibus Subnet.

Application Tips
Typically. a DP subnet will involve a single DP master. This is re ferred lo as a Mono-Mosler
configuration. You may also hove several mono-master systems within a project. by simply
creating multiple PROFIBUS DP subnets and attaching a DP master to each. A Multi-Moster
configuration, involving two or more masters on o single subnet, though not typical. is a lso
possible. You would do this by a ttaching the DP masters lo the some DP subnet.

B~EI
"'1 SIMATIC JOO(l)(Conf'igur.>tion) -- DP _Pl'ojJ

,a;. (OiU R
..
1 PS307 10A •
CPU 315-2 DP PROFlBUS 1 . DP ma:s!ei : e<n 1
2

7
8
9
10

Figure 3-1 6. 57-300 station with the CPU 31 5-2 DP selec ted as DP master.

;-:,, 51"1ATI C JOO (Connl}Utatlon) -- DP_Proj3 l!!lf~ £1

1 PS 3071()1>. •
2 CPU316
13
.____
4
---
....... ..... -
CP342-5
!
..:-
PRO Fl8US12t OP 11\A!ler 1y llffll 1180)
5
6
7
8
9

4
~
Figure 3-17. S7-300 slolio n wllh the CP-342-5 selec ted as DP master.

84
Working with Hordware Configurations

]JlsIMATI[ J1JO(I >([onfiQUr8llon) -- DP _P,·ojJ 8~ l'3


>B'.10] UR PROABUS 1J OP maste, ; tem II I
1 Ii PS 307 l OA •
2 If:! CPU 315-2 DP
X2 If OPMas!M
3 ijl~) IM 153-- ii (5) IM 153: iJi (6JIM153.-
4
5
6
7
mm mrn:ID mm
8
4

.-] ~ PROf l8US(1): OP m,1Lor sytlm (l}

PROFIBUS add,... Modulo -· Orde, ~


IM 153·1 6ES7 153-IMOl ·OXBO 1022
IM 153-1 6ES7 153-IMOI-OXBO 1021
IM 153·1 6ES7 153-lMOl -OXBO 1020

Figure 3-18. S7-300 CPU 315-2 DP master with attached ET-200 M modular 1/0 drops.

Quick Steps: Configuring an S7-300 DP Master

■ 1
ACTION

From lhe SIMATIC Manager open lhe required project, and S7-300 station lo serve
as DP Mos ter. The S7-300 must be inserted lo the project ii it nol already installed.

2 With lhe S7-300 station opened in lhe hardware configuration window selec t lhe
central ro ck. Insert the required rock and power supply if ii is no t already installed .

3 If a CPU will serve as the DP master lhen the correct Profibus-DP CPU must b e
selected (e.g., CPU 315-2 DP. or CPU 316-2 DP). From the catalog open lhe CPU-300
folder, selec t and drag the required CPU to slot-2 of the central rock.

4 When lhe Profibus interface dialog is presented. select the Profib us subnet to which
the DP master should be a ttached; set or accept the suggested Profib us address
(e.g., 3-125), lhen click on the Properties button lo sel lhe subnel Transmission Rate
and olher properties if they have not yet b een set.

5 After the DP properties dialog is saved, a DP Moster system objec t should appear as
a block and white dashed line exlended from the OP masler. If lhe object is not
shown, right-click on the DP master object in row 2X2, and selecl Add Master
System.

6 You con save your work, but at least one OP slave must be attached lo compile
without errors. See the various ta sks on Configuring and Attaching Modular,
Compoct, and In telligent DP Slaves.

If a communications processor (CP) should serve as the DP masler. then the opproprio le
selection must be mode from fhe CP-300 folder under the Profibus folder. From th e CP342-5
or CP342-5 FO subfolder, find the required communications p rocessor and drag it lo slo t-4 or
higher or the central rock. The Profibus interface dialog will be presenled and lhe
configuration may be continued with Steps 4, 5, and 6.

85
STEP 7 in 7 Steps

Configuring and Attaching Modular DP Slaves


Basic Concept
The S7-300 supports distributed 1/0, using the DP componen t of Profibus, which operates
much like remote 1/0 drops. The DP configuration involves one or more DP Master Sia/ions.
each o f which manages the 1/0 of one or more assigned DP slave Stations . A modular DP
slave station. is one in whic h individual 1/0 modules ore installed in on 1/0 base. Examples of
modular DP subsystems Include ET-200M. ET-200L SC, ET-200S, and ET-2001S. Attac hing
configured modular DP slaves is simplified if the Profibus subnet and DP master ore already
configured.

Essential Elements
The DP master to which the DP stoves w ill be attached. will be p ro vided by on S7-300 or S7-
400 C PU, with o DP interface (e.g.. CPU 315-2 DP, CPU 4 16-2 DP); or formed by o
communications processor (CP) with DP master capability (e.g.. C P342-5 or CP443-5 Ext.) and
o compatible CPU. Each slave is ollached to a DP master system using o modular DP slave
interface module (IM) that is installed on the S7-300 mounting rail. along with on arrangement
of 1/0 modules. Each IM is o~signe d o uniqve Profibus address (e.g.. 3--125).

Several modular 1/0 styles ore available. Your choice of IM wm determine the number and
type of usable m odules. Modules supported by a g iven IM o re contained in the hardware
ca ta log. under the specific interface module (IM) folder. ET-200M. based on several choices
of th e IM -153, for example. uses S7-300 modules. The ET-200S family of Smort Connect
modules connects using the IM-1 51. Each family of modula r DP sloves is found in a
corresponding folder o t lhe hardware catalog.

Application Tips
As you attach each slave to the DP Master system, STEP 7 automatically assigns the nexl
available address. You should a llow STEP 7 to assign the a d dress. unless otherwise necessary.
Al least one modular DP sla ve d rop must be assigned to the DP master before the master will
save and compile without errors. You must configure each modular slave wi lh a l leosl one
m odule. If multiple DP master systems (i.e., DP subnets) ore in the project, ensure that you
attach the each slave to the correct subnet.

!l1Js1MATIC 300(1) (Connguration) -- DP _Proj3 l!!lliJEJ


:e [OJ UP, •
l PS 307 1Qt.\ •
2 CPU 315-2 OP PROFlBUS 1 : OP m!1$le1s stem 1
X2 DP Mas/or
3
4
.
5
......... -+-......
... ,,., .. ,__,.,
..,N,,...._.J
6
7
8
9
10

Figure 3-19. S7-300 DP master to which modular DP slaves will be attached.
The DP master system object is represented as a b lack a nd white dashed line.

86
Working with Hordware Configurations

!l.'JsJMATIC 31JD(I) (Conflqurallon) -- DP _Prnj3 1!1!111:!:IEJ


PROFIBUS(l~ DP master s</•tem (1)
PS 3071()/\ ~

CPU 31 5-2 DP
X2 OP,,,_
3 ii(4JIM 153-• (S) IM 153-·

5
6 mDl
' . 7
8

PROFIBUS add!... Module ... Ordei nu!J>ber Fi.. Diagnowc - • C«rmehl


IM t 5l-1 6ES7153-1AAD1-0XBO 1022
IM 153·1 6ES7 153-1AA01·0XBO 1021
IM 153-1 6ES7 153·1AA01 -0XBO 1020

Figure 3-20. S7-300 CPU 315-2 DP mosler with ET-200M modular DP sloves.

Quick Steps: Configuring and Attaching Modular DP Slaves

ACTION

Configuring lhe Modular Proflbus DP Slaves with ET•200M

1 From the SIMATIC Manager open lhe required project. and from the project tree
select lhe Sta tion that will serve as DP mosler for the modular slaves you will al1och.

2 With lhe DP master selected. open the Hardware configurolion tool by double-
clicking on the station Hardware object in the right pone o f the project window.

3 Wilh lhe DP master displayed, a DP master system object should be shown os o


block and while dashed line. If the DP master sys tem object is not shown. then right-
click on the DP moster object in row 2X2, a nd selec t Add Mosler System.

4 With lhe configuration window open lo the DP master. from the Profibus DP folder o f
the Catalog window. open the ET-200M folder and drag the required IM 153
inlerfoce module lo lhe configuration window. and drop while touching the mouse
tip to the DP master system objec t.

5 When lhe DP slave diolog is presen ted, selecl lhe Profibus subne t ta which th e DP
master will be attached; set or accept the suggested Prolibus address (e.g.. 3-125).

6 Select the IM 153 bus interface module in the lap pane, la display its configuration
table in th e bottom pone ond to install required 1/0 modules (e.g., signol modules).

7 Drag and drop each odditionol lM 153 bus interface, as required, until done.

8 From th e Station menu. perform o C onsistency C heck, then Save and Compile the
configuration.

87
STEP 7 in 7 Steps

Configuring and Attaching Compact DP Slaves


Basic Concept
The S7-300 supports distributed 1/0. using the DP componen t of Profibus. wh ich operates
muc h like remote 1/0 . The DP configuratio n involves one or more OP Master Sia/ions, eac h of
whic h m onoges lhe 1/0 of o ne or m ore assigned DP Slave Sta tions. A compac t DP slave
typically involves a n enca sed design lho t combines the DP slave processor, a b us interface.
a fixed number of 1/ 0 c ircuits and lermino l blocks. Examples ot compact DP subsystems
include ET-2008. ET-200C. a nd ET-200L. Attac hing configured compac t DP sla ves will be
simplified if the Pro fibus subnet and DP master ore a lready configured.

Essential Elements
The DP master to w hich the DP stoves w ill be attached, will be p ro vided by on S7-300 or S7-
400 C PU with an integra ted DP interface (e.g., CPU 31 5-2 DP, CPU 4 16-2 DP); or formed by a
communications processor (CP) with DP master capability (e.g.. C P342-5 o r CPMJ-5 Ext.) and
a com patible CPU.

Compa c t DP sla ves incorpora te both the DP-interface a nd integrated 1/0. Therefore, there is
no interface module {IM), or mounting base as with modula r slav es. The DP-interface o f ea c h
com pa ct sla ve m ust be attached to the DP master system, a nd o ssiqned o unique Profibu s
a ddress (e.g.. 3-1 25). The combination o f 1/0 circuits of a device is selecte d b a sed upon
sig na l requirements ot the drop location. Compac t sla ves. and lhe inlegroled 1/0 each
offers m ay be viewed in the Profibus-DP folder of the hardware catalog .

Application Tips
As you attach each slave to the DP Moster Syst e m ob jec t, STEP 7 au tomatically assigns the
ne xl available address. You should allow STEP 7 to assign the address, unless o therwise
necessary. You must configure and attac h a t lea st o ne slave d rop to the DP master, in ord er
for the Mo ster to sa ved and compiled wit11oul errors. If multiple DP m a ster systems (i.e., DP
subnets) are in the p rojec t. ensure that you attach each slave lo the correct subnet.

ill sIMATIC 300 (Configuration) -- DP _Proj3 l!!'llil J3


.
..
PROFIBUS(2t DP master $}1$lem 80)
3
4
5
6
7
8
9

Figure 3-2 1. S7-300 DP m a ster to which compact DP slaves will be attached. No te the DP
m aster system object (for Profibus subnet), shown os a b lock a nd white dashed line.

88
Working with Hordware Configurations

!!l\1SlMATlC 300 (Configuration) -- OP _Proj3 l!llil EJ


_...'(OJUR PAOFlBUS 2): DP ma,te1 •
1 PS 307 10A •
2 CPU 315-2 OP i )132) B-16D1' (33) B-1601 jj (34) 8-1601'
)C2 OP MDS111r
~
3
4
5
~ ml ~
~


6
7 ... ,
+iJ■... I PROFIBUS(2~ OP mastei system(180]
PROFIBUS add-... Module ...
Ordei number Fl... D,agr'lOWC ... ~nt
2 B-1601/1600 DP GE S7 133-08 LOO-OXB 0 1022 •
B-1601/1600 OP 6ES7133-0BLOO-OXBO 1021
B-1601/1600 OP 6ES7133-0BLOO-OXBO 1020 ...
Figure 3-22. S7-300 CP-342-5 a s DP master with compact DP slave drops.

Quick Steps: Configuring and Attaching Compact OP Slaves

■ ACTION
-=-===============================-
Configuring Compact Pronbus DP Slaves with ET-200B

1 From the SIMATIC Manager open the required project a nd from the project tree
select the Slotio n to serve as the DP master ror lhe compact stoves you will at1ach.

2 With lhe DP master selected , open the Hardware configuration tool by double-
clicking on the station Hardware object in the rig ht p one o r the project window.

3 With lhe DP master d isplayed, o DP master system object should be shown as o


block and white dashed line. If the DP master sys tem objec t is not shown. then right-
click on the DP Master object in row 2X2. and select Add Master System.

4 Fro m the Profibus-DP folder of the catalog, open the ET-200B folder and select lhe
correct part number for the compac t slave; drag a nd drop the port onto the DP
master System object.

5 When the DP slave d ialog is presented, select the Profibus subne t lo which th e DP
master will be oltoched; se t o r accept the suggested Profibus address (e.g.. 3-125).

6 Se lec1 each compact 1/0 d rop lo displa y its configuration table in the bot1om pane
and to configure parameters of the drop if required (e.g .. Pro flbus address).

7 Drag and drop each additional compocl 1/0 block. as required. unrn done.

8 From lhe Station menu, pertorm a Consistency Check. then Save and Compile lhe
configuration.

89
STEP 7 in 7 Steps

Configuring the S7-31x-2 DP as an Intelligent Slave


Basic Concept
An S7-300 con serve as on intelligent DP slave w hen o CPU with DP copobilily is configured to
operate in DP slave mod e. Operating as a n intelligent slave, the 57-300 c a n perform its
normal control duties as well as opera te o s o sla ve device reporting loo DP master. Such o
configuration may be required in applications where certain field input/outp ut signals of the
sla ve may require some rorm o f pre-processing locally al !he slave, before lhe DP master
accesses fhe d o ta. Where intelligen t staves are involved, the DP master does not have direc t
a ccess to the field signals of the slave. Instead, the DP master accesses o n area o f memory
in the slave where the slave writes dofo tho I fhe master reads as field inp uts. and the stove
receives input data from the master. w hich it in turn mops onto the field outputs.

Essential Elements
If the sla ve is ba sed on the C PU of the S7-300 then a cen tral station must be crea ted just a s it
would be normally, except Iha! o CPU with DP capability must be inslolted {e.g.. CPU 315-2
DP or CPU 316-2 DP). The DP interface of the CPU m ust b e set to op erate in DP Slave mode.
all a ched to lhe DP mos1er System. and assigned g unique Profibv~ o ddre:;s /e.g .. 3-125). The
slave must also be se t to "A c tive", if programming functions (PG/PC) and standard
communications via the DP interlace should be allowed. After the S7-300 PLCs ore
c onfigured a s slaves. they w ill be listed as c onfigured slave controllers, as shown in the dialog
below. You may then logically connec t lhe DP sla ves too configured DP master.

Application Tips
w orking with intelligent slaves ls simplified when lhe Profibus subnel and the DP master ore
already configured . If multiple DP master systems (i.e., DP subnets) are in the projec t. ensure
that you a ltach each slave to the correct sub net. Once you hove assigned lhe slaves too
DP master. the Final step is to define the master-slave d ata exchange areas. This step is
d escribed in the ta sk " Configuring Moster-In telligent Slave Do to Exchange Area."

DP slave properties

I
Gene1al Comection CGrii!J,A.Jion I
- COl'lhgured Slave CootJoteJs- - - - - - - - - - - - - - - - - ~
Ccnfigured •l•v• ccntioler• can be ccffu!cted to the PROFIBU S ma.lei.
Selecla slave ~ d click ''Conr)BCt";
S!Gve PROF!BUS Slot
'""'a=u 315-20P PROABUS[l ) 6 $7300 Intelligent OP 3 Of2/1
CFU 31~-2 [•P PAOFlBUSII 4 $73CD_lntdl enl DP. 1 0/21 1
CPU 315-20P PROABUSII) 5 S7300_1ntelli!lenLOP_2 0/2/1


.._ ___________________ .!.I
I I
AcliveComection- - - - - - - - - - - - - - - - - - - - - - . .
<No Connection>

OK Help

Figure 3-23. Connection lob of DP Slave properties shows configured slave


con trollers - allows intelligent slaves to be logically connected loo DP master.

90
Working with Hordware Configurations

El.'.l S ·1 300_Master (( onf19uratmn) •· lntelluJFnt _S 7300 _Slave< l!!(l!J £i


...
PS 3076A PROFIBUSf1 DP maste1 ;;:em
;;;,;.i.f1;.:,l__,,.,.---
CPU 316·2 DP
X'J OP-Mas.'IX
(4)57-JOO

mm
3
4
6
6

,...,J• I PAOABUS(1~ OPm!l>le1systemt1)


PROABUS add!... Module ... 01d&1nl.lllbal... flrr,Nble Oi4!J)oslic oddlm Comtnffll
S7-300 CPU 31 • 2046 ,,.
S7-300 CPU 31x 2045
S7-300 CPU 31 • 2044
S7•300 CPU 31• 2043

Figure 3-24. S7-300 CPU 316-2 DP OS DP mosler wilh S7-300 PLCs OS inlelligenl DP slaves.

Quick Steps: Configuring the CPU 31 x-2 DP as an Intelligent DP Slave

■ 1
ACTION

The S7-300 slotion lhol will serve os o n in1elligen1 slave must be created if no!
already in the project. IFnecessary insert o new S7-300 station. open lhe station in
!he hordwore conf1guro11on 1001. and insert !he required power supply.

2 From the catalog, open !he CPU-300 folder: drag the required CPU 315-2 DP to slot-2
of !he cen tral rock.

3 The Profibus interface dialog will open when the C PU 315-2 DP is inserted. Select the
subnet. to which the DP slave will be a ttached, then sel or accept the sugges ted
Profibus address [e.g .. 3-125]. Confirm entries by pressing the OK bull on.

4 Double -click on the DP object in row 2x2; when the dialog is disployed select the
Operotinq Mode fob and ac1ivate the CPU for DP slave mode; confirm with OK.

s From !he SIMATIC manager select ond open !he DP Moster slolion in the Hardware
Configuration tool. A DP master system object should appear as a black and while
dashed line extended from the DP mos/er object, in row 2X2. If !he DP master system
object is no t shown. righ t-click on row 2X2 and select Add Master System.

6 From !he Prolibus folder of !he hardware colalog, open !he Configured Sia/ions
subfolder; drag and drop !he CPU 31 x object onto lhe DP master system objecl.

7 The DP stave properties dialog is op ened to the Connection tab, w hich lists the
configured intelligent slaves. Selecl each stove you wish to attach lo !he DP master;
press the Connect bu tton. then press !he OK bu tton lo confirm connections.

8 You may sove and compile the lnlelligenl station, but lhe DP moster will not
compile until each slave has al least one area defined for Master-Slave 1/0 data
exchange. See the lask Configuring Moster-Intelligent Slave 1/0 Exchange Areas.

91
STEP 7 in 7 Steps

Configuring the CP-342-5 as an Intelligent Slave


Basic Concept
A Profibus CP-342-5 communico tions p rocessor con be used lo allow the S7-300 lo serve os
an intelligent DP slave. Operating as an intelligent slave, the S7-300 can perform its normal
conlrol duties as well as operate as a slave device reporting loo DP master. Such a
configuration may be required In applications where certoln field input/output signals ol lhe
slave may require some form of pre-processing locally al the slave. before the DP master
a ccesses the data. Where intelligent stoves ore involved, the DP master does not have direc t
access to the field signals of the slave. Instead, the DP master accesses an area of memory
in the slave where the slave writes data tha t the master reads as field inputs, and the slave
receives input data from the master. which it in turn mops onto field outputs.

Essential Elements
If the slave is based on the CP-342-5, then !he S7-300 central station in w hich the
communications processor will be installed must be created just as it would be normally.
except that the CP-342-5 must be installed. The DP interface o f lhe CP-342-5 must be set to
operate in the DP Slave mode. attached lo the DP master System. and assigned a unique
Profibus address (e.g., 3- 125). The CP-342-5 must also be set lo "Active." if programming
functions (PG/PC) and standard communica tions via lhe DP interface should be allowed.
Arter lhe CP-342-5 is configured os on intelligent slave. ii will be listed as o configured slave
controller as shown in the dialog below. You may then logically connect the DP slaves to on
already configured DP master station.

Application Tips
Working with intelligent slaves is simplified when the Profibus subne t and the DP master are
already configured. If multiple DP master systems (i.e., DP subnets) are in the project. ensure
that you attach each slave to the correct subnet. Once you hove assigned the slaves lo a
DP master, the final step is to define the master-slave data exchange areas. This step is
descri bed in the task "Configuring Dalo Exchange Areas for CP-345-2 lnlelligenl Slaves."

Properlie• - DP sl,111c

General Cor,-,eciron I
CoofiguredSlave Contder~- - - - - - - - - - - - - - - - - ~
(#,figured slave c:oot/of4'rs c:an be c:cmecled lo the PAOFlBUS master
Seleci o dove <!llld click ''Connect".
PROFIBUS i-i SlabQn
CP 342·5 PROFIBUS(1) 7 S7300_CP342..5_1nt_OP7 0/4/0
CP 342·5 PROFIBUS(1/ 6 S7300_CP342..5_lnt_OPS 0/4/0
CP 342·5 PROFIBUS(1 I 5 S7300_CP342_5_1r'l!_OP5 0/4/0
L - 2 2-5 OFl8IJSl1 I 4 STllll LP"342 5 'r,' · Pt 0/oltll

ActiveCo1T1eC1ron- - - - - - - - - - - - - - - - - - - - -
<No Comecli!>n>

OK Cancel Help

Figure 3-25. Connection tob of DP Sla ve properties shows configured slave


controllers - allows intelligent stoves to be logically connected to a DP master.

92
Working with Hordware Configurations

!!:m s7300_Master (Configuration) -- lntcp§IV l!l~D


a fOIUR
...
PAOFl8US(1 : DP rMste, &
1 PS307~ •
2 CPU 31&·2 OP (4}57:3=00-.f1 i....-:::1 S::-::
(5'"' 7-::•300=sif (6) S7°300 I i£7is1.3oo,
mm rmm
X2 DP--MastrN
3

5
• El]
~
6

=
PAOFlBUS adclre..• fl MO!Ue ... Order number Fir... Oiago._ Con-me~
• 57-300 CP342·5 OP 66K7 342-SDAOx•OXEO 2046 ...
~ 57-300 CP342-5 OP 661(7 342-SOAOx-OXEO 2045
Ii
T
57-300 CP342·5 DP
57-300 CP342-5 OP
66K7 342·50AChc·OXEO
661(7 342-SOAOx-OXEO
2044
2043
!....
... ,
Figure 3-26. Sl-300 CPU 316-2 DP as DP master with S7-300s/CP 342-5 as intelligent slaves.

Quick Steps: Configuring the CP -342-5 as an Intelligent DP Slave

II I
ACTION

The S7-300 station that will serve as on intelligent slave must be c reated if not
a lready in the project. If necessary, inser1o new S7-300 s1otion, open 1he s1o tion in
the hardware configura tion tool, and insert the required power supply.

2 From the hardware cata log, open lhe CP-300 folder and the Proflbus subfo lder;
then drag lhe required CP342-5 to slol-4 or higher of the central rack.

3 The Profibus in1erface dialog is opened When the CP342-5 is inserted . Select the
subnet to w hich the DP slave will be o ltoched; then set or accept the suggested
Profibus address (e.g ., 3-125), and confirm the selec tio n by pressing the OK button.

4 Double-click on the DP mosler object in row 2x2; w he n the dialog is o p ens select
the Operoting Mode tab and activate the CP342-5 for DP slave; confirm with OK .

5 From the SIMATIC mana ger selec t and open the DP Mosler sta tion in tne Hardware
Configuration tool. A DP master system object should appear a s a black o nd white
dashed line extended from the DP mos/er object, in row 2X2. If the DP master system
object Is no t shown. righ t-c lick on row 2X2 and select Add Moster System.

6 From lhe Prolibus folder of the hardwa re ca talog. open the Configured Sia/Ions
subfolder, drag and d rop th e C P 342-5 object o nto the DP master system object.

7 The DP slave properties dialog is o pened to the Connection lob wi th configured DP


slaves listed. Select each intelligent sla ve you wish to a ttach lo the DP master; press
the Connect b utton. then press the OK button to confirm the connections.

8 You may save and compile the intelligent station, b ut the DP master will not
compile until each slave hos at least o ne a rea defined for Mosler-Stove 1/0 data
exc hange. See lhe task Configuring Exchange Area for CP 342-5 lnlelligen/ Slaves,

93
STEP 7 in 7 Steps

Configuring the ET-200X {BM 147/ CPU) as an Intelligent Slave


Basic Concept
The BM 147/CPU Basic Module is o Basic language p rocessor and CPU combina tion.
Operating as an intelligent sto ve. the BM 147/ CPU can pertorm its normal control duties a s
well as operate as a slave device reporting too DP master. Suc h o configuration ma y be
required in applica tions where certain field inp ut/output signals of the stove moy require
some form o f p re-processing locally al the slave. be fore the DP master accesses the d o lo .
Where intelligent slaves ore involved . the DP master d oes not ho ve direct a ccess to the field
signals of the slave. Instead the DP master a ccesses on area of memory in the slave where
lhe slave outpuls d ata to be read by the master as field inputs. and receives Input dolo from
the master to b e mapped onto the field outp uts.

Essential Elements
The configura tion of the BM 147/CPU Basic Module. as on intelligent slave. is storied by
creating a new S7-300 station. Instea d o f plac ing a rock in the empty window. you will drag
the BM 147/CPU Basic Module lo the window. The SM 147/CPU Ba sic Module is in the Profibus
fold er of hard ware catalog. contained in th e ET 200X subfolder. like other Pro fibus nodes. the
BM 147/CPU slave must be a ttached to lhe DP master system. and assign§ld a unique
Profibus address (e.g .. 3- 125). Once configured. the BM 147/CPU will be listed as o configured
sla ve controller in the connection dialog o f the DP slave properties. You may then logically
connec t the DP slave to on already configured DP master sta tion.
Application Tips
Working with intelligen t slaves is simplified when the Profibus subnel and the DP master ore
alread y configured. If multiple DP master systems ~.e.. DP subnets) ore in the project. ensure
that you a ttach ea ch slave to the correct sub net. Once you assign the slave s too DP master.
lhe final step is to define the master-stave d ata exchange areas. This s1ep Is descri bed in the
ta sk "Configuring Moster-Intelligent Slave Da to Exchange Area ."

li,JBM_147_CPU_lnt_OP _Slave (Configuration) -- lntelligent_57300_51aves l!!I~ EJ


....
r (OJBM 147 I CPU
1
2
...........,_
BM 147
,._.......... _ •
X2 DP
3
4 018xDC24V
5 DO EbcOC24V/1 .2A
6
7
A :.:.I

~ '.!!J (Ol BM 147 / CPU

,
Slot- MocUe 01de1numbe, ... M .. l addle$$ Q addiess C(ffll)enl

,? BN l./7
.
, I(;," OP 12ti
3
4 DI 8xOC24V 6ES7141-1BF30·000 0
5 DO 8.xDC24V/ 1.2A 6ES7 142·1 BF30-000 4
0

Figure 3-27. The BM 147/CPU configured a s on intelligent DP slave. When o modular slave
sta tion is selected. its modules ore listed in the bottom p ane.

94
Working with Hordware Configurations

:T.,1 573D0_!'1,1stc, (Configuration) -- lnt<!lligcnt _57300_51,1v"s 8~ El


•]PI UA
1 PS 30751\ .~ PROABUS(i . D?m~e1 svsternlll
2 CPU 316-2 OP
X2 DP-MilllfJr
(41S7-DJ iij 15) S7,300 I ji(6) $7,300 I ij (7) S7-300 I
3
4
5
6
D ml ~ mm

~~ PROABUS(li OP meilel tY$lem l1J
PR OABUS aild1ess
S7 •300 CPU 31x 20-45 ..
O.;;,
·3_0.a.
....Sa.a7.... CPU
;..;;...a.
Jl_x- i r - - - - 1 - - - - t -20-44
-'--'-----1-------j
57-300 CPU Jlx 20-43
BM 147 / CPU 2042 .,.

Figure 3-28. When the DP master system object is selecled, lhe intelligent slaves ore listed in
the bottom pone.

Quick Steps: Configuring the ET-200X {BM 147/ CPU) as an Intelligent Slave
ACTION

I Open the required project and create o new S7-300 station to serve as the
intelligent slave. and then open the station in the Hardware Configurolion tool.

2 From the catalog. open the Profibus DP folder. the ET 200X subfolder, then drag and
drop the BM I 47/CPU object to the emp ty top pane o f the station window.

3 The Profibus interface dialog is opened when the BM 147/CPU object is inserted:
select th e subnel to which the DP slave will be o floched; set or accept the
sugges ted Profibus address (e.g .. 3· I 25), and confirm entry with the OK bu tton.

4 From the ca talog. expand the BM I 47/CPU folder and from the signal module
subfotders, drog the required expansion sub-modules to the appropriate rock slot.

S Once the required expansion sub-modules ore entered. save the configuration.

From the SIMATIC manager. selec t and open tt1e DP Moster station in the Hardware
Configuration tool. A DP Mosler system object should appear as o block and white
dashed tine extended from the DP master object, in row 2X2. If the DP master system
object is no t shown, righ t-click on row 2X2 and select Add Master System.

6 From the Profibus folder of lhe ca talog. open the Configured Slotions subfolder;
drag and drop the X-BM 147/ CPU objecl onto the DP master system object.

7 The DP slave properties dialog is op ened to the Connection lob with configured DP
stoves listed. Select each slave (e.g., X-BM 147/ CPU ) you wish to attach to the DP
master and press the Connect bullon: confirm connections w ith the OK button.

a You may sove and compile lhe intelligenl station, but the DP mosterwill nol
compile until each slave hos al least one area defined for Moster-Slave 1/0 data
exchange. See the losk Configuring Moster-lnte/Jigent Stove 1/0 Exchange Area.

95
STEP 7 in 7 Steps

Configuring Master-Intelligent Slave Data Exchange Area


Basic Concept
1/0 data exchange between o DP master and on intelligent DP sla ve is different from the
normal mosler-slove interaction. with modular and compact sto ves. Normally. the DP master
directly accesses the slave 1/0 - cyclically wri ting lo outputs and reading inputs. With
intelligent stoves, the 1/0 is no t accessed directly, Instead, DP data areas ore defined in the
slave to allow 1/0 dolo exchange with the master. The DP master reads (input dala) from
areas defined os outputs in the slave and writes (output doto) lo oreos defined os inputs in
the slave. The user program in the slave is responsible for continuously reading data from the
doto area and wrillng data to the data area to handle 1/0 data exc hange with lhe master.

Essential Elements
When defining o data exchange a rea. on address defined a s output in the slave, will be
read from on address defined os inp ut in th e DP master. An address d efined as Input in the
slave. is wril1en lo from on address defined as output in the DP mos/er. Depending on lhe
applico lion, a single con tiguous input area a nd a single contiguous output area may be
required. or several 1/0 a reas of one or more bytes or words may be required. In either case,
you must specjfy the data unit (i. e .. bytes or words), length. and consistency. The length is the
number of doto units, and consistency delines how the data should be kept together when
transferred. If the slave CPU, or the DP master supports process image partitions (e.g .. S7-400),
then you may specify the partition number lo which the a rea should be assigned.

Application Tips
Whe n specifying o dola area for an $7-300 slave, you must not use input/output addresses
assigned to installed modules. If the data a rea is for the BM 147/CPU. then the useoble
address ra nge for the slave is from by te 128 through 159 for bolh the Inp ut and ou tp ut a reas.

iA 11iHA lit?§ •l,f4O•UtJ Ii 31iilil11112\U·l iI H·ifl I 2Sl


Mode:
- DP Paitner. Ma$Cer
I•1s 3 [Ma$lel•d!\/I! co~ailon)
Loc.11-Slave

DP ~cJ.i...,.;
3 DPaddresr 14
Name: jDP-Mattet ~lame: lop
Addles s.l)ipe: lou1put 3 Addre,~ type; jtnput 3
Adcieu; !40 Address: J2
''SJot''! !4 "Siot'~ 14
Procen image: ]001 'P' 3 Proc=,nage: jt"JB Pl 3
lntem4)1 OB:
3 Dr1rJr~..,,:l(i = I
Length 12 ~ :

Uoc jB}4a 3
Comistency: lurt :::I ;!,]

11'
I />ppl,o
I C-aocel I H~ I
Figure 3-29. Dialog for configuring master-intelligent slave dola exchange area.

96
Working with Hordware Configurations

Quick Steps: Configuring Master-Intelligent Slave Data Exchange Area

ACTION

1 With the DP Moster station open in the Hardware Configuration tool. in the top
pane, double click on the intelligen t DP slave objec t for which you wish lo define
data exchange areas.

2 When the DP slave Properties diolog is presented, selec t the Configuration lob to
open the dialog for defining mos1er-slave exchange areas. Exchange areas that
hove already been defined will appear as rows in a table. Each row represen ts - In
the end. the number of rows will depend on the number of separa te areas you
need to define.

Defining on lnlelligent Slave Input Area :

3o To define o slave input orea, selec t Output as the Address Type in th e DP master
column. and in the Address field enter o start byte number for the logical area from
which data will be sent to the DP slave. Select Input as the Address Type in the DP
stave column. and in the Address field enter o start byte number in which data will
be received from the DP master partner.

In the lower part of the dialog, define the length ol th e data area: select the unit of
the data as bytes or words: and define the consistency o f the data according to
the unit or total lenglh. The consistency defines how the data should be kept
together and maintained during transfer (e.g.. byte. word. total length).

So Click in the Comment field to enter information associated wi th the data area.

6o Conflrm the entry by pressing the OK button lo enter the defined logical area. The
defined area w ill be entered as a Configuration Row on the Conligurolion tab.

Defining on Intelligent Slave Output Area:

3b To define a stave output area, select Input as the Address Type in the DP master
column. and in the Address field enter a start byte number for the logical area in
which data wrn be received from the DP sla ve. Select Ovtpvt as the Address Type in
the DP slave column, and in the Address field enter a start byte number from which
dola will be sent lo the DP master partner.

4b In the lower port of the dialog. define the length o f th e d ole area: select the unit of
the data as bytes or words: and define the consistency of the data according to
the uni/ or total length. The consistency defines how the doto should be kept
together and maintained duri ng transfer (e.g.. byte. word. total length).

5b Click in the Comment field to enter information associated w ith the doto oreo.

6b ConFirm the entry by pressing the OK buflon to enter the defined logical area. The
defined area w ill be entered as o Configvrotion Row. The p rocess may then be
repeated to define a no th er logical data exchange area.

97
STEP 7 in 7 Steps

Configuring Data Exchange for CP 342-5 Intelligent Slave


Basic Concept
1/0 data exchange between o DP master and on intelligen t stove is different from the normal
master-slave interaction, with modular and compact slaves. Normally, the DP master
a c c esses the slave 1/0 directly- cyclically wri ting to outputs and reading inputs. When there
is on intelligent slave, the 1/0 is not accessed. Instead, DP data areas ore defined in the stove
lo allow 1/0 data exchange with the master. The DP master reads Vnpul data) from area s
d efined as outputs in the slave and writes (output data) lo areas defined as inp uts in the
slave. The user p rogram in the stove is responsible for continuously reading data from the
dota area and wrillng dola to lhe doto oreo to handle 1/0 data exc hange wilh lhe master.

Essential Elements
When defining the data exchange area, on address defined as output from the slave will be
read to on a ddress defined as inpu t to the DP master. An address d efined as Input lo the
slave is written to from on address defined as output from /he DP master. Dep ending on the
1/0 application, a single contiguous input area and a single contiguous outp ut area may be
required. or several area s of one or more byte or word units may be required. In either case.
the d oto unit (i.e., bytes or words). and consistency must be specified. Consistency defines
how the d a ta should be kepi together when tronsrerred; by the unit (e.g .. byte. or word). or
by the total length. If the slave CPU or DP master suppom using process image partitions
(e.g .. in S7-400). then o partition number to which area should belong may be specilled.

Application Tips
When defining the Input/output address areas. you must no t use address bytes that hove
been assigned lo installed modules.

!!l'.]57300_M.:,~tcr (Conngur.:,tion) · - lnlq,sl-,, 80013



PROFIBUS[lt DP rna;ter i
1 PS 30? 5A •
2 CPU 31 S-2 DP
ij (4JS?-3001 ij (5] S?-300 I ~ 16157-300 ~ (7) 57-300 I

ma m
DP.,.b<°..Jl)f'
ill] ~

..l• I (4) 57-300CP342-5DP

-:,-1------1----------+---------------·· I
Figure 3-30. S7-300 lnlelligent slave with Universal modules for configuring doto exc hange.

98
Working with Hordware Configurations

Properties - DP slave :

Addi&: / ID I
1/0 Type; In ct. 3 OiectEnby... j

lr'C)IA
Addres,:; Lel'.l!lth: Unit Con~tent ovei:
Start: j4D 12 3 !Byte .:] lunl 3
End: 41
PJoc= image par\ijon fop Pl 3
Data forSpecilic Maoolacturer.
(Mai<im1111 14 bites heicadecimal, sepa,ated by comma 01 blank space)

OK
I C.,ncel I__H_e_lP_ _.

Figure 3-31. Configuration dialog for 1/0 d o to exchange w ith CP-342-5 slo ve.

Quick Steps: Configuring Data Exchange for CP 342-5 Intelligent-Slave

ACTION

1 Wilh lhe DP Moster sta tion open in the Hardware Configuration tool. In the top
pone. and select lhe in lelligent DP stove objec l for which you w ish to define doto
exc hange oreas.

2 From lhe hordwore cotolog and under the Configured Slolions folder. open the 57-
300 CP-342-5 DP folder; then find the Universal Module and drag one or more
modules to the configuration toble in the bo ltom p one. The number of modules
installed will depend on the number of separa te areas you need to define.

3 Double -click on o module to open the configuration dialog for defining the data
exc hange area.

4 Select the 1/ 0 Type as Input, if the module receives input data from the master; as
Ou/put. lo allow lhe module lo send d alo to the master. Selec t Output-Input. to
allow the module to accept inpul from the master and to send output data to the
master. Select Empty Slot lo leave on unused area within lhe defined area.

5 Nexl, define lhe length of the d ata area; select the unit of the data as bytes or
words; and define the consistenc y o f the data according lo the unit or totaJ length .
The consistency defines how lhe da la should be kepi toge ther and maintained
during transfer (e.g .. byte. word. total length).

6 Confirm the enlry by pressing the OK bullon.

99
STEP 7 in 7 Steps

Configuring S7-300 CPU General Properties


Basic Concept
The General properties of o n S7-300 CPU module ore viewed in the properties dialog of the
CPU with a right-click o n the CPU. t11en selec ting Object Properties. Basic information about
the CPU. which may vary depending on the relative age of the module, includes items such
as type and loca tion, o short list or characteristic features. and for modules with
communications interfaces - related information is provided.

Essential Elements
The Short DescripHon . the some os given in lhe hardware cotolog. gives important CPU
features such as work memory size, cycle time/1000 instructions. digital 1/0 capacity,
supported connec tions. DP/MPt ports. multi-computing ond routing copobitlty. The Order
Number reflec ls the module assigned In the configuration tool ond con be compared lo the
installed module. The Name fie ld shows the delaul1 name of the module. which you can
modify as required. Changes to the CPU name are reflected in the SIMATIC Manager.

The Interface parameter group. generally on modules with communications interfaces. shows
basic information such as node address and whether or not the node is o ltached. The
Properties bu tton provides quick access lo parameters ol lhe in lertoce; but interlace
properties [e.g .. MPI. Profibus, a nd Ethernet) are generally set in the hardware configuratio n
tool. The Comment field a llows more details about the C PU application to be documented.

Application Tips
The user-defined Plant Designation identifier. available with some CPUs, is a user-defined
identifier that con be evaluated in sta rt-up OBs the user program, Examples of evaluating the
"plant designation" ore provided in the STEP 7 Sample programs.


ikl·l·t911t4AdA1flt·Al;J•tfti.-::
Tim~·ol·I>~ lntenl.C)tt
General ] St~
I CJ>Ci~ lntent1pt
Cyds/Cb;k Memory
D~1tic,/Clock
J A8'eotive M-y
I
Sholl Oewipliorr CPU316
p28 KB work momoty; 0.3 m~/1000 iMtruclioAs; MPl caw,clion,
[ti-lief cor11i,.&181ion up to 32 mcdiles

.:J
6ES7 316-1AGO!l.(W!O

lntorf,ice
Tl\'.llr. MPI
Addre~ 7

.:J

I OK I Hel\, !
Figure 3-32. CPU Properties: General porometers d ialog (e.g., CPU 316).

100
Working with Hordware Configurations

i4t·l ·t41it¥◄34 1 Ell~ffif;i1 tttJ _ _,,_____ ~


Tirne-of-0 ay Irterrui;J; I Cyde hte,:rul)A I Oiagio,;bCUC:lock I
Pro1ection I
Gene141 ] Stanup I c,de/Clod. Merray I Aetenlive Meme,y j Memory I
lotenwti I
CPU 318-2
°256 KB WOik. memoty; O .J mr{1_000 mltucti~; MPI+ OP conneclian .:J
(OP mo~, 01 Of" 1lave}, ,,_.a,tieol ca,f,g,.a~1on _., to 32 mod!~e,, (erd
and Receive ~'Uy for drect conm.nl)ati:,n, con;tant bin~
line. ,cuing, fwll'(l'!ere \11 .o ..:J
01det No,; EES7 318-2.\100-0ABO
Name, lt!taitill

Con-rnert

I OK I Help

Figure 3-33. CPU Properties: General parameters dialog (e.g .. CPU 318-2).

Quick Steps: Configuring S7-300 CPU General Properties

ACTION

I With o sla tion open in the Hardware Conrlgura tion tool select the CPU, right-click
and selecl Object Properties, lhen select the Generol 1ab.

2 The Short description of the module provides a brief summary o f th e unique features
or lhe installed CPU module: it connol be modined.

3 The Order Number of the module is the specific number used to identity lhe exact
CPU that should be installed in the rock. The order number determines the unique
feolures of lhe CPU, which ore summarized under lhe Short Description.

Click in the Name field to modify the default name assigned lo the module. The
default name is based on lhe short name of the selected CPU lype (e.g .. C PU 318).

5 The Interface static group, shows lhe module's set MPI address (default - 2). and
whether or nol lhe module is attached lo lhe network: the Properties button allows
the module's lnlertace parameters lo be accessed for viewing or editing.

6 Click in lhe Comment field to document the module purpose or application.

7 Confirm any changes by pressing the OK bul1on.

101
STEP 7 in 7 Steps

Configuring S7-300 CPU Start-Up Properties


Basic Concept
S7-300 CPU modules moy be started without ony changes to the default stort-up param e ters.
There are a few adjustable parameters. however. that allow you to determine CPU start-up
characteristics or whether or not the CPU should even be allowed lo star!. These parameters
are checked by the CPU o f the various startups (e.g.. power O N, or the transitio n from STOP-
to-RUN). before beginning lo process the main cyclical program (OB1).

Essential Elements
The parameter Startup If Setpolnt and Actual Configuration Differ. determines if the CPU
should be allowed to start-up if the setpoin t and actual confi gurations differ - the default
beha vior in the S7-300, is lo start even if the setpoint and aclual configurations d iffer. The
parameters Reset Outputs at Hot Restart and Disable Hot Restart by Operator are bo th
grayed since the "hot restart" does not apply to the S7-300. The Startup After Power-On
parameter is generally g rayed out and fixed to "Worm Restart.'' since it is generally the only
start-up mode possible in S7-300 CPUs - in newer S7-300 CPUs like the CPU 31 8, ii is possible lo
selec t whether o start-up o fter Power- On will initiate a "Cold Restart, " or a "Worm Reslorl, "

The Monitoring nme parameter, Finished Message, specifies the maximum C PU wait-time. a t
power-up. lo receive ready-signals fo r a ll configured modules. The parameter Transfer of
Parameters to Modules specifies lhe maximum lime tor modules, including DP-In terface
modules, lo acknowledge receip t of their configuration parameters (the wait-time sta rts ofter
receipt of the "Finished Message") . If either of th ese two monitoring parameters ore not
acknowledged before the se t time e xpires, the prese t and actual configurations will be
considered different. The CPU reaction is then determined by the parameter "Startup ii Prese t
and Actual Configuration Differ." Finally, th e Hot Restart parameter applies only in the S7-400.

TfmMl·D~.dntem,c,ti
General Si.,t~
I Cydc lrnell\lpt
I C}'Cle/C10ck MeJllOo/ J
I Di<lOlQttlc.vOock
Rele<itive Memoty I
I
MEfl'JOI.Y
Piohii:lioo
I ,,..em.¢
I
J; Star~ v-hen e~pee!td/~tu!I conl'IQlieii«I dlfei
P Flr :l!l 011lp\Jl •l,rl 1r 1111
J;1 D1-.rl'I,;, t/pln,,;lar; l·y <!P1l•at.or llor e1<amp e 1;0'11 PG)
Qr c~111~:,-q017 cb /Qr eiiarnpe fTom llf'I $\itlrrvl

StatupaftaPowerOn- - - - - - - - - - - - - - - ~

Monitoring Time lo,,,_---------------""'


'fii1ithed'' mes:.-ga bi, mo6.Jle~[100 ms~ jsso
lrol!l'l,fer ol l)bl-,meters to modules (100 mst ,1-00_ __
...

Hoc~.·a111oom, In

I OK I Help j
Figure 3-34. S7-300 CPU Properties: Start-up parameters d ia log.

102
Working with Hordware Configurations

Quick Steps: Configuring S7-300 CPU Start-up Properties

ACTION

1 With the Hardware Configuration tool open to the desired project and station:
select the CPU module. right-click and selec t Object Properties. then select the
Startup lab. Parameters that ore grayed ore either not possible in the S7-300 or in
the open CPU.

2 Activate the check box Startup if Preset and Actua l Configuration Differ, to allow the
CPU lo start even ir the preset and se tpoint configurations differ. With this selling,
central rock or distributed 1/0 modules are not checked; PROFIBUS-DP interface
modules ore checked and must be inserted ror the CPU to start. This parameter is
activated by default in older S7-300 CPUs and cannot be changed.

3 De-activate the check box to disable Startup If Preset and Actua l Conflguratlon
Differ. If at least one configured slot differs, then the CPU switches to STOP. If
module-slots other than those originally configured hove inserted modules. they ore
not compared. This setting is generally not possible wilh older S7-300 CPUs.

4 The parame ters "Reset Outputs at Hot Restart" and "Disable Hot Restart by
Operator" are grayed since they ore only possible in the S7-400.

5 Where allowed. select "Cold Restart" or "Warm Restart" as the mode of Startup After
Power On. The option is flXed to "Worm Reslor1 " In older S7-300 CPUs.

6 Set the parameter Anlshed Message, in milliseconds, lo specify the maximum CPU
wall-lime ror configured modules lo signal ready for opera tion ofter power-up.

7 Set the parameter Transfer of Parameters to Modules. in milliseconds. to specify the


maximum time for all modules, including DP slaves, to acknowledge receipt of their
configuration parame ters.

8 The Hot Restart parameter is grayed, since Hot Restart is not supported in the S7-300.

9 Confirm the configuration parameters with OK.

10 Use the toolbor Save and Compile b utton lo generate the sys-fem data blocks.

103
STEP 7 in 7 Steps

Configuring S7-300 CPU Cycle and Clock Memory


Basic Concept
The Cycle o nd Clock Memory parame ters ollow for the cyclical processing time of the CPU
to be influenced and for a single byte to be defined where the CPU may output periodic
c lock pulses. Modifying default parameters o f this dialog is not essential for S7-300 operation;
however they do allow adjus1ments tho! optimize use of CPU processing time.

Essential Elements
The Update Process Image Cyclically porometer determines it the p rocess imoge of inpu ts
and o utputs should be updated cyclically. This poromeler is fixed lo always update the Pit
ond PIQ in the S7-300. but moy be a ltere d in the CPU 318. The Scan Cycle Monitoring Time is
the limer volue thot if exceeded by the CPU cycle, the CPU is slopped. The Minimum Scan
Cycle. not applying to the S7-300. is grayed. The Scan Cycle Load from Communications
allows o percentage of the total processing time to be allocated to communications.

Adjusting the Size of the Process Image Inputs and Process Image Outputs, perha ps to reflec t
actual usage, is o nly re levant in the CPU 318. The parame ter OB 85 Call Up at 1/ 0 Access
Error, is generally grayed and by default is fixed such thot 1/0 access errors do not result in o
coll of OBS5. no r is on entry mode In the diagnostic buffer. In loler CPU revisions. o ther op lions
for colling 08 85 include "Only for Incoming and Outgoing Errors". or "On Each Individua l
Access." Finally. the Clock Memory parameter allows a byte from Bil memory {M) lo be
sp ecified as the location w here the CPU will output eight individual clock-pulses.

Application Tips
Clock p ulses, ore accessed in the user program, via the eighl bits of the specified byte. From
the most-significant lo the least-significant b it. the output frequency is 0.5. 0.625. 1.0. 1.25, 2.0.
2.5. 5.0. and 10 Hz. These pulses ore used instead of timers, where periodic signals ore
needed. Typica l uses include fla sher-circ uits, a larm synchronizatio n. or where even ts must be
con tinuously triggered a l periodic intervals. Clock p ulses ho ve o n on/off ratio o f I : 1.

iQJijH§di¥1341fil·Miti•M1--=
Time-d-Da_yl~errulll~ I Cycle lntenvcil } 01,~not~t/Oock ] Protectm }
Gerieral I Staitw, Cycle/Clock Memory ) Reteivive Memoo, I Memo,y lntem.¢ I J
- Cjd&
w Update 091 proceu i~ ac~

Scan Cycle Monil01T>ll Tine (rmt ,,so


Mnrrun Scan Cycle Tme [inst 10
Scan Cj.iole Load horn Cortm!rilalJon [%~
Size t,/ tho I " ~ ~ input .,,~a
Siza t,/ the f>ioceas~ffW>'J!> Outpli Area

0885 · Cal Up-at l/0 Ace= Enor INo 0885 ca.1 IJI> .:]
At each indi-.idial ;,cceu
' ' .

~ Merna;,-----------------------~
P Clock merroy
M ~ 8;,te< 120

I, OK I Cancel j __H_e_~_...
Figure 3-35. CPU Properties: Cycle Time and Clo c k Memory parameters.

104
Working with Hord ware Configurations

Quick Steps: Configuring S7-300 CPU Cycle and Clock Memory

ACTION

1 With the Hardware Configuration tool open to the desired projec t and station:
select the CPU module. right-click a nd selec t Object Properties. then select the
Cycle/Clock Memory fob. Parometers tha t are grayed are either no t possible in the
S7-300 or in the op en CPU.

2 Ac tivate the checkbox Update OB 1 Process Image Cyclically for cyclic updates o f
the process image tables /Ptl/PIQ). This default setting is genera lly fixed in most S7-
300 CPUs and c annot be changed. De-oc tivote the checkbox to disable normal
cyclic updates o f the p roc ess image; 1/0 upd a te musl b e handled by calling
blocks.

3 In the Scan Cycle Monitoring Time field, sp ecify in millise conds. the cycle time tha t
the CPU is not to exceed. If the actual cycle time exceeds this watc hdog time, the
CPU enters the STOP mode. unless OB 80 is loaded in CPU memory.

4 In the Minimum Scan Cycle Time field specify. in millisecond s, the minimum time
that should be used to process the program. If the octuol cycle lime is less than the
specified minimum, the CPU waits until the minimum cycle time expires. or if O B 90 is
fn memory. this remaining time is used by the C PU for b ac kground p rocessing.

5 In the Scan Cycle Load from Communications field. en ler o value from 10 to 50. a s
a percent of the set cycle lime ta alloc a te for c ommunicalions p rocessing.

6 Click in the Size of the Process Image Inputs field and enter on end byte -address for
the Ptl Iha! reflects the actual number of input-by tes (Pit) installed. The PII up date
lime is thereby minimized. The parame ter is only relevant in some S7-300 CPUs.

7 Click in th e Size of the Process Image Outputs field and enter on end by te-address
for the PIO that reflec ts lhe actual number of outpu t-bytes /PIQ) installed. The PIO
update time is thereby minimized. The parameter is only relevant in some S7•300
CPUs.

8 Where the OB 85 Call at 1/ 0 Access Error parameter is allowed, select the option
" No Colt of OB 85" it 0885 should not b e c alled w hen a n 1/0 a ccess error occurs
during up d a te of the process images /PII/PIQ) : select the option "Only for Incoming
ond Ou tgoing Errors." lo minimize lhe impac t on the CPU cycle. The option " On
each individual access" c on resull in on increase in CPU cycle lime.

9 To use clock memory, aclivale !he Clock Memory check box and lhen enler a byle
/e.g., MB 97) from Bit Memory, ta use for CPU output o f eight individual clock p ulses.

10 Confirm the configuration p aram eters with the OK b utton.

11 Use the loalbar Save and Compile b ulton lo generate the syslem data blocks.

105
STEP 7 in 7 Steps

Configuring S7-300 CPU Retentive Memory


Basic Concept
The CPU Retentive Memory poromeler settings allow o reos of memory lo be defined os
re ten tive. Re tentive memory retains its stored contents when the CPU opera ting mode is
switched from RUN to STOP ond even upon power loss. Modifying the default parameters o f
this d ialog is not essential for operation of S7-300 CPUs, unless you require tho! certain
memory bytes, timers, counters, and data areas retain their contents on loss of power.

Essential Elements
In the S7-300 ports of bi t memory (MJ. timer [T). ond counter (C) oreos moy be defined os
re tentive. The first three parameters require an entry of the number of bytes, timers. or
counters lo reserve starting rrom byte-0, limer-0, or counter-0 respectively. An entry of 4 in
the bit memory field reserves byte-0. 1, 2, and 3 as retentive. In addition lo these re tentive
memory areas, the S7-300 also ollows Da to Block a reas to be reserved a s retentive. The
defined areas will reta in its data given power loss and even the loss of bol1ery backup.
Finally, the ma.ximum size tha t can be reserved as retentive is dependent on the CPU.

Application Tips
Recall that under normal cond itions involving loss of power, the contents of data blocks are
a lways retained by battery backup. The maintenance free S7-300 feature, described here, is
to protect against loss of the areas defined as retentive not only g iven a lass o f p ower, but
particularly a loss of battery backup.

i4i,i,ldlit4434fEll·li;lrttt➔ ----- ~
Time-ot-0">' Irterrupl;
Gene•¥ I Storlup
I Cydc lrterrupl I
Cycle/Q;,d< Mem()l)I
Di<!'..}!l(l;tiCJICkii;k
RetmeMemoiy
P,otoolion
lnten~
I
I
RetMMy- -
Nurrber Q/ Mem01y Bvtei Startiig with MBO: Im
Nlf!i>er Qf S7 Tmeu Starmg with TO; lo
Nurrh!r of S7 Counters S~rti-Q wilh CO; la
Alea,
-
OB No. BvteAdd1en NLfli>er ol Byl~
Retem-,,e Aiea 1. 1, 0 lo
Relerlrve A1ea? 1, 0 lo
Re1~ A1eal. 1, 0 lo
Reterwe Area 4: 11 0 lo
ReterweA1ea5: 11 0 lo
Reterwe A,ea & 1, 0 lo
Relenr,,e Area r 1, 0 lo
Reterlive Area a It 0 lo

I OK
I Cancel Help

Figure 3-36. CPU Properties: Retentive Memory parameters.

106
Working with Hord wore Configurations

Quick Steps: Configuring S7-300 CPU Retentive Memory

ACTION

1 With the Hardware Configuration tool open to the desired projec t and station:
select the CPU module. right-click a nd selec t Object Properties. then select the
Retentive Memory tab to d efine required re te ntive memory a reas.

2 Click in the Memory Bytes field , a nd enter the total number of bytes to define as
retentive. The defined oreo starts o t MB Oo nd will inc lude oll by1es up to MB n- 1.

3 Click in the S7 Timers field and enter the numb er of timers to d efine a s retentive. The
defined re tentive oreo starts at TO. and will include all timers up lo Tn- I.

4 Click in the S7 Counters lleld and enter the number o f counters 10 define as
retentive. The defined re tentive area starts a t CO, and will includ e a ll counters up to
Cn-1.

5 To d efine retentive doto b loc k oreos as required, start with Retentive Area I and
enter the data block number in the DB No. fie ld; enter the starling By1e Address in
the second field: o nd en ter the total Number of Bytes in the los t field. Using on even
number for both the start a d dress a nd the total number of bytes will help to o void
o verwriting d ata areas.

6 Deline a s ma ny retentive d a ta b lock areas as required a nd confirm the p a rameters


with the OK b utton,

7 Use the toolbar Save and Comprte b ullon to genera te the system data blocks.

10 7
STEP 7 in 7 Steps

Configuring S7-300 CPU Local Memory


Basic Concept
Local memory is the S7 memory area used when temporary (TEMP) variables, whic h were
declared in a code b lock, ore accessed during program execution. This memory, also called
the local slack or L-stock. is only available to the current block while the block is being
processed. After the block is done the local slack is available lo the next called b lock, which
oveiwrites the previous data . Each CPU hos a fixed local memory size Iha! in most S7-300
CPUs cannot be altered, but may be re-allocated in the CPU 31 8 and some newer CPUs.

Essential Elements
Each CPU ha s a fl.Xed amount of local memory that is equally divided among the priorities
classes (1-29). As will be discussed in more detail later, all code blocks (e.g., FB, FC. SFB. and
SFC) are called direc tly or indirectly from on orgonl1.ation b lock (OB) for processing.
Furthermore. all organiza tion blocks ore called by the operating system based on a pre-
assigned priori ty class. Since local memory is allocated to the priori ty of OBs. the local
memory available to each code b lock is based on lhe OB from which the block is called.

In C PUs where local memory may be re-allocated. the memory assigned too priority con be
re-distributed to where it is needed. In some cases for instance, a priority class is not in use or
all of its local memory is no l needed. Re-allocation of the local memory is useful since p riority
classes do not all need the same local stack size. High priori ty classes. for example. do not
normally involve large dala requirements or more lhan two levels of block calls.

Applic a tion Tips


When allocating local memory. all temporary variables of the OB and of the blocks called
from lhal OB musl be considered. If loo many nesting levels (blocks called in a horizonlal
direction) are used, the L-stack may overflow. The local slack require ments o f each program
should be tested. The local data requirements o f synchronous error OBs must a lways be
token into consideration. All organization blocks require a minimum o f 20-bytes of local
memory to store the 20-bytes of start information entered by 11,e CPU.

Properties - CPU 31 S - (R0/52) __


Time-of-Oav lri~r I Oiagrmtic-i/Clo0k Protection
G~eral I
Sla1lt11> l I RetEtme Memoiy I lnte11~

CPU 315
48 KB Mlfk mernocy; 0.:3 mtn 000 ~!l,uctioos; MPI comecllon: mulli·tlei ..._
c:onhgu,atlon I.Ill t() 32 m ~

Orde, No.: EES 7 315•1AF02,QilJ!O


Name:
• lnterf~o
Two: MPI
Allteu; 2
N&twoiked: No

c-~

OK I Help

Figure 3-37. CPU 315 - No Memory tab. All priorities allocated 256-bytes.

108
Working with Hordware Configurations

iQt,]lt§IJ[¥◄34'ill~ffif;i 1 J!fJ _________ ~


r--~-0~ lf(ffl.yPI; I C,i'cic l~etN!lA I Oi~~c•/Clo,-t. P!o1ect10n l
General I St«tui> l Cjoc~/Clock MefllCIO' I Aelentive Memgiy li1ef110fy 1 lnter~ts J
~ local Data IPoon'\y OM-) -
1 Jfi 7 ju 13 lo •s lo 251256
2 J256 ti ! 1~ Ir• ;ri 1, 26 j25S
31256 9 j2!:6 11llo 21 lo 211256
4 1256 10 I 16 laG lJ
t... ze l25s
s lo 11 1· 17 J256 ~ la 29125s
6 jll 121256 18 ,,. 24 1256

Aoeigned 3584 8)(83 o/ IMK. j4096

~ ommuooat,on Aesouoes
,11<n rn,, r,= !rt';l,lf :111 <tr j'l"'J :I
I
I OK I J-1elp I
Figure 3-38. CPU 318 local memory parameters. Memory re-ollocotion allowed.

Quick Steps: Configuring S7-300 CPU Local Memory

ACTION

1 With the Hardware Configuration tool open to the desired project and station;
select the CPU module. right-click and selec t Object Properties, then select the
Memory fob to make required changes to the local memory areas.

2 Click in a Priority field and enter the total number of bytes to define for each priority
class. A minimum of 20 bytes must be en tered to satisfy the minimum requirement of
every organization block For storing 20 bytes of start information used by lhe CPU.
The value must be divisible by 2.

3 Modify as many priori ty classes as required and confirm settings with OK.

4 Use the toolbar Save and Compile b utlon to generate the system data blocks.

109
STEP 7 in 7 Steps

Configuring S7-300 CPU Diagnostics and Clock Properties


Basic Concept
Each S7-300 is equipped with a reol-time clock tho l ls required for using runtime meters ond
for triggering Time-of-Doy interrupts. Each CPU also incorporates a Diagnostic Buffer- on S7
memory orea where Diagnostic events ore stored in lhe order they occur. Modifying the
default Diagnostics and Clock properties is not essential: however these parameters allow
you lo innuence operating charac terisllcs of the diagnostics bufler and o f lhe CPU c lock.

Essential Elements
Three parameters influence the diagnostic buffer. Ac tivating the Extended Functtonat Scope
causes the CPU to enter events other thon stand ard errors into the d iagnostic buffer. For
example. each stort of on organization block is considered o d iagnostic event. The increase
in d iagnostic events will cause the b uffer to overflow sooner. and make it more likely tha t
important messages will be overwritten. In some CPUs the parameter Number of Messages In
Buffer, allows the d iagnostic buffer size to be adjusted. The buffer normally holds 100
messages. The parameter Report Cause of STOP, if activated. causes each CPU STOP to be
entered in the buffer and reported to a designated PG/PC or operator panel.

The c lock can be synchronized periodically based on a user-defined synchronization mode,


time interval and correction factor. If 1he CPU is one of several clock-equipped modules in
the local rack or in a network. the synchronize lion mode allows the c lock to be designated
as a master ond responsible for setting other clocks; or as a sla ve and set by another c lock.
Furthermore. your selection will determine if the clock is synchronized internally from the PLC
bus, or externally over the MPI port. Whether or not a clock can be synchronized exlemally or
act as either master or slave is CPU-dependent.

Application Tips
The extended scope cannot be octivoled in STEP 7 ofter V3. I. If the parameter was
previously active in a project now being converted from V2.x to V3. I or higher. then the
setting con now be downloaded to the C PU or de-octivoted.

Properties - CPU 318-2 - (R0/ 52) ~


General I Startup
Tine-ol·De? lr,_em~ts
I Cycle/Clock Memo1y
I Cyclic Intet~pe
I Retentive Memory I
Diagl'IOStie!ICloek
fv1ernory
j
In!em,llls
Protecii"on
I
r Syslem Dlag,ostics- - - - - - - - - - - - - - - - - - - - - - ~-
r E>~Bnd~lunc:,,.:,ni Nt.mbet of Meisagei in the Dia!,10$lie Buffer: 1100
P' Report cause ol STOP

"

- Clook
Sj.'nchroniz11tian Sj.'ncm>nizatian Mode T~ lr,_erv.il
ln t'1eP.LC: IA,mc11te1 311 minute 21
On MPI: IA, master 311hOUI .:J
On /✓Ff• J1(1(1 3 Ir II .:J
[ Dl11ect,on Fector (ms]: 1,000
J

OK I C-ancel !I, Help I


Figure 3-39. CPU Properties: CPU Diagnostics and Clock poramefers.

110
Working with Hord w are Configurations

Quick Steps: Configuring S7-300 CPU Diagnostic and Clock Properties

ACTION

1 With the Hardware Configuration tool open to the desired projec t and station:
select the CPU module. right-click a nd selec t Object Properties. then select the
Diagnos tics/Clock tab to make the required changes.

2 Activate the Report Cause of STOP chec k box, to hove oil causes of stops to be
entered to the diagnostic buffer and to be sent to a designa ted PG/PC or operato r
panel. Otherwise deactivate the c hec kb ox to minimize the number of events
entering the b uffer.

3 In the PLC lield und er Synchronization Mode, selec t As M aster, If the clock will
synchronize o ther clocks; select As Slave, if the c lock will be set by another local
clock; or select None if the local clock is not to be synchronized .

4 In the PLC field under Time Interval, selec t the synchronization in terval. if th e clock
was set lo synchronize other clocks. In most 57-300 CPUs, the synchro nization mod e
can only be set fo r Master.

5 In the MPI field under Synchronization Mode. select As Mos ter, if fhe clock w ill
sync hronize other c locks; select As S/ove. ii the c lock will be set by a nother local
cloc k; or set None if the loc a l clock is not to be synchronized . In most S7-300 CPUs.
lhe ex ternal synchronization mode con only be se t for Slave.

6 In the MPI field und er Tlme Interva l. selec t the synchronization interva l, if the clock
was set to synchronize other clocks.

7 Confirm the configuration para meters with the OK b utton.

111
STEP 7 in 7 Steps

Configuring S7-300 CPU Access Protection


Basic Concept
Some S7-300 CPUs supper! the ability to use password protection to limit access to the CPU's
con trol program and other operations. This p rotectio n is in addition lo the p ro tectio n
provided by the C PU key-svtitch. With password protection enabled. the control prog ram
and its data a re protec ted from unauthorized changes [i.e .• write access protection). II is
even possible to prevent read access lo program blocks that ore considered proprietary
(i.e.. read access protection) . Use of on line functions such as upload/download blocks may
also be p rohibited to non-password holders.

Essential Elements
Using CPU access pro tection invo lves setting the proteclion level and ii reQuired, defining a
password. Once configured. the protection level and password is downloaded to the
module with the configuration data. Complete read and write access is possible for all
password holders. regardless of the key-switch position. Otherwise. three levels of p rotectio n
may apply to non-password holders. level 1 is the default setting in which standard key-
switch access is in operation. level 2 provides write-pro tection; read access is possible. but
write access is denied without the password. level 3 provides read/write protection, which
means that both read and write access ore denied. independent of the key-switc h position.

Application Tips
On C PUs of series S7-31xC. the opera ting mode switch is not a key-switch. In this case, the
switch has only two positions, RUN and STOP. Both of these positions have no restrictio ns. For
this reason, setting a password for protection tevet t is not possible .

iPl·lH3iii@341111•0i;i14fl _ _ _ __
...
Genetal I St.lit~ Cvcle/ClockMemory I Rete~e Memoiy I lnterrl4)ls
Time-1ll-Day lnlerruptt 1 Cyclic lntenupt I Diagr,ostiC$/Clook Proteclion

level of Protection Mode


r. 1" Key;~h Set~
r Removable wij} Password
1 Process Mode
t'e,i,r,U~ lnc:1101t. Ir.
1 2; Wrte-Piotection ;oan 41:fe 17,r,eby T"I "hncti~ j Cj 111$'

(" 3. W1ite-lFleadPtotewon
P1r. <Y1ord r. Te~ Mode

OK
, I Help I
Figure 3-40. CPU Properties: CPU Access Protection tab.

112
Working with Hord ware Configurations

Quick Steps: Configuring S7-300 CPU Access Protection

ACTION

1 With the Hardware Configuration tool open to the desired projec t and station:
select the CPU module. right-click a nd selec t Object Properties. then select the
Protection lab.

2 Sy d efault, Level I or Key-switc h protec tion is octivoted; at this level, p a ssword


p rotection is not enabled. There is no read or write access restric tion in either the
RUN-P or STOP position; no write access is permitted in the RUN p osition. The key-
switch must be moved to STOP or RUN-P before any download or dola write (e.g.,
modify variables) op erolion is allowed.

3 Activa te the Removable with Password op tion to allow reod and write access lo
password holders. independent of the key-switch p osition. A password must be
entered in the Password field and in the Enter Again field as confirmation.

4 Select Level 2 Protec tion by first octivo ling the Write Protection radio button: then
enter and confirm the desired password in the appropriate fields. In this mode, data
and programs may be monitored, but write operations such os dow nload or modify
variables is only permitted to p a ssword holders.

5 Select Level 3 Protection by first activating the Write-Read Protection radio b utton;
then enter and confirm the desired password In the opprop rio le field s. In this mode,
read and wri te operations ore permitted to p a ssword holders only.

6 Activate the Process Mode o f opera tion in order to restrict PG/ PC test functions
such as program status or monitor/modify variables; lhe in ten t is that the sel
permitted scan cycle time increase is not exceeded. In this mode. testing with
b reakpoints and single-step program execution ore no l possible.

7 Activate the Test Mode o f opera tion if there should be no time restrictions p laced
on test functions via the PG/PC. Realize that these operations may result in
consid erable increa se in the CPU c ycle time.

8 Confirm the c onfigura tion p arameters with the OK button.

9 Use the tootbor Save and Compile b ut Ion to genera te the system dola blocks.

11 3
STEP 7 in 7 Steps

Configuring S7-300 CPU Interrupt Properties


Basic Concept
The S7-300 CPU Interrupts lob lists lour ca tegories of interrupts. Hardware Interrupts include
those generated by machine or process inputs using on interrupt input module or those
triggered by modules (e.g .. CP. FM. or analog SM) thol hove o nboord events that con
generate on interrupt (e.g., over limit, or setpoint reached). Time-Deloy Interrupts o re used
when the main cyclical program (08 1) must be interrupled ofter o precise lime delay,
generated in the use p rogram, has expired. Asynchronous Error Interrupts ore generated by
~yslem-reloled faul ts (e.g.. battery failure, power failure, wire break on analog input). DPVI
Interrupts con be lriggered by DPVl slave devices. lo ensure thol the CPU in the DP mosler
processes the event in the slave.

Essential Elements
Each S7 interrup t hos an associated organization block tha t is called by the operating system
for processing whenever the interrup l occurs. Which of the listed 08s are actually available is
CPU-dependenl. OBs that are not supported in a CPU o re g rayed out. In most 57-300 CPUs,
for example, OB 40 Is the only hardware interrupt; OB 20, the o nly lime-delay interrup t. The
CPU 318. and some newer CPUs. support additio nal in terrupts. The p riority is generally fixed in
lhe S7-300, but where changes o re allowed only the allowed a lternates should be used.
Hardware a nd lime-delay interrupts alternates include 2-ta-24; asynchronous interrupts a llow
24-to-26; and DPV l in lerrupls allow 2. 3. 4. 9. 12. 16. and 17. A priority or zero essenliolly
deactivates on inlerrupl OB. To avoid loss or interrupts. you should not assign o priorily twice.

Applica tion Tips


When an interrup t occurs. the main cyclical p rogram (OB 1) is interrupted . Responding lo on
interrupt requires writing the STEP 7 code for the OB, and downloading lhe block to lhe CPU.
The OB is then ready lo act as the service routine - called when the interrupt is triggered. The
code wrilfen in the OB should be kept as short as possible (e.g .. activa te alarm, send
m essage, halt machine). Remember, time-delay interrupts ore lriggered from the program.
You will need lo call the system function (SFC 32. SRT_DINTJ tor starting a lime delay interrupt.

Prop<ertles - CPU 3 18-2 - (R0/52) ~


T~~-0~ lntem.1pts I
Cyclic lntei,upl I
OiV101tiect/Clock I Pto\~ori I
Geneial ] Stall~ I Cy~ckMemoo, I
Relerove Mem(I()' I Mem01y
- Ha,dwalt
1e n eiru~:

Proeett
- Time-De1QY lnl~l4llt
Pio=
r lntem~s
A,,inc. Eir01 lntem,pt$

111',i,ge Pria,ity;
'
~II P1i::11ly: partJioo:
p~ p&rt~ion: 0981: (25"
liif fns1!-'A 3 0820· (3 3
Ir ~ .p.,
~
0840: 0082:
0821· µ- los f>J,3
0841 : fiT loa1 PA 3 0883: ~
DB?; fo lra1-PA 3
oe12 Fi'"" [oa1 PA ~
0843' (o joa1PA 3 P823 fu""" joa1~A 3
0&84', r
0985: f25
fJB<I-I (o IOB Pt,- i] lnloul.4)ls for OPVI 088!>: (25"
VS.45' fo lnr,1PA 3 0887:f25
Poorty;
PBAG (o I!:Bl -1:P 3
0855·'2 ne~ w=i
{JH4• [o [t l:n "'A 3 0856.j2 0672 lii7
0857· '2 0137.3 [i7

I OK I Cancel
I Help
I
Figure 3-4 1. S7-300 CPU Properties: Interrupts Parame ters dialog.

114
Working with Hordware Configurations

Quick Steps: Configuring S7-300 CPU Interrupt Properties

ACTION

1 With the Hardware Configuration tool open to the desired project and station:
select the CPU module. right-click and selec t Object Properties. then selec t the
Interrupts tab lo make your desired priority-class changes (optio na l).

2 OB40 is the only Hardware Interrupt OB in most S7-300 CPUs and it hos o fixed priority
(priority- 16), If the open CPU supports modifying the defau lt priority then you may
enter o new value of 0. or 2-24. A value of zero may disables on OB.

3 OB20 is the o nly Time-Deloy Interrupt OB In mos1 S7-300 CPUs and it has o fixed
priority (priorlty-3) . If lhe open CPU suppor1s modifying (e.g.. CPU 318) the default
priority then you may enter a value of O. or 2-24. A value of zero disables on OB.

4 OB81 is lhe only Asynchronous In terrupt OB in most S7-300 CPUs and it hos o fixed
priority (priori ty-25). lf the open CPU supports modifying the defa ult priori1y then you
may en ter a value of 0. 2-4, 9. 12, I 6. I 7. or 24-26. Using the default value or a value
in the range o f 24-26 ensures th at asynchronous error OBs ore not be interrupted by
other interrupt events.

S Where the priority of DPVl Interrupt 08s is allerable (e.g.. CPU 318). you may enter a
new value of 0, 2-4, 9, 12, 16, 17, or 24. A value of O is in effect d isabling the OB.

115
STEP 7 in 7 Steps

Configuring S7-300 CPU Time-of-Day Interrupts


Basic Concept
Configuring a time-of-day (TOD) interrupt is only required to hove a port of your STEP 7
program execute o f a specific dale and time. When the interrupt is triggered. the main
cyclical program in OB l will be interrupted at the configured time and date and the
associated service routine (organization block) of the interrupt will be called for processing.
Time-o f-day interrupt can be configured so that upon reaching the target dale and time. the
associated OB is executed once and only once. or every minute. hourly, daily. weekly,
monthly, every end of month, or yearly.

Essential Elements
The properties tab for time-of-day Interrupts lists Organizalion Blocks OB 10 through OB 17.
These ore the eight time-of-day interrupts supported by S7. however OB 10 is the only time-of-
day interrupt supported by most S7-300 CPUs. The CPU 318, and perhaps some newer CPUs.
will support addi tional in terrupts. The CPU does not support OBs tho t ore grayed out.
Configuring a time-of-d ay interrupt requires activa ting the OB. selecting the execution
interval, and setting the sta rt dole and time. The priority is generally fixed in the S7-300. but in
CPUs that support changes alternate priorities 3-24 must be used.

Application Tips
Programming o time-of-day interrupt involves setting the start parameters, activating the OB,
writing the code for the OB, ond downloading the OB lo the CPU. The OB is then ready lo act
a s the service routine - called when the interrup t is generated. The parameters of time-of-
doy interrupts may be set here in the hardware configuration tool. or from w ithin the STEP 7
program, using standard system functions. TOD interru p t applicatio n might include
generating operator messages o r p roductio n reports, or scheduled process readings.


l'ropcrltcs - 1
!k 11i·Ai4 #-tf- - 1 ~
Geoeial I Star\logl 1 Cycle/Clock Memory Retentive Memory I lnteif\4lU I
Time-ol-Day l~em~ts I l
Cyoi,c Inletrupl - Diagiosbcs/Clock I Prolection I
P1oces$image
Pr~ Active Execution Stat dale Time of day priiQn
0810. J2 ~ jonce 3 ]0201.os 1,000 JI 1 P 3
Jlil 1 r r IIle lC 3 (11 01 lo~ou OB Ft 3
0B12- r r jtkne 3 10, 01,Sl lu&uu 081-F,; 3
OB1~ r,,- r
r
I Nl'!'"l<' 3 11:ii 01 ~ jor 111 181 p,., 3
OB1,t IN 1 3 Ei, 01 "' 1111: no OPl.P 3
0815- r r 111 ,, 3 fo1 01 ~ lac oo Dfll ,f,'I ::l
OB1S: r r IN110 3 j1J1 01 " l □r 'ln 08 FA 3
0917 r [" ltj ltl 3 1111 01 S4 Im1111 081 f-A 3

OK ) Cancel !__H_e\:>_ ____,


Figure 3-42. S7-300 CPU Properties: Time-of-Doy Interrupt lob - CPU 316/eorlier CPUs.

116
Working with Hordware Configurations

IQJ,f,I41'1¥Ud41ili;fhi4•4t1- ~
µ ~nil! 41 I Sle!hJp I C-__ycle/Cloel'I Memory I AetMliv6 Mernory I ldemoiy Interrupts ]
Time·ol·D~l' lnten~ls I C,IIClic lnterrupl 0 iagnolbos/Clook J Prolectioo J
Process image
Prmy ActrYa Execution Staat dala Time ~ day pa,tiion

OB1Q r r l □nce 3 joz 01.os 110 00 l □Bl-PA 3


0911: r r !None 3 !01 01.9'1 1□0:00 Ii)& FA 3
ria1;- Jz r lu"' 3 jo1 01 ~ jnc on 081 Ff 3
1.1131g r r jNnc 3 j1n u1 9' ID Oil DBI P.e 3
081,t r r IN° 1. 3 ja, 01 94 10000 3
OBUi r r INone 3 !1J1 01.S~ 10000 081-FA 3
0816 r r IN:(1e:- El f1J1 01 se jut Oil lBl-FA 3
0917, r r: Inane G (01 01 ~ jm1ou Oi:.1-Fr 3

OK
I Ceocel ]

Figure 3-43. S7-300 CPU Properties: Time-of-Doy Interrupt dialog C PU 3 18.

Quick Steps: Configuring S7-300 CPU Time-of-Day Interrupts

ACTION

1 With the Hardware Configuration tool open lo the desired project and station;
select the CPU module, right-click and selec t Object Properties. then selec t the
Time-of-Day Interrupts fob .

2 Select the time-of-day interrupt OB w hose porometers you wish to alter: to modify
the Priority c lass c lick in the field and enter a valid a lternate p riori ty of 3-to-24.

3 Click inside the Active check box to activa te th e 08. Time-of-day interrupts may
a lso be activated from lhe STEP 7 program using system function SFC 30 (ACT_TINTJ.

4 Click the drop orrow in the Executlon field. a nd select whether the OB should be
called o nce. every minute. every ho ur. every doy, every week. every mon th. every
month-end. or every year. Time-of-day interrupts may a lso be set from the STEP 7
p rogram. using system function SFC 28 (SET_TlNTJ.

5 Next. click in lhe Start Dale tietd and enter the slar1 dal e for the time-of-day
intemJpt. If the stor1 dote is not entered on the properties dialog. it c an b e set from
the STEP 7 program using the system functio n SFC 28 (SET_TINT) .

6 Click in the Time of Day field and enter the start time for the lime-of-day interrupt.
The start time can be entered here on the p roperties dialog. or from the STEP 7
p rogram. using the system function SFC 28 /SET_TINT).

7 Confirm the configuration parameters with the OK bullon and use the toolbar Save
and Compile button to generate the system da la blocks.

117
STEP 7 in 7 Steps

Configuring S7-300 CPU C yclic Interrupts


Basic Concept
A cyclic or "watchdog" in terrupt. is generated at o fixed periodic interval. and triggers
execution of a specific cyclic interrupt OB. Cyclic in terrupts ore used to interrupt the CPU's
normal processing at p recise in tervals (e.g .. every 100 ms. every 500 ms. or every 5 sec) to
execute code that must be processed o n a regular basis. Typical uses or cyclic in terrupts
include communica lions, control loops, temperature control. and sampling analog inputs.

Essential Ele m e nts


The properties tab for cyclic interrupts ns ts Organizatio n Block:$ 0B30 lhrough 0838. These ore
the nine cyclic in terrupl OBs supported by S7. Each OB is assigned a priori ty class (7- 15)
as well as a default cyclic in terval at w hich each is processed. Which of these OBs ore
ocluolly available, however. depends on th e CPU. In most S?-300 CPUs. fo r example, onfy OB
35 is ovanoble. The C PU 3 18, and perh aps some newer CPUs. will support additional cyclic
interrupts. The CPU does not support 08s that ore grayed out.

Configuring changes to default parameters is not necessary unless required. The priority is
generally fixed in the S7-300, b ut in CPUs that a llow changes only the allowed a lternates (i.e ..
3-24) should be used. It is a lso important that a priority is not assigned twice, so as to ovoid
loss o f on interrupl. It is also possib le to modify the period of execution and to enter a Phase
o ffset va lue. If several cyclic interrupts ore ac tive. o phase o ffset will ensure thol interrupts ore
distributed throug ho ut tne CPU cycle and do not trigger simultaneously.

Applica tion Tips


Stor1ing a cyclic interrupt simply involves determining Which OB will be used. modifying lhe
default parameters if required, creating. and downloading the organiza tion block code as
port of your program. The OB will be processed according to the specified interval. wh ich is
limed from w hen lhe mode selec tor Is moved from STOP lo RUN. Finally. it is essen tial that the
code programmed in o cyclic 08 is executed in significan tly less time th an the coll interval.

Properties - iii1Ell·Aiti•t+t1~
Gener-,1 lStail~ J Qocl$/Clo,;k Mel!IQIY J Retenti~ Mem01~ ] lnlen\Jpis I
Trno«•D~ lnlerrlllt~ Ci,clic tnte1n.1pl J Dlbslrmtics/Clocl-. I Protecl1on I
Process irMQe par!Jion
Prlonty E:kectiion (msl Phase olbe.4 (ms)
OBJ/J. r, I.1.JL lu IDB1 r'A 3
OB.21 r I.JI,,. lo 1001.oA 3
0832: r I 01"' lri j'181 f',<\ ..:.I
081'3 rio- lsoo lo IOB1·P/> :.=:J
08~4 r,- 1·00 II:) lDB1 -'1\ '.'.:]
0B35: Im (100 lo IJB1 Of:, 3
llB;n r lslJ lo loe1 :::it,. 3
0837- fit I,1 I 111 1001 PA 3
0833'; ~ 110 lo IOBl.PA 3
OK I Cancel
I Help

Figure 3-44. S7-300 CPU Properties: Cyclic Interrupt dialog CPU 316 or earlier CPUs.

118
Working with Hord ware Configurations

i4i,i,t§lii¥1841Ml:&i;f•Ut f - . ~
General J Slattup I Cycle/Clock Mef11()1y I Aelenlive Memory I Memo«y lnteuUl)b I
Trn~·DO)' lr(er1141ts Cyclic lr'lletrupl J Dlag00$llct/Clocl( I Piot~ion l

Pricility Exewion [msl Phase ollsel (ms)

09:10 r 151) 111 l:is1 -:>A 3


OD '1 r I,orri loe1 aA 3
0832: r 1,000 lo loa1.PA ..:I
OBTI fu lsoo lo los1 Pp. 3
013:14: rf,T""' 1~'00 In juB1·"" .:]
0835: 1100 I□ 081 PA •
OB%\ r 1,1J Joe, PA
0837· r ju loe1 PA
(l8J3, r loe,.P,-,

OK I Cancel I__H_e_lP_ _.

Figure 3-45. S7-300 CPU Properties: Cyclic Interrup t d ialog of CPU 318.

Quick Steps: Configuring S7-300 CPU Cyclic Interrupts


ACTION

1 With !he Hordwore Configuration toot open lo the desired project ond station;
select the CPU module. right-click and selec t Object Properties, then selec t the
Cyclic Interrupts . Grayed parameters o re not ovoiloble in the opened CPU.

2 Select the cyclic O B whose parameters you wish to a lter. and enter a new Priority
class if you w ish to modify the default priority: click in the Held ond e nter o valid
a ltern ate (3-24). Assigning o p riority twice should be a void ed to prevent loss of
Interrupts due to multiple (> 12) interrupts of the some priority occurring
simultaneously.

3 Enter o new Execution va lue if you wish to modify the default processing interva l for
the OB; click in the field, and enter o va lid value in the range of 1O milliseconds to 6
seconds !i.e., 10-to-60,000).

4 If multiple cyclic interrupt OBs will be used, enter o Phase Offset value in
milliseconds. for each. The phase offset will ensure tha t proce>sing of th e OBs is
distributed somewha t evenly throughout the to ta l CPU c ycle. A valid range for this
field is (0 -to- 60000). The default value of O represents no pha se o ffset.

S Confirm the configuration para m eters with the OK b ut1on and use the toolbor Save
and Compile button lo generate the System Dato o bjecl.

119
STEP 7 in 7 Steps

Configuring S7-300 Digital Input Module Properties


Basic Concept
The general properties of standard digital input modules in the S7-300 ore viewed or edited
from the Hardware Configura tion. When inserted into the hardware configuration digital
input modules may be started without any modifications to the default properties. unless the
module is on interrupt input type (Also see Configuring S7-300 In terrupt Input Properliesl. Basic
information about the module Is provided on the General tab. The addresses assigned lo lhe
module ore provided on the Addresses tab (Also see Configuring S7-300 Digilo/ 1/0 Module
Addresses). White addresses ore generally fixed in the S7-300. some CPUs do support address
changes (e.g .. CPU 316-2 DP).

Essential Elements
The Short DescrlpHon , the some as given in the hardware catalog, gives important tea lures of
the digital input module such os number of input circuits. supply voltage, ond number o f
circuits per group (i.e .. per common). For example o 120/230 VAC input module may hove
16-inputs with four groups of four circuits (grouping of 4). The Order Number reflec ts the
currenHy open module. which is assigned to a specific slot in the configuration - it should
match the port number of the physically installed module. The Name field shows the default
name o f lhe module. Although the name can be changed. ii is not recomme nded. The
Comment field allows more details abou t the module or its application to be documented.

Application Tips
The writing area on a module connec1or limits what descriptive informat ion that con be
written for eoch digital inpul. Use lhe commen t rleld lo provide de toiled information on the
use of the digital inputs of a module.

i4i·i,I41iibi•llliif4it41killthf;i1JJ.il...-:____~----
General IAdctes:es I

Shaft De;c~ion· 0116AAC120/Z30V


bigKal input module 0116120VAC/230VAC. or~g ~

Or~r Na.:
I
6ES7 321 ·1 tHOO-M.6.0
Name:

Coir,nent
nte comment on ute ol the o,put module, for e>W1mple ""111 91oup of rnach11e cc proce$$ inl)lJ& ~
a1e handled by lhe mowle.

.:::J
OK I c.-ince1 I Help j
Figure 3-46. Digital Input Module Properties: General tab.

120
Working with Hord ware Configurations

i4t,J,I41itW•llld#4if41J#t•Cbf4,t#i_,______~-~
Geneial Adtlesses I
11"4)Uts==========================
S1a1t: 10 P,ocest image:
Eod: 1 loe1 P iJ
P" Systemieleclion

OK
I t.incel , _ _H_el_P_..,

Figure 3-47. Digital Input Module Prop erties: Address lob.

Quick Steps: Configuring S7-300 Digital Input Module Properties

■ I
'
ACTION

Wilh o slo tlon open in the hardware configuro lion. select o rock. to view its installed
modules; double click on a digital input module w hose p roperties you wish to view
or edit. No t oil properties may be edited (e.g ., Order Number, Shor/ Description).

2 On the General tab. the Short descrlptfon of the module provides o brief summery
of the module fe a tures (e.g., number o f inputs, supply voltage. circuit grouping). Th e
Order Number is lhe port number or lhe open module in lhe configura Hon and
should reflec t lhe digital input module installed in the same slot in th e p hysical rack.

3 Click in the Name fiel d lo enter a new name for the module; the default name is
based on the number of inputs and the supply voltage, pre fixed with DI for digital
inp ut.

4 Use lhe Comment field lo enler o descrip tion o f the module inputs or application.

5 Select the Address tab to view or modify the start byte a ddress for the mo dule (e.g..
CPU 318). Most S7-300 C PUs do no t allow the start byte address to be changed so
the System Selection check box will b e oclivaled and grayed. See Configuring S7-
300 Digital 1/0 Module Addresses.

6 Confirm the configurolion parameters with the OK b utton and use the loolbor Save
and Compile button lo generate the System Doto objecl.

12 1
STEP 7 in 7 Steps

Configuring S7-300 Interrupt Input Properties


Basic Concept
The general and address properties of the interrvpl input module ore the some as for the
standard digital input module, however. a third d ia log lab is provided for setting the in terrupt
module's interrupt properties. By default, hardware interrupts ore d isabled so if this module is
used then ii will be necessary lo enable inlerrupl capability from the p roperties dialog,

Essential Elements
Activating the hardware Interrupt parameter enables a ll of the interrupt inputs for use. An
input delay con be specified ro r the en tire module, based on lhe lype of signals connected.
The input delay should closely match the delay characteristics of lhe input device in order lo
protect against false input signals. Finally. in groups of two, !he interrupts may be sel to trigger
on the rising edge or falling edge of the signal, or on both the rising and falling edge. If
neither parameter is oclivaled. then the associated c hannels will not trigger an interrupt.

Aclivo ling the diagnostic Interrupt enables the module lo generate a diagnostic interrupl.
The diagnostic func tion varies depending on the module, but on lhe inlerrup t input module
monitors the supply voltage or !he connecled sensors. The input channels ore divided into
groups of eighl inputs each (Le.. inpuls 0-7, and inpu ls B· 15). By ac tivating the group check
box, each group can be monitored for no sensor supply, If monitoring is activated and the
supply voltage Jails. the group d iognoslic even t is entered into th e d iagnostic data sloroge
area of the module. Th e d ata can be read from the module, In the STEP 7 p rogram, using the
system func tion to ''read system status list" i.e., SFC S 1 RDSYSST). or evaluated in OB 82.

Application Tips
Response to hardware interrupts in the user program is handled using o rganization b lock 40 in
most S7-300 CPUs. In the CPU 318, OB 40 and OB 41 are available. The interrupt OB is assigned
to the module on the Addresses lab. The interrupt OB must be programmed and
downloaded to the CPU. Wh en o hardware interrupt is triggered. the operating system
interrupts the main program block (OB l ) and calls the designated interrupt OB program.

i4i·i4ijUt+WOli@fltDfili4H1l·!hi4 4i;-----~----
1 IBJ
I
Gene,a1 Acld,es,e, 1,._,<Js J

Jrcjw- - - - - - - - - - - - - - - - - - - - - - - - - - - - ,

Start 10 Process image


End: 1 Jnu1 "I 3 oa J•o :±1
P- System celection
j

I OK I Cancel Help I
Figure 3-48. S7-300 Interrupt Input Module Properties: Ad dresses lob.

122
Working with Hordware Configurations

iPiijifBJUN•Jfttffl►I'JMffiiEjJIIPii;i•Jfii - -~------ - 25.1


GeMr41 Addr~e• I 1~1 J

[ Enable [ lr',)ti.Delay [~I / Type ol Voltage~


P' Di.,gr,otlic: inleuupt rv Harm-YOIII interrupt j3 (DC)

lnpti
Dioll(IOStics
I 1 I 2·3 I I s-7 I I !12-13l 1• -1sl
0- 4 ,5 8,9 10 - 11

No ~so, supplj,; I P' 11 P' I

T1,gger 101 Hardware Interrupt


Risi,g {positive) edi,e: wI II P' II w 11 P' II r II r II r II r I
Falltlg (negalive) edge: IT] I r II r 11 r IITJ[TIITJI El I
I OK I ~ I__He_p~
Figure 3-49. S7-300 Interrupt Input Module Properties: Input Porometers tab.

Quick Steps: Configuring S7-300 Interrupt Input Properties

ACTION
I

1 With the required station open in the hardware configuration. select the rock where
the module is inslolled; double click on lhe interrupt input module to open the
properties dialog. then selec l the Inputs lob.

2 Activate the Diagnostic Interrupt box to enoble the module to monitor for loss of the
supply voltage for the connected sensor inputs (No Sensor Supply).

3 Activate the Hardware Interrupt check box to enable use of the sixteen interrupt
input s. Wh en any one of the inputs ore triggered. the main program b lock {OB I) is
interrupted and lhe assigned inlerru p l OB (OB 40 • O B 41J is colled for processing.
The Interrupt OB is assigned to the module on the module Addresses tab.

4 Click in the Input Delay field and select lhe typical signal delay lime (in milliseconds)
of the connected input signals. This parameter affects all inputs.

5 If the diagnostics are enabled. then aclivaling the related No Sensor Supply check
box c auses the module to monitor for loss of the supply voltage in channel group 1
(inputs 0-7), or channel group 2 (inputs 8-15}. A suitable program in 0882. can be
used lo evaluate which error has occurred and on which inp ut the error occurred.

6 Activate Rising Edge check box. if the associated inputs, above the box, should
trigger on a 0-lo-l lronsilion; or Activo le Falling Edge check box. if the inputs should
trigger on a l-to-0 transition. Each check box affects two inputs (e.g., input 0, I ).

7 Confirm the configuration parameters with the OK b utton and use the toolbor Save
and Compile button lo generate the Sys/em Data object.

123
STEP 7 in 7 Steps

Configuring S7-300 Digital Output Module Properties


Basic Concept
The properties of standard d ig itol S7-300 digilol output modules ore viewed or edited from
the Hardware Configuration. A s well, when inserted info the conliguralion these modules
may be sta rted without any c hanges to the default properties. unless you wish to modify the
start address or the module hos ou tput signal parameters you wish to influence. Like the
dlgilol inpu l module. basic information about the module is provided on the General fob.
addresses assigned to the module are provided o n the Addresses lob (Also see Configuring
S7-300 Dig/to/ 1/0 Module Addresses). and on some digital output modules on Output lob,
con ta ins parameters that allow the behavior of the outpu ts on the module to be innuenced.

Essential Elements
The Short DescrlpHon gives imporfanl features of the d ig ita l output module such os number of
ou tput circuits. supply voltage, and number o f circuits per group (i.e .. per common). For
example o 24 VOCI.SA outpul module may hove 8-outputs wi th one group of eight circuits
(grouping of 8). The Order Number renecls the module assigned loo specific slot in the
configuralion - ii should ma lc h the port number o f fhe p hysically installed module, The
Nome fi eld shows the default name of the module. Although lhe name con be c hanged, ii is
no t recommended. The Comment field allows details about the module or its application to
be documented.

A digita l output module may include on Ou tput lob if the module has diagnostic Interrupt
features that monitors and reports certain d iagnosfic events tho! hove been enabled on the
module. Diagnostic functions may 1nclude monitoring for wire break, no load voltage. short
circuit to ground, and short circuit to supply. This digital output also hos the ability to set o
substitute value lhot determ ines the stole that each output should be set to when the CPU
goes to STOP.

i4t,J,I4HI¥1~lltifflJii4'1WOi;J1tti;f _ ___·---~-~

Short De$c~iort D08,DC24V/0.5A


Diglal output mocije DO 8i<OC241/,n'5A., with diagnosbcs, .d
ret:anlig1J1able onlina, extended environmenlal condtioM

.::I
Order No.: 6ES7 322·88F80-MBO
N- : jD08><0C24V/0.5A

Commer-.:
rte oamrnenl on the ute of tho output moo.de; lor exilffC)lo. whbl 9 10~ or 11100e$s oull)IAs
a,e handled by Ille mock.lie.
.:.I
OK
I Ca~ , __H_el_P_ _,

Figure 3-50. S7-300 Digital Oulput General Properlies dialog.

124
Working with Hordware Configurations

i4i,i,t§lii¥itJ•i;C\Ui4®•Ffi0i;(,tti>--- - - -~~~-
Ge~a1 [ Addu,_ Outl)uti I
- Enable- -

'
r,; 01agno1be iltetrupt
1
'"
iI
- Reaouon to CPU STOP
Substtute a value .:I I

OutplA
0~0$IIC$
I I I2 I I I I I I
0 1 3 4 5 6 7

'vf"" bteac I r,; n r,; II r l[EJI r IITIITJ[TI


No IOl!Jd volage-
I r,;- n r,; II r II r 11 r II r II r 11 r I
Short cieul to M: I p II p II r II r II r II r II r 11 r I
I p II p II IITJI r IITJITJITJ
Short ci~ to l +;

SiJMtihAe Value 0 l
' 2 3 4 5 6 7
Subsliute "1 '~ r,; 11 !1:ll r t[EJ[EJ[EJ[EJ[EJ
OK I Cancel I Help

Figure 3-5 1. S7-300 Digitol Outpu t Properties dialog: Output parameter se ttings.

Quick Steps: Configuring S7-300 Digital Output M odule Propertie s

ACTION

I Wilh a sta tion open in the hardware configuration, select a rock lo view ils installed
modules; double click on o digital output module whose properties you wish to view
or edi t. Not all properties may be edited (e.g.. Order Number, Short Description).

2 On the General tab. the Short description provides o brief summary of the module
features (e.g .. number o f outputs. supply voltage, circuit grouping). The O rder
Number is the port number of the open module in the configura tion and should
reflect the digital output module installed in the some slot of the physical rock.

3 The default Name, which is modifiable. is based on the number of outputs. the
supply voltage, and the output current. all p re fixed with DO for digital output.

4 Use lhe Comment field lo en ter a description or !he module outputs or application.

5 Select the Output tab to se t operating parameters for the outputs of the module.

In lhe Reaction to CPU STOP lield. select Keep Lost Valid Slate (logic-0 or logic -I); or
select Substitute a Value. If you select "substitute o value," then for eoch output you
wish to be sel to logic 1. ac tivate the corresponding check box ror Substitute" l ".
Boxes not activated will be set to logic 0.

7 Activate the Diagnostic Interrupt box 10 enable the module's obifity lo generate a
diagnostic inte1TUpl when any one of its diagnostic monrtori ng events occurs.

a To activate diagnostic monitoring (e.g.. Wire Break. No Load Voltoge, Short Circuit to
Ground (M l, Short Circuit to Suoply (L +Lor Blown Fuse) for on ou tput. activate the
corresponding check box beneolh each ou tp ut circuit you wlSh to monitor.

125
STEP 7 in 7 Steps

Configuring S7-300 Digital 1/0 Addresses


Basic Concept
As each digital module is inserted in o n S7-300 configuratio n. the addresses ore assigned
automatically to the module, based the slo t in w hich the module i.s inserted. Each slot. as
shown in t·he figure below. reserves lour-bytes starting with byte-0 in slot 0. Reserving four
byles, allows each slo l lo support modules with a maximum o f 32 input or outputs.

Essential Elements
The figure below shows o n S7- 300 with maximum expansion. Each slot, as shown in the figure.
reserves four-bytes slorting wilh byte-0 in slol 0. Slo t-4 reserves by tes 0-3: slol-5 reserves bytes
4-7; and so on. If on input module is installed in o slo t. the reserved bytes o re in the process
image of inputs (PII); if on output module is installed. the reserved bytes ore in the process
image o f outputs (PIQ). In the S7-300 the default slorting byte-address assigned to each
module (See fhe configura tion table in Figure 3-53) is generally fixed and cannot be
changed. CPUs that support free assignment or addresses (e.g.. CPU 315 v 1. 1 and higher),
also allow input and output modules to use the some starting byte addresses.

Application Tips
Digital inputs a re accessed from the PII using the input memory identifier ' I' as a prefix to the
address; d igita l outputs o re accessed in the PIQ, using lhe output memory identifier 'Q ' as a
prefix to th e address. Both inpuls and oulputs ore refere nced as "byte.bit." A 32-point output
module in slol-4 would use addresses Q 0.0 through Q 3.7. where QO.O corresponds to the first
outp ul circuit: on input module would use I 0 .0 through I 3.7, where I 0.0 corresponds to the
first input circuit. Inputs and oulputs may also be accessed as bytes, words, or double words.

1/Q 1/ Q 1/ Q 1/Q 1/ Q 1/ Q 1/ Q 1/Q

IM36I lo to to to to lo to to
99.7 103.7 107.7 11 1.7 115.7 119.7 123.7 127.7
1/ Q 1/ Q 1/ Q 1/ Q 1/ Q 1/ Q 1/ Q 1/ Q

IM 361
lo to lo to to to lo lo
67.7 71.7 7S.7 79.7 83.7 87.7 91.7 95.7
1/ Q 1/ Q 1/ Q 1/ Q 1/ Q 1/ Q 1/ Q 1/ Q

IM361
lo to to to lo fo lo lo
35.7 39.7 43.7 47.7 51.7 55.7 59.7 63.7
1/ Q 1/ Q 1/ Q 1/Q 1/ Q 1/Q 1/ Q 1/ Q

IM360
10 lo to to to to to to
3.7 7.7 11.7 15.7 19.7 23.0 27.7 31.7
Figure 3-52. Default Digital Addressing of the S7-300. starting a l byte-0. Each slot a lways
reserves 4-byles, allowing for up to 32-inpuls or outpu ts per module.

126
Working with Hordware Configurations

Quick Steps: Configuring S7-300 Digital 1/0 Addresses

ACTION

1 From lhe SIMATIC Manager, open the required projecl and select lhe S?-300 Station
for which addressing is required.

2 With lhe station selecled, in lhe righl pone of the slotion window double click on the
Hardware object to open the station in the Hardware configuration tool.

3 Select o rock whose modules you w ish lo view the installed digitol 1/0 modules or
inserl new digilal t/0 modules.

View the starting byte address of each input module in the I-Address column or
each autpul module In the Q-Address column.

5 To modify the slarling byle address of a module. select lhe module. right-click and
select Object Properties, then select the Address lob.

6 If lhe module addresses of this CPU con be modified. the System Selection
checkbox w ill hove a default check mark which con be removed; o therwise, the
box will be activated and grayed cul or nol available a t all. To modify o start byte
address, first de-activate the System Selection check box lo disable system address
delerminotion.

7 Enler o new storl byle-oddress and confirm by pressing OK. In the S7-300. digilol t/0
start byte addresses, after byte-0. must be o multiple of 4 (e.g., 4, 8, t 2, 16, 24, etc.).
tn CPUs where you may assign addresses freely {e.g .. CPU 315 VI.I and higher),
inpul and outpul modules may use th e some starting by1e address.

8 The Process lmoge field shows lhe process image responsible for updating lhe
module ou tputs. By default digital outpuls are cyclically updated by the CPU.

9 Confirm the configuration parameters wilh the OK butlon and use the toolbar Sove
ond Compile button to generate the System Dato object.

~~ (OJ UR

Modul!t I acMre.. Q addre..- Cocrmer,1

IM 360 6ES7
4 Dn 6llDC24V 6ES7 0... 1 16- re,•M!d h Pl\.
5 D116,cl)C24V 6ES7 , ...5 16, lettlved;, Pl\.
6 Dl32icOC2'4V 6ES7 8. 11 32. ,...,,ve.i;, Pl
7 D132l<DC24V 6ES7 12. .15 32· lt!:tffied h Pl\.
8 D016xDC2.tV/O SA Qc57 16...17 16· 01 1e,eNed in PIQ.
9 DOl6xDC24V/0.5A Et:S7 20... 21 16 Sutfd. es ,e..,ved in PIO.
10 D032l<OC24VI0.5A Ef.S7 24,•. 27 32· • USO<!. es 1e1e1ved in PIO,
11 D032l<DC24V/O SA 6ES7 29.. 31 32·1Xlirt Oulllllt ~rd: 4-bl4e, used. 4-l:!.(es retel\led it1 PIQ,

Figure 3-53. Default digital addresses in S7-300 configuration. Note that although 4-byles (32-
bilsl ore always reserved, the oclual byte usage of lhe module is displayed in the I-address
and Q-oddress columns.

127
STEP 7 in 7 Steps

Configuring S7-300 Analog Input Module Properties


Basic Concept
The general properties of analog input modules in the S7-300 ore viewed or edited from the
Hardware Configuration. Basic information about the module, like port number and a brief
description. is provided on the General tab. The addresses assigned lo the module ore
provided on the Addresses tab (See Configuring Sl-300 Analog 1/0 Module Addresses). While
addresses ore generally ftxed in the S7-300. some CPUs do support address changes (e.g ..
CPU 316-2 DP). Before analog input modules ore started it may be necessary to set certain
module operating parameters (See Configuring Sl-300 Analog Input Signal Parameters) .

Essential Elements
The Short DescripHon . lhe some as given in the hardware catalog. gives important feolures of
the analog input module such as acceptable input signals. bit resolution. and number of
input channels. For example on eight channel analog input module may hove 14-bit
resolution and accept 0-20 mA/4-20 mA current signals and several voltage ra nges. The
Order Number renects the currently open module, inserted in a specific slot in the
configuration - it should matc h the port number of the ocl\Jol installed module. The Name
field shows the default name of the module. Although lhe name con be changed, it is not
recommended. The Comment field allows details or the module's applicolion to be entered.

Application Tips
The writing area on lhe module connector limits whal descriptive information con be written
for each input channel. Use the comment field to provide detailed information on the use of
lhe analog inputs of o module.

IYIIJJ19iit44Ji:ftitJ,U iQAii_.________ _
Genetal IAdlte$ses I 1nr;us I

Shoit Des cf1)1ion: AIBx12Bit


!Analog input modlAe Al8/12 to 14 bit; .d
..::.I
Order No.: 6ES7 331-71<F01-0ABO
N<111le:

Comment

.:::.1

OK
I Cancel , _ _H_el_P_...,

Figure 3-54. S7-300 Ana log lnpul General Properties dialog.

128
Working with Hordware Configurations

IAlfllI§itt¥4Jl•dfJ(f llWiti _ _ _ _______


GenMal Acktet* lnP\bI I
~l"l)Ut$-========================i
Start:
EJ1d. I .:.I
P S?ttemtelection

OK
I C.,ncel j __H_e_lP_~
Figure 3-55. S7-300 Analog Input Module Properties: Addresses lob.

Quick Steps: Configuring S7-300 Analog Input Module Properties


ACTION

1 Wilh o station open in the hardware configura tion, select o rock lo view its installed
modules: double click on on analog input module whose properties you wish lo
view or edil. Nol oll properties may be edited (e.g .. Order Number. Short
Descriplion I.

2 On the Generol tab. the Short description provides o brief summary of the module
features (e.g.. module type. number of inputs. b it resolution). lhe Order Number is
the port number of the open module in the configurotion ond should reflect the
analog input module installed in lhe corresponding slot of the actual rock.

3 To oller the module name. click in lhe Nome field to enter o new name; ltie default
name is the number of analog input channels and the bit resolution prefixed with Al
for analog input.

4 Use the Comment field lo en ter a descrip lion of the module inputs or applica tion.

5 Select lhe Addresses tab lo view or modify the slor1 b yte address for the module.
Mosl S7-300 CPUs do not allow the start byte address to be changed so lhe System
Selection check box will be activated and grayed out. See Configuring S7-300
Analog 1/0 Module Addresses.

6 Confirm the configuration parameters with the OK button ond use the toolbor Save
and Compile button to generate the System Doto object.

129
STEP 7 in 7 Steps

Configuring S7-300 Analog Input Signal Parameters


Basic Concept
In addition to the General and Addresses p roperties tobs used to configure analog input
modules. most analog input modules w ill a lso ha ve o ne or two tnput p roperties tabs. The
Input-Part I or Input-Part 2 tabs allow you to view or configure the module's Hardware
Interrupt or Diagnostic Interrupt features as well as determine input channel parameters that
a rrect the type of signals may be used a l each input.

Essential Ele m e nts


The config ura tion of analog inpu t signal parameters involves two concerns. In the Enable
Section you con activa te the module's hard ware or d iagnostic interrupt features; and in the
Input Section. you will determine lhe input signal charac teristics for each channel. On most
a nalog input modules a hardware interrupt con be triggered when user-defined signal limits
are exceed ed and when all of the input channels hove been read and converted (i.e.,
whenever new measured va lues are a l all inpu t channels).

Depending on the module, d iagnostic events moy be activated for ind ividual channels or
channel groups and include wire break, configuration parameter assignment error. or
common mode error. When a diagnostic interrupt occurs, o n a c ha nnel or w ithin a channel
group, the module reports the event to the CPU (diagnostic buffer e ntry). Module-related
d iagnostic information as well os channel-specific d iagnostic events con be read from the
module using system functions (SFCs),

Applica tion Tips


On modules Iha! use a plug-in range card lo allow the various input signal ranges, ensure
lhol the range cord Is inserted for the req uired channels. Also ensure lhot the encoding
position on lhe module matches lhe letter (e.g .. A, B. Cl d isplayed on lhe input dialog (below
each channel) in the nelds labeled Position of Measuring Range Selec tion Module .

1Altlli91it¥PJl•t5f1H0fIiJtfil♦---------- 29
Gene,a1 J Addresse; lnp~s J
Enable- -
p- Dia~ lrtenupl P' Ha1ilware lntern.ipt \J.lhen l i~ E><eeeded

Input 0 -1 2-3 4.5 6-7


Diai,l0~$
Group O~osli::s: P' P' P' P'
wilh Check for Wie Break: r r p P'
Meo1Uing
M04$1.0ig Type· IE IE l20MU l20Mu
'
M6bSuriii;i Range: l•l-10V 1~•/- 10 V ' j4.. 20m/>.I !4.,20 ml\ II
!'
Position of M-ura,g
Aaoge Selection Modl.k: [BJ [ BI ID I (O I
Iinleifeience frequency !GO Hz jGO Hz f50Hz j50Hz
Tngge, fo, Hard-e lntenupl Ch-.e! O Chamel 2
Hillh Lmt IB.500 V f9. 500 V
Low Unit: J1.soo V ,,.500 V
- -
OK
I Cancel I
Ffgure 3-56. Anolog Input Module Properties: Input porometers lob.

130
Working with Hordware Configurations

Quick Steps: Configuring S7-300 Analog Input Signal Parameters

ACTION

1 With the required station open in the hardware configuration. select the rack w here
the module is installed; d ouble click on the analog input module to open tne
properties dialog; the n selec t the Inputs tab to view or edit input signal parameters.

2 Activate the check box Diagnostic Interrupt in order to use the module' s ability to
generate an interrupt o n certain module -specific d iagnostic events.

3 Activate the check box Hardware Interrupt when Limit Exceeded, to allow inputs to
generate on interrupt when the Input signal exceeds (goes obove or falls below) the
defined limits.

4 Activate the check box Hardware Interrupt at End of Scan Cycle ~f feature
availa ble) to allow the module to signal the CPU w ith a hardware interrupt when o il
of the input channels on the module have acquired new measured values.

5 If th e ''Diagnostic tnterrupl" is enabled then for each channel or channel group, you
may activa te the check box for Group Diagnostics a nd fo r other channel
diagnostics you wish to enable (e.g., Wire Break). If a d iagnostic event occurs, a
diognoslic interrupt is triggered and module-dependent d iagnostic Information is
stored in the module's data area.

6 Clic k in the Measurement Type field d irectly below each channel or channel group,
and from lhe list of available measurement lypes (e.g .. voltage (E). current. T/C.
RTD) selec t one for the a ssociated channel (s). If o channel or channel group is not
connected, select "Deac tivated."

7 Clic k in the Measurement Range field directly below each channel or channel
group, and from the list of available measurement ranges (e.g . ±IOV. ±5V, a nd ±1 V)
select a range for the associated c hannel (s),

8 If th e hardware interrupt is enabled for input signal limits exceeded. then for each
channel tha t supports this feature (only certain channels can monitor the input
value limits), click in the corresponding fields, and enter the Upper limit va lue and
Lower Limit value. The module will trigger an interrup t when the input value exceeds
the set "Upper limit." or wtien the input signal falls below the set 'lower Limit."

9 Confirm the configurol'ion parameters wilh the OK b uHon and use the toolbar Save
and Complle button lo generate the System Dato object.

131
STEP 7 in 7 Steps

Configuring S7-300 Analog Output Module Properties


Basic Concept
The general properties of analog output modules in the S7•300 o re viewed or edited from the
Hardware Configura tion. Basic information about the module, like port number and a brief
descriptio n. is provided on the General tab. The addresses assigned lo the module o re
provided on the A ddresses tab (Also see Configuring S7-300 Analog 1/0 Module Addressesl .
While addresses ore generally fixed in the S7-300, some CPUs do support address changes.
Finally, there is the Outputs parameters tab. for viewing or setting the operating parameters
of the module and individual output channels.

Esse ntial Ele ments


The Short DescripHon . some as g iven in the hardware ca ta log. is o gives o shortlist o r fea tures
of the a nalog o utpu t module such as ou tp ut sig nal ranges, bit resolution. and number o f
output channels. The Order Number reflects the module assigned in the config uration tool
and con be verified with port number of the physically installed module. The Name field
shows the defa ult name of the module. Changes lo the module name ore reflected in the
configuration table. The Comment field allows more detail information about the module
(e.g., how it is used) lo be documented.

You w ill be able lo configure. the Outputs parameters tab. for viewing or setting the signal
lype and range used by each output channel. Th e choices for the Type of Output ore
voltage a nd current:

Applica tion Tips


The writing area on an analog ou tp ut module connector limits what descriptive information
!hot con be written For each ou lput. Use the comment field to provide detailed Informa tion
on !lie use or the analog output channels of a module.

Propertle~ • A08>Cl2Btt • (R 1/ 5 10) -

Genet~ I Adci=et Outputs I


~ Enable
r Oiaonc,sllc lrtenl,lllt ]
0~
I o·1ag110wct
,
II◄ I◄ I► I►I I 0 1 2 I 3 I
Group Oiagno,licr.
I r 11 r II r II r
Oliput
l ~e o/ Outplt: IE IE jE IE
0 ulpul Rct1ga I•/·1()V 1.,. 1ov J+1· 10V l•l· 10V
Aeaclicn lo CPU-ST OP. locv jocv Jocv jocv

I OK I Cencd , __H
_el_P_~

Figure 3-57. S7-300 Ana log Output Module Properties: Outpu l parameters lob.

132
Working with Hordware Configurations

Quick Steps: Configuring S7-300 Analog Output Module Properties

ACTION

1 With the required station open in the hordwore configuration toot. select the cen tral
or expansion rack. or DP slave to display its instolled 1/0 modules; select the analog
output module and double c lick to open the p roperties dialog.

2 On the Generol tab. the Short description provides a brief summary of the module
features (e.g.. number of outputs. digl1ol resolution). The Order Number is the port
number of the open module in the configuration and should reflect the onotog
output module installed in the corresponding slot of the physical rock.

3 The default Name, Which is modiflabte. is based on the number of analog outpul
channels and the bit resolution prefixed w ith AO for a nalog output.

4 Use lhe Comment field lo enter o description of the module outputs or application.

5 Select the Addresses tab to view or modify the stor1 byte address for the module.
Since most S7-300 CPUs do no t ollow the sta rt byte addresses to be c hanged. the
System Selection check box will be ac tivated and g rayed ou t. Otherwise. you may
de-activate the check box. See Configuring S7-300 Analog 1/0 Module Addresses.

6 Select the Outpuls lob to view or modify the operating parameters for the module
and for each analog output channel.

7 Activate the check box Diagnostic Interrupt In order to use the module's ability lo
generate on interrupt on module-specific diagnostic events.

8 If th e "Diagnostic Interrupt" is enabled lhen you may activate lhe check box for
Group Diagnostics for each channel you w ish to hove monitored (e.g .. Wire break
for current ou tp uts. and Short c ircuit for volfoge outpu~). If a diagnostic event
occurs. o diagnostic interrup t is triggered and module-dependent diagnostic
information is stored in the module 's data oreo.

9 Click in the Measurement Type field d irectly below each channel. and from the list
of available measurement types [e .g ., voltage (E). curren t II)] selec t one for the
associated output c hannel. If a channel Is not connected. select "Dea c tivated."

10 Click in the Me-asurement Range field directly below each channel. and from the list
of available measurement ranges (e.g. ±1 OV, 1-SV, and 0- 1OV) select o range for the
associated ou tp ut channel.

11 In the Reaction to CPU STOP field . select Keep Lost Valve IKLVJ; or selec t Zero
Current/Voltage IOCVl . If you selec t "OCV." then for each current or voltage output
channel will output a value of zero .

12 Confirm the configurolion parameters with the OK b utton and use the toolbar Save
and Comptte button to generate the System Dalo object.

133
STEP 7 in 7 Steps

Configuring S7-300 Analog 1/ 0 Addresses


Basic Concept
Default analog 1/0 addressing in the S7-300, like with d igilol 1/0, is predetermined by the
physical slot in whic h the module is inserted. Each slot, as shown in the figure below. reserves
sixteen bytes of the peripheral memory (P) area. slorting w ilh byte 256 In slol 0. Since each
analog input or oulput channel uses two bytes lo handle its digital data. on o llocotion ol
sixteen bytes per slot supports modules o f 2, 4, or 8 analog 1/0 channels.

Essential Elements
The ngure below shows an S7- 300 with maximum expansion. Each slo l reserves sixteen byles
of analog peripheral memory, starting with byte-256 in slot 0. Slol-4 reserves bytes 256 -to-
271; slo l-5 reserves bytes 272 -to- 287; and so on. If an input module is inserted, each input
address is prefixed wilh PIW for peripheral input word: if on output module Is inserled, each
output channel address is prefixed with PQW for peripheral output word. The first analog input
is PIW 256 (byles 256-257); !he second input is PIW 258. The firs! analog ou lput Is PQW 256
(bytes 256-257); the second analog ou1put is PQW 258. Default starling byte-addresses
assigned in the S7-300 cannot be changed, except with the CPU 315 version 1.1 and higher.

Application Tips
Unlike digitol 1/0, that is updo led cyclically and placed in the image lables (PII/PIQ), analog
1/0 must be handled in the program. This is true since wilh peripheral memory, modules ore
directty accessed over the 1/0 bus. In LAD/FBD an analog input is read by specifying !he
input address as lhe source in a move instruction; on analog output is wrilten by specifying
!he oulpul address as the destinolion of the move operolian. In STL. a load operation reads
on analog input by specifying lhe input address (e.g., l PW 258). A value is sent to on analog
ou lput wilh o transfer operation thol specifies the output (e.g.. T PW 260).

PtW/ PQW PIW/ PQW PIW/PQW PIW/ PQW PIW/PQW PIW/PQW PtW/ PQW PIW/ PQW

IM 361 lo to 10 to to 10 to lo
655 671 687 703 719 735 751 767

IM361
10 to to to to lo lo lo
527 543 559 575 591 607 623 639

IM361
lo to to to to to lo lo
399 415 431 447 463 479 495 51 1

IM360
lo lo lo lo lo lo to lo
271 287 303 319 335 351 367 383
Figure 3-58. Default S7-300 a nalog addressing. starting at byte-256 of peripheral memory.

134
Working with Hordware Configurations

Quick Steps: Configuring S7-300 Analog 1/ 0 Addresses

ACTION

1 From lhe SIMATIC Monoger, open the required projecl and select lhe S?-300 Station
for which addressing is required.

2 With lhe station selecled, in lhe righl pone of the slation window double click on the
Hardware object to open the station in the Hardware configuration tool.

3 Select o rock whose modules you w ish lo view the installed analog 1/0 modules or
insert new analog 1/0 modules.

View the starting byte address of each input mo dule in the I-Address column or
each autpul module In the Q-Address column.

5 To modify !he slarling byle address of a module. select lhe module. right-click and
select Object Properties, then select the Address lab.

6 If lhe module addresses of fhis CPU con be modified. the System Selection
checkbox w ill have a default check mark which con be removed; o fherwise, the
box will be grayed oul or not ovailoble ot all. To modify o start byte address. rirsl de-
activafe the System Selection check box to disable system address determination.

7 Enter a new start byfe-address and confirm by pressing OK. In the S7-300. analog
starl byle addresses alter byte-256 musl be a mulliple of 16. In CPUs thal support
free assignment of addresses (e.g., CPU 315 a nd higher}, input and output modules
may use the same starling byle addresses (e.g.. PIW 256. PQW 256).

a The Process Image field has no meaning with analog modules and ls grayed.

9 Confirm the configuration parameters with the OK butlon and use the toolbar Save
and Compile button to generate the System Doto object.

2000
4 Al2i<128l 256.. 259
5 Al~.OI• to 20IM. Ex 6ES7 272 . 279
6 Al8•129l 6ES7 298 . 303
7 A02x12Bi 6ES7 304...307
8 A02"128t 6ES7 320...323
9 A04•129i 6ES7 336...3"3

Figure 3-59. Default analog addresses in S7-300 selpoint configuration. Note, Iha! allhough
16-bytes ore olwoys reserved. the aclual byte usage of the module is displayed under the I-
a ddress and Q-address columns.

135
STEP 7 in 7 Steps

Configuring an S7-400 Central Rack


Basic Concept
The central rock is the main rock of on S7-400 station. This rock. somelimes called lhe
con troller rock. will o lwoys contain a CPU and power supply. and perhaps some
orrongement of o ther modules. You will p robably gel started w ith this rock in order to
connec t with the CPU ond start with your initial programming ond configuration work.

Essential Elements
If o CPU hos not been selec ted, you will need to select one tho! meets the known
requirements of the opplicolion. Op tions for the main rock type will include lhe choice of a
central rack (CR) or a universal rack !UR). both of which support signal /SM), communicatio ns
(CP). and function modules (FM). Rock opti ons will include number of slots, and depending
on the particular part, support for redundant power supply. The power supply choice is
based upon the power requirements of lhe combination of modules installed in the rack.

Application Tips
If you need to connecl to the CPU lo tesl portions of your code. the minimum configurollon
you will need to get started is shown in the figure below. In the initial setup of this station you
will also need to install op tional backup batteries. required memory cards and provide o
power source to the installed power supply. It is lmpor1ant to remember that your hardware
configuration must match your actual ha rdware arrangement.

D.'.] S7400_Central_Rack (ConHguratlon) ·- Warehouse_ l l!!ll!J £J

5
s
7
8
9
10
,_1..;..1_ _ _ _ _ .:J

101 URl

,
Slot fl Modi.le
1J PS 407 lat-
... Drdet numbet
61:S7 407-~-0,t,AO
MPI addren I addrett Q addtes:s Comment
...
-
3
4
1!11 CPU 41 6-1 6ES7 416·1XJOO-OAB O 2 -
5
6
7 .:J
Figure 3· 60. S7•400 Cen tra l Rack Conngura lion. with CPU and Power Supply.

136
Working with Hord ware Configurations

Quick Steps: Configuring an S7-400 Central Rack

ACTION

1 From lhe SIMATIC Manager, open 1he req uired project and rrom lhe projec t tree
select the S?-400 Station for which a central rack configuration is lo be crea ted.

2 From the right pane, double click on 1he Hardware object to open th e stolion in
the Hardware configuration tool.

3 Open !he Hardware Catalog wind ow, from the View menu, if it is not alrea d y
opened.

Open the SIMATIC 400 c a talog object lo view the S7-400 c omponent folders.

5 Open the Rack -400 fold er to list the S7-400 ra cks.

6 Select and drag the appropriate cenlral rack (CR) or universal roc k (URJ from the
folder to the lop pane of the station window. The rack will b e labeled O(CR) or
O(UR) .

7 Open the PS-400 folder, select the desired power supply and drag the part lo stot-
1 o f the central rack.

8 Open the CPU-400 folder and then lhe appropriale CPU sublolder lo select the
required CPU. Drag the selected CPU lo slol-3 o f the central rock.

9 From lhe menu. selecl Station , Consistency Check. lo check for errors.

10 From lhe menu bar. selecl Station ► Save to save lhe configuration; or if done.
use Save and Compile lo g enera te the System Da ta that are download ed to the
C PU.

137
STEP 7 in 7 Steps

Configuring an S7-400 Multi-Computing Central Rack


Basic Concept
Mulli•computing in the S7-400 con involve use of up to lour CPUs in o central rock. operating
in an independent b ut synchronized manner. Synchronized operation means that the
participating C PUs switc h opera tional modes (e.g., starting. stopping) toge ther. The CPUs con
exchange doto via their MPI backplane connection (i.e .. C-bus}.

Dividing th e tasks of very large machines or processes into smaller independent control tasks
con result in bellerresponse limes. increased reliability. and uncomplicated programs.
Smaller programs ore also easier to manage and to troubleshoot. An example case might be
to separate all control from dota p rocessing and communications functions. All process
con trol loops. for example. may be assigned to a CPU.

Essential Elements
The multi-computing configuration requires the use of CPUs and racks tha t support this
capabilily. This arrangement is imp lied when two or more mulli-computing CPUs ore p lace d
in a rack svpporting this operation. A maximum or four CPUs may be installed in the central
rack (e.g.. URI J. Your specific choice or cen tra l rack will depend on the number of slots
require d a nd whether or not redund ant power supplies ore used.

Application Tips
All modules associated with this station. Including expansion 1/0. must b e assigned to a
specific CPU in the multi-computing configuration. A module is assigned loo CPU (e.g..
CPU I. CPU2. CPU3. or CPU41 under the module's objecl p roperties.

'~! Mul_CPUs -- C: \ Patrick\ 57 _Projects\ Mul_CPUs - 1 □1 xt


13- . S7400_Multiple_CPU_Rack
13 [ii) S7400_Multiple_CPU_Rack ~ MPl(l)
BJ- CPU 41 6-111] Ethernet(l )
ttl·- CPU 41 6-1 (2)
l!l··· CPU 41 6-1(3)

l!l·- CPU 416·1 [4)

Figure 3-6 1. Project folder containing multi-computing station with four CPUs.

138
Working with Hordware Configurations

Quick Steps: Configuring an S7-400 Multi-Computing Central Rack

ACTION

1 From lhe SIMATIC Manager, open to the required projecl and from the projecl lree
select the S7-400 Slolion to which mulli-computing will be added. or first odd a new
S7-400 station if if does not already exist.

2 With the station selected, from the right pane of the project window double click on
the Hardware objec t to open the station in the Hardware configuration tool.

3 Open the Hardware Catalog window, from the View menu, if it is not already
opened.

4 Open lhe SIMATIC 400 catalog object lo view the S7-400 component folders.

5 Open the Rack-400 folder to list lhe S7-400 roc ks.

6 Select the opprop rio le universal rock (UR) from the folder. lhot supports mulli-
compuling and lits !he Joto! slots and power supply requiremenls then drag it to the
top pone of the sta tion. The rock will be labeled O(UR).

7 Open the PS-400 folder. select your power supp ly and drag the parl to slo t-I o f the
central rock.

8 Open the CPU-400 folder and then the appropriate CPU subfolder lo select your
multi-computing CPU. Drag the selecled CPU lo slol-3 of the central rock. Add up lo
four CPU modules as req uired.

9 Configure parame ters for each CPU.

10 From lhe menu, select Statton ► Consistenc y C heck lo check for errors.

11 From lhe menu bar. selecl Station ► Save to save lhe configuration; or if done. use
Save and Compile to generate lhe System Doto that ore downloaded lo lhe CPU.

12 Download the complete stolion configura tion to oil CPU modules.

139
STEP 7 in 7 Steps

Configuring the S7-400 as a DP Master


Basic Concept
The S7-400 supports distributed 1/0. using the DP componen t of Profibus. which operates
much like remote 1/0. The DP configuration may involve one or more DP Master Sia/ions.
eoch o f which monages the 1/0 of one or more assigned DP Slave Stations. Depending on
th e requirements of your application, as the DP master, you may ei1her choose an S7-400
with DP master capability or a Profibus communications processor (CP) wilh DP capability .

Essential Elements
The DP master con be configured using on S7-400 CPU, with on integra ted Profibus-DP
interface (e.g .• CPU 4 14-2 OP, CPU 4 16-2 DP); or using a Profibus communications processor
with DP master capability (e.g .• CP443-5 Ext.). in conjunction w ith a CPU that supporls this
feature. In any case, the OP master will con trol one or more assigned OP slaves.

In configuring lhe DP Master. th e Profibus interface of the DP master must be a ttached to a


DP M a ster System, and assigned a unique Prolibus Address (e.g.. 3-1 25). If no t previously set.
then the subne t operating parameters (e.g.. transmission ro te. p rofile) wilt also need lo be set.
See configuration task Adding and Configuring o Profibus Subnet in Chapter 7.

Application Tips
Typically, a DP subnet will involve a single DP master. This is referred to as a Mono-Master
configuration. You may also have several mono-master sys tems within a project, by simply
crea ting multiple PROFIBUS DP subnets and attaching a DP master to each. A Multl-Master
configuration. Involving two or more masters on o single subnet. though not typical, is a lso
possible. You would do this by a ttaching the OP masters to the same DP subnet.

;!JSIMATI[ ~00(1) (Configuration) ·· DP _Prof4 l!lll(!)EJ


iii; 1ll! UH:: •
PROF19US(1t OP mo,.1., ~y,Jem (11
1 PS 4071~

3 CPU 414-2 OP

)13 OPAwtor
~
6
7
8
s

• ~
Figure 3-62. S7-400 CPU 414-2 DP selec ted and inserted as DP master. The block and white
dashed line is lhe Profibus DP Master system object lo which DP slaves will be allached.

:.JstMA TIC ,100(2) (Conflgurnlion) -- DP _Proµ 1!111(!) [3


iiii [OIUR2

1 I'S ~071 (l.'.

3 CPU 41 2•1
X'1 A.A'DP
4 CP4, )5£id
s
6
7
,
8

• ~
Figure 3-63. S7-400 CP 443-5 Ext. selec ted and inserted as DP master. The b lock and white
dashed line is the Profibus DP Master system object lo which DP slaves will be attached.

140
Working with Hordware Configurations

lil I SJMATTC 400(1) (Configuration) -- DP_Proj4 l!JOO EJ


...
iiiiflOJ UR2 3
, r PS 407 10<\ ...
PROFlBUS 1t DP maslet stem 1

3 j:"l CPU 414-2 DP liil l4) IM 153· "i7sTi~IT53.· l[i1(6J ltv1i53-'


)CJ
5
If OPMBSlBr I mrm m iDDm1
6
7
8 ..:J
◄ ~
. . ~ PROFIBUS(1): DP ma~e, s~em{1 J
PROFl!UJS address MOOJI... Ordei nuniler Fir... Oi<9'10stic .•. C.Omment
IM 153-1 6ES7153-1AA83-0XBO 8184 ...
IM 153·1 6ES7153-1M83-0XBO 8180
IM 153·1 6ES7153-1AA83-0XBO 8176 ..
Figure 3-64. S7-400 CPU 4 14-2 DP -mosterwith ET-200 M modular 1/0 drops.

Quick Steps: Configuring the S7-400 as a DP Master

ACTION

I From the SIMATIC Manager open the required project. and S7-400 slolion to serve
os DP Moster. The S7-400 must be inserted to lhe project if it not a lready ins talled.

2 With the S7-400 station opened in the hardware configuration window select the
central rack. Insert the required rack a nd power supply if ii is no t already insta lled .

3 If a CPU will serve as the DP master then the correct Profibus-DP CPU must be
selected (e.g., CPU 412-2 DP or CPU 416-2 DP). From lhe catalog open the CPU-400
folder. selec t and d rag the required CPU lo slol-2 or the cen tral rack.

4 When the Profibus interface dialog Is presented. select the Profibus subnet to which
the DP master should be a l Iached: set or accepl the suggested Profib us address
(e.g.• 3-1 25), then click on the Properties button lo set lhe subne t Transmission Rate
and other properties if they hove not yet been set.

5 After the DP properties dialog is saved, a DP Moster system object sho uld appear
extended from the DP master os o b lack and while dashed line. If the object is not
shown. right-click on the DP object in row 2X2. and select Add Master System.

6 You can save your work, but at least one DP slave must be attached lo compile
without errors. See th e earlier tasks on Configuring and Attaching Modular,
Compact, and In telligent DP Slaves.

If a communications processor (CP) should serve as the DP master. then the appropria te
selection must be made from l he CP-400 folder under the Profibus folder. Find the required
CP443-5 Extended communications processor a nd drag it lo slot-3 or higher of the cen tra l
roc k. The Profibus in1erface dialog w ill be presen ted and ~he configuration may be
continued w ith Steps 4, 5, and 6.

141
STEP 7 in 7 Steps

Configuring S7-400 Local 1/ 0 Expansion


Basic Concept
The S7-400 supports locol l/0 expansion from l .S meters to 3 melers using the appropriate
inlerfoce modules (!Ms) . Locol 1/0 expansion involves placing a publisher interface module in
on S7-400 central rack and o corresponding receiver interface in each expansion rock.

Essential Elements
The IM460-0 and IM 460- 1ore both publisher interface modules p laced in the central rock lo
for local expansion. Whichever o r lhese publisher interlace modules is used, its matching
receiver module is ploced in each expansion rock. The IM 461 -0 is the receiver ror the IM 460-
0; lhe IM 461 -1 is the receiver for the IM 460-1. These modules ore selected according to
d ista nce requireme nts and whether or not the expa nsion rocks will suppor1 communications.

Application Tips
Each IM 460-0 module hos two channels, each of which suppor1s up to 4-rocks. The IM 460-1
module hos two channels. each o r which ore limited to connectio n o r only one expansio n
rock; only two IM 46~ I interface modules moy be placed in the central rock. Altogether. o
maximum of six interface mod ules of any combination may be p laced in the central rock.

ms7400_l ocdl_Expanston (Conflgur<>Uon) .. Warehouse. I R~E3


i,ii l11ER2 ii;f2JER2 i,i,tlJER2 iiiil41ER2
PS 4071Go\ 1 PS 407 IOA PS 40710<\ 1 PS 407 lOA I PS 407 ltlll

Cf'U 416-1 3 3 3 3
IM 460-0 4 4 4 4
5 s 5 5
6 6 6 6
7 7 7 7

9
8
9 IM 461-0
8
9 IM 461-0
8
9 I~ IM461 -0
8
9 lM•61 -0

i,iilSlER2 _ ii;J6tER2 iii, 181 ER2


1 PS •07 10A PS 407104 1 PS , o7 1<tA 1 PS 407 tM

3 3 3 3
4 ◄ 4
'5 5 5 s
6 6 s 6
7 7 7 7
8 8 8 8
9 IM 461-0 9 lM 461-0 9 IIA 461•0 9 IM 461-0


Figure 3-65. S7-400 Locol 1/0 Expansion. using the IM 460-0/IM 46 1-0 pair.
s

142
Working with Hordware Configurations

i4t·1•t91it¥Wl;Ctrt•l ii4• U - A - -----~---


1

oene,a1 Cot-r.ection IAddie=.• I


~~Ol'H)Cl'llecled
Aid;;:
C<!mecied ReckS!

6
7
8
Connei:: C1: I 1 2 3 4 Di~onnect I
Connect C2 I

T;tia o/ Ccmecttn {Local Ink. \'<Ith K Bus. wihout powei su~)

I OK I Help

Figure 3-66. 57-400 Local 1/0 Expansion, using lhe IM 460-0/IM 46 1-0 pair.

Quick Steps: Configuring S7-400 Local 1/ 0 Expansion

ACTION

1 From the SIMATIC Manager open the required project. and from lhe project tree
select the S7-400 Station for which locol 1/0 expansion must be configured.

2 With lhe slalion selected, from lhe right pane or the projec t window double click on
the Hardware object to open the station In the Hardware configuralton tool.

3 Open the SIMATIC 400 catolog object lo view lhe S7-400 component fo lders.

4 Open the Roc k-400 folder. selec t and drag the appropriate expansion rocks [ER) or
universal rocks (UR) to the top pone o f the station window. If the cen tral rock is
a lready installed it is labeled O(UR) or O[CR); otherwise if must be configured first.

5 Open the PS-400 folder. select the desired power supply. Click and drag the port lo
stot- 1 o f each expansion rock as required.

6 Open the IM-400 folder by clicking the plus sign. The S7-400 expansion interface
modules a re shown. Publisher IMs ore installed only in the CPU rock (stol-3 and
higher). Receiver IMs are Installed in 1/0 expansion racks (slot 9- only, or slol- 18 only).

7 Select on IM-460-0 interface module from the cata log and drag to slot-3 or slot-4 of
the CPU rock O(UR). Select on IM-461-0 interface from lhe catalog and drag to sro t-9
or slo l-18 of each installed expansion rock.

8 Select the IM-460-0 in the central rock and right click and select Object Properties to
connect the expansion rocks to the desired channel. From the Connec tion tab.
assign each Non-Connected roc k lo either channel 1 or c hannel 2, by pressing the
corresponding Connec t button. Use OK button to save.

9 From the menu, sefect Station ► Co nsistenc y Check to check fo r errors, a nd then
use Save and Compile lo save the configuration before downloading lo the CPU.

143
STEP 7 in 7 Steps

Configuring S7-400 Remote 1/ 0 Expansion


Basic Concept
The S7-400 supports remote 1/0 exponsion up to 100 meters using expansion interface
modules (IMs). Remote 1/0 expansion involves p lacing a publisher interface module in on S7-
400 central rock and the corresponding receiver Interface in one or more expansion rocks.

Essential Elements
The 460-3 is o publisher interface module, placed in the central rock. Its matching receiver
module. the IM 461 -3. is placed in each expansion rock. Each IM 460-3 hos two channels.
each o r which supports up lo 4-racks. Each installed rock must be connected lo either
channel 1 or c hannel 2. The IM 460-3 may be installed in the central rock with up lo o total of
six other interface modules to form any combination o r loca l and remote t/0 expansion.

Application Tips
S7-400 remote 1/0 expansion up lo 600 meters moy be configured using existing or newly
installed S5 1/0 rocks that ore connected using the IM 463-2.

:J'!.74-00 _Rt'mote_Ckpo:,r1101on (Configur.shan) -- Wru-.ehot.1•e_l !(@El

11 • I'S <!07 16/<J


3
I
Cl'IJ41& 1
Iii .<Ql-3
l
4
I l
4
3

'6
3
I
L
6
7
s
6
7 I
I s
6
7
5

7
L
6
7
8
,
8 I
HI IM461·3 ,8 IM 461·3
8
s n,t 461 ·3
8
.., .cE1·3
' ,i <!61Cl'Z
3

1 PS 4071~ p; Ci)? 104 1 P5 407 I~ ' PS IOi 10/\

3 J 3
•5 •
5
I
5
6 6 6
7 7 7
8 8 8


9 114 461-3 IN 461-3 9
- ~ 461-3 9 .., 461-3

~
Figure 3-67. S7-400 Remote 1/0 Expansion. using tM 460--3/IM 46 1-3 pair.

iRl·i·tilitAll§lld•lii;UJf»- - ---~----
I
G.,..,,a1 Comec1ipn Adaeoce, Tr!ntfc, I I
Non-Connected
Fl acts-.

4
5
6
Comecl C1: 1 2 Olscomeot I
7
8
Con(lecl

T>'l)ool Comae1ion: [Remote link, with K Bus. wilhOUll)OWel i:upply)

I OK I Caicel Help

Figure 3-68. IM 460-3 Proper1ies dialog; configuring rock connections.

144
Working with Hordware Configurations

Quick Steps: Configuring S7-400 Remote 1/ 0 Expansion


ACTION

1 From lhe SIMA TIC Manager open lhe required project. and rrom the projec t lree
select the S7-400 Station for which remote 1/0 expansion mus! be configured.

2 Wilh the station selec ted, from the right pane of the projec t window double click on
the Hardware object lo open the station in the Hordwore configuration tool.

3 Open the SIMATIC 400 c a talog object to view the S7-400 component folders.

4 Open the Rack-400 folder, selec t and drag the oppropriote expansion rocks (ER) or
universal rocks (UR) to the lop p one of th e sta tion w indow. If the centra l rock is
already installed it is labeled O(UR) or O(CRJ; o therwise it must be configured lirsl.

5 Open the PS -400 folder. select the desired power supply. Click and drag lhe parl lo
stol- 1 of each expansion rock as required.

6 Open the IM-400 folder by clic king lhe p lus sign. The S7-400 expansion interface
modules ore shown. Publisher IMs ore installed only in the CPU rock (slot-3 and
higher) . Receiver IMs are ins lolled in 1/0 expansion rocks (slot 9- only, or slot- 18 only).

7 Select on tM-460-3 interface module from the catalog a nd dra g to slol-3 or slol-4 of
the CPU rock O(UR); selec t on IM-461 -3 interface module from th e ca talog and drag
ii lo slol-9 or slol-18 of each or your installed expansion racks.

8 Select the IM-460-3 in the central rock and right click and select Object Properties to
connect the expansion roc ks to the desired channel. From the Connec tion 1ob.
assign each Non-Connected rack lo either channel 1 or channel 2, by p ressing lhe
corresponding Connect button. Use the OK button to save.

9 From lhe menu, selec t Station :.- Consistency Check lo check For errors, and then
use Save and Compile to save the configuration before downloading to the CPU.

145
STEP 7 in 7 Steps

Configuring S7-400 CPU General Properties


Basic Concept
The General properties of o n S7-400 CPU module ore viewed in the properties dialog of the
CPU with a right-click on the CPU. t11en selec ting Object Properties. Basic information about
the CPU. which may vary depending on the relative age of the module. includes items such
as type and loca tion, o short list or characteristic features. and for modules with
communications interfaces - related information is provided.

Essential Elements
The Short DescripHon . the some os given in lhe hardware cotolog. gives important CPU
features such as work memory size. cycle time/1000 instructions. digital 1/0 capacity,
supported connec tions. DP/MPt ports. multi-computing ond routing copobitlty. The Order
Number reflec ls the module assigned In the configuration tool ond con be compared lo the
installed module. The Name fie ld shows the delaul1 name of the module. which you can
modify as required. C hanges to the CPU name are reflected in th e SIMATIC Manager.

The Interface parameter group. generally on modules with communications interfaces. shows
basic information such as node address and if the node is oltoched to a subne t. The
Properties bu tton provides quick access lo view interface parame ters, but the interface
p arameters (e.g .. MPI. Profibus, and Ethernet) ore set in the hardware configuration tool. The
Comment field allows information about the module (e.g.. op plication) to be documented.

Application Tips
The user-defined Plant Designation identifier. available with some CPUs, is o user-defined
identifier that con be evaluated in start-up 08s the user program, Examples of evaluating the
"plant designation" o re provided in the STEP 7 Sample programs.


i?l·l·i91i14idA 111ilf ti,!·Ui)-=:.

lntem.4Jlt I Tcme-ol•D&JI lnli,tf\lpla I Cydclr\le11upt I Di~rmtics/Clod<


uene1al J Sto,tup I Cycle/Oock tdelllOI)' l Reterlivc MerYay I Memory

Shott Oe:aipliort CPU 416'1


~12 KB wo,k memory; 0.08 MS/1llil rltlructiom; 1&KB 01/0; 64
-cximections: MPt ,onnection

01det NG,: 6ES7 416-1XJOO·Oi\BO


N«ne: {tuiffl
Interface- - - - - - - - - - - - ~
Tws: Mf'I
Ad:lrass: 2
fletworked: No

Comment.
...

I OK I c-1 I Help I
Figure 3-69. CPU Properties: General parame ters d ialog.

146
Working with Hordware Configurations

Quick Steps: Configuring S7-400 CPU General Properties

ACTION

1 With o sta tion open in the Hardware Configura tion tool select the CPU. right-click
and select Object Properties. ttien selecl the General lob.

2 The Short description of the module provides o b rie f summary o f th e unique features
of the installed CPU module: it cannot be modified.

3 The Order Number of the module is the specific number used to identify the exoct
CPU tha t should be installed in the physical roc k. The order number determines the
unique fea tures of the CPU, which ore summarized under the Short Description.

4 Click in the Nome field to modlfy the default name assigned to the module. The
default name is based on the short name of the p articular CPU type [e.g.. CPU 416-
1( i )] and o concatenated numeric value in parentheses. that represents the
number of the inslolled C PU. A number is assigned to the CPU since the S7-400
supports up to four CPUs in o rock.

5 The Interface static grouping. shows the module's set MPI address (default = 2), a nd
whether or not the module is atta ched to the network; the Properties button allows
the module' s Interface parameters to be accessed for viewing or editing.

6 Click in the Comment field to enter o description of the module's application -


especially since the 57-400 sup ports up to four CPU's in one rock.

7 Confirm the configuration parameters with the OK b utton.

147
STEP 7 in 7 Steps

Configuring S7-400 CPU Start-Up Properties


Basic Concept
S7-400 CPU modules moy be started without ony changes to the default stort-up param e ters.
There are a few adjustable parameters. however. that allow you to determine CPU start-up
characteristics or whether or not the CPU should even be allowed lo star!. These parameters
are checked by the CPU o f the various startups (e.g.. power O N, or the transitio n from STOP-
to-RUN). before beginning lo process the main cyclical program (OB1).

Essential Elements
The parameter Startup If Setpolnt and Actual Configuration Differ, determines if the CPU
should be allowed to start-up if the selpoint and actual configurations differ. The defa ult
beha vior is to start even if the setpoint and actual configurations differ. The parameter Rese t
Outputs al Hot Restart allows the CPU to reset the outputs. and the process image of the
outputs (PtQ) a t each ho t restart. This parameter is essential since ou tputs are not normally
reset on o Hal Restart The parameter Disable Hot Restart by Operator prevents o ho t restart
from the PG/PC or otherwise. The parame ter Startup After Power-On determines whether a
start-up after o power-up will initiate o "Worm Restart.'' a Hot Restart." or a "Cold Restart."

The Monitoring nme parameter. Finished Message, specifies the maximum C PU wait-time. a t
power-up. lo receive ready-signals fo r a ll configured modules. The parameter Transfer of
Parameters to Modules specifies lhe maximum lime tor modules, including DP-In terface
modules, lo acknowledge receip t of their configuration parameters (the wait-time sta rts ofter
receipt of the "Finished Message") . If either of these two parameters ore not acknowledged
before the set time expires. the preset and actual configurations will be considered differen1.
The CPU reaction is then determined by the parame ter ''Startup if Preset and Actual
Configuration Differ." Finally, the Hot Restart parameter prevents the CPU from starting if the
transition time from power off lo power on, or from STOP to RUN is lo nger than the lime
specified for this parame ter. A "O" value shu ts monitoring off.

iYl+iYih¥§ 41illfi -IO·N-i ! - =


11

I
WWW

lrie,r~~ I l1me-ot·DII!' trteffl41'$ C}tclic lnteru,pt I Dil!O!loola!Oock


Genet.ii St!rtup I C leJOock. Memo\}' Relenbve Merno4)' J Memo{)' _

~ Sta~~\1/hen eMpeotedlactual origwalJon dtfef

~ R= t outplts at hot •~ad


P' 0 it~ hot 1el\41l by 0~1ato1[101 eMride, horn PG)
01-00111~nication job (fo, e1<&!11>1e, Crom MP! 1h1tionsl

- s t,.ll.fl mler Power On

r- Hot1e1ta,t (" Warm reslad

- Mooto,110 Timef0t ================.,,,


''FiMhed" 111eua;ie bl> mo<lJlea 1100 rM.t lsso
T1.,...fer d p a -ters to 11101iJlet: (I 00 mt)· ,..i,-oo==-·
Hot 1e$la1t 1100 '1'1$), lo

I OK I Cancel l Heb I
Figure 3-70. S7-400 CPU Properties: Start-up parameters dialog.

148
Working with Hordware Configurations

Quick Steps: Configuring S7-400 CPU Start-Up Properties

ACTION

1 With the Hardware Configuration tool open to the desired project and station. from
the central rock select the CPU module. righ t-click a nd selec t Object Properties.
then select the Startup lab. Parameters that are grayed ore not possible in th e
opened CPU,

2 Activate the check b ox Startup if Preset and Actua l Configuration Differ, to allow the
CPU lo start even ir the preset and se tpoint configurations d iffer. With this selling,
central rock or distributed 1/0 modules are not checked; PROFIBUS•DP interface
modules ore checked and must be inserted ror the CPU to sta rt. This parameter is
activa ted by defoull .

De-ac tivate the check box to d isable Startup If Prese t and Actua l Conflguratlo n
Differ. If al teasI one configured slot differs, then the CPU switches to STOP. If
module-slo ts other lhan those originally configured hove modules inserted. they ore
not compared.

3 Activate the "Reset Outputs at Hot Restart" lo hove all outputs and the PIQ to be
c leared on each occurrence o f a Hot Restart. De-activa te the check box In order
to hove all outputs and the PIO to maintain their lost state on each Hof Restart.

4 Select "Worm Restart." "Hol Restart, " or "Cold Restart." as the mode o f Startup After
Power On. The Cold Restart optio n is not a vailable on older CPUs.

S Set the parame ter Finished Message. in milliseconds. to specify the maximum CPU
wait-time ror configured modules to signal ready for opera tion otter power-up.

6 Set the parameter Transfer of Parameters to Modules, in milliseconds, to specify the


maximum lime for all modules. including DP slaves. to acknowledge receipt of their
configuratio n parameters.

7 Set o value for the Hot Restart parameter in milliseconds. If th e time that 8 )(pires
between a transition from power-off to power-on, o r from STOP to RUN is longer than
the time specified for this parameter, then CPU sta rt-up \Nill be disabled. The value
"O" means no monitoring occurs.

8 Confirm the configuration parameters INilh the OK b utton.

9 From th e menu, select Save and Complle to generate the System Doto object
before downloading to the CPU.

149
STEP 7 in 7 Steps

Configuring S7-400 CPU Cycle and Clock Memory


Basic Concept
The Cycle a nd Clock Memory parame ters allow for the cyclical processing time of the CPU
to be influenced and for a single byte to be defined where the CPU may output periodic
c lock pulses. Modifying default parameters o f this dialog is not essential for S7-400 operation;
they do. however, allow adjustm en ts tha t optimize use o f CPU processing time.

Essential Elements
The Update Process Image Cyclically parameter determines ii the p rocess image of inpu ts
and o utputs should be updated cyclically. By default thls parameter is set to update the Ptl
and PIQ cyclically. The Scan Cycle Monitoring Time is the timer value that if exceeded by the
CPU cycle. the CPU is stopped. The Minimum Scan Cycle defines a minimum cycle lime th a t
CPU should always use - even if ii must wait. Th e Scan Cycle Load from Communications se ts
a percentage of the total cycle time for servic ing communicatio ns.

Adjusting the Size of the Process Image (PII/ PIQ) , perhaps lo reftecl aclual usage of inp ut/
outp ut bytes, is only relevant in certain S7•400 CPUs. The parameter 08 85 Coll Up at l/ 0
Access Error determines how OB 85 should be handled in the event o f 1/0 access errors. The
parameter is generally grayed and is fixed so lhal 1/0 access errors do not result in a call of
0B85, nor ore entries made in the d iagnostic b uffer. In la ter CPU revisio ns. o ther options for
colling OB 85 include "Only for Incoming and Outgoing Errors"', or "On Each Individ ual
Access." Th e Clock Memory parameler allows o by te from Bil memory (M) 1o be specified os
the location w here the CPU will o utput eight ind ividual clock-pulses.

Application Tips
Clock pulses. o re accessed in the user program, via lhe eight bits of the specified byle . From
the most-significant to !he leost-significanl bit !he output frequency i_s 0.5. 0.625, 1.0, 1.25, 2.0,
2.5, 5.0, and 10 Hz. Yo u may use lhese p ulses instead of timers, where periodic signals are
needed. Typical uses include flasher-circuits. a la rm synchronizatio n. or where even ts must be
continuously trigg ered at periodic interva ls. Clock p ulses hove on on-lo-o fF ratio o f I: I.

Properli«~ - 1:l'U 416 -2 DP - (RO/ 'i6) :Rl


1 ~·011'/· ~ I c,ic.,c Ill(enlJPl 1 Oi.:ignottiWClock I M!illoompAng I
General I Sta,tup C¥c~Clook Memc,y I I
I I
Rel~rve Memocy Uemay lntenlC)li
-C1,'Cla- - - - - - - - - - - - - - - - - - - - - - - - -
p Update 091 p,oceti imoge cyclioally

Sea1CvcteMonacxing Time fmst f150 ;


Mi1m11Y1ScanCl,cfe Tille!mil ,-(o----'-•·•
Sea1Cyclalood fromQimnwJnicblion (%J: f20
Sl'8olthe F'rocetJ lmage ,...,51-2--.:]-,

.:::]

- Clocl. MerllOIJI'- =====================,-;


r
,__________________________
Clock memoiy
'1~l' 891~ f1J ..., ,

I OK I C<n:el I__H_eJ_p__,
Figure 3-7 1. S7-400 CPU Properties: Cycle/Clock Memory parameters dialog.

150
Working with Hord ware Configurations

Quick Steps: Configuring S7-400 CPU Cycle and Clock Memory

ACTION

1 With the Hardware Configuration tool open to the desired project and station. from
the centra l rock select the C PU module. right-click a nd selec t Object Properties.
then select the Cycle/Clock Memory lob. Parameters that are grayed o re not
possib le in the opened CPU.

2 Ac tivate the checkbox Update OB 1 Process Image Cyclically for cyclic updates of
the process ima ge tables /PII/PIQ). This Is the d efault setting but con b e chang ed.

De-a c tivate the checkb ox Update OB 1 Process Image Cyclically to disable normal
cyclic updates o f the p rocess image (PII/PIQ). If this parameter is set 1/0 up doles
must be ha ndled by c a lling blocks.

3 In the Scan Cycle Monitoring Time field, sp ecify in milliseconds, the cycle lime tha t
the CPU is not to exceed. If the actual cycle time exceeds this wa tchdog time. the
CPU enters the STOP mode. unless OB 80 is loaded in CPU memory.

In the Minimum Scan Cycle Time field specify, in millisec onds. the minimum time
that should be used to process the program. If the actua l cycle lime is less than the
specified minimum, lhe CPU waits until the minimum cycle lime expires, o r If O B 90 is
in memory, this re maining tim e is used by the C PU for b ac kgro und p rocessing.

S In 1he Scan Cycle Load from Communications field, enter o value from 10 lo SO, as
o percent of the set cycle lime lo allocate for c ommunica tions p rocessing.

6 In the Size of the Process Image (PII/ PIQ) field , only releva nt in some 57-400 CPUs
ond lhe C PU 31 8. Enter on end byte-address for the PII/PIQ lo re nec t lhe actua l
usage of d igital input-bytes (PII) and d ig ita l ou tp ut-by1es /PIQ). The PII/PIQ update
time is thereby minimized.

7 Where the OB 85 Call at 1/ 0 Access Error parameter is allowed, select the option
"No Co lt of OB 85" if 0885 should no t be called whe n an 1/0 access erro r occurs
during update of the process images {PII/PIQ); select the optio n "Only for Incoming
a nd Outgoing Errors," to minimize the impa ct on the CPU cycle. The op tion "On
each ind ivid ual access" c a n result in an increa se in CPU cycle time.

8 To use clock memory, activa te the Clock Memory check box and then enter a byte
(e.g .. MB 97) from Bit Memory, to use for CPU output o f eig hf individual clock p ulses.

9 Confirm the configuration parameters with the OK b ut Ion.

10 From the menu, select Save and Compile to generate lhe System Da to o bject
before downloading to the CPU.

151
STEP 7 in 7 Steps

Configuring S7-400 CPU Re tentive Memory


Basic Concept
The CPU Retentive Memory poromeler settings allow oreos of memory lo be defined os
re ten tive. Memory is retentive if it reloins its stored contents when the CPU operating mode is
switched from RUN lo STOP ond even upon power loss. Modifying the default parameters o f
this d ialog is not essentia l for operation of S7-400 CPUs, unless you require tho I certain
memory bytes. timers. and counters retain their contents on loss or power.

Essential Ele m e nts


In the S?-400 parts of bit memory (M). timer [T). and counter (C) a reas moy be defined os
re tentive. The first three parameters require on entry of the number of bytes. timers. or
counters lo reserve starling rrom byte-0. limer-0. or counter-0 respec tively. An entry or 4 in the
bit memory fie ld reserves byte-0. 1, 2. and 3 as retentive. Whereas in the S7-300 Doto Block
areas may also be reserved as retentive. this is not possible in the S7-400, therefore this port of
lhe dialog is grayed oul. Finally, the maximum siz.e tho I con be reserved os re lentive Is
dependent on the CPU.

Applica tion Tips


Recall, tho! under normal conditions involving loss of power wi lh battery backup, the
con ten ts of dole blocks ore already retained. The 57-300 feature is lo protect against loss of
these areas given o loss of power, but particularly a loss of battery backup. This maintenance
free feature is not incorporated in the 57-400. Bollery-bockup must be in place In order to
reta in areas defined as retentive.

,
Propcrlic~ -

,,..enupl$
Genttol I
I lime-ot-Oay lrterru~s
Sll!lf4:) l
l Cyclio Interrupt ]
Cyde/Clock MemolJI
01agnosiic$JClock
Retentive Memory j Merr,o,y
I
AeteriMy----------------------.·
tl~r of Memoty Bytes Sta<1r19 with MBO: [ffl
H~r of S7 Tmet* Sta,tr,g with TO: lo
tl~r of S7 Counteri Stert.-,g w~ CO: le
A1ca1
DB Ila. 8)11.e Addlets N~er of 8~ltl$
Af':lf-rlive Aiea 1 1, II) lo
Rt;lcrlWll Aleo 2. '1 Jo lo
A1!1"-1fflYeA1~osJ jI lo lo
fl c,t~,mPJe~ ~ 11 lo lo
ReienliveAre,;5: II JO [o
Actr.n!f.c ~.~11 &
Ri:ltnrvu Ale,> ;
Ae•"""r1e I\Ut& 9
1,
II
II
,~
ICP

lo
lo
la
lo

I Help

Figure 3-72. S7-400 CPU Properties: Retentive Memory parameters d ialog.

152
Working with Hordware Configurations

Quick Steps: Configuring S7-400 CPU Retentive Memory

ACTION

1 With the Hardware Configuration tool open to the desired project and station. from
the central rock select the CPU module. righ t-click a nd selec t Object Properties.
then select the Retentive Memory tob to define retentive memory areas.

2 Click in the Memory Bytes field, and enter the total number of bytes lo define os
retentive. The defined oreo starts ot MB Oo nd will include oll by1es up to MB n- 1.

3 Click in the S7 Timers field and enter the number of timers lo d efine os retentive. The
defined retentive oreo starts a l TO. and will include all timers up lo Tn- 1.

4 Clic k in the S7 Counters lleld ond enter the number of counters to define os
retentive. The defined re tentive area starts at CO, and will include all counters up to
Cn-1.

5 Confirm the configuration parameters with OK.

6 Use the tootbar Save and Compile b utton to genera te the System Doto object
before downloading to the CPU.

153
STEP 7 in 7 Steps

Configuring S7-400 CPU Local Memory


Basic Concept
Local memory is the S7 memory used by the temporary (TEMP) variables of a code block,
when accessed during p rogram execution. The local memory, also called the local stock or
L-stock, is only ovoiloble lo the current block while lhe block is being processed. After the
block is done the local stock is available lo lhe nexl calle d block. which overwrites the
previous d o te. Each S7-400 CPU has o fixed amount of local memory tho! con be re-
ollocoled, os required, from the Memory lob of lhe CPU properties dialog.

Essential Elements
Each CPU has a f1Xed amount of local memory tha t. by default, is equally divided among the
priorities classes. In lhis way. every priority class is guoro nleed its own local slack. A5 Vvill be
discussed in more detail later. all blocks [e.g.. FB. FC. SFB. and SFC) ore called directly or
indirectly trom on organiza tion block for processing. Furthermore, all organization blocks ore
called by the operating system based on o pre-assigned priority class. Since local memory is
allocated lo the priority class of organization b locks. the local memory ovoiloble to each
code block is based on lhe organiza tion block from which the b lock is called.

In S7-400 the total local memory, of the open CPU. may be re-alloca ted. Thal is to soy tha t
port of the local memory assigned too priority con be re-distributed to where ii is needed.
This may be lhe c a se where a priorily class is no! in use or where all of ils local memory is not
needed. Re-ollocolion of the local memory is useful since p riority classes do not oil need the
some local memory size. High priority classes (e.g .. 25-28). for example, do not normally
involve large data requirements or more than lwo levels of block calls.

Application Tips
When allocating local memory. all temporary variab les of the OB and of the blocks called
from tha t OB musl be considered. If too many nesting levels (blocks called in a horizonlal
direction) are used, the L-slock may overflow. The local sta c k requirements of your program
should be lested. The local data require ments or synchronous error OBs must always be
token into consideration. All organization blocks require a minimum of 20-bytes of local
memory to store the 20-byles of start informolion entered by !he CPU.

P1·op~rtl~~ · CPU ·1 13· 1 • (R0/ 52) ~


Inlet~! I Tnne-ol-0 ay Interrupt~ Cyclic lllterrupt Oiag"lo$lics/Clook J
Gene.Ill l Staitup l Cycla/Clock Memoty I Al!lenlive Memory MemQIY
- Local Data (Priolity Clam,s)
1 j!'li ' 10 le.; , ~ 19 10 251256
2 j256 e I'-' IA lo lO ju 2S l2ss
3 j256 9 j2S£ J!.l lo 21 lo z, 1256
4 j256 10 ID 1s j25s 22 10 28 l2ss
.s lo 1, lo 17 ,256 n In zs lri
6 j'l 12 j25S 1a jo 24 !2ss

A#lgned 3328 Bpt~of max. !4096


[ ~nication Resources "
l.tal!im.nn '.:orfll'l!U!litalirn-Jl7.ll 1,so

OK
I Cancel , __H_e_lP_ _.

Figure 3-73. CPU 413-1 Locol memory dialog: memory re -alloca tion allowed.

154
Working with Hordware Configurations

i4t,J1I40i&i411111 i;(•Jti) _ ___ ~


lnteuupti ) Time-ol-Oe,y Interrupt, C,Yciielnterrupt I
0•11ic;/Clock I
Geneial ] Slaltup I
Cycle/Clock Memoiy Relentive Memoiy Memory

Local Data (Prionty Cla~s)


1 ,, 024 7J256 131256 l 9 l256 25 l2ss
21256 8J256 14 1256 20 !256 26 11024
31256 9 j1024 151256 21 j256 27 11024
4 1256
5 j256
s l2ss
10 11024
11 j1024
12 11024
16 1256
17 1256
1e j2Ss
221256
23 j256
24 j256
~ ,~
28 ,, 024

Assigned 13312 B~t~ ol max. ,,6384


[ Comrr.mlciitioo AMWIC4!$
l~D~rr,J,n Can•nur,,. .,11u1 Jllll'I jr,oo

OK
I ~ncel I, Help

Figure 3-74. CPU 416-1 Local memory dialog: memory re -ollocotio n allowed.

Quick Steps: Configuring S7-400 CPU Local Memory

ACTION

1 With the Hardware Configura tion loot open to the desired project a nd station. from
the central rack select the CPU module, right-click o nd select Object Properties.
then selec t the Re lentive Memory tab to define re ten tive memory oreos.

2 Clic k in o Priority field a nd enter the tolal number of bytes lo define for the priority
c lass. No te: the number ol bytes must be d ivisible by 2 and values 2-to-18 ore no l
valid. A minimum of 20-byles sa tisfies the minimum requirement th at every
organization b lock a lso requires 20 bytes of local data for its start information.

3 Modify a s many priority classes as required and confirm settings with OK.

Use the loolbar Save and Compile b utton to generate the System Doto o bject
before downlo a ding to the CPU.

155
STEP 7 in 7 Steps

Configuring S7-400 CPU Diagnostics and Clock Properties


Basic Concept
Each S7-400 is equipped with a reol-time c lock tho l ls required for using runtime meters ond
for triggering Time-of-Doy interrupts. Each C PU also incorporates a Diagnostic Buffer- on S7
memory orea where Diagnostic events ore stored in lhe order they occur. Modifying the
default Diagnostics and Clock properties is not essential: however these parameters allow
you lo innuence operating charac terisllcs o f the diagnostics bufler and o f lhe CPU c lock.

Essential Elements
Three parameters influence the diagnostic buffer. Ac tivating the Extended Functtonat Scope
c a uses the CPU to enter events other thon stand ard errors into the diagnostic buffer. For
example. each stort of on organization block is considered o d iagnostic event. The increase
in d iagnostic events will cause the b uffer to overflow sooner. and make it more likely tha t
important messages will be overwritten. In some CPUs the parameter Number of Messages In
Buffer, allows the d iagnostic buffer size to be adjusted. The buffer normally holds 100
messages. The parameter Report Cause of STOP, if activated. causes each CPU STOP to be
entered in the buffer and reported to a designated PG/PC or operator panel.

The c lock can be synchronized periodically based on a user-defined synchronization mode,


time interval a nd correction factor. If 1he CPU is one of several clock-equipped modules in
the local rack or in a network. the synchronize lion mode allows the c lock to be designated
as a master ond resp onsible for setting other clocks; or as a sla ve a nd set by another c lock.
Furthermore. your selection will determine if the clock is synchronized internally from the PLC
bus, or externally over the MPI port. Whether or not a clock can be synchronized exlemally or
act as either master or slave is CPU-dependent.

Application Tips
The extended scope cannot be octivoled in STEP 7 ofter V3. I. If the parameter was
previously active in a project now being converted from V2.x to V3. I or higher. then the
setting con now be downlo a ded to the C PU or de-octivoted.

i4ill·MHt4--=- f4•4 i f - - ~
G_ .,, Staitup I ~le/Clock Memory 1 Aelentive Memo,y r MetnO!Y I
lntetrupls I Tir11e·ol-O II.I' lnlemJpt, I C)ICrio Interrupt Oiagoo,tic;IClock

r Spstem Dias,l~
I r ElQerid'!d IUr,r;Jlon.
P' Report cal.lie of STOP

Clock
S!-<!Olvoniutian S~chloniu!tion Mode iine Interval
In the PLC: INone ::::) lr,on!i 3
On MPI: INone ::] lt,,on 3
Orr Ml'I 11,,,nt iJ lho11 i]
COiiection Factor (rm): I□

OK
I Cancel , _ _H_e_
lP_ _.

Figure 3-75. S7-400 CPU Properties: Diognoslics/Clock parame ters d ia log.

156
Working with Hord ware Configurations

Quick Steps: Configuring S7-400 CPU Diagnostics and Clock Properties

■ 1
ACTION

With the Hardware Configuration tool open to the desired project and station. rrom
the central rock select the C PU mod ule, rig ht-click and selec t Object Properties,
then select th e Diagnostics/Clock lob to make the required changes.

2 Activate the Report Cause of STOP check box, to hove a ll causes ol stop s to b e
e ntered lo the diag nostic buffer and lo be sent lo a designated PG/PC or operator
pa nel. Otherwise. deactivate th e checkbox to minimize the number o f events
e ntering the b uffer.

3 In the PLC field under Synchronization Mode, select As Mosler, ii the clock will
synchronize o th er c locks; selec t As Slave, if the c lock will be set by ano ther local
c lock: or selec t None if the local c lock is not to be synchronized.

4 In the PLC field under Time Interval. select the synchronization inteNol, if the clock
was set to sync hronize o ther clocks.

5 In the MPI field under Synchronization Mode. selec t As Moster. ir the c lock w ill
synchronize o th er c locks; select As Slave, it the c lock will be set by a no ther locol
c lock: or set None if the local clock is not to be synchronized.

6 In the MPI field under Time Interval, select the synchronization interval. if the cloc k
was set to sync hronize o th er clocks.

7 Confirm the configura tion parame ters with OK.

8 From the menu. select Save and Complle to genera te the Sys te m Dalo object
befo re downloading to the CPU.

157
STEP 7 in 7 Steps

Configuring S7-400 CPU Access Protection


Basic C onc ept
Some S7-400 CPUs supper! the ability to use password protection to limit access to the CPU's
con trol program and other operations. This p rotectio n is in addition lo the p rotectio n
provided by the C PU key-svtitch. With password protection enabled. the control prog ram
and its data a re protec ted from unauthorized changes [i.e .• write access protection). II is
even possible to prevent read access lo program blocks that ore considered proprietary
(i.e.. read access protection) . Use of on line functions such as upload/download blocks may
also be p rohibited to non-password holders.

Essential Elements
Using CPU access pro tection invo lves setting the proteclion level and ii reQuired, defining a
password. Once configured. the protection level and password is downloaded to the
module with the configuration data. Complete read and write access is possible for all
password holders. regardless of the key-switch position. Otherwise. three levels of p rotectio n
may apply to non-password holders. level 1 is th e defa ult setting in which standard key-
switch access is in operation. level 2 provides write-protection; read access is possible. but
write access is denied without the password. l evel 3 provides read/write protection, which
means that both read and write access ore denied. independent of the key-switc h position.

Applica tion Tips


Since o nline func tio ns, like Monitor/Modify Variables or Upload/Download blocks, a re
affected by protection level 2, users a re p rompted to enter a password whenever such an
operation is invoked. If the correct password is entered. access rights ore permitted to
modules for which a pa rtic ular protection level was set during parameter assignmen t. The
ontine connec tio n is es toblished to the protec ted module and the online functions of the
protection level moy be executed. An otternole method. one lhol vtill elimino te the need to
continually re-enter a password, you may enter the password from the SIMATIC Manager.

i41+I#lit¥934111111 f-4•4ii _ __ ~
General I
Stai:h.ip IC_yde/Clock Memo!,' l I
Retentive Memory Memoiv lntem:cib I
Time-of,Dey t~e111,1;it, I Csiclii; Inte,rupl j Diag0!)$tics/C~ Plotection

Level al Protecbon
r. 1: Keysw1tch S elting
r R~movi!ble ~h Pestwo,d
r 2. 'w'rit&-ProtWion

r 3; w'rite-/Read-Piot!!Clion
Pmwr.rr.f;

OK
I Cancel !__H_e_lP_ _,

Figure 3-76. S7-400 CPU Properties: Protection parameters d ialog.

158
Working with Hordware Configurations

i4t,J1I40i&i411111 i;i•Jti)- - ~
General I Slatlup I Cycle)Clock Memcxy I Rel,entive.Memory ) Memoi_y Inteir~i I
Trne-al•D11}' lnlern.ipts I Ciicbc lnteuupl I Dlagrmtics/Clock Protecl1on

,., Level ol Protection,--,-,,===~


r 1: Keyiwitch Seltil"l!J
r flerrowa'Jle ~l\h PasiWOld
r. 2· Wr~e-Protec:hon

C- 3: WriWr/ReM-Plot11etioo
Pimw«d:

Entei ~in:

OK
I ~ncel I '
Help

Figure 3-77. S7-400 CPU Properties: Protection parame ters d ialog.

Quick Steps: Configuring 57-400 CPU Access Protection

ACTION

I With the Hardware Configura tion tool open lo lhe desired project and sta tion, from
the c entral rack, selec t the CPU module, rig ht-click and selec t Object Properties,
then select the Pro lec tlon tab.

2 By defaull. Level 1 or Key-swi/c h protec tion is activated; al this level. password


protection is no t e nobled. There is no read /write acces.s restric tion in either the RUN-
P or STOP position. however. reod access is permitted in the RUN positio n. The key-
switch must be moved to STOP or RUN-P b efore any download or dato write (e.g ..
modify variables) opera tion is a llowed.

3 Select Level I or Key-switch p rotection with the optio n Removable with Pa ssword
enabled lo allow the key-switch restric tions to be re moved with possword entry. In
this mode, Read and write a ccess is possible for password holders. independent of
the key-switc h p osition.

4 Select Level 2 Pro lec tion by ltrst activa ting the Write Protection radio button: then
enter a nd confirm the desired password in the appropriate fields. In this mode, data
and programs may be monitored, but write opera tions such os download or modify
voriables is only permitted to password holders.

5 Select Level 3 Protec/ion by first activo ting the Write- Read Protec tion radio b utton;
then enter o nd confirm the desired password in the appropria te fields. In this mode,
read a nd wri te operatio ns ore permitted lo passw ord holders only.

6 From the menu. select Save and Complle to generate the System Doto object
before downlo ading to the CPU.

159
STEP 7 in 7 Steps

Configuring S7-400 CPU Interrupt Properties


Basic Concept
The S7-400 CPU Interrupts lob lists lour ca tegories of interrupts. Hardware Interrupts include
those generated by machine or process inputs using an interrupt input module or those
triggered by modules (e.g .. CP. FM. or analog SM) tt1 at hove onboord diagnostic or status
events thol con generate on interrup t je.g .. over limit, or under limit). Time-Deloy Interrupts
are generoled from lhe user program using syslem functions (SFCs) and ore used when the
main cyclical program (OB 1) must be interrupted to call a service ofter a precise time delay
has expired. Asynchronous Error In terrupts. are generated by system-related faults (e.g.,
battery failure. power lallure. wire break on analog input). thol are non-program related.
DPV l interrupts con be triggered by so-called DPVI slave devices. lo ensure that the
con trolling master CPU processes lhe event in lhe stave tho I triggered lhe in terrupl.
Essentia l Eleme nts
Each 57 inlerrupt has an associa ted organization block tho I is called for processing by the
opera ting system whenever the interrupt occurs. Which of the listed OBs are actually
available i$ CPU-dependent. OBs tha t ore not supported in a CPU are grayed ou t. The only
modifiable parameter of on interrupt O B is lhe default priority. If you need to change the
priority, only use the allowed alternates. Hardware, lime-delay. and DPVl interrupt priorily
alterna tes include 0, and 2-to-24: asynchronous interrupts allow 24-to-26. A priority of zero
d eactiva tes an interrupt OB. To avoid loss of interrupts. you should not assign o priori ty twice.
Applica tion Tips
When on inlerrupt occurs. the main cyclical program (OB 1) is interrupled. Responding lo an
inlerrupt requires writing the STEP 7 code for the OB. and downloading the block to the CPU.
The OB is then ready to act os lhe service routine - called when the interrupt is triggered. The
code written in the OB should be kepi as shorl as possible (e.g.. oclivo te olorm, send
message. halt machine). Remember, time-delay interrupts ore triggered from the program.
You will need to coll the system function for starting the time defoy (SFC 32, SRT_DINT).

Prop,,rtie~ - CPU 416-1 · (ROi 'i3) ~


I I I
Ttne·ol-0~ lnler~s
Goneral I St~~

- Harr:rw.,re lnlerr~
I Cyei:: lntenupe J Dl11gnoltic$/Clock
C,IICIC/Clock M!ll'Mry

rlime-Del'I'/
I R!ilentive Memo,y

lntanuptt
PralcctJon
I MllmDIJ
MlillCOIJlPtlll"ll)

Asyna. E1r01 lnlm11J1u


lntem,plt

Ptoc~
Proce~, Prwy
II image
im~e Pri01it)I: J>Mllon
Prioil.Y. partition: 0881 ~
0B40. lffi'" lea rt a 0820. [3 3IIJP I p,. 08112- ~
0841: P7 Irc1 p,, 3 0821 f,I loe, ~ 3 0883. 126
0022:[s l'JB I.PA 3
0842; fie lue, ~- E] 0884: ~
0843: [ig j9eP-~ 3 oan; rs lnr 1 PA '..:] 0B85. ~
0844: j2o"° jne r•;. 3
'-
·lm rruptt 11:1 DPV1 I 0B66· ~
0845: FJ IrA PA 3 PrlorilY:
088"{. ~
0846:fF Iris· P,·. E] 085~ 12~ l:8/0 Fi
0947: j23 lc:B'·PA 3 086S '747 GB72- fs
0857 ' ""
0.873. r
I OK I Ceneef
I Help

Figure 3-78. CPU Properties: tnlerrupl poromelers dialog.

160
Working with Hordware Configurations

Quick Steps: Configuring S7-400 CPU Interrupt Properties

ACTION

1 With the Hardware Configuration tool open to the desired project and station:
select the CPU module. right-click and selec t Object Properties. then selec t the
Interrupts tab lo make your desired priority-class changes (optio na l).

2 Up to eight Hardware lntemJpls o re supported in the S7-400. The associated


organization b locks o re OB40 to OB47. The corresponding defoult p riorities ore 16 to
23. To enter a new priority. c lick in the field ond enter a new value (0. or 2-24.).

3 Up to four Time-Deloy lntemJpts o re supported in the S7-400. The associated


organization b locks ore OB20 lo OB23. The corresponding default p riorities are 3 to
6. To en ter a new priority. c lick in the field ond enter a new value (0, or 2-24).

4 0B81 is lhe only Asynchronous Interrupt OB in most S7-300 CPUs and it has a fixed
priority (priori ty-25). lf the open CPU supports modifying the defa ult priori1y then you
may en ter a va lue of 0. 2-4, 9. 12, 16. 17. or 24-26. Using the default value or a value
in ttie range o f 24-26 ensures th at asynchronous error OBs are not be interrupted by
other intemJpt events.

S Where the p riority of DPVl lntemJp t OBs is alterable, you may enter a new value o l
0, and 2-24. A va lue of Ois in effect disabling the OB.

6 From lhe menu, select Save and Compile to generate the System Doto object
before downloading lo lhe C PU.

161
STEP 7 in 7 Steps

Configuring S7-400 CPU Time-of-Day Interrupts


Basic Concept
Configuring a time-of-day in terrupt is o nly required to ho ve o port o f your STEP 7 program
execute at a specific date and time. When the interrupt is triggered. the ma in cyclical
program in OB 1 will be interrupted a l the configured time and dale and the associated
service routine (organization b lock) of the interrupt will be called for p rocessing. Time-of-day
interrupt can be configured such Iha! upon reaching lhe target date and lime. the
associated OB is executed o nce and only once. or every minute. hourly, doily. weekly,
monthly, every end of month, or yearly.

Essential Elements
The properties tab for lime-of-day interrupts lists the Orgonizotion Blocks. OB 1Q..to-OB 17. All or
the time-of-day interrupts are assig ned a defaul t priority 2 class. Up lo eight lime-of-day
inlerrupls are supp orted by S7. but the exac t number a vailable is CPU-dependenl. If one of
lhese lime-of-day interrupts is not supported by the opened CPU. then the OB and its
p arameters ore grayed. Configuring a time-of-day in terrupt requires activating the OB.
selec ting the executio n interval. and setting the start date and lime. Alternate priorities that
may be assigned include priorities of 3-24.

Application Tips
Programming a time-of-day interrupt involves setting the start parameters. activating the OB,
writing the code for the OB, and downloading the OB to the CPU. The OB is then ready to act
a s the service routine - calle d when the interrup t is generated. The parameters of time-of-
day interrupts moy be set here in lhe hardware configuro1ion tool. or from w ithin the STEP 7
program. using standard system functions. TOD interru p t applicatio n mighl include
genera ling operator messages o r p roduclio n reports. or scheduled process readings.

Properties - CPU 416- l -

General I Starlvp I Cvcle/ClockMemDf)' I Retentive Memor, I Memoiy I


lnterf14)1s
Time-of-Oa)' lnterruptt I I
C)'Cic lnletr,..il Diagnostici/Ctock J Protection l
MiJicOOll)lti'lg

Process- rmaga
PriolitJ, Active E~ion St<11t dete Tilie cl day p.111tijon

0B10: r r None 3 I□, 01.94 100:□o loe, Pl> 3


0B11: r r None 3 !□1 .01 .94 100:00 los1-Pta 3
0B12: r r ►lone 3 !01 01.94 joooo I0B1.PJ. 3
0813: r r None 3 101.01.94 100:00 Iue,,r,. 3
0B14: r r None 3 jo1.01.s4 100:00 !oa1.p;1 3
0B15: r r None 3 1□1 .01 .94 100:00 I081 P.la 3
0816: r r ~Jone 3 101 01.94 100:00 [Oill-Pi- 3
0817: r r ~Jone 3 !01 01.94 joooo f0B1 p,. 3

01< I
Figure 3. 79. CPU Properties: Time-of-Day Interrupt parameters dialog.

162
Working with Hordware Configurations

Quick Steps: Configuring S7-400 CPU Time-of-Day Interrupts

ACTION

1 With the Hardware Configuration tool open to the desired project and station. from
the central rock select the CPU module. righ t-click and selec t Object Properties.
then select the Time-of-Doy In terrupts lob.

2 Select the lime-of-day interrupt OB whose parameters you wish to oiler: lo modify
the Priority class click in the field and enter a valid alternate p riority of 3-to-24.

3 Click inside the Active c heck box to activa te th e OB. Tim e-of-day Interrupts may
also be oclivoted from the STEP 7 program using system function SFC 30 (ACT_TINT).

4 Click the drop arrow In the Execution field, ond select whether the OB should be
called once, every minute. every hour. every day, every week. every monlh, every
month-end. or every year. Time-of-day interrupts may also be se t from lne STEP 7
program. using system func tion SFC 28 (SET_TINT).

5 Next. click in the Start Dale field and enter the start dote for the time-of-day
interrupt. If the start dote is not entered on the properties dialog. ii can be set from
the STEP 7 program using the system function SFC 28 (SET_TINT).

6 Click in the Time of Day field and enter lhe start lime for lhe time-of-day interrupt.
The start time con be entered here on the properties dialog, or from the STEP 7
program. using the system function SFC 28 (SET_TINT).

7 Click inside the Active check box to mark the OB as oclivoled. If the Hme-of-doy
interrupt OB is not activa ted on the p roperties dialog, it con be activa ted on
demand from the STEP 7 program. Use system function SFC 30 (ACT_TINT) lo ac tivate
time-of-day interrupts.

8 Confirm the configurolion parameters wilh the OK bu1ton.

9 Use the toolbar Save and Compile button to generate the System Doto object
before downloading to the CPU.

163
STEP 7 in 7 Steps

Configuring S7-400 CPU C yclic Interrupts


Basic Concept
A cyclic or "watchdog" in terrupt. is generated at o fixed periodic interval. and triggers
execution of a specific cyclic interrupt OB. Cyclic interrupts ore used to interrupt the CPU's
normal processing at p recise inleNols (e.g .. every 100 ms. every 500 ms. or every 5 sec) to
execute code that must be processed on a regular basis. Typical uses or cyclic interrupts
include communicalions, control loops, temperature control. and sampling analog inputs.

Essential Ele m e nts


The properties tab for cyclic interrupts ns ts Organization Block.$ 0B30 lhrough 0838. These are
the nine cyclic interrupt OBs supp orted by S7. Each 08 is listed with its assigned p riority (7-
15) . and the default cyclic interval at which the OB ls processed. Which of these OBs ore
ocluolly available, however. depends on !he CPU. In the CPU 416-1. for example, all nine OBs
ore available. 08s th at ore grayed out ore not supported by the opened CPU.
Configuring changes to default parameters is not necessary unless required. While the
default priorities may be changed. only oltemale priorities of 3-24 ore allowed. To prevent
loss o f interrupts, however. core should be token to not assign o priority twice. II is also
possible to modify lhe period of execution and lo enter a Phase offset value. If several cyclic
interrupts will be activa ted, a phase offse t will ensure that interrupts ore d istributed
throughou t the CPU cycle and ore not triggered simullo neousty.

Applica tion Tip s


Starting a cyclic interrupt simply involves determining which 08 will be used. modifying the
default parameters if required, creating and downloading the organization block code as
port of your program. The OB will be processed according to the specified interval, w hich is
limed from w hen the mode selector is moved from STOP to RUN. Finally. it is essential that the
code programmed In a cyclic OB ls execu ted in signinconlly less Hme than the coll Interval.

i?i·lfl#lii¥Wi411111 14•&+;- - ~
General I Slath.1p
Time-of-Oa,11 tnlenupta
I Cycle/ClockMemo1}'
Cycic l~r~ I
I Ae\entive Memoiy I Memoiy
Diagnostics/Clock ] Plotedion
I
lnterr~i
I
MiAicompwig
I
Proc= i ~ partfun
Pricictty Exeallion (mcJ Phate ollff!I (ms)
08::lll: r lsooo lo ID81 D,4 .:]
0831: r 12000 lo joe1.PA 3
j·J81 PA
0832: Is 11000 lo ::J
0833: fio Jsoo lo {JB1 °A 3
0834: r,;- 1200 lo joe1 PA 3
0835: fi2 1100 lo 1001 f'/> 3
0836: f,3 Isa lo los1.PA 3
0837: f,4' 120 lo l.ie, ?A 3
0838: r,s- 110 lo {081 PA °3

OK I l:4ncel j __H_e_lP_.....,
Figure 3-80. CPU Properties: Cyclic Interrupt parameters dialog.

164
Working with Hordware Configurations

Quick Steps: Configuring S7-400 CPU Cyclic Interrupts

■ 1
ACTION

With the Hardware Connguro lion 1001 open lo the desired project ond station. rrom
the central rack, select the CPU module, right-click and select Objec t Properties,
then selec t the Cyclic Interrupts tab to modify lhe configuration parameters.

2 Select the cyclic OB whose parome.ters you wish to alter. and enter a new Priority
c loss if you wish lo modify the defaul t priority; c lick in the field and enter o volid
alternate /3-24). Assigning o priority twice should be avoided to prevent loss of
interrupts due lo multiple (> 12) interrupts of the some priority occurring
simultaneously.

3 Enter o new Execution value if you w ish to modify lhe default processing interval for
the OB; click In the field. and en ter a valid value in lhe range of 10 milliseconds to 6
seconds (i.e., 10-to-60,000).

4 If multiple cyclic interrupt OBs will be running. lhen enter a Phase O ffset value for
each. in milliseconds, if you wish 1o ensure lhat p rocessing of the OBs is d istributed
somewhat evenly throughout lhe total CPU cycle. A valid range for this field is (0 -to-
60000) . The default value of O represents no p hase offset.

5 If the S7-400 CPU supports system update of Pl Partition /process image partitions),
you moy enter the number of the process image segment for the interrupt OB in
question, ii required. The CPU wit! update the a ssigned p rocess image segment.
whenever the associated interrupt OB is coiled. A valid range tor this field is (1 -to- 8).
The default value of " O" represents no p rocess Image partitioning.

6 Confirm lhe conngura lion parame ters with OK.

7 Use the toolbar Save and Compfle button to genera te th e System Data objec t
before downloading to the CPU .

165
STEP 7 in 7 Steps

Configuring S7-400 Digital Input Module Properties


Basic Concept
The properties of standard d ig itol input modules in the S7-400 o re viewed or edited from the
Hardware Configuration. When inserted into the hardware configuration digital inp ut
modules may be sta rted without any modifications to the default properties unless the
module is on interrupt input type (Also see Configuring S7-400 In terrupt Input Propertiesl. Basic
information about fhe module Is provided on fhe General tab. The addresses assigned lo the
module ore provided on the Addresses tab (Also see Configuring S7-400 Digilo/ 1/0 Module
Addresses).

Essential Elements
The Short DescripHon . the some os given in the hardware catalog, gives important features of
the digital input module such as number of input circuits, supply voltage. and number o f
circuits per group (i.e.. per common], For example o 120 VAC input module moy hove 32·
inputs with fo ur groups of eight circuits (grouping o f 8], The Order Number reflects lhe
currently open module, which is assig ned to a specific slot in the configuration - it should
match the port number o f the physically installed module. The Name field shows the defoull
name of the module. Although the name con be changed, ii is not recomme nded. The
Comment field allows more details abou t the module or its application to be documented.

Application Tips
The writing area on a module connector limils what descriptive information that con b e
written fo r each d igital input. Use the comment field to provide detailed information on the
use o r the digilol inputs of o module.

iPIO,IOHtiODEfffiititJ,1"6fd1Uil _ _ _ _______
General IAdtte$ses I

Dl32lciJC 12CN
Oigial input module D1~2. 120 VUC, gro!C)ing 8

Order No.: 6ES7 421 ·1 ELOO-OMO


Name: !•

Comnle~
32-l)Oint Input Caid uses 4-bytes. 4-bytes reserved bJ c~rd

OK
I Cancel !__H_e_lP_ _,

Figure 3-81. S7-400 Digital Inpu t General Properties dialog.

166
Working with Hordware Configurations

IQl,l·I9iit¥UtlEti1Iif1•116f4,ff.tl--------~-~-
Gel'l!la1 Add-esDe& J
lrc>Ylt

Start: F,oce.$:$ image:


End. l □B1 Pl 3

OK
I C.,ncel , _ _H_e_lp_~

Figure 3-82. S7-400 Digital lnpul Address Properties dialog.

Quick Steps: Configuring S7-400 Digital Input Module Properties


ACTION

1 Wilh a station open in the hardware configura tion, select a rack to view its installed
modules: double click on a digital input module w hose properlies you wish to view
or edil. Nol all properties may be edited (e.g.. Order Number. Shor/ Description ).

2 On lhe General lob. the Shor! description of the module p rovides o briel summary
of the module features (e.g.. number of inputs, supply voltage. circuit grouping).

3 The Order Number is the porl number of the open module in the configuration and
should reflec t the digital input module installed in the some slot in th e p hysical rock.

Click in the Name field to enter a new name; the d efault name is based on the
number of inputs and the supply voltage prefixed with DI for dlgitol inpu l.

5 Use lhe Comment field lo enter o description of lhe module inputs or opplicotlon.

6 Select the Address tob to view or modify the starling byte address of the module. To
modify the slort byie address. de-oclivo te the System Selection check box. and
enter a new start by1e-oddress; confirm by p ressing OK. See Configuring Sl-400
Digital 1/0 Module Addresses.

167
STEP 7 in 7 Steps

Configuring S7-400 Interrupt Input Properties


Basic Concept
The general and address properties of the interrupt input module ore the some as for the
standard dig ital input module, however. a third d ia log is provided for selling the inlerrupl
module's interrupt properties. By default, hardware interrupts ore d isabled so if this module is
used !hen it will be necessary lo enable interrupl capability from the p roperties dialog,

Essential Elements
Activoling the hardware Interrupt parameter enables o il of the inlerrupl inputs for use. An
input delay con be specified ro r the en tire module, based on lhe type of signals connected.
The input delay should closely match the delay characteristics of the input device in order to
protect against false input signals. Finally, each input channel may be set lo trigger on
interrupt on the rising edge. fa lling edge, or on both the rising and failing edge o f the signal.
If neither parameter is activated. then the associated channels will not trigger an inlerrupt.

Activo ling the diagnostic Interrupt enables the module to generate a diagnostic inlerrupt.
The diagnostic func tions may vary depending on the module, but on the interrupt input
module includes monitoring the supply vollage o l !he connecled sensors and for a wire
b rea k in the connection between the input circuits and sensors. If mo nitoring Is
octivoled a nd the supply voltage foils. !he group d iagnoslic event is enlered inlo the
diagnostic dolo storage area of !he module. The data con be read from the module, in the
STEP 7 program, using the syslem funclion to "read syslem slatus lisf' (i.e.. SFC 51 RDSYSSTI or
evoluoled in 0882.

Application Tips
Response to hardware interrvpls in the user program is handled using organization b locks
(OBs) . In lhe S7-400 OB 40 through OB 47 ore available a nd ore assigned to the interrupl
module on the Addresses tab. The interrupt OB must be p rogrammed and downloaded to
!he CPU lo be ready to handle on interrupt. When o hardware inlerrupl is lrlggered. the
operating system interrupts th e main p rogram block (OB I) and calls the lnlerrup I OB.

iPi+IAiUNOll@CfJI Interrupt - (llU/ 5!1


General AcktesSM ln~iI I
--------
- 1,w~- - - - - - - - - - - - - - - - - - - - - - - - - ~
HW rlerrupt oiggers:
Start JS Pioc= image;
End; 3 loe, Pl .:] 08 j40 3

OK I Cancel , __H_el_P_..,

Figure 3-83. 57-400 lnlerrupl Input Module Properties: Addresses tab.

168
Working with Hordware Configurations

1Alflti§iit¥U•lll@•lf4i1inl§il11•lf IIB•4ii----------~-
I
aenera1 Ac:kle- lnPl,ts I
!Enable Oestioatioo CPU
- -=
P- D"iagrio$tic Interrupt P' Hardware lnlelllJ!lt (01 lnter!1:§!l: I C~J 41;2DP
- '.3
-
I~ h◄ l ◄ l ► l ~I 0
I 1 [ 1
I 3
I
Di.,grmticf
Wire Br~:
... p- P"
• . P'

r
No Loed Voltage L+: p rv P' rv
''
Trigger for Her~& lnteliupl
R~ng (Positive) Edge: P" p- P' P"
Falling (Negelive) Edge• r r P' a.,. l
.
Inpot Dele;, (mst- 13(OCJ j3t(•CJ j31t:•l; )3 (C,CJ
'
R&acltlll"I lo Error. lsv :!

Sub,titute "I'~
I r
- II r II r II r1 I
=
OK
I ~nce1 I Help j
Figure 3--84. S7-400 Interrupt Input Module Properties: Input parameters lab.

Quick Steps: Configuring S7-400 Interrupt Input Properties

ACTION

I With the required station open in lhe hordwore configuration, select the rock where
the module is inslolled; double c lick o n lhe in terrupl input module lo open the
p roperties dialog, then selec t the Inputs tab.

2 To use the module's d iagnostic feature. o cliva te the Diagnostic Interrupt c hec k box
and then aclivate the corresponding Wire Breok check box ror specific channels or
the Na load Voltage check box for lhe module. causes the module lo monitor a nd
reporl on these conditions. A suitable program In 0882. con be used lo evaluale
which error has occurred and on which inp ut t11e error occurred.

3 To use the module's hardware interrupt features. acliYa te the Hardware Interrupt
check box, then to enable use of the sixteen interrupt inputs. Ac tivate the Rising
Edge check box below the c hannel number if the input should trigger an lnterrupl
on a O-lo-1 transition; or Activate the Folling Edge check box, if the input sho uld
trigger on interrupt o n a l-lo-0 transition.

4 Click in the Input Deloy field and selecl lhe lypicol signal delay lime Vn milliseconds)
of the connected input sig nals. This parameter affects all inputs.

5 In the Reaction to Error field, select Keep las! Valid Value (Kl VI (logic-0 o r logic- I );
or selec t Substitute Value (SV). If you select substilule value, fo r each o ulput you
wish lo be se t to logic I , activate the check box for Substitule Value "I". Boxes not
activated will be set to logic 0.

6 Confirm the configuration parameters with the OK b utton and use lhe loolbor Save
and Compile button to generate the system data b locks.

169
STEP 7 in 7 Steps

Configuring S7-400 Digital Output Module Properties


Basic Concept
The properties of standard d ig itol S7-300 digilol output modules ore viewed or edited from
the Hardware Configuration. A s well, when inserted info the conliguralion these modules
may be sta rted without any c hanges to the default properties. unless you wish to modify the
start address or the module hos ou tput signal parameters you wish to influence. Like the
dlgilol inpu l module. basic information about the module is provided on the General fob.
addresses assigned to the module are provided o n the Addresses lob (Also see Configuring
S7-400 Digitol 1/0 Module Addresses), a nd o n some d ig ital output modules on Output lob.
con to ins porameters tha t allow the behavior of the outpu ts on the module to be innuenced.

Essential Elements
The Short DescrlpHon gives importanl features of the d ig ita l oulpul module such as number of
ou tput circuits. supply voltage. and number o f circuits per group (i.e.. per common). For
example o 120/230 VAC/2A outpu t module may hove 32-outpuls with eighl g roups of four
circuits (grouping of 4/. The Order Number refl ects the module assig ned to a specific slo t in
lhe configuration - ii should molch lhe port number of the physically installed module. The
Nome field shows the default name of the module. Allho ugh the name con be c hanged, ii is
no l recommended. The Comment field allows details about the module or its application to
be documented.

A digital output module may include on Ou tput tab if the module hos diagnostic Interrupt
features that monitors and reports d iagnostic events that hove been enabled on the
module. Diagnostic functions may include detection of wire break. no lood vol/age. shorl
circuit to ground. and short circuit lo supply. or blown fuse. This d igital outp ut may also hove
the ability lo se t o substitute va lue lhot determines the slate tha t each output should be set
to when the CPU goes to STOP.

141·Jll§Ht4i•I•Ji%i4ifl•tf#I•®4:Ai4•4idf■ ______~~-~
I
Gehei.al Ad~e- I
Shalt D~c11)11on. D016AAC120/230V/2A
Oigial oulpul modtJe D016. 120/230VAC.) 2A. giouping 4

l
Order NQ.: 6ES7 422·1FHOO-MAO
Name: loo1SAAci 2on3w12A

CO!ffllent

OK I Cancel I__H_el_P_ _.
Figure 3-85. S7· 400 Digital Output Module Proper1ies: General p roperti es tab.

170
Working with Hord ware Configurations

i4t,J,I41itW•Illliffldi4•1Hffii\ii;i•J4ii>la _____~ - -
I
s en!!fa1 Adlteu iea Outj)Ult I
r Enabl&- - - - - - - - - - - - - - - - - - - - - - - - - - ,
P Oiagnottic lntenupl D~ inalii:ln CPU for II .:]
lnte11J,llll:
Reaction tc CPU-STOP; ISubslik~e a v.we (SV) .:]
OutpiA
II◄ I◄ I► I►I I 0 I, 1
I 2
I 3
I
Diagn~
p
No ~ Volt~e L+;
I II p II ~ II p I
Shi:,il Circuit lo M·
I p
II r II r II r I
Sooslitute Value
5uootiute "1" [ El II r II r II r I
,.

OK I eance1 I Help I
Figure 3-86. S7-400 Digitol Outp ut Properties: Output porameters settings.

Quick Steps: Configuring S7-400 Digital Output Module Properties

ACTION

I With a sta tion o pen in the hardware configuro lion, select a rack to view its installed
modules: double click on a digital output module whose properties you w ish lo view
or edit. Nol all properties may be edited (e.g .. Order Number, Short Description).

2 On the General lob. the Short description provides o brief summary of the module
features (e.g.. number o f outputs, supply voltage. circuit grouping) . The Order
Number is the p ort number o f the op en module In the configura tion a nd should
reflec t lhe digital output module installed in the some slot in the p hysical rock.

3 The default Name, w hich is modifiobte. is based on the number of outputs. the
supply voltage. and the oulp ut current. on p re fixed with DO for digital output.

4 Use the Comment field lo enter o d escrip tion o f the module outputs or appticalion.

5 Select the O utput lab lo se t operating parameters for the outputs of the module.

6 In lhe Reaction to CPU STOP field. select Keep Last Valid State (logic-0 or logic-I): or
select Substitute a Value. If you selecl "subslitute o value," lhen for each outpul you
wish lo be set to logic 1. aclivale the corresponding check box for Sybstilute "1 ".
Boxes not activated will be set to logic 0.

7 Ac tivate the Diagnostic Interrupt box to enable the module' s ability lo generate a
diognoslic inlerrupt when any one of ils diagnostic monitori ng events occurs.

a To activate diagnostic monitoring (e.g .. Wire Breol;. No Lood Voltoge. Short Circuit
to Ground (Ml. Short Circuit to Supply IL+I. or Blown Fuse) for on outp ut. ocflvale the
corresponding check box benea th each oulp ut circuit you wish lo monitor.

171
STEP 7 in 7 Steps

Configuring S7-400 Digital 1/ 0 Addresses


Basic Concept
Just os in the S7-300. eoch digital input module. when inserted in the S7-400 configuration.
reserves 4-by1es or the input imoge (I) memory; and each output module. when inserled.
reserves 4-by1es o f the ou tput image (Q) memory. Reserving four bytes allows for a module
with up lo 32 inputs or 32 outpu ts to be inserted. Although default addressing in the S7-400 is
similar lo the 57-300. II is not fixed or slol-dependenl. Also. rull use or the inpul ond output
images is possible. This means that input and outpu t modules may use 1he some starting byte
addresses ond that the assigned addresses of ony module may be changed.

Essential Elements
As eoch module is inserted. four bytes ore reserved in either lhe process imoge of inpuls
(input moduleJ or process image of o utp uts (output module). The starting byte address for
each successive module is bosed on the next ovoilable byte address following the previous
input module (for inpulsJ or previous o utput module (for outputs). even if a slot is left empty,

If inpu t modules are installed in the first four slots. os seen in the figure below. slot-4 would
reserve bytes 0-3; slot-5 would reserve bytes 4-7; slot-6 would reserve bytes 8-11: and so on. II
ou tp ut modules ore installed in the following four slots. slot-8 would reserve bytes 0-3; slol-9
would reserve bytes 4-7: stot-10 would reserve bytes 8-1 I; and so o n. In the S7-400, assigned
starting byte-addresses may be modified under lhe address properties ot the module.

Application Tips
Digital inp uts ore accessed rrom the Pit using the input memory identifier ' I' prefixed lo the
a ddress; d igita l ou tp uts o re accessed in the PIQ, using the output memory identifier 'Q '
prefixed to the address. Both inputs ond ou tputs ore referenced os "byte.bit". A 32-point
ou tp ut module in slo t-4 would use addresses Q 0.0 through Q 3.7: on inpul module would use
I 0 .0 through I 3.7. Inputs/Outputs may also be accessed as by1es, words. or double words.

I Q Q Q Q

4,0 8.0 o.o 4.0 12.0


lo lo to to to to 10 to
0.7 4.7 8 .7 12.7 0.7 4.7 8.7 12.7
Byte-1 Byte-5 Byte-9 Byte-13 Byle-1 Byte-5 Byte-9 Byte-13
1.0 5.0 9 .0 13.0 1.0 5.0 9.0 13.0
lo lo to to lo lo lo to
1.7 5.7 9 .7 13.7 1.7 5.7 9.7 13.7
Byle-2 Byle-6 Byte-10 Byte-14 Byte-2 Byte-6 Byte-10 Byle-14
2.0 6.0 10.0 14.0 2 .0 6.0 10.0 14.0
to lo to to lo lo lo to
2.7 6.7 10.7 14.7 2.7 6.7 10.7 14.7
Byte-3 Byte-7 By1e-11 Byte-15 Byte-3 Byte-7 Byte- II Byte-15
3.0 7.0 I 1.0 15.0 -3.0 7.0 11 .0 15.0

to lo lo 10 lo 10 lo to
3.7 7.7 11.7 15.7 3.7 7.7 1 1.7 15.7
Figure 3-87. Default digiloJ1/0 addressing in the S7-400 slo rts al byle-0, regardless of fhe slol.
and reserves 4-by tes per slot. Input a nd o utput modules moy use the same by1e addresses.

172
Working with Hordware Configurations

Quick Steps: Configuring S7-400 Digital 1/ 0 Addresses

ACTION

1 From lhe SIMATIC Monoger, open the required projecl and select lhe S?-400 Station
for which a ddressing is required.

2 With lhe station selecled, in lhe righl pone o f the slation window double click on the
Hardware object to open the sta tion in the Hardware configuration tool.

3 Select o rock whose modules you w ish lo view the installed digitol 1/0 modules or
inserl new digilol t/0 modules.

View the starting byte address of each input mo dule in the I-Address column or
each outpul module In the Q-Address column.

5 To modify the slarling byle address of o module. select lhe module. right-click and
select Object Properties, then select the Address lob.

6 To modify a starting byle address. de-octivote the System Selecllon check box to
disable automatic address determination by the system.

7 Enter a new start byte-address and confirm by pressing OK. Since in the S?-400 the
complete PII and PIQ con be used. input ond ou lp ut modules may hove the some
addresses. Digitol 1/0 start byte addresses. ofter byte-0, must be o multiple of 4 (e.g.,
4, 8, 12. 16. 24. etc.).

8 The Process Image field shows the process image responsib le for updating the
module outputs. By default digital outputs ore cyclically updated by lhe CPU.

~ t_J (0) UR1


Moduio
PS 4071~
... Or... FL. MPI... I o~dlcso Q .;ddr,;,, Corrmenl
6ES7 ..
4 Dll2>ilC 120/
5 D13UJC 12W 6ES 7
6 Dll2>ilC 120\/ 6ES 7 8...11
1 D116>-AC 120I 6ES7 12...13
8 0116>-AC 120/ 6ES7 16. ..17
9 OO~DC24VI0.5A 6ES 7 0,.. 3
10 D032.DC2<1V/0.511 6ES7 4. .. 7 32 le• uoed, 4 re,erved.
11 D016~D C 24V/2A 6ES 7 8..,9 1 nt ~ - t or : · es used, 4-~es 101-eived
12 OD IS.DC 24V/2A 6ES7

Figure 3-88. Default digital a ddressing in S7-400. Note that although 4-bytes (32-bils) ore
olwoys reserved. the ocluol byle usage of the module is displayed under the I-address and
Q-address columns.

173
STEP 7 in 7 Steps

Configuring S7-400 Analog Input Module Properties


Basic Concept
The general properties of analog input modules in the S7-400 ore viewed or edited from the
Hardwa re Configura tion. Basic information about the mo d ule, like port number and a brief
descriptio n. is provided on the General tab. The addresses assigned lo the module o re
provided on the Addresses tab (See Configuring Sl-400 Analog 1/0 Module Addresses).
Before a nalog inpul modules ore slorted ii may be necessary to set certain module
operating parameters (See Configuring S7-400 Analog Input Signal Parameters).

Essential Elements
The Short DescrlpHon, the same as given in the hardware catalog. gives important features of
the analog input module such as acceploble input signals. bit resolutio n. and number of
input channels. For example an e ig ht channel a nalog input module may have 14-bi1
resolution and accep t 0-20 mA/ 4-20 mA current signals and several voltage ra nges. The
Order Number reflects the currently open module, inserted in o specific slo t in the
configuration - it should matc h the part number o f the actu a l installed module. The Name
field shows the default name of the module. Although the name con be changed. ii is not
recommended. The Comment field allows details o f the module's applica tion lo be entered.

Application Tips
The writing a rea on the module connector limits what descriptive information con be writ1en
for each input channel. Use the comment field to provide detailed information on the use of
the analog inp uts of a module.

Properties - All6>113B1t - (RO/ S4)

I
Ge~al Addresie, lniiut,I I
Shtwl Detcripbon: Al 16il1:Ilk
r- ginputl)lod\eAl167°3 bit;

..!J
Orclei No.. 6ES7 431-0HHOO-OABO
Name;

16-chamel 1.-.,ut Card 1.11:es 32-b_vtes, 32-1:l'µs ,~erved by ~d ...

I Cencel !__H_e'3_ _
Figure 3-89. S7-400 Analog Input General Properties d ia log.

174
Working with Hordware Configurations

Properties · AI16K13Bit -

Ge1Wal Addleitea j Ir,;iutl l


lnpuls

Stait: j512 Pioo- imag~:


End. 543 I i]

OK
I Cancel I__H_~-~
Figure 3-90. S7-400 Analog Input Address Properties dialog.

Quick Steps: Configuring S7-400 Analog Input Module Properties


ACTION
'

1 Wilh a sta tion open in the hardware configura tion, select a rock to view its installed
modules: double click on on analog input module whose properties you wish lo
view or edit. Not all properties may be edited (e.g .. Order Number. Short
Descriplion I.

2 On the General lob. the Short description provides a brief summary of the module
features (e.g.. module type. number of inputs. bit resolu tion).

3 The Order Number is the port number of the open module in the configuration and
should reflec t the analog input module installed in the same slol in the actual rock.

4 Click in the Name field lo enter o new name; the default name is the number of
analog input c hannels a nd the bit resolution prefixed with Al for analog inp ut

S Use lhe Comment field lo enter a description of the module Inputs or opplicotlon.

6 Select the Address tob lo view or modify the starting by te address o f the module. To
modify the start by1e address, de-activate the System Selection check box and
enter a new slorl byte-address; confirm by p ressing OK. See Configuring Sl-400
Analog 1/0 Module Addresses.

175
STEP 7 in 7 Steps

Configuring S7-400 Analog Input Signal Parameters


Basic Concept
In addition to the General and Addresses p roperties tabs used to configure S7-400 analog
inpul modules, most analog inp ut modules wilt also hove one or two Input properties tabs.
The Inpu t-Part 1 or Input-Part 2 tabs allow you to view or conngure the module's Ha rdware
Interrupt or Diagnostic Interrupt features os well as determine input channel parameters that
a rrect the type of signals may be used a l each input.

Essential Elements
The config ura tion of analog inpu t signal parameters involves two concerns. In the Enable
Section you con activa te the module's hard ware or d iagnostic interrupt features; and in the
Input Section. you will determine the input signal charac teristics for each channel. On most
a nalog input modules o hardware interrupt con be triggered when user-defined signal limits
ore exceed ed and when all of the input channels have been read and converted (i.e.,
whenever new measured va lues are o f all inpu t channels).

Depending on the module, d iagnostic events may be activated for ind ividual channels or
channel groups and include d iagnostics such as wire break, Underflow. Overflow, or Short
Circuit lo Ground. When a d iagnostic interrupt occurs, on a channel or within a channel
group, th e module reports th e event lo the CPU (diagnostic buffer e ntry). Module-related
d iagnostic information as well os channel-specific d iagnostic events con be read from the
module using system functions (SFCs).

Application Tips
On modules that use a plug-in ronge card lo allow the various inpul signal ranges. ensure
lhal !he range cord Is inserted for the req uired channels. Also ensure Ihol the encoding
position on the module matches the letter (e.g.. A, B. C , D) d isplayed on 1he input d ialog
(below each channel) in the fields labeled Position of Measuring Range Selection Module.

l'ropt:tlU!~ - AJJblC l681l -

I
General Aditesses lnp,Js · Part 1 t~uts- PanI 21
r:- Enable- - - - - - - - - - - - - - - - - - - - - - - - - - = - i
P D~tic Interrupt P" Hardware Datin~nCPU for j1 'YU 414-1 ..:)
lr-.ern.c,t lnteirupl

Refe1ence Temperal.ure: j0.00


-
Il"ClUt

O~O!lic,
I H l ◄ l ► I HI 0
I 1
I 2
I 3
I
Wire Break r ' n r r• II r '
I
Refe1ence Channel Error. r II r r II r
Underflow- r II r r II r
Oveiflow r II r r II r
She1t Ciicuit l,Q M: r II r r II r

OK
I Cancel Help

Figure 3-9 1. S7-400 Ana log Input Module Properties; Input Poromelers-Port I.

176
Working with Hordware Configurations

iAltltI§iit¥4Jlltlid:(f 114•4i)~
I I
General Adltesse; 1n~s • Part 1 l~ut; · Pail 2 I
lrl)Ul
lH l ◄ l ► l ►1 I 0
I 1 I, 2
I 3
I
M~sll~g
Me<ffllrin!I Type, j2DMU j2DMU l4DM U j4DMU
MeoJtijing Ailnge, 14 20 rrA j4.,20 ml\ j4 .20m<\ J4..20 rrA I

Position o( M-tmg Rang!! [0 I [o I [ CI [C l


Selection Module:
linlegraticn time j20ms j2oms j2oms l20 rn,
Smoolhing jnone jnone jnone jnone I

ReferenoeJl.llCti<n I· .. I· .. I· .. I· .. ''
l
Tngger lor Herctware Interrupt
End o/ SCM Cycle
Reached al Ir,put I Ir:,! II r II r II r I
High limit I m<\ I m<\ I m<\ I m<\
low lri I mt. I m<\ I mt. I m<\

OK. I eance1 I Help I


Figure 3-92. S7-400 Ana log Input Module Properties: Input Parame ters-Port 2.

Q uic k Steps: Co nfiguring S7-400 Analog Input Signal Parame ters

ACTION
'

1 Open to the required sta tion canfiguralian. double c lick o n the analog inpul
module lo open the p roperties d ia log. then selec t the Inputs lob.

2 Aclivote the check box Diagnostic Interrupt in order to use the module' s ability to
generate interrup t on certain module-specific diagnostic events.

3 Activate the check box Hardware Interrupt when Limit Exc eeded. to allow Inputs lo
generate on interrupt when the input signal exceeds (goes above or falls below).

Activate lhe check box Hardware Interrupt at End of Scan Cycle (if feature
available) to allow the module to signal the CPU with a hardware interrup t when a ll
o f the Input channels on the module hove acquired new measured values.

5 It the "Diagnostic lnlerrupr' is enabled then for each c hannel, you may activate the
check box for Group Diagnostics and for other c hannel diagnostics you wish to
enable (e.g.. Wire Break). If a diagnostic event occurs, a diognostic interrupt is
triggered and the module-dependent d iagnostics a re stored on the module.

6 Clic k in the Measurement Type field d irectly below each channel. and from the list
or available measurement types (e.g .. voltage (E). curren t. T/C. RTD) select one for
the associated c hannel. If a channel is not connected, select ''Deactivated."

7 Clic k in the Measurement Range field directl y below ea c h chonnel, and from the list
of available measurement ranges selec t a range for the associated channel.

8 If the hardware interrupt is enabled for input signal limits exceeded, then for each
channel, click in the corresponding fields and en ter the Upper limit va lue and l ower
limit value. The module will trigger an interrupt when the input value exceeds the set
"Upper limit," or when the input sig na l falls below the set "Lower Limit."

177
STEP 7 in 7 Steps

Configuring S7-400 Analog Output Module Properties


Basic Concept
The general properties of analog output modules in the S7-400 o re viewed or edited from the
Hardware Configura tion. Basic information about the module. like port number and a brief
descriptio n. is provided on the General tab. The addresses assigned lo the module o re
provided on the A ddresses tab (Also see Configuring S7-400 Analog 1/0 Module Addressesl.
Finally, there is tt,e Outputs parameters tab, for viewing or se tting the operating parameters
of the module and individual output channels.

Essential Elements
The Short DescrlpHon, some as g iven in th e hardware ca ta log, is a gives a shortlist of features
o f the analog outpu t module such as ou tp ut signal ranges. bit resolution. and number of
ou tp ut channels. The Order Number reflects the module assigned in the configuration tool
and con be verified with port number of the physically insta lled module. The Nome field
shows the defo u!t name of the module. Changes to the module name ore reflected in the
configuration table. The Comment field o ltows more detail information about the module
[e.g., how it is used) to be documented.

You will be able to configure. the Outputs parameters tab. for viewing or selling the signal
type a nd ra nge used by each o utput channel. The c hoices for the Type of Output o re
voltage a nd c urren1;

Application Tips
The writing area on o n analog ou tput module connector limits what descriptive Information
tha t con be written for each output. Use the comment field to p rovide detailed Information
on the use or the analog output channels of o module.

l 1ropt!rtlcs - A01!1<l31!11. • (lt0/ 58)

I
Jieneral Adctesse$ Outputs I
0utpl.Cs
1 St~rt:
End: 527 I 3

OK I C.,ncet l __H_e_lP_ _,

Figure 3-93. S7-400 Ana log Output Module Properties: Addresses tab.

178
Working with Hordware Configurations

IAlflti§iit¥0J•I:ffiFl:fif 114 TJ.il6- - - - ------~-


1

aeneia1 I Ac:kiene; Outputs I

0 1
l 2
l 3
I
Output
Typaol Olllpul: II 11 IE IE
Output Range: ,4-
... 2-
□ -IM--,4 . 20 rAA ,., ., DV
==
I(+/· lOV

OK I C.,ncel H_el_P_
, ___ _,

Figure 3-94. 57-400 Analog Output Module Properties: Outpu t parameters lab.

Quick Steps: Configuring S7-400 Analog Output Module Properties

ACTION

1 With the required sta tion open in the hardwore configuralian tool, select the cenlral
or expansion rock. or DP slave to display ifs ins tolled 1/0 modules; select the analog
output module and double click to open the p roperties dialog.

2 On lhe General lob. the Short description provides o brief summary of lhe module
features (e.g .. number of outputs. digital resolution). The Order Number is the port
number of the open module in the configuration and should reflecl the analog
output module installed in the corresponding slot or the p hysical rock.

3 The default Name, which is modifiable. is based on the number of analog output
channels ond the bil resolution prelixed wilh AO for analog output.

4 Use the Comment field lo enter o d escrip tion of the module outputs or app licotion.

5 Select the Address lob to view or modify the modules starting byte address.

6 Select the Oulpuls lob lo view or modify the operating parameters for the module
and for each analog output channel. Use the Output novigotionol buttons to see
the output channels tt1o t ore no t In view.

7 Click in the Measure ment Type field below each channel, ond from the list of
available measuremen t types [e.g., voltage (E). current (I) ] selec t one for the
associated outp ut channel. If a channel is not connected . select "Deactiva ted."

8 Click in the Measurement Ra nge field below each c hannel, and from the list of
available ranges (e.g.+ 1OV. 1-5V. and 0 -1DV) selecl a range ror lhe outpul channel.

9 Con firm the configuration parameters with the OK b utton and use the toolbar Save
and Compile button to generate the Sys/em Doto object.

179
STEP 7 in 7 Steps

Configuring S7-400 Analog 1/ 0 Addresses


Basic Concept
Each analog module inserted in o n S7-400 configuratio n, depending on the number of
channels will reserve sixteen or thirty-two bytes of the peript1erol (P) memory area. Since
each analog input or output channel requires a word (two bytes) lo handle its digitized data.
an 8-channel module reserves 16-bytes and a 16-chonnel module reserves 32-byles.

Essential Elements
Default addressing for S7-400 analog 1/0 starts with byle-512 of peripheral memory, for both
inputs and oulp uls. As each successive module is Inserted. its starting byte address is based
on the next available byte address following the previous analog input module (for inputs) or
previous analog output module (for outputs). even if a slot is left empty. Like with digital
modules analog input and output modules con hove the some start bye addresses.

In the figure below, lhe S7- 400 hos 16-channel analog input modules in slo ts 4-6 and 8-
channel analog output modules in slots 7-8. Starting with byle-512, slot-4 reserves bytes 512 -
l o- 543; slol -5 reserves bytes 544 -to- 575; and slol-6 reserves bytes 576 -lo- 607. Again tram
byle-512 for outputs, slol-7 reserves byles S12 -to- 527; slol-8 reserves bytes 528 -lo- 543. Each
input address is prefixed w ith PIW (peripheral input word); each output address is prefixed
with PQW (peripheral ou tput word). The first analog input is PIW 512: the second input is PIW
514. The firs t analog ou tput is PQW 512; the second analog output is PQW 514.

Application Tips
Since peripheral memory involves d irect access to input or output modules, analog 1/0 must
be handled via lhe program. In LAD and FBD on analog input is read by specifying the input
address as the source in o move instruction; an analog output is wri11en by specifying lhe
output address os the destination of the move opera tion. In STL, a load operation reads on
analog input by specifying lhe Input address (e.g .. L PW 5 12). A value is sent to on analog
output with o transfer operation that specifies the output address (e.g.• T PW 5 12).

PIW/ PQW PIW/ PQW PIW/ PQW PIW/ PQW PIW/ PQW

PIW514 PIW546 PIW57-8


PIW516 PIWS48 PIW.580 PQW514 PQW530
PIW5 18 PIWSSO PIW582
PIW520 PIW552 PIW584 PQW516 PQW532
PIW522 PIWS54 PIW586
PIW524 PIWSS6 PIW588 PQW518 PQWS34
PlWS26 PIW558 PIW590
PIW528 PIW560 PIW592 PQW520 PQW536
PIW530 PIWS62 PIWS94
PIW532 PIW564 PIWS96 PQWS22 PQWS38
PIW53.4 PIWS66 PIW598
P1W536 PIW568 PIW600 PQW524 PQW540
PIW538 PIW570 PIW602
PIW540 PIWS72 PIW604 PQW526 PQWS42
PIWS42 PIW574 PIW606
Figure 3-95. S7-400 default analog addressing. starts ot byte-512 for inputs and outputs.

180
Working with Hordware Configurations

Quick Steps: Configuring S7-400 Analog 1/ 0 Addresses

ACTION

1 From lhe SIMATIC Monoger, open the required projecl and select the S?-400 Station
for which a ddressing is required.

2 With lhe station selecled, in lhe righl pone o f the slation window double click on the
Hardware object to open the sta tion in the Hardware configuration tool.

3 Select o rock whose modules you w ish lo view the installed analog 1/0 modules or
insert new analog 1/0 modules.

View the starting byte address of each input mo dule in the I-Address column or
each outpul module In the Q-Address column.

5 To modify !he slarling byle address of o module. select lhe module. right-click and
select Object Properties , then select the Address lab.

6 To modify o starting byle address, first de-oclivote lhe System Selection check box
to disable automatic address determination b y the system.

7 Enler a new start byte-address and confirm by pressing OK. In the S7-400 analog
inpul ond onolog outpu t modules may hove the some starting byle addresses (e.g ..
PIW S12, PQW S12). Analog 1/0 start by1e addresses. a fter byte-5 12, mus1 be at 16-
byle boundaries.

8 The Process Image field hos no meaning with analog modules and is grayed.

~~ (OI UA2

PS 40710!\ 6E S7 407-0KAO

AJ 16•1 3B~ 6ES 7~31-0HH 512. .543


AJlSxl GB~ 6ES 7431-?QH 544... 575 16-chftn ard: 32,b • • retorved card
6 AJ16x16Bl 6ES7 ◄31 •70H 576... 607 16-channetl reaerved card
7 A08l<13Bit 6ES7 ◄:l2·1HFO 512... 527 8-dwlnelO e:s r&el'/ed ciwd.
8 A08"138t 6ES7 432· 1HfO 521L.543 8-elw!,,nelO e; ,eseNed ciwd.
9 IM460-0 SES7 460-0AAO 16380

Figure 3-96. Default analog addressing in S7-400. Nole, lhol 16-channel module res erves 32-
bytes and 8-channel modules reserves 16-byles. Also note, under the I-address and Q-
address columns. that analog inpuls and oulputs in the S7-400 may use lhe some addresses.

181
STEP 7 in 7 Steps

Configuring 1/ 0 Modules for Multi-Computing Operation


Basic Concept
All function modules (FMs), d igita l a nd analog signa l modules (SMs). and communicatio ns
proc essors /CPs) in a multi-computing configura tio n mus! be a ssigned to a specific CPU (i.e.,
CPU 1, CPU2, CPU3, o r CPU4) in the configuration. A mod ule is assigned loo CPU by selecting
the module and opening its object properties.

Application Tips
A module is assigned to a particula r CPU by selecling the module and opening its objec t
properties. Modules ha ving interrup t capability will a utomatically indicale. under its o bjecl
properties, the CPU to which it is assig ned.

IAl·l•I§Utl§,Jlld:t4it4•t-rihi•tfi -......________
Ger,eral Addrll'$$e; I

JOO r Proe1m Image Priion

1 No.. I d3

2 CPU 416-1(21 3
3 CPU 416·1(3) 4
4 CPtJ 416-1(4) 5

01<
I CNocel I Help I
Figure 3-97. S7-400 1/0 Module Ad d resses dialog in multiple CPU configura tion.
Each module must be assig ned lo o specific CPU.

182
Working with Hordware Configurations

14irfrt§lit4§'11UffiDfJ@ijjJHh1i431411ttifblll 29
Genet.al I Add1~e$ lnpo.As I

f Enable
C Oiag-iostic lnteirupt r Hardware lntetrupt Oe&tinaticnCPIJ
I~. ere 416-1121 3
forlntem..,t
-

Ir-wt
Diaglom
II◄ I◄ I► I►II 0
I 1
I 2
I 3
I
\r{1e Break r I r r II 17
I-loLo.,d Vol~e L+: r I r r 11 r
Trigger for Hllldw111e lntesrupl
Rising (Posijve) Edge; r r r r
~ aliig (Negative) Edge: r r r r
-
I 1npulD8.W (m:~ j3 (DC) j3 tOCl I• nci j3IOC}
::.
-
I Reaction to En01: jsv
Subsblu!e "1 '~
I C1 II r II G II C1 I
I, OK I Caicel I
Figure 3-98. S7-400 Interrupt Input Module Properties: Input poromelers lob.
showing the Des lino lion CPU for interrupt genera led by lhis cord.

Quick Steps: Configuring 1/ 0 Modules for Multi-Computing Operation

ACTION

1 Slort the SIMATIC Manager and open lhe projecl with the mulli-compuling station.

2 Open lhe Hardware Configuration tool to display the multi-computing station and 1/0
rocks and modules.

3 Select and double- click on a module and select its Address lob.

4 From the CPU Assignment window, displaying the multi-computing CPUs. selec t the
CPU No. the module will be associated with.

5 Repeat the assignment process ror all digital/analog signal modules (SMs), !unction
modules (FMsl, and communications processors (CPs) in both th e CPU rock a nd all
local a nd remote expansion rocks.

183
Working with STEP 7
Programs and Data
STEP 7 in 7 Steps

Introduction to STEP 7 Programming Principles


The STEP 7 programming e nvironment supports the structuring of the control tasks ol a
machine or process and i1s corresponding control code into functional units. In such on
app roach. lhe system ls bro ken down in to log ical or functional units and ii necessary, ea c h
unit furl her broken down into subunits. Once broken down into units that renect the major
con trol tasks, the STEP 7 programming resources supp ort develo pment of the control code in
m odular sectio ns called bfocl<s. You may coll these blocks to be processed os needed.

There o re many a dva ntages to creating your code in modular blocks. Each block Is a
worldng unit tha t m ay b e called repe titively as need ed. and may be stored in o libra ry for
la ter use. Since each block performs a specific function, the program is simplified, ond e a c h
b lock may be tested individually. Code blocks may be copied a nd duplicated or slightly
m odified for reuse for the same or a similar function. Finally, each b lock may be called in ll1e
program for processing on a condilional or on unconditional b asis.

Program Design Strategy


The program design strategy is largely concerned with the struc ture o f the STEP 7 program.
While the tra ditlonol lineor approach lo PLC programming is possible, o slruc lured desig n,
using modular blocks of code to perform d ifferenl task. is the bas-is of the STEP 7 progra mming
a rc hitecture. In either c a se, th e design strategy is best developed in two steps. The first step
Involves partitioning ~he machine or process in lo logical units or segm ents, and each unit into
subunits a nd o p erations. The second sta ge is to d evelop the co ntral logic of the individual
tasks and operations of each process unit. The stand ard STEP 7 package airers lhree
languages which you m ay use sep ara tely or combined to develop your c o de b locks.

Defining Machine or Process Units


Any machine or process con be pa rlilio ned into its logical units. These units, which reflect the
m ain subsyste ms. each perfo rms o functiona l port o f the whole system. By dividing the system
into units. members of o develo p ment team will quickly g rasp what hos to be co ntrolled. Well
planned pa rtitioning no t o nly facilita les group deve lopmen l. b ul a lso allows for easier
a daptation of the p rogram for reuse, and for future ex1ensio ns. Defining units is o first step in
d eveloping o program 1ha t is handled by STEP 7 code blocks.

._________w_a__ren_o_v _re_c_ on_v_ey_<>r_ c_o_n_tr_ol_Sy


_ st_e_m_ _ _ _ _ _ __,~

I
fV'lain Carrovsel Sorter Sh rink Wrcp Operator
Conveyor Control Con trol Control Pcnel

Figure 4-1. Typical d ivision of machine/process into m ajor functional or technological units.

Defining Subtasks and Operations


Machine or process units generally rellec t the major systems involved in p roducing a fi nished
product. Therefore. each con usually be further d ivided into functional tasks. which must be
accomplished lo com plete the unit func tio n. Each task will norm ally c onsist of several
operatio ns. which require conlrol of individual devices. process loops, or o lher process
elemen ts tor whic h c on trol logic must be d eveloped. This co ncept. illustrated in the following
diagram. is one method of conveying the major procedures, subtasks. and operations for
whic h a program must be developed . Non-hardware tasks suc h as communications, alarm
pro cessing. production a c counting, and prop rietary algorithm s must also b e consid ered.

186
Working Wilh STEP 7 Programs and Doto

Developing the Control Logic


The second stage o f the program design strategy deats with developing control logic for the
tasks of each process unit. In other words. the definition or how specific operations (e.g..
devices, process loops, etc.) will be implemented. A g iven subtasks, for instance, may require
control of several d igital and analog octuotors. Completion of fhe task may also require
data processing. error checking. and perhaps communicolions functions. One-by-o ne. lhe
control logic for each of these operations must be defined and then developed.

Mo ohine/Prooe ss units unit subtasks oevioes or l.OOPS


'
Mo.in ~
Su:>losk 1 - Device or IDop 1
r-----.-.__ ' r----.. Dev ioe or IDop n
~
I\Aain
Program C◊nveyor

Slbtask (n) .._____- Device or IDop 1
011 1 Devioe or IDop n

- " Device or IDop 1


Carrovsel --....... Su:>losk 1 K: Device or IDOP n
~- Control - Swtask (n) i....._- Device
OE,vloe or Loop 1
--........ or LOop n
,::- - Swtosl: 1 Devk:e or LOop 1
Sort~ r---....__
Device or IDoo n
Control
Sl.btaslc (n) oevice or IDop 1
"-..... Device or LOop n
- "'
- Sl.bloslc 1 ~- Device or LOop 1

~
Shrink ---......
--
Oevioe or LOOP n
Wrq::per
Sl.btaslc (I'\) ....___ Device or LOop 1
Devioe or LOop n

-• Opefqtor
Sl.blasl: 1 o evice or LOop 1

~
Device or Loop n
PO"lel
Slbtask (n) Device or Loop 1
'--. Devic e or IDOP n

~~
--- OtherUnrt
Sl.blosk 1
.. ---- - Device or Loop 1
Device or LOOP n

....__ Sibtask (n)

Figure 4-2. Illustration of p rogram design based on d ivision of control task into major
--~ Devk:e or LOop 1
Device or LOop n

lunclional or technological units. unit subtasks, a nd finally into device or loop operations.

Modular Functlonal tty with Blocks


As you p robably see by now, developing a STEP 7 program is abou t writing modular blocks of
code, each of which perform o specific function in the overall control task. This concept,
involves a program composed o f a collection of procedures. In STEP 7, a procedure would
be called a block. Each block might correspond lo a subtask as shown In Figure 4-2. Here.
the various tasks of each machine or p rocess unit o re d ivided into blocks, eoch of which
would contain the con trol logic for the devices or opera tions tho I complete the subtask.
Several blocks may be required to perform the subtasks tha1 complete the unit control.

As you develop th e program, you may subdivide ii into as many sections or blocks as you
like. To the degree tha t it is possib le , each block sho uld be self-conta ined and relatively
independent of other blocks. Wrth this approach, the block con be easily tested and
debugged, and later problems con be pinpoin ted too block based on the func tion.

187
STEP 7 in 7 Steps

STEP 7 Block Types


The STEP 7 programming environment provides three categories of blocks from which the
user program may be developed. User-blocks ore S7 resources that you ore able lo create
and insert p rograms and data: System blocks. ore blocks integrated as port of the S7 PLC
operating system. yet moy be called from the user p rogram. Stondord Blocks ore off-the-shelf
blocks that you may also incorporate in your program. Standard b locks support applications
such os PIO conlrol and communications drivers. Several groups of standard b locks ore
supplied as libraries with STEP 7, while others may be purchased separately.

While all of the resource listed below may be used in your programs, the actual number of
blocks that may be programmed (e.g.. FBs, FCs, DBsl. or that ore available (e.g., OBs, SFCs
and SFBs), is CPU-dependent. The size I hot o block con be (i.e., length in bytes) Is also
dependent on lhe CPU. You may view the performance characteristics for a CPU, from the
online window o f lhe SIMATIC Manager. ofler selecting the CPU lhen from lhe menu
selecting PLC ► Module Information.

Tobie 4-1. STEP 7 Block Resources Overview.


llockType ldertlller lange . Category ,' Comment
System Blocks SFB/SFC/SDB - System Pre-Numbered
Organization Blocks OB OB 110 OB n User Pre-Numbered
Function Blocks FB FB 1 to FC n User User Numbered
Functions FC FC l to FC n User User Numbered
Doto Blocks DB DB 1 to DB n User User Numbered
- - - -

System Blocks (SFB, SFC, SOB)


System b locks includes system functions (SFCs) and system function b locks (SFBs). both o f
whic h ore Integrated as port of the S7 CPU. These conned routines may be called in the user
program. Since system blocks ore conned functions, they hove pre-defined b lock numbers
and the code cannot be modified. System blocks handle many commonly required tasks
tho! help reduce the overall development time. Numerous system blocks ore available tho !
allow !he user program to access servic es o f the CPU (e.g.. enable and d isable interrupts.
set/read real-time c lock) and perform services !hot include control. message-handling, and
communications functions. A listing of SFCs and SFBs is provided in the appendix.

Finally, system blocks include system doto b locks (SDBs), which contain doto used by lhe
PLC. SDBs contain the compiled configuration data generated by the hardware and
network configura tion tools, as well as function module configuration tools. Ultima tely, the
SDBs ore downloaded to the CPU and lo the associated modules (e.g., CPs, FMs, e tc .).

Organization Blocks (OB)


Organization blocks (OBs) ore one of three b lock types in which you may write ports of your
STEP 7 code. The purpose of OBs is to p rovide o structured and simp lilied means for handling
the various processing requirements o f a to tal STEP 7 program. Organization blocks ore
important because they provide on interfac e between lhe S7 operating system and the user
program - this is true since organization blocks ore written by the user as porl of the control
program. but all OBs are called by the S7 operating sys tem based on certain events or
conditions. For example. on each start-up of the C PU. depending on the type of start-up
either OB 100 or OB 101 (programmed with your start-up code) wm be called and processed.

188
Working With STEP 7 Programs and Doto

Just os OB 100 ond OB 10 1 ore assigned too specific lype or slor1up. each OB ho.so specific
processing task, based on system-related event. When tho! specific cond ilion or event
occurs. the S7 operaling system responds by colling the associated OB to be processed. lhe
oc tuol response. however. is based on the code tho l you will hove wri llen in the O B. By
implementing code in !he various organization b locks, you determine what code ls
processed o f startup, duri ng the normal cycle, in lhe event of timed or hardware in terrupts.
and syslem-rela ted errors. An overview of organiza tion b locks according lo lhelr processing
function ond the events or conditions lhot trigger their calllng is shown in the loltowing table.

Ta ble 4-2 . 0 verv,ew o f 57 0 raan1za r,on Blocksond lheir. ossoc1a e noaenna even I.
OIType OB No. Cal Event and Appllcalfon Description
Normal Cyclical Called ofter each CPU slort-up ond therea fter, cyclically. to process
1
Processlng Iha moin user progron1.

Time-of-Doy Called of user-conlfgured llme-ol-doy interrupt, to process user


10-17
Interrupts code that must be processed ot o specific dole one, time.

lime-Deloy Called ofter user-defined delay expires, to handle porlions of the


20-23
Interrupts program tho! must be processed ofter the lime delay expires.

Coiled cyclically ot defined in tervals (e.g., 500 ms). to handle code


cyclic lnlerrupts 30-38 (e.g., PIO loopsj tho I musl be processed ot precise inlervol~.

Hardware Called when ony or the assigned process or module-generated


40-47
Interrupts interrupts occurs. to process the user-programmed service routine .

Called on on inteJTUpt generated l)y ony of the CPUs In Q multiple


Mul1l-Computing
60 CPU configura tion. lo process o user-defined synchronized
tnlerrupl
response.

Redundancy Error Called upon occurrence of o redundancy errOf in on S7-400 H-


-
70-73
Interrupts system, to process the user-programmed response.

ASynctvonous Coiled ot occurrence of o syslem-reloted error (e.g., power rupply


80-a7
Error interrupts loull, or module failure), to process user-denned se,vice toutlne.

Background Called lo process non-critical code, when the octuol cycle time of
90
Processing lhe current cycle is less than the user-defined minimum cycle.

CPU Startups
- Called of each CPU start-up and pnor to colling OB I, lo process
100-101
Processing fnlliolizotlon code thol must be execuled once ot each startup.

Synchronous Called o t occurrences of progrom-reloled runtime errors, lo process


12 1- 122
Error lnleirupls the user-programmed serVice routine ror synchronous errors.
~
- -
Note: See Programming Orgonizof/on Block I . for guidelines on wri ling the code for 08 I.

189
STEP 7 in 7 Steps

Function Blocks (FB)


A Function Block (FB) is one ol lhree block types (OB. FC. ond FB) in which you may write
code. FBs ore intended for creating logic routines or algorithms where data that is either
genera ted by or required by the block must be ovoiloble from one coll of the block lo the
next. To handle this memory requirement. you must assign a data block /DB) to each FB. The
DB is opened lor read/write access on each Instance the FB is called. a nd is therefore called
on instance DB. An FB con actually hove several assigned instance DBs. allowing it to work
with different se ts of data. Each coll of on FB/DB is referred to as on "instance." As seen in
the templa te for p rogramming a nd FB. like other blocks it con tains a variable declaration
section (lop pone of window). for declaring variables; and a code section (bottom pone of
window). for writing the program.

In on FB you may define temporary /TEMP} local variables. for those values that ore only
required by the FB w hile the b lock is processing; you may d efine static {STAT) variables, for
those values that must be saved and ovoiloble from one coll o f the FB to the next (I.e..
memory). You may also define formal parameters. a special type of variable. which allows
you lo develop on FB os o b la ck box function. When specifying formal parameters. you may
define IN. OUT. or IN_OUT variables. IN variables are inp uts to the function. read into the FB;
OUT variables ore outpu ts from the FB. written to by the FB; on tN_OUT variable is both read
from and written to by the FB. Formal parameter variables to an FB act as substitute address
holders. Each time you coll the FB as o function in you p rogram. you will supply a different se t
o f actual addresses (actual parameters) in p lace o f lhe form al parameters.

,,,,---,----- !Contents Of: 'Enwonmert\lnrerface\IN' -


Interface Name Address Data Type lnllial Value Comment
- 0-flD 'O
~o our
,·-0 IN_OLJT
- -'(a- STAT
"-& TEMP

FBlOO : Title:
~t;.;,~k-~:
. , ,. ... -~--. .,~l
T it.l e :

Figure 4-3. The LAD editor open lo the template for programming o function block (FB).

Calling a Function Block


An FB con be coned from any o ther block (e.g., OB. FB. or FC ) in LAD. FBD, or in STL. If the FB is
written without formal parameters. then In LAD/FBD you may drag the FB from the F8 Blocks
folder o f the Program Elements and drop it into the current network. You must then specify
the rela ted instance DB just above the FB. You may coll the FB with or without preceding
logic conditions. If the FB hos formal parame ters. the some procedure is used bu t the address
of each ac tual parameter must be supplied os required by each fonmol parameter.

In STL. on FB wilnoul form al parameters is called using the CALL instruction. to specify the FB
number and the instance DB number (e.g ., CALL FB t 00. DB 100). If the FB hos formal
parameters. each parame ter is listed on a separale line beneath the CALL line. allowing you
to specify on address for each ac tual parameter.

190
Working With STEP 7 Programs a nd Doto

Functions (FC)
A Function (FC) is one of three user block types (08, FB, and FC) in which you may write port
of your program. Unlike the FB, the FC does no1 require on assigned da ta block (DB) as
memory, However, o n FC con access o global data block Fo r reading or wri ting doto tha t
other blocks may access. FCs ore suitable for simple logic to complex digital opera tions, ond
In many S7 applications, will account for os much as seventy to eigh ty percen t o f the to ta l
program. As seen in the template fo r p rogramming ond FC, like o th er blocks ii contains o
variable declaration section (lop pane of block window), for declaring block variables: o nd
a code section (bottom pone of b lock window), for writing the program.

In an FC, you may define temporary (TEMP) variables, for those values that are only required
by the FC and ore only available white the FC is processing. Each FC also allows you lo
define a RETURN variable tha t is re tu rned to the colling block. You may also define formal
parameters, a special type of variable tha t a llow s you to develop an FC as a b lock box
function - similar too box instruc tio n. When specifying format parame ters. you may define
IN, OUT, or IN_OUT variables. IN variables o re inputs to the function and are read into the FC;
OUT va riables are outputs from the FC or w ritten lo by the FC; an IN_OUT variable is b oth read
from and written to by the FC. Format parameter va riables to a n FC act as substitute address
ho lders. Each lime you c o ll the FC as a func tion in you p rogram, you w ill supply a d ifferent
set of actual addresses (actua l parameters) in place of 1he formal parameters.

- f□l ~
,Contents Of: 'Envitl:ltlrnent\l~foce~•
,.,....--,-----
Int etface Name Data Type Comment
0-11. 0
,...o, our
!
IB -0 IN_OUT
1!1 ~ TEMP
f!l··ORETURN

Ftl : Title:

,.~t;.;,~k
.......... ~·-il: Titl e :
.,

Figure 4-4. The LAD editor open lo the template for programming a function (FC).

Calling a Function
An FC con be called from a ny other block (e.g., OB, FB, FCI in LA D, FBD, o r in STL. If the FC is
written without formal parameters, lhen in LAD/FBD you may coll !he FC using the CALL coil
or o utp ut resp ectively; you must specify lhe FC number above the coil or output. You may
also drag the function from the FC Blocks folder of the Program Elements and d rop ii inlo lhe
c urre nt network. You may call !he FC with o r withou t preceding logic cond itions, If the FC hos
forma l parameters, the CALL coil o r output canno t b e used. Instead, you must take the FC
box from the Program Elements browser a nd place ii onto lhe nelworl<. where you must
sp ecify the address of each a c tual parameter as required by each formal parameter.

In STL. an FC w ithout formal poromelers is called using the CALL instruclion lo specify !he FC
number (e.g .. CALL FC 1). If the FC hos formal parameters, each is lisled on o separate line
be nea th !he CALL line, allowing you lo specify on actual parameter (address) for each.

19 1
STEP 7 in 7 Steps

Data Blocks {DB)


Doto Blocks {DBs) ore lhe equivalent to the Doto Table found in some PLCs. In STEP 7. the DB
is o resource for organizing and storing the various constant and variable data required in
your p rogram. Typical conslants mighl Include presets ror onolog high ond low limits. for PIO
loops; or recipe data values in a batch process. Variables might include analog input and
oulput dato. or perhaps various p roduction totals.
DBs may be organized to your requirements and may contain variables of the some or of
different data types. You also determine the name and order or each variable. and the lotol
number of variables in each DB. Whe<eos intermediate results might be stored in Bit Memory
(Ml or in temporary local memory (l) o f the block (i.e., 08. FC. FB). dolo blocks ore used to
store data stored that needs to be retained always.

l'ii 0810 -- NewJ)rj\ SJMATIC 300(1)\ CPU 316 1!!1~£1


Initial Cui■ient

o.o
+o .o TI1J' PRESET l IlIT 350 Tezperature Pre5et Zonel
+2.0 TI!P PRESET 2 IrIT Temperature Pre5et Zone2
- - 315
+4. 0 TI1J' PRESET 3 IlIT 400 Temperature Pre5et Zone3
-
+6 .0 OVR_LHT_Tl BOOL FALSE ZONE l OVER Limit
+6. 1 OVR Liff T2 BOO L FALSE ZONE 2 OVER Limit
- -
+6.2 OVR_Llff_T3 BOOL FALSE ZONE 3 OVER Limit
END STRUC1

Figure 4-5 . Each data block may be defined according to your data requirements.

There ore two doto block types in STEP 7. The DB type, is defined when lhe data block is
created, and is based on haw the 08 will be used in conjunction with logic b lacks. Shored
DBs (also called global DBs) ore used to store dolo tha t may be reod from or wril ten to by
any block within the complete program. An instance DB, on the other hand, is o data b lock
assigned too specific Function Block a s required memory. The FB hos read/write access lo
lhe instance DB and stores both ils declared stalic (STAT) variables and formal parameter
variables in the DB. When an instance DB is created, it must be explicitly assigned to on FB.

FC 10 (
R/W ,. Shaed DB
OB I
DP, 20

RJVll
FC20 - -

R/W .
fnstonce DB

R/W DB 100
FB 10 (

Figure 4-6. Illustration of Access to Instance and Shared [Global) Doto Blocks.

192
Working With STEP 7 Programs and Doto

Accessing Data Elements in Data Blocks


As data is entered into a data b lock, each elem ent is stored in the o rder it is entered, starting
from data byte zero. Doto elements moy use ony valid dol o type (e.g .. BOOL. INl. DINT.
REAL CHAR, and S5TIME). As each element is en tered, on area is reserved that corresponds
to lhe assigned data type. The start byte address of each element is shown in the 'Address'
column of the data block (See Fig. 4-5). Whether a data e lement uses obit, byte, word, or
double word. the start byte is reflec led ln the absolute address of each element.

Before accessing o DB variable. you must open the doto block Firs!, using the appropriate
instruc tion to rererence lhe DB number (e.g.. OPN DB n). Once o doto block is open. any
variable may be accessed. using the correct identifier and address (e.g .. DBW4, Tobie 4-3).
Each S7 CPU hos lwo regislers lhol ii can use lo open a DB. These registers. which the CPU
uses to hold the number of the current DB. ore called the DB-<egisler a nd the DI-register.
Although both g lobal a nd instance DBs may be opened in either register. it is preferable that
global DBs ore opened with the DB-register and instance DBs with the DI-register.

Tobie 4-3. Partial Addresses used lo access Shored DB or Instance DB voriobtes.


Area Identifier Access Units Example Description of Example
DBX =Bit DBX4.4 Bil .4 or Byte 4 of Shored DB (nJ

Doto Block DB DBB =Byte DBB4 Byte 4 o f Shored DB fn)


(OPNDBn)
DBW =Word OBW4 Word 4 of Shored DB (nJ

DBD =Double DBD4 Double ,vord 4 or Shored DB {n)


word

DIX = Bil Dl>02.4 Bil .d of Byte 12 of Instance DB {nl

D18 =By te DtB12 Byte 12 or Instance DB (n)

Doto Block DI DIW =Word DIW12 Word 12 0 1Instance DB {n)


(OPNOI n)
DID = Double word DtD12 Double ,vord 12 o f tnsfonce DB (n)
Note: Data elements are accessed with partial addresses, using the DB or DI identifier,
depending on whic h data block register (i.e., DB or DI) is used to open the data block.

While the CPU uses the DB and DI registers identically, some restrictions and guidelines help lo
minimize potential errors. In LAD/FBD, for example , you con only affect lhe DB register when
you use the OPN coil or OPN output. Therefore. in LAD/FBD you may open a global data
block. Any data element can then be accessed in the following networks until a new DB is
opened. In LAD/FBD. the instance DB associated with on FB is, by design. opened with lhe Dl-
regisler whenever the FB is coiled. In STL. the open instruc tion is simply 'OPN DB n' (e.g., OPN
DB 22). or OPN DI n (e.g., OPN DI 23). As shown in Tobie 4-3, a dolo word is addressed DBW if
you used OPN DB a nd is addressed DtW if you used OPN DI.

Other methods for addressing the elements of a DB include fully addressed access, and
symbolic addressing. Fully addressed access, only possible in LAD and FBD. does not require
opening lhe DB. The DB is specified os port of the address (e.g.. DB 10.DBW 4). Similar to full
addressing. the symbolic address of each data loca tion is derived by combining the
assigned symbolic name or a dolo block w ith the assigned name o r each e lement in the
d ata block (e.g., Zone_l.TMP_PRESET_3). In this case, the DB name is Zone_ l a nd the variable
is TMP_PRESET_3 (See Figure 4 -5).

193
STEP 7 in 7 Steps

S7 Program Processing
An essential step in STEP 7 p rogramming, is deciding how each block is called for processing.
This step involves defining what should trigger the coll of o block, a nd how often lhe block
needs processing. Before any block con be processed. it must be downloaded lo the CPU
and called from somewhere within the program. How orten a block needs processing and
what triggers its coll is generally based on the function the block performs. In any case, the
processing needs of your program con be efficiently handled by the OBs listed In Tobie 4· 4.
As you define how lhe blocks of your p rogram will be processed. you will need to consider
using OBs. Consider colling blocks that initialize va lues at each startup, from the slarl-up OBs.
Coll blocks that need processing at fixed Intervals (e.g.. every 500 ms), from o c yclic OB (e.g.,
OB 30) . Blocks tha t act as service rou tines, responding to p rocess or module-generated
interrupts, ore called from on interrupt OB (e.g ., OB40/. Blocks that need continuous
processing. ore coiled fro m OB 1 [main program).

The Normal CPU Cycle


Normal cyclical processing o r o STEP 7 program Is handled by OB 1. Arter power is applied
and the CPU is switched to RUN, OB 1 is called and is processed on ea c h CPU cyc le, until the
CPU is slopped or power is removed. Since OB 1 Is p rocess continuously, most o th er b locks
(i.e., FBs, FCs. SFCs, and SFBs) of your p rogram will be coiled either d irectly or ind irecHy from
OB 1. This is true since most blocks of the p rogram will need evaluating on ea ch cycle. During
the normal cycle, OB I is processed from the first network until the los t. If calls a re made from
OB 1 lo other b locks, as each block completes its execution. control is p assed bock to O B 1.

Interrupting the Norma l CPU Cycle


With the exceptio n o f the start-up cycle and background processing, all other processing
tasks must interrupt the normal cyc le of OB 1 to be processed. Start-up OBs a re called just
prior to the normal cycle , and background processing sho res the normal cycle. Whe n o ther
events such as those that trigger hardware interrupts, limed interru pts. synchronous or
asynchronous errors occur. lhe operating sys tem responds by inlerrupting OB t and colling
the appropriate OB, When the interrup ting OB is d one, control is returned to OB 1.

Tobie 4-4. Overview o f S7 Oraonization Block Prioritv Classes.


OIType OINo. Default Priority Alternate Prlottlles
'

Cycllcol Processing fMoin Prog,omJ 1 I 23 None


10, 1I, 12, 13, 14, 2 2-lo-24
l1me-of-Ooy Interrupts 15. 16, 17
Time-Deloy Interrupts 20, 21 , 22, 23
I 3,4, S.6 2-to- 24
30, 31 , 32, 33, 34. 7,8.9, 10.1 1, 2-lo-24
Cyclic IPeriodic) Interrupts 35.36.37,38 12, 13, 14, IS
Hardware Interrupts 40, 41. 42, 43, 16. 17, 18, 19. 2-to- 24
44, 45, 46,47 20, 21, 22. 23
MuJll•Compuling lnlem.,pt 60 25 None
'
Redundonc y Error lnlenvpls 70, 71, 72. 73
80, 81 , 82, 83, 26 24 -to- 26
Asynchronous &toi lnlertvpts 84, BS. 86. 87 /28 duting slorlup)
'
Background Processing 90 .29 None
CPU Start-up Roufine 100, 10,1. 102 27 None
Synchronous Error Interrupts 1 121, 122
I .

194
Working With STEP 7 Programs a nd Doto

The CPU uses o p riority schem e to manage how o th er OBs may interrup t OB 1. as well as o ne
ano ther. With priority classes from 1- 28, priority 28 is the highest. If an OB is called while one o f
lower priority (e.g .. OB 1) is being proc essed, the lower priority is interrupted. After the
interrup ting OB is done. the interrup led OB con tinues at lhe point immediately following the
po int o f interruptio n. OBs that ore assig ned the sa me prio rity (e.g., OB 10-0B 17, priority 2) are
processed in sequenc e , should they be triggered simultaneously. OB 90 hos o priority of 29.
a lthough ii is interpre ted o s 0.29. ma king it the lowest p riorily. In g e nera l. priorities o re tixed in
the S7-300: however. in the CPU 318 and in S7-400 C PUs. certa in OB priorities may be a ltered.

r··············-···· ---- --- -------------··••••


I
S7 Operomg STEP 7 User frogra111
System
'
I
I
I
Orgorizotioo Block
I

Detec t I
Start Lp
Power Up '
I
I
Progrom
'
I
I

' 01uuni!ulion mock


, ~ '
I
••
Coll Moir, I
Moin FC 10 F& 42
'
Cycle

" "'
I
I
Program
'
'
I
I OB I FC 20

"
:I
I
I
Orqorilofioo Block
I
I
.
lrotenvp t ln tenvpted Pro c ess lntell\,f.>t
Detected
- SeNk:e Rovtine
'
I
I
-
I
I
I

FC30
:I

Error/ f'Ov lt .
I
I
I
I
l
lntenvpted
" ,
Orgori10Jion lllock

Pr◊<::e$s rovn
Detec ted '
I
SeNice R◊Vtir,e
I '
I

'
I
I
I

~
'II FC -40
I

'
I
I
I
I

~
I
FC SO F& 43
Process
PII/ PIQ
I
I

'
I
I
I
blo ck End
"-
T I
I
I

'
'
~--~·~ ------ --- ------- - --- ----- -- - --- -----···--J
I

Figure 4-7. Illustration of S7 Program Processing; and Organiza tion Blocks as the Interface
between the S7 Operoiing System a nd th e User Program.

195
STEP 7 in 7 Steps

Addressing S7 Memory Areas


S7 controllers. like other PLCs, contain memory areas that you may access in the user
program. In the S7-300 and S7-400. these areos include input image (I). output image (OJ. bi/
memory (M) , peripheral input {Pl}. peripheral outpu ts (PO), loco/ (L), limer /T). ond counter (C)
memory areas. In the rollov,ing discussions we will look at how lhe locations in each or these
areas may be addressed using the absolute address. The addresses of each of these areas
may also be assigned a unique symbolic address using the STEP 7 Symbol Editor.
Each memory area is organized in byles. starling from byte-0. S7 memory areas. allow access
to obit, byte (8-bits), word ( 16-bils), or a double word (32-bils). Referencing o word address
accesses byte-n and n+ I- a double word accesses by te-n. byte n+ 1, by1e n+2. and byte
n+3. Each absolute address. is prefixed by a unique identifier (e.g.. I. Q, M. Pl, PQ. L. T. and C)
based on the area. A bit address is always referenced w ith the identifier followed by the byte
and bil number separoted by a period (e.g .. I 33.5/. A memory identifier is followed by a 'B' ,
'W'. or 'D' to identify the location as o byte, word. or double word. All S7 memory areas.
except for the local memory area may be referenced in any b lock.

Input Memory (I)


The process image of inputs {Prt), in S7 PLCs corresponds to the input image fable in other
PLCs. Prior to each program cycle the CPU reads the status of digital inputs and stores the
results in the PII. The input circuits of each module ore mopped to the PII based on the
starling by1e address that was assigned to the module during hardware configuration. Input
addresses ore accessed in the program via the address area ror inputs. using the identifier
lefler 'I'.
An input bit is addressed I byfe.blt. a byte is addressed 18 n. a word is addressed IW n. and o
double word as ID n (e.g .. 19.7. 1B 8. IW 8. or ID 8). See the peripheral memory area to learn
how to obtain the instantaneous sto lus or digital inpuls.

ID 8 Input lyfe-8 (111) Input lyte-9 (119) Input lyfe-10 (1110) Input lyle-11 (1111)

Bit Positions 7 0 0 7 0 7 0

Figure 4-8. Illustration of input double word-8. Bit address t 9.7 is highlighted. On a 32-point
rnodule. with start address of input byte-8. byte-8 is the first group of eight inpul circuits.

Output Memory (Q)


The process image of outputs {PIO) . in S7 PLCs corresponds to the output image in other
PLCs. During each CPU cycle. lhe program determines the status of each ou tput and stores ii
in the PIQ. Al the end of each cycle, the CPU transfers the PIQ to the modules to reflect the
program results. The output circuits of each module ore mapped to the PIQ based on the
~orling byte address assigned to the module during hardware configuration. Ou tput
a ddresses ore accessed In the program via the address area for outputs. using the identifier
letter 'Q '.

An output bit is addressed Q byte.bit, a byte is addressed QB n, a word ls addressed QW n,


and a double word as QD n (e.g ., Q 5.7. QB 5, QW 4, or QD 4). See peripheral memory to learn
how digital outputs ore written to immediately.

QW4 Output lyte-4 (QI 4) output lyte-5 (QI 5)

Bit Positions 7 r 6 5 4 3 2 0 7 6 5 4 3 0
Figure 4-9. Illustration o f ou tput word-4. Bit address Q 5.2 is highlighted. On a 16-point
module, with start address of byte-4. by1e-4 is the second group of eight output circuits.

196
Working With STEP 7 Programs a nd Doto

Bit Memory (M)


The bit memory area is the equivalent of internal storage b its in o ther PLCs. Bit memory is
typically used when a bit, byte, word, or double word location is needed for on intermediate
binary or digital opera tion. For example. for internal outputs that holds the b it status of
internal logic o perations, or the interlocking of logic circuits. Intermediate data results in
arithmetic or o ther data opera tions might also use bit memory. Bit memory is typically used if
the result does not need permanent storage. but is required througho ut the en tire program.

Bil memory addresses o re accessed in the program using the identifier letter ; M'. A bit
loca tion is addressed M byte.bit. a byte is addressed MB n, o word is addressed MW n. and o
d ouble word as MD n (e.g., M 101.2, MB 100. MW 100. MD 100). When configuring the CPU
parameters, contiguous areas of bit memory con be defined as retentive. Otherwise, the
con tents o r bit memory ore lost when power is removed.

MW100 Memory lyle-100 (Ml 100) Memory lyte-101 (Ml 101)


Bit Positrons 7 6 5 4 3 2 0 7 6 5 4 3 0

Figure 4-10. Memory word- 100: A b it address is written ·M byte.bit' (e.g .. M 101.2).

Peripheral Memory (PI/PQ)


The peripheral area of memory allows the useoble data or on input module to be read
d irectly from the module, and the useoble d a ta of on ou tput module lo be written d irec tly to
the module. By accessing peripheral memory. the normal delay associated with the 1/0
image update a t the end o f each CPU cycle is eliminated. The identifier for accessing input
r11 odutes is Pl (for p eripheral input), and for output modules is PQ (for peripheral output). A
byte (PIB/POB). word (PIW/POW), or double word (PID/PQDJ con be accessed.

Uke other S7 memory areas. the peripheral memory sta rts al byte-0. In fact. the Input image
area (I) reflects d ata read d irectly from d ig ita l input modules by the CPU on each scan. The
CPU reads the input modules starting wilh peripheral input byle-0 (PIB OJ and places the
results in the inpu t image area starting with input byte-0 (1B 0). You can also read a module
from anywhere in your program by accessing the desired input byte from the Pl a rea.
Conversely. you may transfer data too digital o utput module by accessing the desired
p erip heral output byte (e.g., PQB O updates the eight bits of the digita l outp uts at QB OJ.

The peripheral memory area nol only corresponds to the addresses assig ned in lhe hardware
configuration, for both d ig ital modules. bul a lso lo analog modules. Unlike d igital modules,
analog input modules ore not read cyclically to on input image; nor is on analog outpu t
imoge transferred cyclically to analog output modules. Each analog 1/0 musl be read or
written o n d emand in your p rogram, via peripheral memory, Analog inp ut addresses are
pre F1Xed with PIW a nd analog ou tp uts ore prefixed with PQW. In LAD/FBD, the Move
operatio n is used to reod ond write analog 1/0. In Statement Ust (STL), the load operation
rea ds an a nalog input (e.g., L PIW 256) a nd the transfer operation writes lo on analog output
(e.g .. T PQW 256).

LPIW 256 Perfpheral Input lyfe-256 (PII ~) Petfpheral Input lyte.257 (PII 257)
F[rst Analog Input ' 7 6 5 4 3 2 I 0 7 6 5 4 3 2 I 0

Figure 4- 11 . Accessing peripheral input word-256. The next analog input channel is PIW 258.

TPQW 256 Pertpheral Output lyt9•256 (Pll 256) Perlpheral output lyt9•257 (PII 257)

Firs! Anolog Output 7 6
••
5 4
"
3 2 I

0
·•
7
-6 5 4

3
••
2 1 0
Figure 4-12. Accessing peripheral ou tput word-256. The next analog output is PQW 258.

197
STEP 7 in 7 Steps

Timer M emory (T)


The Timer Memory area of S7 memory contains the software timers of you program. Each
timer is stored in one word location, which contains both the time preset value and the lime
base. Timer word locations are accessed by preceding the location number with the
identifier 'T' to indica te timer. From the first location. timers ore addressed TO. Tl , T2, and so
on. The number of available timers is CPU dependent. Timer addresses ore used lo designate
the timer and is used in b it operations to check the timer status, and in word operations lo
check the remaining lime. STEP 7 interprets the address appropriately, based on the
opera tion. See S7 Doto Types and Formals, and the SST/ME doto type, for furlher details.
'
STEP 7 Timer Memory

Time Base Timer Pre1el Value In BCD (000-999) Timer Word

15 14 13 12 11 10 09 I oo 07 06 05 04 03 I 02 I 01 I oo
"
X X 0 0 0 1 0 1 0 I 0 1 0 0 0 0 TO
-
X X 0 I Tl
X X I 0 T2
' -
X X I 1 T(n)
Figure 4- 13. lllustrotion of Timer Word formal. The preset value of TO= 550 x .01. or 5.5 sec.

Counter M e mory (C)


The Counter Memory area holds coun ter instruc tions. Like S7 timers. each counter reserves a
word location, which is addressed in the prograni by preceding !he location w ith the
identifier 'C ' . From the firs! location, counters ore addressed CO, Cl, C2. and so on. The
number or available counters is CPU dependent. Coun ter addresse s ore used to designa te
the counter and is used in bit operations to check the counter sta tus. and in word operations
to check the current count value. STEP 7 interpre ts the address appropria tely, based on the
operation.

STEP 7 Counter Memory

BHs 12• 15 Unused


-
Counter Value In BCD (000-999}
I CountWOfd

15 14 13 12 11 10 09 08 07 06 I os 04 I 02 01 00

X X X X 0 1 0 I 0 I 0 1
03

0 0 0 0 co
-
X X X X Cl

X X X X C2
- - ,_ - - - -

X X X X Cjn)
Figure 4-14. Illustration of Counter Word format.

Local M e mory (L)


Local memory (the L-stock) is memory allocated lo a b lock (e.g., OB. FC. FB, SFC. SFBJ for
handling !he temporary local variables declared in the b lock. The L-stock is mode available
to each block as it is called. When a block terminates. the L-stock is available to the next
called b lock and the previous temporary data is overwritten. The identifier ' L' precedes local
memory addresses. A lo c al memory b it is addressed L byte.bit, a byte Is addressed LB n. a
word is addressed LW n, and a double word as LD n (e.g., L42.6. LB 2, LW 2, or LD 2).

198
Working With STEP 7 Programs and Doto

The total size of the local memory is CPU dependent. The ac tual size of the tocot stock
available too block is actually the size allocated lo the OB from which the b lock is called. By
default. the local memory available is equally divided among each OB {e.g.. 256) bytes). In
S7-400 C PUs and in the CPU 318. the amoun t of local memory allocated to each priority con
b e modified. Since not all priorities require the sam e size local stack. a larger local slack can
be assigned to priori ty classes needing more local memory. Furthermore. priority c lasses lhat
are not required in the p rogram may be deactivated. to free additiona l local memory.

Summary of S7 Memory Addressing


A summary o f how each S7 memory area is addressed Is provided in the following table.
Each area may be referenced in the STEP 7 program or in the STEP 7 monitor/modify data
utility. using e ither the absolute or symbolic address. The input (I). output (Q), and Bit Memory
(M) areas a ll allow bil. byte. words. and double word access. Peripheral (P) memory does not
support bit access. Counter and tim er addresses may be used In bit operations lo check the
limer/coun ler status. and in word operations to check the remaining time/current count.

Ta b le 4•5.Address1na summarv for Access1na S7 Memorv Areas.


Area ldenlller Access Units ea,.- Description of Example
I = Bil 130.7 Input Byte 30. bit 7

Input I IB = Byle IB 30 Input Byte 30


tmoge IW = Word IW 30 Input Word 30; bytes 30-31
(PIIJ
IO= Double word lD30 Input Double word 30; bytes 30-33
Q = Bit Q44.7 Outpu t Byte 44. bil 7
Output Q QB= Byle QB 4-4 Output Byte 44
tmoge
(PIQ) QW = Word QW44 o utput Word 44; bytes 44. 45
QD = Double word QD44 Outpu1Double word 44: bytes 44-47
M = Bil M 23.6 Memory Byte 23, bit 6
MB=Byle MB23 Memory Byte 23
BIi Memory M MW = Word MW24 Memory Word 24: bytes 24-25
MD= Double word MD8 Memory Double word 8; bytes 8· I I
Counter C C = Counter C64 Counter 64
Tmer T T= Timer 1 12 Timer 12
L = Bil L 2.7 Locol Memory Syfe 2. bit 7
LS ,. Byte LB 2 LocoJ Memory Byfe 2
Local l LW = Word LW2 Locol Memory Word 2; bytes 2·3
Slack
LO = Double word l02 Local Memory Double word 1
PIB = Byte PIB 44 Peripheral Input Byte 44
Pl PIW=Word PIW66 Peripheral Input word 66
Peripllerol
Inputs PIO = Double word PID82 Peripheral Input Double word 82
&
PQB =Byte PQB44 Peripheral Output Byte 44
Peripheral
Outputs PQ PQW = Word PQW66 Peripheral Ou fpul word 66
PQD = Double word PQD82 Peripheral Output Double wQfd 82

199
STEP 7 in 7 Steps

S7 Data Types and Formats


An understanding of the data types and formats used in STEP 7 is essentia l as you start to
organize and define your data. As each variable required in a code block or data block is
declared, you will explicitly define its data type. A variable's data type stipula te its width in
bits [e .g ., I -bit. 8-bits. I 6•bits. 32-bits, etc.), and how the binary data is represen ted and
interpreted by STEP 7. How data is represented and interpreted is referred to as the formal
[e .g .. signed integer. or c haracter string). The range of values that a variable may use is also
d e termined by da ta type. For example, data type INT, allows a range of -32768 to+ 32767.
The Following d iscussio ns introduce Elemen tary, Complex, and Parame/er d a ta types.

Elementary Data Types


Elementary Doto Types refer to the group o t data types that represent variables tho I involve
single data e lements. alt o r which ore 32-bits or less. Variables of elementary data type may
be declared In alt b locks. inc luding data blocks, organization b locks, functions, and function
blocks. Elementary data types include BOOL, BYTE. WORD. DWORD, INT, DINT, REAL, DATE,
TIME. S5TIME. TIME-OF-DAY, and CHAR. Variables of elementary dola type. may be used as
d irect input or output parameters of LAD both and FBD b ox instructions.

BOOL
Dalo type BOOL reserves a single bit for o variable lhot con take on the permissible values
ot e ither TRUE or FALSE.

■ 08100 -- New_prj\ SIMATIC 300(1)\ CPU 3 16 ll!!l~Ef


llddre88 Kaine Type Iaitial value C0ii■e11t
...
o.o STRUCT
+o.O OVR LlIT Tl BOOL
- - FALSE zom: l OVER Li mi t
+o.l OVR- LIIT- T2 BOOL FALSE ZONE 2 OVER Li Jnit:_ ~

..!J /4
Figure 4- 15. The first two bits of DB 100 ore declared as BOOL variables.

BYTE
A varia ble of doto type BYTE. reserves 8-bits. These bits ore not evaluated individually, but as
on 8-bit hex number. Each hex digit is represented In four-bits, allowing a lwo-d ig lt Hex value.
A constant of data type BYTE is specified using the identifier 8# 16#. where " B" is for byte, and
' 16' is for hex (e.g .• B# I 6# OA). The permissible range o f values is from B# 16#00 lo 8-# 1611 FF.

07 06 OS 0-4 03 02 01 00 BIi No.

I 0 0 I 1

A F B# l 6/!AF
Figure 4- 16. A BYTE variable

WORD
Variables o f d ata type WORD reserve 16-bits. Da to typ e WORD re presents a 16-bit string,
where the ind ividual bits ore no t evaluated as a unit. therefore a WORD variable supports
several bit-oriented uses. A WORD variable can simply be a 16-bil b inary string of Is and Os; o
4-digil Hexadecimal number; a 3-digii count value in BCD; or two unsigned decimal va lues,
each stored in one byte (e.g .. 255, 255).

200
Working With STEP 7 Programs a nd Doto

WORD As 16-bit String


A WORD variable is specified a s a 16-bil string value, using the identifier 2# (e.g..
2#0000_101 l _l l 1l_l I l I ). The range of this formal then is 2/tOOOO_OOOO_OOOO_OOOO to
2# 1111_1011 _11 11_111 I. This option might be used. for example, lo compare the 16-bits on
input module lo on expected 16-bil pa ttern ; or to monipulole sixteen digital o utp uts.

WORD · As Four Digit Hexadeclmal/ 3-Decade BCD


A variable o f dolo type WORD is specified as a hexadecimal number using the identifier
Wl/ 16# . •w· is for word length. ' 16' is for hex (e.g., W#16# 0FFF). Each hex d igit is represe nted
us:ing four-bits. allowing a rour-digil Hex number in o WORD variable. The permissible range o f
values for this rormot option is from W# 16110 to Wit l 6#FFFF. This option mighl be used when
up lo 4-dlgit hex numbers ore required. or as a shorter notolion for ind irec fly specifying a
binary pattern (e.g .. W# l 6#FFFF instead of 2# 111 1_11 11_ 1111_ 1111 J.

The 16-b il hex format con also support o 3-decode BCD value. simply by only e ntering hex
digits 0-to- 9 in order lo avoid invalid BCD numbers. BCD does not use a unique identifier, but
instead uses the hexa d ecimal identifier. The range for o valid 16-bil BCD number is ±9 ,99.
specified as W# 16#FOOO to W# 16#0999. Bits 12-l 5 are used to indicate the sign. Negative is
denoted by I XXX. a nd positive by OXXX, since only bil 15 is used for the sign.

8 4 I 2 1 I8 4 I 2 1 8 I 4 2 I1 8 I 4 I 2 . 1 I Weight

15 14 13 12 11 10 09 08 '11 06 OS m 02 01 oo ■ Na.

1 1 1 1 1 1 l 1 1 1 1 1 1 1 1 1

F F F F W#16#Ffff
Figure 4-17. WORD variable interpreted as 16-b it hexadecimal.

WORD • As a Count Value


A variable o f dala type WORD may be sp ecified as a count value, which might be loaded
lo a co unter on command. Recoil, that each counter va lue reserves a single word and is
interpreted as a 3-digit BCD value. When specified os o consta nt paromeler inpul to o n
instruction or os on Initial value of a WORD variable declaratio n, the count value is preceded
by !he identifier C# (e.g.. C#SOO). The permissible range !or this format is C#OOO lo C#999. This
format could be used to compare the current value of a counter too se t point value. The
compare for example. could compare C# 100 to C6 (counter 6).

WORD • As Two Bytes Unsigned Decimal


A variable of d a lo type WORD is specified os 2-byles of unsigned decimal numbers, using
the identifier 8#. The two numbers are enclosed in parentheses and separated by a comma.
for example, 8#2(25, 175). This format maximizes l 6-bil data storage if posi tive values from 0-
255 o re alt lhol is required [e.g.. indexing a loop to+ 10). The maximum range of each byte is
from 0-255 or B# [0. 0.J to 8#[255,255).
.
'
128 I 64 32 I 16 a I 4 2 1 ,' 128 64 32 . 16 I s II 4 I 2 I 1 I Weight

14 13 12 11 10 m 01
15
1 1

1 1 1 1

09
1
08 ! 07
1 1
°' 1
OS
1
-
OI

1 1
02

1 1
00
1
-
■ No.
-
255 255 a#(255,255)
Figure 4-18. A WORD variable interpreted as 2-bytes unsigned decimal.

201
STEP 7 in 7 Steps

DWORD
Variables of data type DWORD reserve 32-bil s. Data type DWORD represents a 32-bil siring,
where the individual bits ore no t evaluated as o unit, thereby allowing o DWORD va riable to
be used for several b it-oriented purposes. A DWORD variable con simply be a 32-bil b inary
string of Is and Os; on 8-digit Hexadecimal number; or four unsig ned decimal values, each
stored in o ne byte (e.g.. 255. 255. 255.1 ). Because the binary equivale nt o f Hex 0-9 Is the
same for BCD, DWORD variables moy also be used in BCD opera tions.

DWORD - As 32-blt String


A DWORD variable is specified as o 32-bit binary string, using the identifier 2# fe.g ..
2#0000_ 1011 _ 11 I I _ I I 11_0000_ 1011_ 1111_ 1I I 1). The minimum value o f this formal is when a ll
32-bits are 'O': the maximum value is when oll 32-b its are' 1'. This option might be used, to
co mpare the 32-bits o f an input module to an expected 32-bit pattern: to manip ula te thirty-
two digital o utpu ts simultaneo usly; or as o mask pattern in 32-bil word logic operations.

DWORD - As Eight Digit Hexadecimal/ 7-Decade BCD


A variable of d a ta type DWORD is specified as a hexadecimal number using the identifier
DW# 16 #. 'DW' is for double word length, ' 16 ' is for hex [e .g., DW# 16#0FFF_AOFF). Each hex
digit is represented using lour-bits. a llowing o n 8-digil Hex number in o DWORD variable. The
permissib le range of values for 8-digit Hex is from OW# 16#0000_0000 to OW# 16#FFFF_FFFF.

The 32-bit hex forma t co n also support o 7-decode BCD value, simply by o nly using the digits
O-to-9. in order to ovoid invalid BCD numbers. The valid range for 32-bil BCD numbers is
±9.999.999. Specified using the 32-bit hex identifier, is OW# I 6#F9999999 to OW # l 6#09999999.
Bits 28-3 1 are used lo ind icate the sig n. Negative is denoted by 1XXX. and positive by OXXX.
since only b it 31 is used For the sig n.

8421
'
8421 8421 I 8421 8421 I 8421 I 8421 I 8421 I Weight

31-28 27-24 23-20 19-16 15-12 11 ·08 07.04 OS·OO . ■ No.

1111 1111 1111 1111 1 11 1 1111 1111 11 1 1

F F F F F F F F DWf1 6'tttt fFfF

Figure 4-19. DWORD variable interpreted as 32-bit Hexadecimal.

DWORD - As four Bytes Unsigned Decimal


Whe n o co nstant of data type DWORD is specified a s 2-bytes of unsigned decimal numbers.
the lour numbers a re separated by a comma. enclosed in parentheses, and preceded with
the identifier B#; for example. B# (255, 255, 255, 1). This forma t maximizes 32-bit data storage if
positive values from 0-255 o re all that is required (e.g.. indexing o loop to+ 10), The m aximum
ra nge of each byte is from 0-255 or B#(O. 0, O. 0) to 8#( 255. 255, 255, 255).

128 64 32 16 8 4 2 1 I 128 64 32 16 8 4 2 1 I 128 64 32 16 8 4 2 1 1286432168421 Weight

7 0 7 0 7 I
0 7 I 0 Bil No.

I 1 1 1 1 I I 1 1 l 1 I l 1 1 1 1 1 1 I 1 1 1 I 1 1 1 1 1 1 I 1

255 255 255 255


Figure 4-20. OWORD va riable interpreted a s 4-by1es unsigned decimal.

202
Working With STEP 7 Programs a nd Doto

INT
Variables of data type INT represent sig ned decimal integers in o 16-bil word. The permissib le
range for data type INT variables is -32.768 to +32.767. A constant of type INT is entered in the
declaration a re a o f a code block, data block. or as on input va lue to on instruc tion. simply
with the appropriate sign (e.g.. +2575). No ide ntifier is required.

15 14 13 12 11 10 09 C8 rn 06 04 00 BitNo.

0 0 0 0 0 0 0 0 I 0 I 0 I 0

512 + 64 + 16 + I +
'I +597
Figure 4•2 1. Doto type INT variable . interpre ted as signed 16-bil integer.

Using the two 's complement melhod of representing negative values, data type INT uses bit-
15 l o represent the sign. A 'O' Indicates o positive value; o 'l' Indicates negative. The
remaining b its (0-14) hold the actual va lue. The two 's complement value o f any value is
oblained by inverting each bit from right-lo -left. bul only after lhe first ' 1• is detec led. This
m ethod is equivalent to inverting each bi t (i.e ., change ls to Os and Os to Is) then adding+ I.
. I '
15 14
.
13 12 11 I 10 09 08 07 06 05 . 04 03 02 . 01 . 00 Bil No.

0 0 0 0 0 0 0 I 0 1 0 I 0 t 0 I +597
' •
I 1 I I 1 1 1 0 1 0 1 0 1 0 1 I -597
Figure 4-22. Two' s Complement representation of data type INT negative number.

DINT
Variab les of data typ e DIN1 represent signed decim al integers in on S7 double word (32-bits).
The permissible range of DINT variables is -2. 147,483,648 lo +2. 147.483.647. DINT variables
should be used whenever the intended operations ore expected to exceed the range of
d ata type INT. An initial DINT constant is entered in a code b lock. data block. or as on input
value to an instruction. using the lo ng integer identifier 'l' (e.g.. L#500000).

Using the two 's complement melhod lo represen l negative values. DINT variables use b it-31
as the sign b i1. A ·o· in lhe si9n bit indicates a positive va lue: a ' 1' indicates negative. The
remaining 31 bils hold the value.

s I
I I I I
'
31 - 28 27 - 24 23-20 I 19 • 16 15 • 12 11 - 08 I 07 · 04 [ 03 - 00 [ Bil No.

0 1I I 11I I 1I I I 1I I I I1I I 1l 1I I I 1I I 11I +21 47483647

1000 0000 0000 0 0 00 0 000 0000 0000 0001 -2147483647


Figure 4-23. Doto typ e DINT variable, inte rpreted as signed 32-bit integer,

203
STEP 7 in 7 Steps

REAL
Variables of d ata type REAL represe nt floating-point numbers (e.g .. 25.375). REAL varia bles
ore used to work with fractional numbers or to handle calculations or measured quontilies
that require llooting-poinl occurocy. lnlernolly, REAL variables ore represen ted in the IEEE 32-
bit llooling-poinl rormol. In this format. bits 0-22 represent the mantissa, or th e significant
digits of the number: and bits 23--30 represent the exponenf, o signed power o f 10. Bit-31
represents !he sign. where O' indicates o positive value and ' 1' indicates a negative value.

A REA L constan t is specified as the initial value tor a declared variable or as a cons tant input
lo an instruction. using the REAL notation shown below. This shorthand notation places the
first o t the significan t d ig its (non-zero) to the left of the decimal point a nd up lo six additiona l
significant digits to lhe right and preceding the exponent. An uppercase 'E' or lowercase 'e'
is valid. The number in the exponen t reflects the number of places the decimal point must b e
moved to th e left or righ t of the most-sig nificant digit, in order lo represent the o riginal value.
A positive exponent reflects o move to the right - o nega tive exponent o move to the teH.

Tobie 4-6. REAL (Flootino-ooinlJ constonls in scien tific notation.


Original Value REAL Notation Original Value REAL Notation
12345.67 1.234567 e +04 2000.0 2.0 E +03
-
.1234567 1.234567 e-01 20003.0 2.0003 E +04
-

- 12.34567 -1.234567 e +O 1 [ ,0 1 1.0 E-2

--0.0000023
+0.00000000067 5
-2.3 e -06
6.75 e - 10
.- .001
.0001
1.0 E-3
1.0 E-4

- 1234567000000 1.234567e+ 12 10000 1.0 E .,.4

DATE
A variable of data type DATE reserves a n S7 ward. lo represent a dale value as an unsigned
fixed-point number. Internally the time value is interpreted as o fixed-point number that
represents the total days since January 01, 1990. This IEC formal far specifying o dote uses the
identifier 'DATE #' or 'D'. and lhe year, month and day separated by hyphens (e.g..
DATE/#2002-08-22). Doto type DATE supports dates from January 1, 1990 through December
2168. This range or values is exp ressed DATE# 1990·01 -01 through DATElt2168- I 2-31.

TIME
Variables o f d ata typ e TIME reserve on S7 double word. Constants of data lype TIME ore
defined in units o f days (D), hours (H). minutes (M). seconds (S). and milliseconds (MS),
preceded by the identifier 'TIME' or 'T'. Unit identifiers may be entered as upper or
lowercase, and unneeded units may b e omitted (e.g., TIME# 10H30M). This IEC format for
specifying o lime value is intended for specifying o delay (e.g.. a 'wait time' in your STL
code). Both positive and negative Time values ore supported, with a range o f TIME#-
24d20h31m23s647ms lo TlME#+24D20H3 l M23S647MS. The internal representation of the lime
value is as o signed 32-bii fixed-point number, interpreted by STEP 7 as total milliseconds.

TIME_OF_DAY
A vorlable of doto type TIME_OF_DAY reserve on S7 double word. A TIME_OF_DAY constant Is
sp ecified using the identifier 'TIME_OF_DAY#' or 'TOD#' preceding the hours, minutes, and
seconds w hich ore separated by colons (e.g.. TOO#Ol : 15:00). Milliseconds may be added to
the lime using o period os lhe separator. or omitting it altogether. The internal representation
of th e TIME_O F_DAY time value is as o signed 32-blt fixed-point number, Interpreted by STEP 7
as total milliseconds.

204
Working With STEP 7 Programs a nd Doto

CHAR
A variab le of data type CHAR reserves o ne byle (8-bils) a nd rep resents a single ASCII
character. All printable characters including upper and lower cose a lphabe ts, numbers 0-9.
and some special characters are valid. An inilia l charac ter value is specified for variab les of
data type CHAR. by enclosing the character using apostrophes (e.g., ' Y' ). It is o lso possible
with the MOVE instructio n. to transfer either two or four charac ters enc losed in apostrophes,
lo a word or double word localion. The spec ia l choraclers listed in the following toble. are
entered using a specia l notation . (See ASCII c ha racter table in Appendix C ).

Ta b le 4•7 . Nota f'1an for S,nec1


.0 I CHA RCh oroc Iers.
CHAR ASCII Code {Hex) ASCII Character
$$ 24 Dollar Sign
$' 27 Apostrophe
-
$Lor $1 OA Line Feed Control (LF)
$P or $p oc New Page Control (FF]

$R or $r OD Carriage Return Control (CR)
$Tor $1 I 09 Tab Control

S5TIME
A variable of da ta type S5TIME is specified to represent a preset value for a timer. This 16-b il
format is the some as wha t was formerly used to store the STEP 5 timer preset. An initial S5TIME
value is enlered in units of hours (H). minules (M), seconds (SI, and milliseconds (MS}.
preceded by the dalo type identifier 'SSTIME#' or 'SST#' (e.g .. S5Tl/2H30M30S), The unit
identifiers may be in upper or lowercase. and un-needed units may be o mitted.
As described in detail under S7 Memory Areas. the internal format of the S5TIME data type
involves o single w ord encoded in lwo BCD ports. The time value. represenled in bils 00-11 of
the timer word, allows a BCD value from OOO-to-999; the time base. represented in bits 12- 15,
tokes on encoded va lues o f 0000, 0001 , 0010. and 001l. These values ore in lerpreled as .01
sec . . I sec, 1.0 sec.. or IO sec .. respeclively.

Time Bose Timer Value in 3-decodes BCD (000-999)


(0000-0011)

15 ,~ 13 12 11 10 09 08 07 06 05 04 03 02 01 00 nmer Word
0 0 0 I 0 I 0 0 0 I 0 1 0 1 TO

X X 0.1 sec 5 5 5 55.5 sec.

00 = .01 sec
01 = 0.l sec

IO= 1.0 sec


l l = IOsec
Figure 4-24. Illustration of Timer Word forma l. The p resel value of TO = 555 x 0. 1, or 55.5 sec.

205
STEP 7 in 7 Steps

Ta ble 4· 8 . Summarv o f S7 Elemenlary Dala Trvoes


Data Type BHs Format (units) Constant Notation and VaRd Range

BOOL I Boolean Text TRUE/FA LSE

BYTE 8 Hexadecimal B# 16#0 -lo- B# I 6#FF

Binary ........................ 2#0-to-21111 11_ 1l I I - 1111- 1I 11

Hexadecimal.. ......... W# 16#0000 - to- W# l 6#FFFF


WORD 16
BCD Count ................ C#OOO -to• C#999

Two Unsigned Bytes.. Blf(O.O) -lo- B# (255.255)

Binary........................ 2#0 -lo-


2#1111_1111_1111_1111_11 11_1111_111 1_1111

DWORD 32 He)(odecimal.. .........


DW If 16#0000_0000 •10· DW If 16# FFFF_FFFF

Four Unsigned Byles.


8#(0.0.0.0) -to- 6#(255,255.255.255)

INT 16 Signed Decimal -327 68 -lo - 327 67

DINT 32 Signed Decimal L#-21 47483648-to- L#2147483647

REAL

DATE
=i 32

16
IEEE Floating Poin~

tEC Dote {l..cfoy)


175495e-38 -to- ±3.402823e+38

D# 1990-1-1-to- 0#'2168-12-31

T#-24D_20H_3 l M_23S_648MS -to-


TIME 32 IEC nme (1ms)
T#240_20H_3 1M_23S_647_MS

TIME_OF_DAY 32 lime of day ( l ms) TOD#0:0:0.0 •to- TOD#-23:59:59.999

CHAR 8 •
ASCII Character 'A'. 'B'. ·c·. 'D', and so o n
SST#Of-!_OM_OS_IOMS -to-
SSTIME 16 SS Time (I Oms)
SST# 2H_46M_30S_OMS
Note: Constan ts entered as binary. BCD count. or os unsig ned bytes all revert to Hex va lues
when declared, but may viewed in the desired forma t in the Monitor/Modify Variables tool.

Complex Data Types


Complex dolo fypes allow you to define voriobles that combine other data types a nd lhat is
co mp rised of more than one data e lement. Complex data types. which include DATE-AND-
TIME. STRING. ARRAY, STRUCT, a nd UDT. may only be used w ith lhe variables declared in data
blocks. or those specified as te mporary variables. o r a s formal b lock param eters.

STRING
A variable o f dote type STRING defines o string of up to 254 ASCII characters (CHAR). By
default. a character-stri ng reserves 256 bytes that allows for 254 c ha racters and a 2 byte
header. A string con be specified as STRING [n). where n d efines the maximum number of
characters (e.g .. STRING[6)) the variable can accommoda te . II no leng th is sp ecified , 256
characters ore reserved. An initial string is defined by enclosing the characters with
apostrophes. or p receded by the dolla r sign in the case of the special characters defined
under data type CHAR. The aclual storage requirement o f a string is. minimized by specifying
the exact number or charac ters (e.g .. string( 12]. with initial value 'System Ready') . 11 lhe Initial
siring is shor1er than the specified length then the actual length is reserve d .

206
Working With STEP 7 Programs a nd Doto

DATE_AND_TIME
Variables of data type DATE_A ND_TIME are comprised of the d ote and lime . When
specirying this variable in o doto block or os o static va riable in o functio n block (FB), on
initia l value is enlered using the identifier DATE_AND_TIME# or DT#, followed by the units of
yyyy-mm-dd:hh:mm:ss:ms (e.g., DT#2004:12-31 -23:59:59.999) , where milliseconds may be
omitted. Internally, this variable is stored in BCD formal using 8-bytes. Starting w ith the byte
(n), lhe variable contains the year (00-99). month (l -12.), day (1-31), hour (0-23). m inu le (0-
59) . second (0-59), millisecond (0-999). and finally th e weekday ( 1-7). w here Sunday is day I.

ARRAY
An array variable represents o fixed number o r data elements of the same do lo type (e .g ..
10 values of data type INT), that may include all dala types except parameter types. A n
array is declared as ARRAY [xl ..yl }, where the dimensio n limits xl and y l define the size of
lhe a rray. The index values may start al a negative integer. zero, or o positive integer (e.g.. (·
10.. 10). defines on orroy with 21 elements. Up lo six dimensions moy be declared by
separating each d imension by a comma. ARRAY (1..2, 1..6), defines a two-d imensio na l array
with 12 elements. The doto type of on orroy (e.g.. INT, DINT, or REAL), ls assigned on the
dec laratio n row immediately following the dec lara tion of the a rray name and size (Fig. 4-25).

lnittol values may be assigned to each array element by entering each value separa ted by
commas. The some value c on be assigned to consecu tive elements by enclosing the value
in parentheses preceded by o repetition factor (e.g .. 5( I 00). Elemen ts not assigned on initial
value will default to zero. An a rray element in a single d imension array is addressed in the
program os Nome [index) (e.g.. temp (4)). The full indices must be used when specifying on
a rray element in o m ulti-dimensional array. Given the two-dimensional array ·ARRAY [ 1..3,
1..4] .' the firs I element is addressed Nome [ 1, l ]; the lhird element is addressed Nome (1.3];
the fo urth element is addressed Nome (2, l J; and the last element is addressed Name [3.4).

lddrew .._ rme


o.o STRUcr
+o.o E:x l AAAAV(l, .10] S ( 100) , 5 (SO) S1n9le dilll.en.,1on; 10 I NT ele .. ent:i.
•2.0 I llT
+20.0 !:x_2 ARAAV(0 •• 15 , 0 .. JJ 64 ( l'ALSI!:) 2-dinensional ; bool element3.
• 0.1 SOOL
+36.0 !:x_3 ARRAY(-10 •• 10 ) 10 (TOl>ll2: 0: 0 . 0 ) Tillle-ot-Day attfl'.r l 21 e l e01ent.2.
•4.0 T!l!l:: OF DAY
+1 20.0 £x 4 ARRAY[l,.2 , 3 .. <IJ 'Y ' , ' II ' , ' 0' , 'l ' 2- clinensional a rray; 4 CRAR e l eDent.s
•1.0 CHAR

Figure 4-25. Declaring ARRAY vari ables.

STRUCT
A variable o f dola type STRUCT is represents a structure with a fixed number of elemen ts that
m ay invo lve any combinati on of other data types. In the declaration table, the STRUCT
variable includes the data e lements enclosed between the keywords STRUCT and
END_STRUCT as shown In the figure below. Stru ctures may be defined either in the variable
decla ratio n of the logic b lock or in o data block. The individual elements of the structure
may be accessed using the structure name ond the variable element name separated by a
p eriod (e .g ., Reclpe_A.Sys_Rdy).

207
STEP 7 in 7 Steps

I ID!ff 4il§t'tillit,iilmtl4111L.-r::
lddre•• If.- Tne I:nit:Lal value Cc 11: at

0.0 S'IRUCT
+0 . 0 Recipe_A S'IIUICT Stai:t Recipe A; St.z :uctuLe LJ
+o.o Sy$_Rdy BOOL FALSE Element~~ Recipe . Sy:,_Rdy
+2.0 Ingred l IJIT 1500 Element == Recipe. lngced_l
+4.0 lngred_2 REAL 1.502345e+002 Element •e Recipe.Ingred_2
-t-8.0 Stop:, All.RAY(l.,10] 10 (FALSE) End Recipe A; Sttuctuce
"0 . l BOOL
•10.0

-
END S'rnUCT

Figure 4-26. Declaring ARRAY variables.

UDT (User Defined Type)


A UDT is o user-defined type tho I may include bo th elementary and complex variables. A
UDT is essentially o structure, comprised of data elements of arbitrary data types. The intent of
the UDT is to provide o user defined doto structure tho! con be used os o doto b lock
lemplo te or os o predefined structure. Once defined, 1he UDT may be used os o template to
d efine the dota structure of several data b locks; or os a doto type (essentially o struc ture).
The elements o f the UDT ore accessed like the e lements o f o doto b lock or a structure. A
specific data element is accessed using the name o f the UDT and the variable name
separated by a period. You con create o UDT in the Blocks folder of o program using the
SIMA TIC Manager or the standard editor. The UDT is assigned a number (absolute address)
from UDT O to UDT 65.535, and con be assigned o symbolic address (e.g., PID Loop). A
variable named PY. in a UDT named 'PID Loop' is addressed os 'PIO Loop.PV '.

- l□t~
Jddress lfalle Tn,)e IAitial value Coa111ent
o.o STRUCT
+o . o Loop_lfo IJORD lJ#l6#1 Loop NUil.bee
+2.0 PV REAL O.OOOOOOe+OOO Process Input Vatial:lle
+6.0 SP REAL 5. soooooe+002 Setpoint. _J
+10.0 UL REAL 6.750000e+002 Upper Limit Alarm
+14. 0 LL REAL 6. 550000e+002 Lo~er Limit. Alarm
+18. CTRL IJORD 1Jf16eO Cont.col lolocd
=20.0 l!lID STRUCT ...

Figure 4-27. A UDT (User-Defined Type) is c reated from the SIMATIC Manager.

Parameter Data Types


The Parameter data types refer to the group of data types that represent variables that allow
limers a nd counters (e.g., Tl. T2. CI , C2J, os well os blocks (i.e., FCs, FBs. DBsJ to be used os
formal parameters in on FC or FB. With parame ter doto types, you may write on FC or FB in
whic h o limer. counter. FC . FB. or DB number may be passed to the block on each coll ol lhe
block. Parameter data types include TIMER, COUNTER. BLOCK_FC, BLOCK_FB, BLOCK_DB,
BLOCK_SDB, POINTER, and ANY. The parame ter type POINTER and ANY allow poin ler
addresses to be defined, for indirect addressing of specific addresses or address a reas, w ith
respect to transferring b lock. parameters.

208
Working With STEP 7 Programs a nd Doto

Overview of the LAD/ FBD/ STL Editor


In STEP 7. developing o program for the control system is lo creole o collection o f code
blocks and data blocks. each of which perform s o specific task and Iha ! together form a
comple te program. The LAD/FBD/Sn editor is the standard tool for STEP 7 program
development. If alone is oll lhot is required to build the program incrementally. using the
b locks resources (e.g.• OBs. FBs. FCs, SFCs, SFB, DBs) that hove been previously p resented.

Introduction
The LAD/FBD/STL editor may be started from the Windows Slort Menu or from inside the
SIMATIC Manager. Aller a block is genera fed in fhe offllne b locks folder of a program.
double clicking on the b lock launches the editor and opens the b lock in its own win dow.
Once developed, a block may be copied to o fher STEP 7 programs or projects. and
d ownloaded to the CPU. Each block con be checked for correct operation, using several
monitoring and debugging tools (See following c hap ter). Once created and downloaded.
the status of any b lock may b e open a nd viewed onfine. showing th e status of opera ling
values.

Menus and Toolbar


Menu headings of 1he LAD/FBD/STL editor include Fife. Edit, Insert, PLC. Debug, View , Options,
Window. and Help. File operations allow you lo creo le, open. save, and compile b locks. Cul,
Copy, and Paste opera tions from the Edit menu or from the right click allow you to copy
program elements within a block or b etween blocks and programs. PLC operations support
online access to CPU opera tions such as download, monitoring and diagnostic tools. View
operations allows switching between the LAD, FBD. and STL representolions. and for
c omponents of the editor to be displayed or hidden; w hile the Window menu allows the
editor and block windows lo be arranged to your convenience.
The toolbar b uttons. listed below. represenl some o f the most frequently used menu
operations or software u tilities tha t you may launch while using the programming editor.

/ Tl Proaramrn no Ed1tor
Table 4-9. LAD/ FBDS . c ore Toolbar Buttons.

Icon Toolbar Function Icon Toolbar Function

ill] Create New Sta tion in Project


- ~ Monitor Block Slofus Online

~ Open Station Oflline Window


-
[g] Display Overview WiAdow

~...,. Open Offline/Online Partner


-
~ Displa y Details Window

[!] Save
-
I§• Insert New Network
-
1~1,1 Compile SCL Text [into block)
-
[I8 Insert Normally-Open Contacl

...00 00
Cut Selected Obiect Insert Normally-Closed Confac t

~ Copy Selected Object


-
Bl] Insert Coil Instruction

[j] Paste Object from Clipboard [g Open Parallel Branch lLADJ

ii]
->
Download lo PLC
-
~ l
Close Parallel Branch (LAD)

@] Toggle Symbol Addresses On/Off

209
STEP 7 in 7 Steps

Program Elements/Call Structure Window


The Program Elements/Coll Structure window contains the vorious LAD/FBD instruc tion folders
on the Program Elements tab. ond a tree-like structure of the call hierarchy of the currently
open p rogram. While the editor Is opened. the Program Elements/Coll Structure window con
be hidden from view or displayed by selec ting View ► Overview from the menu {toggled
on/off). You moy also "dock" or " undock" the window by double-clicking on the window's
Control bar/TIiie bar. When undocked. the window c o n be resized and moved around lo suit
your convenience. You ma y dock the window on either the lett-side or the right-side of lhe
main window by dragging and dropping ii on th e left or right edge or the window.
The Program Elements tab. When selected. conta ins the New Ne twork object. used to insert o
new network: and the folders of the instruction categories. for whichever o f the LAD/FBD
languages is currently enabled. STl instructions are no t listed. While programming , you may
d ouble-click on the New Ne twork objec t lo insert a new network. a nd you may open an
instruction folder and d rag the desired instruction on to th e c urrent nelworl<. The window a lso
con ta ins folders for a ny user FB. and FCs that hove been c rea ted, and any SFCs a nd SFB tha t
you may hove copied to your program. You may also drag FCs, FBs. SFCs. fro m their fold er
and d rop ii into lhe current network.

filit A0/ 5ll/ U10 · I tlh ffi11.AD,',tl/JllD - 001


Fl_e Ed l J1tl>l<l PLC Oi!ol.O >\!W - WrdtM ijelo F-'o Edt i,,.,.t FI.C ~ Viel' Oj)U>n< \'lrdow lleb
01~1:~1, u~ '1,1~1~1..,,,~, c~11• 1.9 ~ Dj~ j'l~!lil I ~ ,I', It;,_,jei! ~ ~ .9 !'::.
.:Ji!) I!)
S· S1ProV<n
r.J11c... . - i . S O ~I
tilSJ llil1- -0 Fill, 061
l!l 3J Ca,p.,otm
e~ (cn..crlt1
$ :i:JI CW'llct
1¥ ii:) DE c..t
1,1 ii.I Mn>•
1 0
0
0
FCl2
FC3
FC♦
B OE6
· 0 1'82, Ce:?
$ i[) 1rt<9or lun<tk>n 0 F<:I
1,1 i!) flootlng-p<>rt f<t --0 RI<, C&I
rii 123110.... □ Fa
1B 5:i:I l'tog,om _ , ., O FCT
m :i.i) Shf\/~otato 0 FC8
CB S!i st.tu, bi., O F<.:9
rp AJ tlncr, 0 lz.10
m9:il Wfflll:,g£ 0 FCII
til ill F&tlo<b □ F<;';
I!) J:ll FC blods> O R:6
QI SRl- 0 FCIJ
ie SKtilod<s 0 1'83, Oll'.l
• 11•-.,,..,.,.,,. e ce.
□ F85, er,;
OJ • IA:•- e ce>
.:I

PretSFl ~OO(Ho'I>.

Figure 4-28 fa ) Left-Docking with Program (b) Un-Docked window with Coll Structure
Elements tab selected . tab selected.

The Coll Struc ture lob. when selec ted. conta ins o tree-like struc ture o r the colling hierarchy of
lhe o pen program. The coll structure shows the called blocks and lhe re la tionships between
each and ifs colling block. Each bloc k in the project is listed a t the for lett. with OBs b eing
leH-mos t. Th e b locks called from each OB are indented underneath ii is a list of the b locks
lhot ii con call or use. Blocks which ore not called from a nywhere in the program ore shown
a l the bottom of the coll structure and marked with a b lo c k c ross. When you click on the plus
(+) symbol. the lower structures of the coll hierarc hy are expanded and displayed. When you
click o n the minus (·) symbol. lhe lower structures of the coll hierarchy ore collapsed and no
lo nger displa yed. With o block selected. from the right-click. you may na vigate d irectly lo
the b lock or lo lhe location from which the b lock is called_

210
Working With STEP 7 Programs a nd Doto

Block Window
Each b lock is opened In its own window. You may orrange the open windows in a horizontal,
verlical or cascaded layout. As seen in the figure below, each b lock window consists of a
variable declaration pone and a code pone. where the ocluol program code is w ritten. If
lhe block is new, lo begin writing code, simply click inside the p one a t the first network; for
existing b locks that you wish to edit, find and select the network you w ish to edit. You may
open as many b locks as you like, and must select lhe specific b lock you wish to work w ith.
While a block is open. you may copy any block element (e.g .. Network Tille, Network
Comment. Network Logic . e tc .) and paste it to the some or to a different b lock.

LAD !irL 1W fU

= 'b r,;i&M;,..
<I! Ei) "' ""'
1-tit•ftot
ltJ 0, ltl
tJ WGc~ ~ 'i! OC,JJ
-;i~tt:~1
i-t-0- ltf_CU'I
·ij ti.I"""'
!.ti fill IC•C-l l
1-1 ti- ro,1
~ ORCT..Ffj
Zf!!iJ' )._~
:J! [D lri'"P' f.1-.1>.11
<jlli:il
t:I ~
""'n""'"
n,.,._
It<
rn 1 o u01 n aJ!t r «-t 1JUJtt."On.111ru,,
• •
...........,
.··-·-~······
.ii S, ~,..,.w m.1
,~ li,i 9 . .......
aetw rl. 1!' 1 txca,le1 lf!tli!,1 aie er Dd~
.......... Th1.ct - e, ~ ~~ :>;--~! !. .u:11cle U:,1.r,, .ldd!:c,e P.:!il t111=e t -!~ De

*fill~•
;ti ~ !...-. l•I , l
liW _,.,, , •• , 1'0$ I 00.1

~ CC
'Ii-I ia GI """'
1--- · ~ - - - - - 1 ( ) , -l
t.o,s
ffi IJ;3 9'101:1:h
~!Ki,,,.,
1:U t,U , • - ll~~rt I
l II "~ t"f.:~

"'•"'-

lkt,vd,. ) : h--'1c U:JiIQ C.10 1 0::>lU'ic ?4.'l' Q:.,i Tit~


• . s
1
I... .
Figure 4-29. LAD/FBD/STL Editor loot with docked Program Elements/Coll Structure w indow;
Program window wi th two open block. windows arranged vertically. The Details window hos
several tabs lhol provid es tools for monitoring and diagnosing the conlrol program and
d ata.

Details Window
The Details window is opened from the menu by selecting View Details and hidden by again
selecting the Details option from the View menu. The Details window allows you to select any
one of seven views. b y selecting lhe Error. Info. Cross-Re ference. Address Info. Modify,
Diagn ostics. or Comparison tab.

Each tab provides a different service lhot enhances working with the open block. The cross-
reference tab. tor instance, lets you see in whol other networks or blocks ore lhe addresses of
the c urrent network located. The comparison tab is used in conjunction with the block
compare function. When the results o f a compare opera tion ore determined. lhe compared
blocks ore shown in two windows and the found differences lis ted on the comparison lob.

211
STEP 7 in 7 Steps

STEP 7 Instruction Set Overview


The discussion following. w ill introduce each of the STEP 7 instruction categories for LAD
(Ladder) ond FBD (Function Block Diagrams). The purpose o f each instruction category is
briefly described, and then followed by o table that lists th e opera tions it includes. The
operation o f each instruction is explained in the table. In the LAD/FBD/STL editor of STEP 7,
each o f these categories is represented as o folder object that contains the operations
shown in the loble. For the purposes of this discussion. the Bit logic category is divided inlo
Basic Operations. and Special Opera/ions.
Bit logic Instructions - Basic Operations
The first group o f STEP 7 bit-logic instructions, so-called Basic Operations, is used in developing
relay equivalent control circuits and internal binary decision logic. Wilh instructions that
include normally-open and normofly-closed contacts. and lhe standard output coil, these bit
logic instru c tions allow development of series. parallel, and series-parallel logic
combinations. Set and Reset output instructions, also known as latch/unla tch outputs. allow
bit addresses to be latched ON until unlatched, regardless of the driving logic. The invert RLO
instruc tion inverts the logic status at the point where the instruction is inserted.
These instruc tions. which examine and control lhe status of any addressable bit location. a.re
the basis for creating th e driving logic of externally connected discrete devices as well as for
triggering internal operations such as timers. counters. conversions. arithmetic calculation,
program flow conlrol, word logic, shifl-rolo le and move operations.

Tobie 4-10. LAD/FBD Bit-Loaic Instructions - Basic Onero tions


LAD FBD Brief Description
Ovtpu l Output If the resull of the logic opera tion (RLOJ preceding the
.. ..
.. , ? ??.? re ferenced output oddress = logic l then ossfgn logic 1 to the
-()1--
??, ? -

I output address, othervlise assign logic Oto the output.

Normolly-Open Input Examine the reterence<l address for o logic 1 5latus. A status
Conto ct of logic I ollows loglc conlinui1y; logic Olntem.ip ts continuity.
?? . ? ?? .? I
-II-
Normally-Closed Negote Input Exomine the referenced address for o logic Ostatus. A status
Contact o f logic O allows logic continuity: logle I interrupls con tinuity.
.,., ..')
~
??. ? --01
-VI-
.,, ,
Set Output Set Output
??.?
If the result of the logic operotion (RLO) preceding the
referenced output tronsltlons from logic I -to- logic O. then
......:.(s5- ??.?-__:_J assign logic I to the oddress, Remain al logic I unlit reset.

Reset Output Reset Output When the result ol loglc operolions (RLO) p(eceding the
,, ?
??. ? referenced output transitions from logic I -to- logic 0, then
- (R} - assign logic O lo lhe oddress, Remain al logic O until set ogoin.
??. ? - ~

Invert RLO Negate RLO Invert the RLO (result of logic operation} status at the point at
- l rroT ~ which the instruction Is Inserted (i.e.. logic O -lo- logic I:
--0 logic I -to· logic OJ.

Note; In FBD, the Negate opera tion performs the same func tion as the NC contact in LAD.
The Negate in FBD also serves lhe some function as the NOT operation in LAD (i.e.. lo invert
lhe RLO or power flow ot lhe poinl of insertion.

212
Working With STEP 7 Programs and Doto

Bit Logic Instructions - Special Operations


This second group or STEP 7 bit-logic operations inclu des edge detection operations for
detecting positive and negative transitions. An edge con be detected in o specific address,
or in the status tha t results lrom a logic operation (RLO). that precedes the instruction. These
instructions ore useful for simply detecting a discrete transition, or when triggering another
operation (e .g., counter. arithme tic calculation, or move opera tion) that should only be
triggered on the transition from 0-to - l (posi tive edge), or from 1-to-O /negative edge).
The Se t/Reset flip-flop opera lions either allow the set or reset to hove priori ty w h en both
sig nals occur simultaneously. The mid-line outp u t instruction is what it soys; ii allows on ou tput
operation to be p laced at o poin t in the logic circuit other than al the en d o f the network. In
this way. logic duplication con be minimized. finally, th e Save output copies the logic slate
lhot p recedes the instruction lo the BR status b il of the C PU status word .

T0 ble 4- 11 . LAD/FBD B't . Instru c ti ons -


I - LOOIC s,oec1.0 I 0 1oerorion s
LAD FID Brief Descrtpffon
Mid-Line Output Mid-line Oulpu I Stores inlermediote result of logic operation (RLOI ror the
,., • ? .,·).,. . ')
logic circuit up to and preceding the point al insertion.
(, ) -
? ?. ? - ~
SAVE RLO to BR SAVE RLO lo BR Sovesresull of the preceding logic operallon (RLO), to
- ( SAVE} -
?? . ? -
Positive RLO
SAVE
I the binary result bit ol the status word.

Positive RLO Detects 0-l o•1 transi tion resulting from the preceding
Edge Defection Edge Detection logic operation [RLOI, An edge defection is signaled by
??.? ??. ?
the oulput going high for one CPU scon /single pulse).
~
(P} - f'
??. ? -

Negative RLO Negative RLO Detects 1-to-O transition resulting from the preceding
Edge Detection Edge Detection logic operation [RLOI, An edge detection is signaled by
..,., ,
.. .. ??. ?
lhe output going high for one CPU scon /single pulsel,
~
(N}- II
? ?. ?-

Set/Reset Sel/Resel Implements Set/Reset flip•tlop. giving priority lo lhe Reset


Flip Flop Fflp Flop function If bolh S ond R Input lines go TRUE
??_? ??. ?
SR slmulloneausty.
SR
s aL ,?. ? - S

... - R. ... -·a 0 -


Resel/Sel Reset/SeI Implements Reset /Set flip-flop, giving ptiorily to lhe Set
Flip Aof. FGp Flop runclion If bolh R ond s Input lines go TRUE
? •? ??.?
RS slmulloneovsly.
RS
R aL ,?. ?- R

... - S . .. - s 0 -
Address Negolive Address Negolive Detect a negolive-edge transition o f o specific bil
Edge Detec tion
??. ?
Edge Detection ~,,
.. .. address. An edge de tection is signaled by the output
IIEO going high for one CPU scan (single pulse).
HE-0
ol ??. ?- M BIT
- Q~

??. ?-!I BIT

Add1ess Positive
r Address Positive Detects o poillive-edge lronsllion of a specific bit
Edge Detection Edge Detection address. An edge delecllon 1s signaled by the output
??.?
POS
0 ~
?1,?
??. ?- M BIT
POS
Q
t going high for one CPU scan (single pvtse).

??. ?- II_B rT

213
STEP 7 in 7 Steps

Counter Instructions
The counter instructions include the Up counter, the Down counter. and the Up/Down
coun ter, whic h counts both up a nd down. The UP and Down counters ore implemented both
os box functions and os ou tput instructions. Box counter functions support the full funclionolity
of th e counter in o single instruction. a llowing the counter to be triggered, o prese t value
loaded. monitored. and reset. Th e UP and Down counter output opera tio ns simply support
counting. Separate instructions would be used to food o preset, or to reset o counter ou tput.
The compare operation would be used to check the current count value.

Each counter you specify, numbered CO, Cl, C2, and so on, will reference o single word in
the counter memory area. The exact number o f counters ovo~obte is CPU-dependent.

Tobie 4-12. LAD/FBD Counter Instructions Summary


LAD FID Brief DescrlpHon
Set Counter Output Whenever the driving logic lrat1sitions from logic O lo
,,,
Set Counter Coil ???
SC
logic I . lood lhe specined preset volue PV lo the
addressed counter.
- (s·c·)- ?? . ?-
??? , , , _ PV

UP Counter Coil UP Coun ter Output Whenever the driving logic tronsitions from logic O-to-
?? ., ??? logic 1, increment the specified counter by one count.
-(cu)- ??. ?- ~
DOWN Counter Coil DOWN Counter Whenever the driving logic transitions from logic O-to-
??? ??'! logic I . decrement the specified counter by one count.
- (co)- ??. ?-
CD

I
UP Coun ter UP Cout1ter Whenever the toglc lnpul line CU tronslllons from logic 0-
??? ??? lo- logic 1. increment the specined counter by one
5_CU I s_co count. Logic l on the reset inpu1 line R resets the counter
- CU Or - cu lo zero .

-S CVr -s CV -
=~ CV_BCD r
- PVCV_BCD

-R
-
0-

Down Cout1ter Down Counter Whenever the logic input line CO tronsitions from logic O -
??? ??? lo- logic 1, decrement the specified counler by one
-CD
S_ CI)
o
I - CD
s_co count. Logic 1 on the reset lnpul line R rese ts lhe coun ler
to zero.

-S t:V1
r -s CV -
- PVCV BCD -
-~ - R 0 -
UP-Down Counter UP-Down Counter For eoch loglc O-to- logic I tronsilion on the cu lnpul
??? '1?? fine. increment the specified counter by +I: tor each
s_cuo s_cuo
-CU 0
- - cu
logic O to- logic 1 transition on 1he CO lnpot line.
decrement the co11nt by+ I. Lo.g ic 1 on lhe reset Input
- CD CV - - CD line R resets the counter to i;ero.

~ s CV_BCD - -s CV -
- IV
- -
- PVCV BCD

- R. -R 0 -

214
Working With STEP 7 Programs and Doto

Timer Instructions
STEP 7 timers, ore based upon the STEP 5 implementation of timers, and os such ore referred
to as SS Timers. The instruction set includes five timer types. each o f w hich is implemented a s
o box function a nd a s o simple ou tp ut instruc tion. Bo x timers support the fu ll func lion otity of
the timer in o single instruc tion, a llowing lhe timer to be loaded with o p reset value, started ,
reset. a n d monitored. Timer ou tputs simply a llow a specific timer type to be started with a
give n preset value. Separa te instruc tio n s ore used to reset or monitor th e timer' s opera tion.

Ea c h timer you specify. numbered TO, Tl . T2. and so on. will reference o single word in the
timer memory area. The exact number o f timers available is CPU-dependent.

Ta b l e 4- 13. LAD/FBD BOX r1mer Instruc fions summarv


LAD FBD Brief Description

.,,,
ON-Deloy Timer ON-Deloy Timer
???
When lhe enoble input s tronsillons horn 0 -lo• I, lhe fim ei
s_oi>i- I s_o~t
storts timing ond continues lo lime unless lhe enable goes
raise or lhe reset input R transitions lrom O-lo• 1. The oulpul
- S o -s 81 -
BIi1
Q is o ctivo led ofter lhe p reset l ime hos elop$8d. ond sta ys

~ 'IV - 'Ill BCD - energized until lhe enable slgnol lronsllfons from I -lo- Oor
the timer is reset.
-R BCD r -R 0 -
OFF-Deloy Timer When the enable input s transitions from 0 -lo- I , the tlmet
,,, OFF-Deloy Timer
7,, output Q is octivotod. The timer storts ttming when the
I
-~ S_Off OT
or -s
$_0FFOT
-Bl
enoble signol S transitions from l -to- 0. The timer win run unto
the programmed delay expires, unless the reset slgnol R
-TV Bir - T\I BCD - transitions tromO-to- I . After the limed delay expires. the
timer oulpl.Jt Q Is de-activated. The output Q is also de-
- R BCD r -R 0- oc tivoted whenever the 1lmer is reset.

Retentive Re tentive When lhe enoble input S lronsitlons from O•lo - I . lhe timer
ON-Deloy Timer ON -Delo y Timer starts liming ond conlinues lo lime and continues to lime
1?? 'J')?
even ii lhe enable signol S lronsilions from I •to• O. If lhe
s_o1>rs I S_OOTS
enoble signal c hanges bock lo · l' before the timer expires.
-5 or -s BI - the ti mer wilt restart. The outpu t Q is o cllvoted oiler l he
- 'TV BIi -TV BCD - preset lime hos elapsed , ond remains o clivoled until the
timer is reset.
- R llCD r •R 0 -
Pulse n mer Pulse Timer When 1he enoblei nput S lransiliot'ls from O-1o• 1. l he timer
??? ??? starts timing and continues lo lime for os long os the S Input
s_PULSE I s.PULSE is ' I ·• or unm lhe pro91ommed detoy expires. WhDe the timer
-S 0 -s BI - isrunning. the oulput Q is octivotect for as long os the
enable signol S is octivoled. If the enable signol S returns to
- 'IV BI ~ - TV 8C1) - ·o· before the timer el(pi(es. the1imer ls stopped and lhe
output Q ls de-oclivo ted. Whfle the timer ls running. o
- R BCD r -R 0 - frohsifion from O-to- I on lhe reset fine Rresels1he timer.

Extended Extended When lhe enable input S tronsitlons fro m O-lo - I . lhe llmer
Pulse n mer starts timing ond con tinues to time until the programmed
,,, Pulse Timer
? ?? delo y expires, even if the inpu t S returns to 'O'. The output Q
s.PEXT
- !! or J
-s
S.f'EXT
BI - is oc livoled whenever lhe tim er isrunning. While lhe timer is
running. o transition from O-to- I on the reset line R resets
-TV BIi - TV BCD - the timer.

-R BCDr -R 0 -

215
STEP 7 in 7 Steps

Conversion Instructions
A conversion operotion changes the fo rmal or data type of a variable to a new format or
data type - generally before the dolo is further used. For instance, o value inpu t as BCD
must be converted before use in on integer arithmetic operation. Conversely. if the integer
resul t must be o utpu t to o BCD d isplay, then the value would need to be converted to BCD.
II on arithmetic or comparison is to be pertormed on the data stored in two locations. the
variables must be of the some data type or format to ovoid erroneous resul ts. Furthermore.
since STEP 7 a rithmetic opera lions ore only performed on integer. double integer or real
numbers. a variable not of these data types would require the appropriate conversio n.

Conversion operations include conversions for variables of data type INT (integer) and DINT
(double integer) variables. BCD numbers. a nd REAL numbers. There are a lso four opera tions
for converting a REAL number to DINT formal by rounding. These four operations differ in how
the number is rounded w ith respect to the fractional port of the floating-point number.

T0 ble 4-I 4. LA D/FBD C onvers,on Ins true tons ummarv r s


LAD FID Bdef Description
BCD to Integer BCD lo Integer
eco_, j BCl>_I When EN is al logic 1, convert lhe 3-digit BCD value o l
Ell ElfO .. . -a OIIT ~ ??? supplied ot IN too 16-bit INT vatue. Pul the result in the
location specified al OUT.
??? - nl our ~??? ??? - DI ENO ....

Integer lo BCD Integer lo BCD


, eco j 1_eco When EN Is a t logic 1. convert the 16-bit INT value supplied
1!:>l EllO , .. - D 01/T ._??? at IN lo a 3•dlgi1 BCD value from 000-999. Pt.JI the result h1

???- TII l;llfT ~ ??? ??? -Ill El/0 ....


lhe locotlon specified al OUT.

Integer lo
Double Integer Integer to
DJ
I DI
ElfO
I Double Integer When EN is al logic l . convert tho 16-bit INT value supplied
1_01 o l IN lo o 32-bil DINT value. Put the result in lhe location
• .. - £11 Otrr ....??7
???-DI OlfT ~???
specified al OUT.
??? - I l l EllO
--
BCD to BCD to
Double lnleger Double Integer
ec1>_1>1 I BCl>_DI
When EN is ot logfc 1, convert the 7-digil BCD valve
"Wpplied ot IN lo o 32-bit DINT value. Put the resvll in the
EN ENO ... - a 01.rr ,-777
lacotloo specified al OUT.
???- Ill OUT~??? ??? - Ill EIIO ....
Double Integer Double Integer lo
to BCD BCD
QI_BCO I C>J_PCD
When EN is at logic 1. convert lhe 32-bit DINT value
supplied ot IN to a 7•digit BCD value. Put lhe result in lhe
£If EJIO ' .. - !Ji our ....??? location $pacified 01OUT.
???-111 Otrr~??? ??? - !Ji ENO ...
Double Integer Double Integer
to REAL to REAL
Whe!'l EN is ol logic 1. convert lheJ2•bil DINT value
£If
DI.JI
£NO
I ... -Df
DI_R
OIIT ._???
supplied o t IN loo REAL value trtooling-pointj. Put the
result in lhe location specifled o t OUT.
??? -IN OUT ~??? ??? - 11l ERO ...
Note: When EN is' 1' ENO will also be • 1· except on error: then w hile EN is' l '; ENO is 'O'.

216
Working With STEP 7 Programs a nd Doto

Table 4- 15. LAD/FBD Conversion Instructions Summarv !Con tinued).


LAD PID Brief DescdpHon
Ones Complement Ones Complemenl
Integer lnleger
When EN Is ol logic I. complemenl or invert the
IJJ
ltlV I
- El!O
I .. . - EH
INV_I
OUT r-???
integer value supplied o t IN and put the resutt in the
locotion specified ol OUT.
???- DI ourl??? ??? - m IDIO ...
Ones Complement Ones Complement
Double In teger Double Integer
When EN Is al logic I. complement or invert lhe
Etl
IIIV_OI
EJIO
I ... - 'EJJ
INV_ DI
OUT ~ ???
double integer value supplied at IN ond put the result
in the location specified of OUT.
??? - IJI ourl??? ??? - nl E>IO ...
Negate lnleg er Negate Integer
When EN is a l togic l. negole the integer value
EN
HEG_!
EIIO
I . . . -EN
tl EG_I
supplied ot IN [change sign of volue; positive-lo-
01IT r-???
negative. negotive-to-positiveJ. Put the result in the
???-lN ODTl??? ??? - IN ElfO ... location specified ot OUT.

Negate Double Negate Double


Integer Integer When fN is o1 logic I , negate the double integer
11 110_ 1>, I . . . - 1:N
IIEGJ)J value suppfied ot IN (posili11e-to-negative. negative-
ID EIIO lltrr ~ ,?? to-positive). Pul !he result in the local Ion specified ot
OUT.
11? - m ourl ??? ??? - m EHO ...
Negole REAL Negate REAL

EJJ
11110_ 11
EIIO
I ... -
IIEG_ R
Ell OUT ~ ? ? ?
When EN is al logic l . negate the REAL value supplied
at IN (posilive-to-negolive. negative-to-positive). Put
!he result in the location specified ot OUT.
???-IJI OUTl??? ??? - DJ EJIO ...
Round lo Round to
Double Integer Double Integer When EN Is al logic 1, convert the REAL value
ROUrlO I ROUND supplied al IN to Integer by Rounding lo nearest
Ill E110 ... - E!J OUT ~? ?? Double lntege< value. Pvl the resull In the location
speclfled al OUT.
???-DI ourl??? ??? - m DIO ...
Truncate Trunco le
Double Integer Po/I Double Integer Port When EN is of logic I, convert lhe REAL value

l:fl
TRUIIC
ENO
I . .. - EJJ
TIIOIIC
OUT --???
supplied ot IN lo Integer by Truncating the fractlonol
port of the REAL volue. Put the resul t in the locolion
specified ol OUT.
•??- IJI OIITl ??? ??? - !ll !110 ...
Celling lo Ceiling lo
Double lnleger Double Integer When EN is ol logic I. convert the RfAL value

EH
Cl'll
!VO
I ... - EN
CEIL
OUT r--???
supplied al IN lo DINT 1/0lue by Rounding lo lowesl
DINT value greoter•lhon-or•equct lo IN. Put the resull
In the loco lion specified al OUT.
77?- lll OIJTk777 ??? -IN ENO ...
Floor to Floor to
Double In teger Double Integer When EN is at logic I. convert !he REAL value

Ell
FLOOR
E:110
I fUJOR
our - ???
supplied a l IN lo DINT value by Rounding to hig hest
.. • - EN DINT value tess-lhon-or-eQuol to IN. Pul lhe result In
the location specified a l OUT.
??? - I ll OUTl ??? ??? - IM !NO -
Note: Wh en EN is •1• ENO will also be ' l ' except on error: then while EN is • 1·; ENO is ·o•.

217
STEP 7 in 7 Steps

Integer and REAL Arithmetic Instructions


STEP arithmetic inslrucllons support the lour bosic arithmetic operations of addition,
subtraction multiplication, and division on numbers of data type INT (inlegerJ, DINT (double-
integer). and REAL (floating-point). In STEP 7, real numbers a re represented in IEEE floating-
point form a t- therefore; the terms REAL and Floa ting-Point are often used interchangeably.
These instru c tio ns allow the con trol program to perform basic production accounting, and
the ability to solve simple a lgorithms for control, diagnostic, or other p urposes. While the
DIV_DI instruction p roduces the normal quotient result. the MOD_DI operation produces the
remainder port of the quotient as the result.

Table 4-16. STEP 7 Integer and REAL Arithmetic Instruc tions


LAD/ FBD Arithmetic Instructions Using Data Type

INT DINT REAL


Permissible Range Permlsslble Range Pem1issible Range

Operation -32.768 to -214.783.648 to t 1.7549Se--38 to


+32.767 +214.783.647 ± 3.40'l823+e38

Addition AOD_I ADO_OI ADD_R

S11btroction SUB_I SUB_Dt SUB_R

Multip&catton MULJ MUL_OI MUL_R

Olvislon with Quotient Result DtVJ DIV_OI OIV_R

OlviSion with Remainder MOD_Dl


- - -

Ari thmetic opera tions ore performed o n the values specified ot INl and IN2, p lacing th e
resull I lhe loca tion specified at OUT. The orilhmelic operation is a lways relative to IN l (e.g.,
DIV_R; IN 1divided by IN2). A cceptable values. as shown below, include constants within the
valid range, the con ten ts of absolute memory locations, or declared variables of the correct
data type. If absolute memory locations ore supplied, the correct memory wid th must be
specified (i.e.. word. double word). In any case. the contents of the specified memory
localions or variables must be of the correct data type and fall within th e permissible range.

Tobte 4- 17. Exomote LAD/ FBD tnteaer, Double lnteaer. and REAL Addihon lnslruc tions.
IN1/IN2/0UT INT DINT REAL

I I
- -,!11
A00 j
-i:wo --Elf
ADO_DI
&I/Or - -EN
Al>D_R
.ENO

??? - ml OUT I??? ???- INl DUTIi ???


---~I
,77-m2
- - - ~I
???-IN2

Constants -32,768 lo -214, 783.648 to ± l.75495e-38 lo


~n permissible range) +32,767 +214,783,647 ~ 3.402823+e38

IW 28 1D 28 ID 28
S7 Memo,y Locations Q W42 QD42 QD42
(Absolu te or Symbotrc) MW 54 MD54 MD54
DB6.0BW l2 D86.DBDl2 DB6.DBDl2

#Volue_l #Value_! 1/Volue_l


Declared Votiobles #Volue_2 I/Volue_2 /!Volue_2
(of correct dote type)
#Tolol #To to t #Toto!

Note: Wh en EN is' 1' ENO wilt also be ' I ' except on error: then while EN is' 1'; ENO is 'O'.

218
Working With STEP 7 Programs a nd Doto

In addition to the fou r bosic a ri th metic opera tions. the STEP 7 instruc tion sets include standord
ma the m atical function s, as listed in the ta b le below. These operations in c lude functions for
finding angle ond rodion measurement. absolute value. squa re root. square of o number.
na tura l tog of o number. and finally. o function to determine l he exponent of o number wi lh
a rad ix of base e. In th e STEP 7 p rogramming software , t hese o p eration s ore lo cated in the
floating-point folder of th e Program Elements lob.

Tobie 4-18. LA D/FBD: Standard Math Functions {REAL numberaoera tio ns).
LAD/ FBD Name Brief DescrlpHon
SIU I Sine When lhe EN signol is ot logic 1. find lhe Sine of lhe REAL volue
EN mor. (rodion angle) supplied at IN . Pu t the resulf in location
specified ol OUT.
???-IH OUT r???

cos I Cosine When the EN signor is o f logic 1, find the Cosine or the Ri:AL
EH l:NOr/ value (rodiao o ngle) supplled o l IN. Pul result in locotlon
specified o t OUT.
??? - IH OUT,???

TA U I Tongenl When the EN signol is ot logic 1, find the Tangent o f the REAL
!!l
ENOr value (radian a ngle) supplied a l IN. Put the resull in location
specified al OUT.
???- Ill our ,111
AS1~ I Arc Sine When the EN signal is a l logic 1, find the Arc Sine of lhe v alue
EJl ENOr. supplied o t IN (- 1 to+ I J. Put ongle result jrodiansJ In tocolion
specified ot OUT,
???-W OIJT ,???

ACOS I Arc Cosine When lhe EN signal is al logic 1. find the Arc Cosine of the
EN l:NOr/ value supplied at IN (-1 to + I ). Put ongle resull [radio ns) in
location specified o t OUT.
??? - J'N OUT,???

A TA U I Arc Tongent When the EN signal is ot logic 1, tind the Arc Tangent of the
tlJ ENO r✓ value supp lied a t IN. Put angle resull (rodianstin locolion
specified a l OUT,
??? - lll OIJT r ???
Absolute When the EN signal is at logic 1, find the Absolute Va lue of the
tlJ ABS ENOI Volue volue supplied o l IN. Put the resull in location specified o t OUT.

??? -Ill 011l'~??7

SORT I Square Root When the EN signal is at logic 1. find the Square Rool o t the
EW ENOr value supp lled a t IN. Pul lhe result in loca1ion specified a t OUT.

???- Ill Ol1l'1 ???

$OR I Squore When the EN signal is ot logic 1, lind !he Squore of the value
EW tNOr supplied ot IN. Put the result in location specified ot OUT.

???- Ill OUTr???

Noturol LOG When the EN signol is ol logic 1. find the Nolurol Log of the
tN LIi ENOr votue supplied a l IN . Pul the result in location specified a t
OUT.
???-IN our r~?

EXP I Exponent When the EN signal is at logic I. find lhe Exponent of the v alue
llJ !:NO r✓ supplied at IN. Pu t lhe result in location specified at OUT.

???- Ill Ol11' 1 ???


.
Note: Wh e n EN is ' 1' ENO will also be ' 1' except o n erro r: then w hile EN is · 1·; ENO 1s 'O' .

219
STEP 7 in 7 Steps

Compare Instructions
STEP 7 compare Instruc tions a llow compa rison o f integer (INT). d ouble-integer (DINT). and
REAL (floating-point) values. There ore six compare typ es. each of w hich may be performed
using each o f the three numeric data types (i.e .• tNT. DINT. REAL). Th e c o mpare tests inc lude
equa l. not equal. less fhan . greater than. less than-or-equal. and greater- than-or-equal.
Compare opera tions o re often used fo r range chec king . set point c ontrol, or limit checks on
calculations.

Table 4-1 9. LAD/FBD Compa re Instructions Summary.


LAO/ FBD Compare Instructions Using Doto Type

INT DINT lEAl


Pen 11lsslble Range Permissible Range Permissible Range

Compare Test -32,768 lo ·214,783,648 lo ± 1.75495e-38 to


+3-2,767 +214,783,(>47 :1: 3A02S.23+e3a
'

Equd CMP==I CMP==D C MP=R

Not Equal CMP<>I


- CMP<>D
- CMP<>R

Les.s Than C MP <I C MP <D CMP <R

Greater Than C MP >I C MP >D CMP >R

Less Thon or Equal C MP<=I CMP<a:-D CMP<;R

Greater ThQn or Equot C MP>:al CMP>=D CMP>=R

Comparisons allow decisions b ased on the o utcome of the specified compa rison o f the
va lues input at INl and IN2. The compare test is always rela tive to INI (e .g., CMP>I; IN I > IN21.
Accepta ble values, as shown below, inc lude constan ts within the valid range o f the data
type. the contents o f a bsolule memory locatio ns. or tocol varia bles decla red in a code
b lock. ti absolute me mory locations ore supplied as the inp ut va lues, then lhe correct
memory wid th must be specified (i.e .. word. doub le word). In a ny case. the c ompared
va lues must fo ll within the permissible number range of the data typ e being compa red .

. . amoe
Ta b le 420Ex I LAD/ FBD In teoer, D OU bl e In Ieoer. an d REA L C om oare E:QUO I Instrue f,ons.
IN1 /IN2 INT DINT IEAL
CtAP -1
I_ Cr,IF>.,. I>
I CUP - R

? ??- INl ? ?? ~ I.Nl


~

???- Dll
'-
??? - lNi! ?? ? j l112 ???-lll2

Cons1onts -32.768 to -214.783.648 to ± I .75495e-38 to


(in permissible range) ..32.767 +2 14.783.647 ± 3.402823+e38

IW 28 ID 2a ID28
S7 Mem O()' locotions QW 42 QD42 QD42
(Absolute or Symbolic) M W 54 MDS4 MD54
DB6.0BWl2 DB6.DBDl2 OB6.DBDl2

Declared Voriobles #Volue_l itVotue_l #Volue_l


(or correc t doi o type) i/ Volue_2 11Votue_2 #Volue_2
Note: Symbolic add resses may b e substituted fo r a bsolute a ddresses.

220
Working With STEP 7 Programs and Doto

Program Flow Control Instructions


Progrom flow con trol insfruclions. provide one o f the ways in which you con conlrol how your
program is processed. tn short. you will be oble to a lter the way in whic h the CPU p rocesses
your program so !hot p rocessing needs ore serviced on on as-needed basis. Overall. these
instructions con be used to c reole o more efficient and more organized program, reduce
lhe processor scan time. and in some coses may be inserted lo troubleshoot sec tions of the
control program. a nd th en toter removed.

In both the LAD ond fSD instruction browser. the Jump o nd Lobel instructions ore grouped
with so-called " Jumps" operations; Moster Control Relay, Call. and Return instructions ore all
grouped with ''Progra m Control'' operolions; and Open DB Coil. is under "DB Coll." For the
purposes of our d iscussions, all o f these instructions ore grouped together os "Program Flow
Control Instructions."

T0 b le 4- 21 . LAD/FSD Pronrom Fl OW Con tro I Ins Irue I'ions summorv


LAD FBD Brief Description
Lobel Lobel Four-chorocter label defining a network lo which a JMP or
JMPN direc ts progrom execution. Combined with jumps. ollows
??? ?•? skipping of portions of logic.

Jump Jump Causes lntemol block fump to labeled nelwort based on


??? ??? conditional or unconditional logic. The jump deslinotion Is
-(JMP)- specified by label oddress specified above the JMP outpul.
...-~
Jump-it-NOT Jump-if-NOT When the conditional logic is ot logic O (RLO = OJ, on intemol
???

~
block jump is direcled lo the oolwork identified by the label
-(JMl'N}- address specified above the JMPN output.
??. , _

MCR Activate MCR Acllvole This uncondilionol output. when encountered. enables the use
- ( MCRA}- !IICRA of MCR zones up lo the poinl of the next MCR Oe-octivate
I instruction. Paired wilt, MCRD inslruction,

MCR Oe-Aclivote MCR De-Activate This uncondjtlonal aujout. when encountered, disables the use
- (MCRD }- MCRI> of MCR zones up lo the polnl ol lhe next MCR Activate
I instruction. Paired with MCRA instruction.

MCR ON MCR ON This t;Qnditlonol output, when activated by the driving 1ogic.
- (MCR<}- ,, ,_
. . .. \
MCR<
I
begins on MCR zone- Paired with MCR•OFF (EndJ instruction,

MCR OFF MCR OFF This unconditional output. when encountered. ends on MCR
- .( l'ICR> }-
_::_J zone. PoireO with MCR-ON (Begin) instrucHon.

.,., ,
Coll Block Coil Coll Block ,,, When the driving logic [conditional or unconditionol} is at logic
l, lhe referenced Function fFCJ Of System Funclion (SFC).
- (c·A-LL}-
• • •- ~~L I having no formal porometers. is called for proces.slng_

,,,
Open Dalo Block Open Doto Block
???
When this uncondilionol lnsfruction Is encounleted, the shared
doto block (OB) referenced above the instruclion is opened.
-( oi>i1)- OPII
I allowing data access to !he doto localions.

Return Coit Return Output When the condllionol loglc driving this output is !rue. execvtfon
- (RE"r)- ,, ,_
- - ..
RET
1
of the cu1Tent block is terminaied and control is.returned to the
colling block; otherwise continue with the following network_

221
STEP 7 in 7 Steps

Status Bit Instructions


S7 controllers genera te a variety of status condi1ions Iha! result from soflwore operations.
These status bits. whic h ore combined into who! is referred to as the CPU status word. ore
used by the CPU in controlling binary logic opera tions (e.g .• AND/OR relay logic). and set by
the CPU as a result or vario us digital operations (e.g .• compares. arithmetic , conversions, shiff.
ro to te. a nd word logic). Although the CPU sta tus word is no! directly available to the user
program. it is mode available indirectly using the status b it instructions of Table 4-2 l.

In LAD, these inslruclions ore implemented as no rma lly-open and normally-c losed contacts
!hot may be cornbined wi th o tt1er instructions. Just as the standard NC contact allows an
inverse conditio n l o be examined. use of the normally-closed status bit instructions allow you
to check !he inverse co nd ition of each status b it. For example. w he n the normally-closed
con ic.ct of the "result b it greater than zero," is used o zero status wilt allow power now
through the contact. In FBD these instructio ns ore available with positive evaluation only. You
may combine these instructions with the ·negate RLO' instruction to examine for the inverse
status bit result. Status bit opera tions may a lso be combined with other bit opera tions.

Tobie 4-22. LAD: Status Bil {Result Bits) Ins tructions Summarv.
LAD lnstrucllons
Name Brief Description
NO NC
BR BR Slnory Result Bil Use 1he NO contocl to check the SR bfl for logic l to ollow
- I t- -VI- power flow: use NC BR bit to check for logic Oto allow power
Row.

uo uo Unordered Bit Check if previous floating-point operation involved ot least


-I f- -VI- one lnvolfd {Unordered) flooHng-point number.
av OV Overilow Bit Check if previous moth operation resulled in o volue ou tside
-I f- -VI- of permissible negative or positive range.

OS OS Overflow Bfl Stored Check if previous $8ries or moth operotions resulted in o


-I t- -VI- value outside ot the permissible range.

>O >O Greoter Thon Zero Check result of previous moth operotion for greoter Ihon
- I I- -Vl- Result Bil zero.

<0 <0 Less Thon Zero Check result ot previous moth operation for less than zero.
-I t- -VJ- Result Bil Combine fn series or porollel with other conlocts.
::>eO >~O Greeter Thon Check resull or previous moth operation for greoter-thon-or-
- I t- - V}- or Equal Zero equal zero.
Result Bil

<•0 <•0 Less Thon Check result of previo11s moth operation for less lhon or equal
-I I- -Ill- or Equol Zero zero.
Result Bit
==O ==O Equol Ze10 Check result of previous moth operation for equal zero.
- I t- -l/1- Result Bil
<>O 00 Not Equol Zero Check result of previous moth opero1ion for not equal zero.
-I t- -J,/j- Result Bil
Note: These some instructions imple me nted in FBD a re represented in a box. In STL. these
operations ore implemented as Jump instructions (i.e .. jump to label). allowing internal block
jumps based on the sta tus result bits.

222
Working With STEP 7 Programs a nd Doto

Word Logic Instructions


Word Logic operations allow you to perform standard Boolean operations of AND. OR and
Exclusive OR on two word ( 16-bit) locations or two double-word (32-bit) locations. These
instruc tions ore quite useful in performing diagnostic c hecks on machine or process stoles.
Thro ugh the use of these instructions, the desired sto les or the resulting word or double word
loca tion co n be masked in (set lo ' I '). using the OR opera tion; or masked our (set to 'O'J.
using the AND opera tion. II is a lso possible l o invert m ultiple bils of the result o r to dete<mine
whal bits differ from an expec ted bit p a ttern, using Iha XOR operatio n.

Ta b te 4-23 • LAD/FBD Wo rd LOO .IC Ins IrUC I'ions Summorv


LAD FID Brief Description
AND Word AND Word When the EN signal ls at logic l . perform obit-by-bit
WANl)_\N
.EU ENO
I '#Allr,_w • tog.icol AND on lhe two 16-bil values supplled ol
(IN1 / IN2). Pu! result in the location specified at OUT .
. . . -Eli

? ?? - INl OUT ~ ? ? ?

??? - IB2 ??? - IN2 EJIO

OR Word OR Word When the EN slgnal is ot loglc 1. pe1r01m o bll-by-bit

Ell
WOR w
ENO
I ' ... -
WOR_W
£11
logical OR on ihe two 16-b1t values supplied ot
(IN1/ IN2), Put resull in llie location specified at OUT.

???-ml o11t' L:? ??? - INl OUT ~ ???

??? -W2 ??? - IN2 EWO

Exclusive OR Word Exclusive OR Word When the EN signal is al logic 1. perform a bil-by-bit
I logical XOR on the two 16-bit values supplied at
WXOR
.ED :tNOr
w
... -
WXOR_W
!:II (IN1 / IN2). Put result in the location specified at OUT .

??? - I lll 011T' ~ ??? ??? - Ilil OUT I-???

??? - Dl2 ??? - IN'Z ENO

AND Double-Word AND Double-Word When lhe EN signal is ot logic 1, perfom, obit-by-bi t
WANO_DW 1 WAIID_l)VI/ lQgical AND on the two 32-bit values suppUed at
!:II !NO ;, .. ' -tll (IN 1/IN2 1. Pul result In the location specified al OUT.

??? -Illl OlJT - ???

???-1112 ??? -Dl2 ERO

OR Double-Word OR Double-Word When the EN signal Is al logic 1. perform o bit-by-bi t


WOR_DW
!:ll !NO
I -;, . . . -Ell
WOR_r,w logical OR on lhe two 32-bil values supplied at
(IN1 / IN2). Put result in the location specified at OUT .

??? -IJll OlJT - ???

??? ~ Ill2 ??? -Dl2 ERO

Exclu~ive OR Double• Exclusive OR Double- When the EN signal is a1 logic 1. perform a bit-by-bit
Word word toglcol XOR on the two 32-bil values supplied ol
wx,oR_ow
!:11 ENO 7
I .. , -Ell
w;x.oR_ow (IN1 / IN2). Pu! result In the location specified at OUT.

??? -Illl
= ~???
??? - Ill2 ??? -Dl2

Note: Wh en EN is' 1' ENO will also b e ' 1' except on error: then w hile EN is' 1' ; ENO is 'O'.

223
STEP 7 in 7 Steps

Shift-Rotate and Move Instructions


Shift and rotate opera tions move the bit data or a specified word or double word location to
the lert or right. These instructions ore orten used in materials conveying oppticotions where
information on discrete ports must be frocked for some dislonce. while the product is in
motion, and usually prior to performing a secondo,y operation.

The move operation copies data from one memory location lo another, leaving the source
unchanged. Often. data is moved too new locofion either prior to performing on opera tion
or just ofter on operation hos been performed. in order to preserve the doto. Changing a
timer prese t, a process set point, or saving and stacking data for transfer to another device.
all ore coses where move operations might be used.

Tobie 4-24. LAD Shilt-Rotate and Move Instructions


LAD/ FID Name lrfef Description
Shift left Word Shifi lhe 16-bils of the Word specified ol IN , by n-bits lo the
le ft.

Shift Right Word Shift the 16-bils of the Word specified ot IN, by n-bils to the
righl.

s~i_plli' Shift Left Shift the 32-bits of the specified Double-Word, by n-bits to
- !ll ll'IO
Double Word the lefi.

???- ti

Shift Right Sl11ft 32-bits of the Dovble-Word specined ot IN, by n-blts to


DoubfeWord the right.

l
- EN !I Xlr ROt_,OW Rotate Lefl
Double Word
Rotate the 32-bits of the Double-Word specified ol IN. by
n-bils lo the left.
??? - Iii 011T r ???

???-! _ ]

Rolale Righi Rotate the 32-blts of the Double-Word specified al IN. by


Double Word n-bits bits to the right.

- ED
S~R.I
mo
I Shilt Right Integer Shift the 16-bils bits of l he Integer value specified ot IN. by
n-blts lo the right. while mointolnlng lhe sign bll.
?n - tu o]urj ???
'!?"! - 11

Shilt Right Shift the 32-bits of the Double Integer value specified ol IN.
Double Integer by n-bits to lhe right, while mointoinlng sign bil.

Move word Copy lhe variable specified o t IN lo lhe location specified


ot O UT.
??? - l U Ottr - ??"J

224
Working With STEP 7 Programs and Doto

Comments on Working with STEP 7 Programs and Data


The programming tools and software resources of STEP 7 ore designed to facilitate the
development of a well-planned and organized program - a program tho I con be easily
storied and later maintained. Ta sks associa te d with developing your program with STEP 7 ore
lruly stroigh tforword and simple. If thoughtfully designed and developed. the program will
process etticien lly and correclly. and ollow easy interpretation of b loc k opera tions and flow.

In the remainder of this c hapter. examples of develop ing blocks and using the STEP 7
programming Instructions ore presen ted in o step -by-step manner. Regardless of the size of
your control task, you con accomplish the required tasks by b reaking the job into smaller
tosks. The following checklisl wm aid in this regard a s well as in highlighting major
development steps.

Checklist. Working with STEP 7 Programs and Data


• Define mofor technological/functional unils of the machine/process.

• Define subtasks of each machine/process unit, Including inputs and outputs.

• Specify one or more blocks (I.e .. FCs, FB.s, etc.) to handle each subtask.

• Determine da ta block required by eoch block (i.e .. global D&. instance D&J.

• Deline control /ogle for each device/operation of a logic block.

• Assign absolute addresses to lnpu"ts, Outputs, Timers, and Counters.

• Assign symbolic addresses lo Inputs. Outputs, logia and data blocks.

• Denne preliminary allocation of bi/ memory for each roglc block.

• De/ermine defau// language {i.e .. LAD/FBD(STL) for creating blocks.

• Create and enter dolo for each global data block.

• Develop code blocks, creating con fro/ logic for each task (i.e., each device
or operation}.

• Determine /he processing requirement {how often ond from which 08) of
each block (i.e., start-up only, cyclical, periodic in teNol, on interrup t, error
reaclion, etc.).

• Downfoad and test each block separately by ca/ling the block from OB I.

225
STEP 7 in 7 Steps

Viewing and Editing Symbolic Addresses


Basic Concept
Sym bofic addresses o re a lphanumeric names assig ned to the absolute addresses in your
progra m. using the Symbol Editor. Whereas symbols c reated in the symbo l table may b e
a ccessed a nywhere in lhe progra m a nd o re considered g lobal, Loco/ Sym bols. re fer to
names given to the variables assigned in the declo ration table o f a b lock. The use of local
symbols is restricted to the b lock where they were d eclared. When you use symbolic
addresses in the program or in a monitoring to ol. g lo ba l symbols must be e nclosed in double
q uotes (e.g.. ''Mator_l "), and local symbols o re preceded by a p ound sign (e.g.. #Value_A).

Essential Elements
To c reole o symbol address is to assig n o meaningful name (24-characters max.) as o
substitute for on a b solute a d dress. Yo u may a ssig n globa l symbo ls to all S7 memory area s
(See Tobie 4-5) includ ing Inputs (1), Outp u1s (Q). Bit Memory (M). n mers (T), Counters (C),
Peripheral Inputs (Pl). and Peripheral Outpu ts (PQ) . Addresses assigned from these a reas may
include b it. byte. word. and d ouble word locations. Symb o l add resses may also be a ssig ned
lo c ode S7 blocks (e.g .. FB. FC, OB, SFC. and DB). You may assign symbolic a ddresses lo
blocks in the symbo l ed itor or in the b lock p roperties d ialog when the b lock is first c reeled or
lo ter.

Application Tips
Symbol a ddresses are on add itio na l aid in viewing a nd und erstanding your program. The
ed itor c a n be started from the SIMA TI C Manager. by d ouble-clic king o n the Symbo l Table
objec t from the LAD/ FBD/STL editor menu: or from w ithin the Mo nitor/Modify tool. while
editing a Va riable Table (VAT). For fast entry of symbolic names for 1/0 mo dule a ddresses.
consider entering these from the Hardware Configuro lion tool os you insert each module.

M,li@1%4!-\Hi1i•.P•i-il#f41 1fi,j,jnftB4!t!l(!kjlwi,@u\.:llli
Symbol Table Edi; fnseft View Options Window Help

.;i New_prj\SJMATtC 300(1 )\CPU 316\57 ....\ Symbol~


,. - lt!f XJ
S mbof Address Da1a e Co ....
1 TANK A LEVEL I 20.0 BOOL Level Sensor Tank,...__,
2 TANK B LEVEL t 20.1 BOOL Level Sensor Tank 8
3 VALVE TANKA Q 401 BOOL Main Valve Tank A
4 VALVETANK B Q 40 7 BOOL MainV alve Tank B
5 MAIN BLOCK OB 1 OB 1 Main Cyclical Progra
6 TANK 1 LOGIC FC 1 FC 1 Tank A Control Logic
1 TANK B LOGIC ,FC 2 FC ,c=_ 2 _ _T'""a-'-nk B Control Logic
8
-
LOOP A CONT FB 10 FB 10 Tank A Loop Control
9 LOOP B CONT FB 20 FB 20 Tank B Loop Control
10 ...

Figure 4·30. STEP 7 Symbol Ed itor. for assigning symbolic labels to S7 memory addresses.

226
Working With STEP 7 Programs a nd Doto

Quick Steps: Viewing and Editing Symbolic Addresses

ACTION

1 From the SIMATIC Monager, open the correct the project and select the Program in
which you wish lo creole new or edil existing global symbols.

2 With an S7 Program folder selected, from the right pane o f the project window
double c lick on the Symbols object. or right click on the object and select Open
Object. The symbol tab le is presented like a spreadsheet, with a column tor Symbol,
Address, Data Type , and a Comment.

3 Click in the Symbol field and enter up lo 24 characters for the symbolic name: click
in the Address field and enter the a ssocia ted absolute address: click in the
Comment field and enler a descripllve comment of up to BO-c haracters. The dala
type of each absolute address is a utomatically inserted.

When done wilh entering symbolic addresses. from the menu selec t Symbol Table ►
Close.

227
STEP 7 in 7 Steps

Creating a Data Block


Basic Conc ept
To c reole o new doto block is to generate o new DB object. The new DB object is essentially
o container used to store data for your process and program. Recall. that there ore two
types of dola b locks - Shored DBs, which con be accessed by any of your program blocks;
and Instance DBs. each ossocio ted with o specific Function Block {FBI as required memory.

Essential Elements
Doto blocks ore comprised ol lwo sections; lhe block header, and variable declara tion.
When you generate o DB, the header dialog allows you to define attributes of the doto
block, including whether it should be on Instance or Shored DB. Once o shored DB is
generated, you may open the block to define and initialize the data elements. When you
create on insta nce DB you will simply assign ii to on olreody existing FB.

Application Tips
Each FB you create will require an instance DB. You should c reole the FB and define the
declorollon tobte before creotlng the instance DB. When the Instance DB is crea ted and
a ssigned to on existing FB, the structure of the declo rotion oreo of the FB (i.e., static voriobtes.
and fo rm al parameters only), is wrilten to the instance DB. In this way. the static variables and
the actua l parameters ore stored in the DB on each instance the FB is called.

~SIMA Tl[ Molld1l~' - NewProJ 1!11~ 13


I
Ae Edt ln<ftt PlC v.ew Op(ions Wlndo-11 Help

DI ~11 7.-,IIWI 1
fe' ~, A.A.1:-~h::: rm uJ! 1<Nor.te, ,
:;, ., 1-:'
•I
- 0 X
S11>t<m dblo
o7 Oloct ► 1 o,,pi,4tion 81ock
I ZRr.clic,,Block
J fU'lc110!1
S,,"llt<:I f~le
f.·mnoL:,ou,~
Soata Type
, ~ SIMATIC300(21 6 vi.ll:l:llo Table
~ SIMATIC 300(31

InsartsOal:a Blod<.at thecusor posibcn , "



Figure 4-3 1. Generating o new 57 Doto Block from th e SIMATIC Manager.

Properbes. - Onta Uloc:k

Geneial -P.i,11 IGer,er4 • Pa:t 2] Cob I At!JW.,.I


M-11ndl)lpo: loe1 lstwod DB 31
ji,ntdc Noma: -----irr;lnill!l!,
rt , MnD ci!!eli:
\ --,
Sllf!td.CO-nl
Creed" ' ~ loe
f'r~l paltr
S101.-00 loe.,b011
o/ Plo,:,l:t IC:\Pa11\Cll\S7_P1oiilclt\Ne,,,P,01
Code lnt~loce
Dote aelllDd 12112/lOO,I 1:25.31 PM
t.a..l mpdlied' I 2112/200,I 1:.'5:31 Pt.I 12/12/20'.l4 1:25:31 f'N

l.l
I
Cgm0>!11t

~
OK I
Fig ure 4-32. Dalo Block General Properties Port-I: Shared DB Selec ted.

228
Working With STEP 7 Programs a nd Doto

Properties - Data Blodc

10020 Ilnitarice DB i.1 IFBl i.1


Symbol Cwimerit
r ______.:. :. . .__-il,~ci~smii,.....J
Created ,n L~a~; [DB
f'h¥,ct p~lh:
Sl01oge loeabon
°' f)!oject
IC·\Patook\S 7_Projectc\Niw;Piaj
Code lnleiface
Dale et&ateci 12/12/2004 209:1~ F'M
Latlmodlic,d, 12/12/2004 209:1~ PM 12112/2004 2:09: 14 Ft,t

.:.1
d
I OK I Cancel !__Help-'--_.
Figure 4-33. Doto Block General Properties Port-1: Instance DB Selected.

Quick Steps: Creating a Data Block

ACTION

1 Open the p rojec t and select the Blocks folder of the program in which lhe new
dole block is to be inserted.

2 From the menu, select Insert ► S7 Block ► Data Block, lo generate the new data
block object. The block properties dialog is opened lo the General Port-1 lab.

3 In the Name and Type field. the next availab le DB number is placed in lhe left
field . Use either the next available number or type in a new DB number (e.g .. DB
10).

In the adjacent field. to the right of the DB number. selecl the drop arrow and
c hoose Shored DB or Instance DB. based on lhe DB type you wish to creole.

4 If Instance DB is chosen as lhe DB type, press the drop down arrow in lhe right-
most field, and select the FB number to whic h the DB should be assigned.

5 Nex t. in lhe Symbol Name field. enter a label for lhe DB (up to 24-characters). The
symbol name is entered into the Program' s symbol table a s a substitute address.

6 In the Symbol Comment field. enter a descriptive commen t of up lo 80-


c haraclers. The comment will appear with the symbol in lhe symbol table.

7 In the Comment Field below. you may enter a descriptive comment tor the entire
data block. perhaps describ ing ils main use in the application.

8 On the General Part 2 tab, an Instance DB will be assigned the same header (i.e ..
Version, Family, elc.) information of the FB to whic h ii was assigned.

9 Press lhe OK button to confirm lhe DB header entries and lo generale lhe new
DB.

229
STEP 7 in 7 Steps

Editing a Data Block


Basic Concept
When you created data b locks for the first lime, you may hove created both shored DBs and
instance DBs. The initial data structure and content of each instance DB you created was
initialized by the editor when you assigned the DB too specific function b lock. On lhe other
hand. shared DBs will con tain process doto tha t will be available to any of the blocks o f your
program (for reading or writing data). You will determine the data organiza tion and iniliol
values for each data element of these shored dote blocks. If the dole blocks you wish lo
work wilh already exist. then you may insert lhe initial dala or edit the current data contents.
Essential Elements
A DB. like olher blocks, con be edited offline or online. and may be opened from the
SIMATIC Manager or from lhe LAD/FBD/STL editor. In either case, when you ore done editing
the DB you con determine whether it is stored ollllne, onllne. in bolh places, or simply
discarded. Variables are entered in the declaration table of o dolo block in the same
fashion as the wilh logic blocks. This initial editing is done whUe in the Dec/oration View ot the
editor. For each variable. you musl assign a Name and Data Type; on Initial Value and
Comment are optional. Structures and arrays ore also entered in lhe some fashion as in logic
blocks.
The variable dote in a dala b lock may include both process conslants and variables. Some
votues w ill be written lo by your program while the system is in process. If you need to edit the
actual values of DB variables al some Icier poinl, you will need to switch lhe editor to the
Dalo View. Furthermore, al some point you may also wish lo reinitialize lhe en tire dola block.

!J.stMA TlC Manauer - r<~wPruf 8@E3


!',le Edt lnsffl f'\.C Yl//N/ OpUans wh:b,1 Help

~NeM'rot ·- D:\Sl_projtets\,Ne- j DNLINf - IOL~


No,,P1q Sv,tom dal• d N..,P,oi 8'. Sy,lom data
liii) SIMATIC 300(1) O OB1 S IMi] SIMATICJ00(1) 0 0B1
8 (9 CPU316 OFCl 8 j) Cftf 316 O FCl
El @J S7 P1og1arr(l) 0-08!0 l=l CJ S7Prog~II liJFC2
(Al Sou,a.t I O Bb<k, 1iifiij
- ~ 810(K$ Iii) SIMATIC 300(2) ""--
• II) Slt.tATIC 300(21 ·WJ SIMATIC300(3)
ijl fii) S11~.\TIC 300(31 . !ii) SIMATIC 300(!)
ffl i) SIM,\TIC 300(41

Pra« Fl to get Help. @ fll:•tod /4


Figure 4-34. SIMATIC Manager open to "NewProj," with o ffline and online windows arranged
vertically. The LAD/FBD/STL editor opens offline or online based on your selection.

iJ2iLAD/ <;Tt/ F8D • (0810 -· New...J1rj\ 5fMATfC 300(1)\ CPU 316) 11!!1~ ~
0 File Edl 11\sert PLC ~bug V'iew Options wf\dow H~

Type
lddre11• ·-
o.o STRUCT
DJT 0 Tellporacy placeholder vsriehle
END_ST!WCT

.!.J
Figure 4-35. Default screen when editing a Shared Dalo block for the first time.

230
Working With STEP 7 Programs a nd Doto

'. LAD/ STL/ FBD - [0010 -- New_JJrj\ SlMATIC 300{1)\ CPU 316] - IDJ~
O FIie Eat Insert PLC Debuo View Options Wndow Help -1611~
lddress Bame Type Initial value Cw1.e,1t
o. STRUCT
+o.o TIIP PRlSET l Temperature Preset- Zonel
- llIT
nrr
350
+2.0 TiiP PRlSET 2
- - 375 Tempei:ature Preset Zone2
-1-4. 0 TMP PRESET 3
- - nrr 400 Temperatur e Pte:iet Zone3
+6. 0 OVR- IJIT- Tl BOOL FALSE zom: l OVER Limit
+6.1 OVR urr T2 BOOL FALSE zo.m: 2 OVZR Limit
+6. 2 OVR- Lm'- T3 BOOL FALSE zom: 3 OVER Limit
•8 . 0 DID STRUCl

Press FI to get Help. • (;:) [oiflne IAbs <5.2 ~nsert r-::a


Figure 4•36. Editing a Shared Data block. Data voriobles defined with fniliol votues.

Quick Ste ps: Editing a Data Block

ACTION

1 From the SIMATIC Manager. double-click on the doto block you wish lo edit.

2 From the menu, select View ► Declaration View in order to declare variables.

3 In the first data row. click in the Name field and enter a name; click in the Type field,
right-click and select the dola type from Elemenlo,y Types or Complex Types; click
in the Initial Value field. and enter on inilial value (optional); click in lhe Comment
field and enter a comment (optional).

4 From the menu, select Insert ► Declaration Line ► Before Selection or After Selection
to place the next variable either before or otter the first row. Enter os many variables
as required, and then from the toolbar press the Save bu tlon lo save lhe DB otnine:
press the Download button to save the DB online in the PLC.

5 . Select File ► Exit to close the editor.

Edit Actual Values of Shored or Instance DB doto elements

2 With the dala block open. from the menu selec t Vie w ► Dato View (if not already
activated) to view the DB with on Actual Value column for editing the variables.

3 Click in on Actual Value field to modify any value as required.

4 If you simply wish to reset all of the variables of the DB to their initial values. from the
menu. selecl the Edit ► Initialize Data Block.

5 Enter os many values os req uired, then press the Save button to save the DB offline:
press the Downtood button to download the entire DB: for lnstonce DBs. if you are
using the DB parameter editor you will also hove the option of only downloading the
parameters values of the data block.

6 Select f ile ► Exit lo close the editor.

231
STEP 7 in 7 Steps

Generating a New Code Block


Basic Concept
In STEP 7. ony code b locks that you in tend to write. you will first need to be c reated. To
create a code block is to generate a block object of a specific type (i.e., OB. FB, or FC). The
objec1, once crea ted. is essentially a container in which you may open and then enter code
as required. Although your STEP 7 program. may eventually consist or several user b locks that
you develop. the complete program is built incrementally, block-by-block.
Essential Elements
Code blocks o re comprised of the block header. variable declaration a rea. and code
section. When you generate o block. you ore actually creating the header. which allows you
lo define attributes al the block. Once generated, you mo open lhe block and begin writing
your code. From the SIMATIC Manager. double-click o n the block or righ t-click and select
Open Object. From LAD/FBD/STL, open the b lock using File ► Open fro m the menu.

~51MAT1[ Manaqer - l'oewProJ l!!ll!J 13


r
File Edit Insert PlC View Options Window Help
D I~ J! ".ta:ic,-; : r:-;-;::~=-~
=~--;--
- a--:~,;;::·:.=.-,-=-;-lrm---:-;-1§ll--;-;:I
--:- = > =I
< ,=,o=Fill=et=
. -· SiJtnt:
l'rc.,J1'~1l I

. ~ 57 5¢tWMe S~stem data


as
j C
57 Block
'17 sott,.,...re
I
I
J Orgenlutlon Block
2 Fts1ction Block
j Flllct1on

I 4 Data Block
SData Type
I iii SIMATIC30Q'.2) 61/arleble Tallie
fiil SIMATIC 30(X3J
iii SIMATIC30(X4)

lnserts Flh:tion et the ct1rsor poSitlon , /4


Figure 4-37. Genera ting o new S7 block from the SIMATIC Manager.

Propertic'i • function

I
Gene,al -Parl 1 Gerietol · Pa,12 I Ca& ] Allribulos I

~lame: jFC19
. , - - - - - - - - -.
Simoolic Name: I
Simbol Cotlllrel"t

Coealed in langu/1115: !LAD


Pro1ecl!)dth:
Slorago kic<llioo
of prc;ett IC:\Patrrck\S 7_P!oiecla\Brillian
Code Interlace
Dale c:1eated: 10/12/2004 527:57 PM
Lall modi/led: 10/l2/2004 5:27:57 PM 1on 212004 5: 27: 57 PM
Comrnl!ll'4.

I
I, OK I eenee1 I Help j
Figure 4-38. Properties d ia log: General Properties Port I - of Block Heade<.

232
Working With STEP 7 Programs a nd Doto

Properties - Function ·

Veision (Heeder) jo.1


Aubof·
~ -==
Lengths-=====================~l
LocalOata: Obytes
MC7: 2bytes
L04d ~1omol)' Rcqi.ernent 82byte,
Wok Memay Requiemont 38 by!&

r DB is wrle-p,otecled in tne PLC r Slandardbloc~


r Know-how pioteelion r Uninked

DK
I Cancel

Figure 4-39. Properties dialog: General Properties Par1 2 • or Block HeadElf".

Quick Steps: Generating a New Code Block

ACTION

1 Open the p rojec t and select the Blocks folder of the program in which the new
block is to be inserted.

2 From the menu. select Insert ► S7 Block, then select the b lock type (e.g., Function)
lo generate. The block p roperties dialog will be presented.

3 On the General Part I tab, the Name field will contain the next a vailable block
number for the block type you hove chosen. Either use the derived number or enter
a new number (e.g .. FCl 0, or FC 20). This name is the absolute address of the b lock.

4 Click in the Symbol Name field to en ter o mnemonic name !or the block. The
symbolic name is actually a substitu te tor the absolute address.

5 Click in the Symbol Comment rield lo enter o descriptive comment. The comment,
which may contain a maximum of SO-characters. will appear with the symbol name
for the block when the symbol table is opened with the symbols editor.

6 Select the Created in Language drop down arrow, and choose the language in
which the new b lock should be initially edited (e.g., LAD, FBD, or STL).

7 Select the General Parl 2 lob lo enter additional properties for the block.

8 In the appropria te fields, enter o Name (not some as symbol). ror the block; o
Family name. lho l associa tes the block with a group of b locks; a Version number,
tha t allows changes lo the b lock lo be managed; finally, on Author tho l iden tifies
the user or perhaps deportment responsible for creating the block.

9 Press OK to confirm the configured b lock header and to generate the new b lock.

233
STEP 7 in 7 Steps

Navigating the LAD/ FBD/ STL Editor


Basic Concept
LAD/FBD/STL. the stand ard editor fo r c reating STEP 7 p rog rams, supports three language
representations. The first language is LAD, a Ladder Logic representation; FBD or Function
Block Diograms. is a Boolean gate logic representa tion: and STL or Statement Us t, is a line-
oriented text lang uage sim ilar to assembler or BASIC, With LAD/FBD/STL. you ore able to
develop a complete S7 p rogram tha t combines user-developed organization blocks (OBs),
function b locks (FBs), functions (FCs). and d a ta b locks IDBs). as well as stand ard library and
system blocks. LAD/FBD/STL is opened from the Windows Sie rt menu - Siert ► SIMATIC ► STEP
7 ► LAD/ FBD/ STL. or from within the SIMATIC Manager.

Essential Ele m e nts


In addition to menus and toolbars of the STEP 7 editor. there is the main window, the Program
Elements/Call Structure window. and the Details window. The main w indow is a work area,
whic h a llows one or more b locks to be opened for editing in separate w indows. The Program
Elements/Ca/I Structure allows you lo access th e STEP 7 LAD/FBO instruction folders, or view
the overall calling structure of the open program. This window may be docked on either side
of th e main widow or may be hid den from view , using the View menu. The status bar. on the
main window bottom, provides Informa tion on the sta tus or the editor as well os PLC
operations, Finally, the Deta ils wind ow, whic h may also be shown or hid den fro m view, gives
you access to various views or p rogram-related in formation.

Application Tip s
You may copy block elements including Block Title. Block Comment. Network Tille. Network
Comment. and Networks. between blocks using Copy a nd Paste operations.

~ @•ff.il@IUr 11111~•1 ICi i6MiiZhtilHtil1IPi·liZ!,,tbIII


1 1 : 101])
0 FIie Edt Tns«t PtC Debug \liow Opijons Window Help - 16112!)
01~1~,.llill ~ JI, l~lel •-:lr•I C
"i&l• I ~
~ ~ m~ m-IH* l-<>l~l41Jl½l ~
..:J.l!f 'lc«Aer1ts &: 'Ermonmert\ItU>fece\lN'
!di lr(erface Name Dal~ Type tComment
,- ►,;
New net-k
-• om 'O
~ CAI Bl looic OOUT
Ii) (D Co,,pord:or - 0 IN_OUT
$,$1 Conve,'ter ••..;@- lfl'P
IDS C01Stor 1B O Wl.'lN
$ @I on ,o11
Ir-(&) Jur!'j)S .!.
FClOO : Simpl e Ladder Loaic u,inQ Bit. Iruit.ruction,.
IE @ Ir.top hn:ti:n
ID @ Fb!!tng-pant fct . ~~~~:~: S1:nplo L"ddor ciccuit.
-
with one noc,<>J.ly- opcn (1/1
00-£) llbVe
IF-(ili PrOQrcrll ccrtrol
,, (a) Shtt/Rot<lte I r20. o Ql7,0
()-1
' -~ Status b~, 1 1:
Ii: !ii Trne, s
lt},Qil Word kgc
lfr 'i:a FB blocks Ne tw r k i : 51:11.ple Serles CltCu l t. tnth thee normally- open ( I
Ip-Iii! FC blocks
1!J (1;il SFB blocks
- I
r ll
-'i:11 SFC blocks I20 . 1 I20 . 2 I Z0.3 017 . 5
I: I: ()-1
• f-\JUl)le lrul.vrces .:J
-•r>et-1<. "-<
,-:;
Nc:t1fflr k 3: Su,ple P.u:allel c ircalt u ith three n o aa.il;-- opCJ
- (fl Pi<391o:n cbn,.. :Cal ,uucl.. ◄ II ~
Press FI to get Hep, I ·~ [oiiine !~ <S.2 I l1nse,tJ 41
Figure 4-40. An opened block (FC 100) inside the LAD/FBD/STL programming editor.

234
Working With STEP 7 Programs and Doto

Quick Steps: Navigating the LAD/ FBD/ STL Editor

ACTION

1 From the SIMA TIC Manager, open the required project and 57 Program folder.
Select the offline Blocks folder to display the off/ine blocks in the right pane.
Al ternatively, you con view the online Blocks folder by selecting View ;.. Online from
the menu.

2 Double-click on o b lock or right-c lick on o block and select Open ► Object to open
the b lock in the LAD/FBD/STL editor.

3 From the LAD/FBD/STL Editor menu select View, and then select LAD, lo edit the
block in Ladder format select FBD, to edit the block in Func tion Block Diagram
format; or selec t STL, to edit the block in Slo/ement Us/.

4 Select View ► Status Bar, to display the editor status information on the bo ttom
window edge. Select Slolus Bar again lo hide the slolus bar.

5 Select View ► Display With ► Symbol Representation to toggle between the display
of symbolic addresses or absolute addresses in the open program block.

Selecl View ► Display With ;.- Symbol Information lo toggle the display or symbol
information (i.e., symbol address, absolute address, commen t) with each network.

7 Select View ► Display With ► Comments lo display program comments or to allow


entry of additional comments ii required (toggles comments display on/off).

8 Select View ► Overview to display the Program Elements/Coll Strvcture w indow. The
Program Elements lob lists the instruction folders. Instructions may be dragged trom
a folder and dropped onto the current network. The Coll Structure displays the
hierarchy of how blocks ore called in the open program: you may double click on
any block to open the b lock.

9 From the menu. select View ► Details to display on information window al the
bollom of the main wind ow. The window contains seven tabs offering further access
lo rela ted information for the open block.

10 From the Program Elemenls lob. expand lhe FC Blocks and FB blocks folders. to view
user func tions and func tion blocks that hove been c reated: or expand the Libraries
object and then the Standard Library folder. to access system block folders. FCs. FBs,
SFCs, and SFBs may also be dragged and placed into o network.

11 To edit a program, find the network (e.g., Network I ) you wish to edit; click on a
posilion in the network. lhen insert basic logic elements from the tootbar (e.g.,
normally-open and normally-closed contacts. coil, and branch instruclions) or drag
on instruclion or block from the program elements window.

12 Use hotkeys for basic logic operations (e.g., F2 ► NO contact: F3 ► NC contact: F7 ►


Coil: F8 ;;.- branch open: and F9 ► branch close) , Use the <ln.sert> key to toggle
between the insert mode and the overwrite mode while editing networks.

13 From the menu, select file ► Exit lo c lose oil open blocks and close the editor.

235
STEP 7 in 7 Steps

Opening , Editing, and Saving a Block


Basic Concept
In STEP 7. once o block object hos been genera ted (i.e .. OB. FB. FC. DB, elc.J. it is essentially a
con ta iner in which you may open and then enter and edit the code or dalo as required. A
btock con be edited olfline or online. but in either case. ii is actually temporarily held in o
memory buffer on your PC until actually saved. When you ore done editing a block, you may
determine ii II should be slored o lfllne. onnne. in bolh p laces. or simply d iscarded.

Essential Elements
A block that already exists moy be opened for ediling from the SIMA TI C Manager or from the
STEP 7 LAO/FBD/STL editor. From the SIMATtC Manager you will o p en the offline blocks
window o f the required project. or to edi t online you w ill need to open lhe online blocks
window from the toolbar or from the menu. The block is selected and is opened by simply
do uble-clicking on the block or with a right-click on the b lock and selecting Open Object.

Application Tips
As o moHer of good practice and solely, consider mo king all program changes offline.

,SIMA llC Manaqc, • Ncwl'roJ 11!1@£1


Rio Edi tnsert PtC 'Jiev1 Oobons W!r>rlow Help

D!rii!~?ji)'.ilj ~ l~!BJ_@] .!Ji; 2A ::- ::::21 mJ jtloSytt<ml!lod<• .:].::e_j ~ ~


~ --------------; ~------------ /!)NewProJ•· D:\ ST_Pro)e<ts\ Me...,,oJ ONLINE ..,..ll;!J.1:9
8 . Nc,,.Aq 8 . NcvR1e1 Sv•le<n data
B ii SIMA TIC JOC{l ) a fiil SIMATIC D{1 J 0 081
lJI
s-- CPU 316 s-im CPU J1 6 • liil
8 GzJ571'1091~1 J B CJ S7 Prograrr(l J
(il) Sou,co• Cj Blocks
(:jBlodu liJ W] SIMAIIC lll(2)
Ill ii SIMA l lC JOC12] liJ fiil SIMATIC 300(3)
E!l·!iiil SIMAl lC JOC(3J ll !iii S11.\ATIC :nl(4)
15 liiiJ SIMA l lC '.J00'.41

P11:>s f I to oot Heb, lg f l:ercd [ ,i


Figure 4-41. The projecl "NewProj" is opened wi th olfline and online windows arranged
vertically. The LAD/FBD/STL editor will open o nline or affline based on your selection.

29
Enl1ypoirt v-
iPicioct .:.I Icomponent vew .:.I (" Onn (o' Ollfne

Name: Storag, p.,ih


1»..,.P,q il JO:\S 7_P10tedt\tlewP101

;=J- N.,,..f'toj • 081


a Iii SIMATIC 300n I • liil
a Ill CPUllS
Et -@] S 7 Plograll'(l)
1:i] Source•
--0 81ooks ~
C r.1 I r=-
JltD f' l\4 '- ,,.,~ 'Vlt\f'"'U ►

F'C1

il
OK I Holp I
Figure 4-42. In the LAD/FBD/STL editor, File Open presents dialog for opening a block.

236
Working With STEP 7 Programs a nd Doto

jffiiLAD/ 5Tl /fBD - FCI .

-
Fie Edi: llllert PlC Debug -
-
Qptla<IS Wtwlo;, Help

Dl~l~..lr.ij §I :t. 1r~le.l •• V• t-' • 0 Gd' 1 ! !lEil!!J Ei:J ~tl* l-<)!wl4[...tl•-d~


.:T, · -1□1 xJ

~ rie., nct.m •
l!! tw Btl09ic r ct- lN O IN
lj,' Cb ( Offll>)rolOI 0~0-UT-- - - - - - - - - - - - - - - - - <
o our
b 6/l COl>Y.,ter
e O IN_WT
l:l cc,.,,1 .,
t,;; [!J OOcall i ~ T£M?
IE O RETURN
0 IN_OUT
~ TEMP
~© '""'I>• 0 RETURN
lt (ill lntegor fu-,ctjon
Ee G:!J Flo&tr,g-p,,nt f<t. TC! : Title :
e (29 Mo>v• llct\10r k l : Title: ..J
I:!! fill PI09'atll COOO'Cl
Ci' ~ Shf'tfl\Olate
(! !ill Status txts
II l ZIO,O
1-- - - - - - - - - - ( ) l - - 1
01 7,0

IE12) T111ct•
l?) Qjl W01dlc,g;:
EE i::9 FBbl>d:s Relvork 2 : Tl t.J.e :
& itl! FC !:locks
~ !cl SFi!tlocb
I 120. 1 r 20 . 2 01,.s
li;i) SFC bl<rw 1----v-----r.>-1
Al M.J11319 nstances .:::J 1
ew nr:IW<lfl, '( S


Pre.sFI to o-,t lidp. p°iil,,. fiit,, <:S'.2-· (iMtJ /4
~
Figure 4-43. LAD/FBD/STL editor. FCl block open in LAD; Program Elements window on left.

Quick Steps: Opening, Editing, and Saving a Block

ACTION

1 From the SIMA TI C Monoger open the required project. select the desired program,
and then select the o ffline Blocks folder. ormne blocks ore listed in the right pone.

2 Double-click on o block lo edil. or righ t-click on the block and select Open ►
Object. The LAD/FBD/STL editor opens w ith the offline block.

3 If lhe Program Elements lob is no t in view. select View ),. Overview from the menu.

4 From the menu. select View. then select the language of choice /e.g .. LAD, FBD.
ond STL); in this cose, selec t LAD. lo edit the block in Ladder formal. The Program
Elements tab is refreshed to reflec t o change in the cl,oice of language.

5 Find the network you wish to edit. tor example to odd a normolty-open contac t lo
Network 1: c lick on o position in the network, then insert basic logic instructions from
the toolbar (e.g., normolty-open and normally-closed contoc1s, coil. ond b ranch
instructions) or drag on instruction from the instruc tion browser.

6 To inrert o new network ofter a particular network. select the network ond then from
the menu select Insert ► Network, or from lhe toolbor press th e New Network icon.

7 To sove o block ormne when done editing. from th e menu select FIie ► Save; or from
lhe toolbar. press lhe Save icon.

8 To sove o block online wh en done editing, from the menu select PLC ► Download;
or lrom the loolbor, pres.s the Download icon. An online connection is required.

237
STEP 7 in 7 Steps

Documenting a Code Block


Basic Concept
Each user-writ ten code b lock provides built-in mechanisms for easily docume nting your code
and data, thereby making your p rogram easier to interpret and to troubleshoot. The
documentation Iha! you w ill enter for each block is stored in the otmne program. but is
available when either the offline b lock or ifs anline equivalent is opened.

Essential Elements
Each b lock you create, whether in LAD. FBD. or STl, allows you to enter (1) Variable
Comments of up lo 8D·cl1aracters. for each local variable declared in lhe declaration loble;
(2) o Block Tille of up lo 64-charoclers, to b riefly title the block: (3) a Block Comment, of up lo
64-K•byles of lext. to describe the p urpose or opera tion of the block; (4) o Network Title of up
lo 64-characters. to title each logic Network: and (5) o Network Comment that allows text
entry of up lo 64-K-bytes per network. lo describe the p urpose or opera tion of each logic
network. Blocks wrillen in Statement List, a lso a llow o Line Comment for each instruclion line.

Application Tips
If o Symbol Tobie hos been c reated for the program. symbolic addressing and symbol
commen ts may be viewed by selec ting View ► Display with ,. Symbol Representation and
View ► Display with ► Symbol Information from the menu.

!!Pi•AD/ 5Tl/TBO • re,

·Hi1Mtiiitiffilh 'tiiPt·HdihlO~
1 ' ,- f □LXJ

~Ne,•~ •
Ii) gJ Bl loQic
E!l (b Canparoto,
j 0 111 0-IN
o "'o..,.,l!T
= - - - - - - - - - - - - - - --1
Ltl-~ OYT
F! SI CMl«ll!f ill o 111_cur
(u] C0<6ltor OIN_OUT
~-~ T'fl'P
~ (i'f)OOcdl :uJ:- 1'!:MP
rli O Rf'lUR/1
1£ © .)J,rps :0, Rl:l'URN
E!l-[D 1ntege1 ftttucn
~ [!} Fb,tno-po'rn fct, TCI : Tltle :
I'£ (cl Move llct\,ork 1 : Title: _J
(;: 6'f:I P100-orn cor.trol
I
!ti-W) ShftJRot.-:e
8 -wJ Sl•tus l:iU
@:],m.,,s II i - - - - - - - 1 } - I
I 20, 0 017, 0

Ir-Qi;) Word lo;Jt


r;;: liJl F8blotks Network 2 : Tit.le :
IE ~ Fetlocks
I
ff>fijj Sffl tlocb
i;a SFC hlod<s
M MJt~ rist...:c. .:J
r' 120. 1 120 . 2
1----VI------()
01, .s
,

~w natwerlt "'s
• ~
Pte<•FI toget~. -
{Ab< cs.2 e joifline
J1nsatt J /4
Figure 4-44. Block FC I opened in the LAD/FBD/STL editor. with LAD representation selected
and wi1t1 Display Comments not octivaled.

238
Working With STEP 7 Programs a nd Doto

■ FC 1 -- BrllliantTraining\ 57 Prograrn( 1)

!contents Of: 'Environmert\lnterfac~• '


h,,.----,------,
11,.J7 lnterface. Name ...
~"-:0 IN 0- IN
ffi-:0 OUT ._O_U_T- - - - - - - - - - - - - - - -----1
e- o IN_OUT O IN_OUT
• =I!}- TEf'IJl :lit TEMP
©-:0 RETURN 0 RETURN
!'Cl : Simple Laddec Logic using Bit Ins tcuc t ion s . ...
8J11Ples: Usin9 the Not11ally-Open Contact and Coil output Instcuc t ior

lletwor);. 1: Simple circuit 1Jith one N. O. contact.


1) I t I20.0 1S True (l ) 017.0 v111 tum O»(l).
2 ) If I20.0 is f alse(O) 017.0 will turn OIT(O).
I20 . 0 017 . 0
- I 1 - - - - - - - - - - - - ()--

Figure 4-45 . Block FC 1 shown opened in the editor with commenls displayed.

Quick Steps: Documenting a Code Block

ACTION

1 With the desired block open in the LAD/FBD/STL editor, from the menu. select View
► LAD lo choose ladder as the language o f choice for editing the block.

2 From the menu. selecting View ;.. Display Wtth ► Comments activates comment
entry or toggles lhe display of comments on and off. The check mork is shown when
comments ore displayed. No check mark is shown when commenls ore not active.

3 Click on the word 'Tille' shown just to the right of the block name fe.g .. FC 1: Title). to
enter o Block Tille. Enter up lo a maximum of 64-chorocters for the title.

4 Click on the word 'Comment' in the gray field, below the block name. to enter a
Block Comment. The field c hanges lo white allowing entry of up lo 64-K-bytes to
describe lhe operation or purpose of the block. Click outside the box. when done.

5 Click on the word 'Tille' shown just to the right of each network (e.g .. Network l:
TIHe), in order lo en ter o Network Titte. Enter up to a maximum o f 64-chorocters.

6 Click on the word 'Comment' in the gray field, below each network. to enter o
Network Comment. The field changes to white allowing entry of up lo 64-K-bytes to
describe lhe network operation or purpose. Click outside the box when done.

7 From the menu, select FIie ► Save to save the block and its documentation.

239
STEP 7 in 7 Steps

Programming an FC without Formal Parameters


Basic Concept
An FC written without formal parameters is typical for porls of your code involving basic logic
opera tio ns in which no permanent data storage is required. Recall. tha t FCs may use
temporary local variables. b ul these variables ore handled in local memory, and ore no
lo nger available when the b lock is done processing , In applica tions consisting largely of
discre te loglc. most o f lhe code will likely be wrilfen In FCs without use of formal parameters.
Essential Elements
In on FC. the declaration types include IN. OUT, a nd tN_OUT, which o re used for declaring
formal parameters: a nd TEMP. used to decla re temporary local variables. Writing on FC
without formal parameters mean you only need to define temporary (TEMP) local variables if
they ore needed. You may define a s many temporary variables as re quired. Once you have
d eclared the te mporary variables. you will write the required logic, in the code section of the
function.

...
$ O IN
'
,..._
OIN ___________________
Name

!f! O OUT UO IJT


~ O IN_OUT 0 IN_OUT
rB-~ Tf?'/P
TEMP
1B O RETURN
ORETVRN

FC4 : Main Conveyoi: Hocoi: Con-ci:ol Logic


?!~~~~¥~~ : Conveyoi: Motoi: Ho . l Conti:ol logic . _J
j 14. 0 14. l 14. 2 04. 0

jL., I I Q
~)--1-
1 I 0-
Het'W'Ork 2 : Conveyo r Kotor No . 2 Control logic.
I IS . O IS.l 15 . 2 05 . 0

1:,_~3-~-J1----11-~--::~.1-
1 I - ( }--
lfetffllrk J: Conveyo i: l!otoi: No . 3 Concc ol logic .

1
Figure 4-46. A Function (FC) written wilhou I use o f formal parameters. See Figures 4.49
and 4-50 later. lo see how on FC w ith formal parameters c on replace repeated logic.

240
Working With STEP 7 Programs a nd Doto

Quick Steps: Programming an FC without Parameters

ACTION
'

1 From the SIMA TIC Manager, open the project and the required p rogram Blocks
folder; then double-click on the FC lo open the block in the LAD/ FBD/STL editor.
Create the FC if necessary.

2 From the editor menu, select View ► then the language of choice (e.g., LAD).

3 Select View ► Overview trom the menu if the Program Elements/Call Structure
window is not in view (LAD/FBD instructions ore in categorized foldersI.

4 To declare new temporary variables: First select the TEMP objec t in lhe left pone of
the declara tion table. then click in the Name field of the declaration row and enter
the name for the variable. Click in the Data Type field and selec t the data type for
the new variable from the drop list. Finally, c lick in the Comment field and enter a
descriptive comment. Enter as many temporary local variables os required.

5 To insert a temporary variable before on existing variable: First select the existing
variable row, th en right c lick and select New Declaration Row. The new declaration
row is placed above the row you selected . You may otso selec t o declaration row
and drag ii lo a new position.

6 To enter code for the block: C lick inside the code sec tion. starting with network 1.
then write the code for each network operation, using either absolute addresses or
symbolic addresses (if already defi ned). Note: Network 1 is au toma tically inserted.

7 To start a new network. from the menu select Insert ► New Network, or from lhe
toolbar press the New Network bu tton.

8 From the menu selec t FIie ► Save when done with lhe lost network.

9 Select Ale ;.. E.xlt lo close lhe e ditor.

2 41
STEP 7 in 7 Steps

Calling an FC without Formal Parameters


Basic Concept
With the exceptio n of orgonizo tion b locks. you must coll all b locks to ensure thol they ore
processed. A block is called by referencing ils absolute address (e.g .. FC I OJ or symbolic
address (e.g .. "Sor1er_ 1") with the appropriate coll instrvction. A coll to the FC con be
unconditional o n evel)I CPU cycle or conditional when specific logic conditions ore met.

Essential Ele m e nts


In both LAD and FBD. on FC with no parameters con be called using the CALL coil or as o
box function (CALL f C n). lhe Coll coil instruction. however. moy only be used when lhe FC
hos no formal p arameters. If the coll is p rogrammed without any preceding log ic then ii is
exec uted on every CPU scan (on unc onditional coll); if logic condi tions precedes the coll (o
conditional coll) lhen the FC is called vvhen the conditions ore met; if the logic conditions ore
not met. the instruction following the coll is processed.

In Statement Lisi (STl). on FC written without formal p arameters con a lso be called
conditionally or unconditio nally. The cond itional coll (e.g .. CC FC 10) is executed if the
preceding result of logic operations is satisfied {RLO = logic I). The unconditional coll (e.g ..
UC FC 10) is execu ted on every CPU cycle.

Applica tion Tip


Calls to FCs having no parame ters. ore typically condllionol or uncond itional calls from the
main organiza tion block (OS I ) or from another block {e.g.. O B. FC. FB). Based on th e purpose
of on FC. you will determine where ii is called from a nd how often ii is called. Conveyor
control logic, for example, mig ht be called from OB 1 whenever the conveyor system is
enabled. On the other hand, on FC written to sc ale analog inpuls mig ht be called several
times in one cycle. based o n the number of input channels thol need scaling.

I liiGll ffiliHHiitiffil,l·l~ilAl11·1i·\,li4i
1 .-JgJ~
1
1!}-@} 08 cdll .. ~ lnterfo:,e
jcoolecl:s Of: "En~ronment\lnterlace'
Nama •
I If! (sJ Jurps
0- IN
'1B @ Integer f untt1on
I ~ @) Floaling•point fct.
O OUT
'fit ~M4ve U- IN_OUT
1-
1li½-'2d A'og1am COM'ol ~TEMP
' 1'.a) g,ftfRot,,le
I ijt 0 RETURN .:J
'$·t!ll Status bits
'@(w Toners .:.I
1
f4I '.ii) Word log;: Ketwork 11: Call fC l Condi t.iona.l ly if I 20. 0 is a.c eivat.ed.
1fH 1J;jj F8 blocks
1

~ 1JI FC blocks
' 0 F<: ! e,t_Log,:_St d
µo:o fCl
~ CALL }-I

I. 0 FC2 Bil:_Log,c_Spc

II 0
0
FO l imetsjlox
FC4 lime,s Col tlet"110rk 14 : Ca.l l FC 2 Uncondiciona.lly on each scan.
O FC5 Court;,sjlo( rcz
I O Fa. Counters_Ccil I ( CALL }-j
6 FO COffll)llres I
0 FC8 Coo-,,ersions
0 FC9 lnteg,!r _Allth Nctmrk 15 ; Call FC 3 Uncondit.ion,il ly on each :>CClD,
·0 FCIO Real A11th
0 FC I I RealJ'1ath_~ •I I El/
rc3 I
EJJO I .J
I l.~ I
l@)Progr<rnel .. ◄I I ~ -
Figure 4-47. Colling FCs written will1out Formal Parameters in LAD, using Coll Coil or Coll Box.

242
Working With STEP 7 Programs a nd Doto

~~ I i!iG ;bhrbilildb
[Con!e,Jb Of: 'mvtronmalt\lnt;;;feoe'
'$ t'.R!J 08 call =-=1-,-nter
-,f:-
ac:e
-- Nam &
:e-~ Ji.rrps t:O-=+.l'""
N- - - - - - - - - - - - - - - - 1·- 1!
I~ liIJ lnte',)el' funcbon
I$ @I Floating•polnt let. OUT
,i!t(29 Mow ~ IN_OUT
i I& ffi:I PYO<], am conll'ol ~TEMP
Ip' (al 9-i't/Rotale 0 RETURN .=J
ltl ~ Sl:6tUS bits
ffi ~ Timers tretuork ll : Call TC l Condi tionally if I 20. 0 i s ecr:J.11atcd. •
1

' Q3 Word logic


lil
!fl iii FBblocks
1
8 (QI FC block>
0
• 0 FC2 Blt_Log!c_Spc
Netwr>:. 14 : Call YC 2 Unconllic.i onally on eech s can.
6 FC3 lintts_Jlox
0 FC1 lim~u_COii fCZ
0 FCS Coorteis_Box
6 FC6 Cconters_COil .. . - ~
-0 FO Cornp.,res _J
0 FC8 Cmwersions tfeh,ork l 5 : Cal L FC 3 Un1:ondictonally on each scan.
~ "'-0 FC9 Int~_Allth~ , • I
I l.~ ... - ~
- llit) Prog1<11l el Ii;; Col •tlue.... •• ,j
I=~-------------------------=~~ •
Figure 4-48. Calling FCs written without formal parameters in FBD.

Quick Steps: Calling an FC without Formal Parameters

ACTION
'

1 Open the b lock (e.g., OB 1) from which on existing function (FCJ will be called.

2 To mo~e o condijionol call in LAD/FBP, click in the code section of the b lock. then
from the toolbor press fhe new network icon. From the Program Control folder, of the
Program Elements tab. drag and drop the CALL Coll (LAD or FBDJ onto the network.
En ter lhe FC address above lhe Instruction (e.g .• FC 1J. then insert lhe conditional
control logic to determine when the FC should be called.

3 To make an unconditional call in LAD/FBD, click in the code section of the block,
then from the toolbor press lhe New Network icon. From the Program Control folder
of the Program Elements lab, drag and drop the CALL Coll (LAD or FBD) onto the
network. Enler the FC address above the coil (e.g., FC 2).

4 If you wish lo see the FC as a box function as shown in Network 15. open the FC
Blocks folder and drag the FC onto the network. The FC number is displayed inside
the box. You may coll the FC box function with or without preceding logic .

5 If lhe FC you wish lo coll will use data locations from a shared DB, coll !he DB in the
network prior lo colling the function. using lhe OPN DB coil (e.g.. OPN DB 22).

6 To moke o conditjonol coll in SIL. click In the code section and en ter o new network:
enter !he conditional logic and end the logic string with the conditional call
instruction (CC) to reference lhe address of lhe FC (e.g.. CC FC 3).

To moke on vncondHional coll in STl. c lick in the code section and enter a new
network; I hen e nter the unconditional coll instruction (UC) referencing lhe address
of the FB to call (e.g.. UC FC 2). without any preceding logic string.

243
STEP 7 in 7 Steps

Programming an FC with Formal Parameters


Basic C onc ept
By using formot 1/0 porometers. you can develop FCs as o block-box opera tion. similar ta a
box a ddition instruction. that con be called whenever needed - supplying diflerent values
or addresses on each coll. The formal parameters of the FC will represent the standard inputs
and outputs ol lhe operation and act as address p laceholders. A n FC written, for example,
to con trol a specific AC motor type would require formal parame ters of the standard 1/0 of
such o motor. On each call of 1he FC in your program, the actual input and ou tput addresses
for a specific motor are p lugged info the FC in p lace of the formal parameters.

Essential Elements
Formal parameters o re specified using the IN. OUT. and tN_O UT. declarations. An IN
declara tio n represents on input to the FC. a value lo be read: on OUT declaration represents
on ou tp ut from the FC, a value to be written; the IN_O UT decla ration represents both on
inpul lo and ou tput from the FC. a value that is read and written by lhe FB.
The example AC motor FC might include inputs lor the Start PB, Slop PB. Emergency Stop PB.
and Holding Coll contac ts. a nd outputs for the Motor starter, and a Status light. If temporary
variables are req uired , they are specified using TEMP declarations. After defining as many
forma t parameters and temporary variables as required, the b lock code is then written using
one or more networks just a s you would normally, bu t instead o f using actual inpu t and
ou tp ut addresses. you w ill en ter the formal parame ters instead (See Figure 4-49).

Application Tips
Use of fo rma l parameters is a great advantage In that while the actual code is written once.
the FB may be called repea tedly. Memory use is also minimized and errors ore reduc ed.

Iii FC40 ·· NewJJrj\SIMATIC 300(1)\CPU 3_16'

!contents Of_1'Envlronment\Interface\IN'
lfifi'Tr1rt;;e;rfha~ce; ---- Name Data Type Comment
ltl O fm t?I START Boot Start Pu shbutton
~' 0 OUT t!1 STOP 8001 Slop Pu shbutton
:··0 1N_OUT ~ ESTOP 80 01 Emergency Slop Pushbutton
, ..,a. TEMP
m HCOIL 8001 Motor Holding Coil Auxitary Contact
ttl•-:e- RETURN
u
FC40 : Motor Func tion ( FC)
Loqio is vritten using foaal Paraaeters (substitut.e paroeters) .
cwal pe.r8.llet:ers ( add.I:esses) e.re supplied wen the re is ctlled.

?~~!'?!'~:!!: Motor Logic for standard AC J1otor.

I #START ji!:STOP #STOP #MOTOR

GCO,-IL- - -I - - -I ---,-~:TUS
,----i l }-I

Figure 4--49. FC 40 Molar Conlrot Logic: IN formal parameters shown in dec laration table.

244
Working With STEP 7 Programs a nd Doto

Interface Name Data Type Comment


l±l-·0- IN Ul STATUS Bool Status Indicator
ij}·-OE m MOTOR Bool Motor
···-0 IN OUT
' -
,·· :€I-TEMP
a
ttl·O RETURN •
Figure 4-490. FC 40 Motor Control Logic: OUT formal parameters shown in declaration table.

Quick Steps: Programming an FC with Formal Parameters

ACTION

1 From lhe SIMA TIC Manager, open the project and the required program Blocks
fo lder. and then double-click on the FC to open the in lhe LAD/FBD/STL edito,.
Create the FC if necessary.

2 From the menu. select View ► then the programming language to use (e.g .. LAD);
then select View ► Overview from the menu if the Program Bements/Coll Structure
window is not in view.

3 To declare a new formal parame ter: From the left pone of the declaration table ,
select the parameter type you wish to declare (i.e .. IN, OUT, or IN_OUT), then click in
the Name field o l lhe first declaration row ond enter the name for the variable.
Click in the Data Type field and select the d a ta type from the drop list. Finally. c lick
in the Comment field and enter o descriptive commen t. Enter as many variables o t
o particular parameter type before moving loo new formal parameter type.

4 To decla re a new tempo ra ry variable, firs1 selec t lhe TEMP object in the left p one of
the declaration table; then click in the Name field of the first declaration row and
e nter the na me for the variable: c lick In the Doto Type field and select the dole
type for from the drop list. Finally. clic k in the Comment field and enter a descriptive
comment. Enter os many temporary local variables os required.

5 To insert o rormol parameter or temporary variable before on existing variable: First


select the TEMP object or the desired formal parameter type (i.e., IN, OUT, or
IN_OUT) from the tell pone, to d isplay the current records of tha t type. Then. select
on existing variable row, right c lick and select New Oecloroflon Row. The new row is
inserted before the row you selected. You moy also select a n existing variable and
d rag it to o new position.

6 To enter code for the block. click inside the code section; starting with network I.
write the code for lhe device or operatio n as you would normally, using lhe rormol
parameters where you would normally use absolute addresses (See Figure 4-49),

7 From the menu. select FIie ),, Save when done wilh the lost network.

8 Selec I File ► Exft lo close lhe edilor.

245
STEP 7 in 7 Steps

Calling an FC with Formal Parameters


Basic Concept
An FC you developed with format parameters is meant to be called multiple limes
throughout your program. For example. the FC written in the previous task was developed to
con trol AC motors of a specific type. Each time you call the FC to control o d ifferent mofor.
you must supply a new set of addresses (i.e .. actual parameters) for !hot motor.

Essential Elements
When called in LAD or FBD, on FC with parameters appears as o box containing its input
parameters on the left side of the box and output parameters on the right side. Each
parameter hos a name that reflects the actual input or ou tput for which it is a p laceholder.
The AC motor con trol Function inc ludes START. STOP. ESTOP. and HCOIL inputs: MOTOR, and
STATUS ore outputs. On each coll of the FC. you must supply an absolute or symbolic address
o l each parameter. As you use on FC with format parameters. you must ensure Iha! the
correct addresses are entered al the appropriale parame ters and ore of the some dola
type (e.g.. BOOL, WORD, INT, and DINT). In this example. all of the parameters ore of data
type BOOL. and require that addresses of bit variables be specified (e.g .• I 4.1 , or Q 5. 1) .

Application Tips
A system function (SFC) with parame ters is handled in the same manner as a user-developed
function (FC) w ilh parameters. In LAD/FBD. the EN/ENO signals allow lhe FC or SFC with
parameters to be used in a network like any other box operation. To use an SFC or existing FC
correctly, you will need appropriate documentation to know the purpose and operation of
the block. II is essential to know the type of memory variable (e.g.• I. Q. M. Pl. PQ, and DBDW)
and data type (e.g.. BOOL. DINT. INT, and CHAR) expected at each parameter.

- (Pl ,cJ
{2S) Mwe Name
G: G'fl Progrom cortnJI e "'rN_______________----l
I:,' \iii Sh(,\/Rot.ote
:Q- OUT
Gl~ Stolus bils
E·-G2) llmetS 0 IN_OUT
IS fi:I Word loge ~ TE~IP
1,:- i;jl FB bhl.s :ORE RN
8 'iii FC bb:l<s
· 0 FC I llt.Jooi'~td llet110rk , : Cllll Motor Control runct1on (TC•IO) tor Botot !Jo . l
0 FC2 llt_Logi<Jp<
0 FCJ 1'1Toor$_8ox
0 Fe, rtners_Col
FC40 mo~I____
0 FC5 COU'\!91S_Box
0 FC6 Counle,s_Ccil
0 FC7 C ""'°""" IQ . z- ESTOP
Q FCO Convt<si:>ls
0 FC9 lnl•9!'_;.,~h
- 0 FC 10 Real_llllth
0 FCI I Real)'\Mh_Funttkn
GFC12 ~ lletlJork 18 : Coll Bator Control function (ff40) for ltotor Ila. 2
0FC13 ~CR
0 FC11 5t&JSjlil$ ;-I_ __ Ell EC40 IJIQ 1,-_ _ __
·0 FCIS :sNft_Rot<>le
·• 0 FC 16 Mo~_OP; ts.o-STAXT
_J
0 FC17 W<rd_Loglc

.
0 FCI \I f'loV'b,,_Cnttl
IS. 2 - ESTOP
0 FC40 AC_M0t01 ~lot<>,-$ ..:::J
~ IS. 3 - lltOIL
'
~ " ' of the pr<>jel.'l "-{
..
®Prog,.,..•li!fne... ; c..'t &t,i.d.,o ~ •::=!.____________________-=.!.G~
n
Figure 4-50. Coll from FC 19 to FC40 (M o tor Control Logic) for two motors.

246
Working With STEP 7 Programs and Doto

Quick Steps: Calling an FC with Formal Parameters

ACTION

1 Open 1he desired S7 program and the colling block (e.g.. FCS) from w here you will
make o coll to on existing function (FC) wi th parameters.

2 From the View menu. select l.AD as the programming language lo use.

3 If the instruction browser is not already in view. from the menu selec t View ►
Overview.

4 To make first coll in LAD. click in the code section o f th e block. then from the toolbor
press the New Network icon lo enter a new network in w hich to coll the FC.

5 From lhe Program 8ements lob. open the FC Blocks folder to display all user-
created Functions (FCs) of the currently opened S7 program: locale the desired FC
number (e.g., FC 40). then drog and drop the FC onto the network.

6 For eoch parameter, enter lhe actual addresses for the first coll of 1he operation.
lnserl logic in the EN inpu l line for a conditional coll lo the FC; insert the FC without
logic conditions preceding the EN input tine for an unconditional call.

7 To make second coll in LAD, press the New Network button to insert o new network
in which to coll the function. Repeal the programming process, of steps 5 and 6, but
supply the next set of actual addresses (absolu te or symbolic) for lhe next device or
operation.

8 From the menu, select File ► Save when done with the last network.

9 Setecl File ;... Exit to close the editor.

247
STEP 7 in 7 Steps

Programming an FB without Formal Parameters


Basic Concept
An FB written withou t formal parameters is typical in subroutines involving doto operations.
where one or more values musl be main tained. !or use on the next call of the FB. Examples
might inc lud e an FB that performs analog input filtering or Iha! tola ls line production counts.
On each call or a lota lizer routine, the tota l value is either incremented or decremented by
a dding or sub tracling o ne lrom the previous total value. In the lillering routine. consecutive
readings of o n onolog input are added and then divid e d by the number of samples token.
Essential Elements
In on FB without formal parame ters. the IN. OUT. and IN_OUT declarations ore not used. To
define variables tha t must be maintained as memory in the instance data block. you must
declare lhem as static (STAT) variables. To deline variables that a re needed only while the
block is processing you must decla re temporary (TEMP ) variables. Once you have defined
lhe required variables. you may write lhe block code in the code sec lion of lhe block.
Application Tips
FB50. shown in Figures 4-51 and 4-51 a. uses a routine that filters four a nalog inputs to illustrate
on FB wrilten without formal parameters. A static variable is required for each c hannel (e.g ..
C HO_ACC, C Hl _ACC, C H2_ACC, C H3_ACCJ, lo a llow successive readings of each inp ul to
be added. A static variable {SMP_ACC) is used to count lhe number of readings (i.e .. how
many limes the FB is called) . After lour readings are taken, the sum of each input is d ivided
by tour. lo obtain on overage reading. Eac h filtered resull ls lhen saved to bit memoiy.

■ f850 -- Br11!1antlrarrun9\ § l Program( I)

•~ Of: 'Emi,,i,...,rt\lr,tCtf<itc\si'AT1
Name
UI CHOJ.CC
Data TVl)e Address tnttial Value Comment
Int 0.0 0 Accumulator for 1st Ma log Input Chan...
-
00--0 CU! 1!I CH1_11CC lnl 2.0 0 Accumulator for 2nd Analog Input Chan...
0 IN_OOT UI CH2..ACC Inf 4.0 0 Accumulator for 31dAnaloo Input Chan...
=lit 5TAT
'ID CH3_ACC lnl &O 0 Accumulator for , th Ana log Input Chan,
lB :Ii)- TEl'P

f'BSO : f ouc Channel J.Mlog I npuc Yilu:c Roucine .
lletlKlr k l : on each c all o c cht fB r eact each 1.npuc end add to previous veJu!: . _J
- - - - -Ell
.. 111:. I I
-!D0; . . . . . . - - - - - - - -!11
ADO_I I 1188 , 7
!!lO; . . . . . . - - - - -•f ) I
PIIJ256-INJ Otn''r~CHO_ACC PU1'258 - _I D
_ l_ _o_lTT_ .r' CHJ _.I.CC
ICHO_ACc - _r_m_ ___._ #Clil_ACC -lll2 _

i - - - - - -EN
AOD_I I
EBO. . - - - - - - - - - -ED
ADO.I I
,t!IO _ _ _ ___.
PI11260 - Dll Otrr~ #CHZ_ACC PIW26Z ~__ l _ _o_ur
!U __.r ' CH3_ACC
~2___.,!
f Clll-_Acc-_r_ ,fCR3_Acc- ID2 !
ff~t1'10r~ 2: Incce•ent. Sl!P_ACC ; Councec f oe nWlbec of ,az,:,10, wen.

- - - - -£11
1',01) I I
E:110; - - - - - - - - - - -
fSMP _,.cc - I NJ OllT'r~SltP_ ACC
1-IllZ _

llctlror k 3: Tc,t to ,cc if the ol l , anplc, ht!vc been telten; 1f not. ll£TIJJUI
f.1,1P Cl
, - - - - - -,( ru:T} -1
J!'il!P_ ACC - llll
4 - 1112'

Figure 4-5 1. An FB without formal parameters. w ritten as o 4•c honnel Analog Input Filler.

248
Working With STEP 7 Programs a nd Doto

Ii f850- Unllicmttrdllllhq\SI l'roqrdm{I)~ - {□Jltl


I 'leonteiis of: 'Envitonment\lnl.erface!STAl'
lfet110r>c 4 : Divide each enalog input. accumuJ.ator by four t.o 9et t...>ie average .
DIV_I I DIV_I I 1188 , '/
, - - -£11 Elf0 . - - - - - - - -1!:11 EN0; - - - - - - - - - - - - . . . . . . - '1( ) -I
#Cl!O_AC~= ~~ Otrr~l!liSO IC!ll_AC~=~: ~ OtlT ,ms2
..----1!:N
DIV I I
-e;N0 , - - - - - - - - £ 1 1
DIV I I
-ENll; . - - - - - - - - - - - - - '

#CH2_AC: : : Otrr~11VS4 IC!IJ_AC:=~: ~ OUT rl!WS6

_J
lletmr k , : Resee st-ae1c ~ciables Ctt0_ACC,Clll_ACC,C112_ACC ,CH3_ACC ,SHP_ACC .
I. - - - -Ell MOVE I
ENO; - - - - - -IEfl
MOiie I M88 . 6
ENO . - - - - - - - - - - - - . , . . ( ) -1

o-'!N ou-rL, ctto_Acc 0-111 001'r1ctt1_Acc


l!:11
1110\IE I
l!:N'O- - - - - - -EU
.;\Olli: I
!N1J _ _ _ _ _ _ _ [JJ
tAOVE
oro _ __ I
~ ,m ourL1c112_Acc a-In 0UTL1c113_Acc O-Ill OIIT r #SMP_ACC .:J
~
Figure 4-51a. Continuation of FB53: 4-Chonnel Analog Input Filler routine.

Quick Steps: Programming an FB without Formal Parameters

ACTION
I

1 From lhe SIMATIC Manager. open lhe projecl and the required program Blocks
folder, and then double-click on the FB lo open the in lhe LAD/FBD/STL editor.

2 From lhe menu, select View ► lhen lhe language of choice (e.g.• LAD for ladder).

3 Select View ► Overview from lhe menu If the Program Elemen ts/Coll Structure
window is not in view (LAD/FBD instructions are in categorized folders I.

4 To deciore o new tem oorory or static vorioble: First select the TEMP or STAT object in
the left pane of !he d eclara tion table; then click in the Name field of the
declorotion row and enter the name for the variable. Click in the Data Type field
and selecl !he doto type for rrom lhe drop list. Click in lhe Comment field and enler
a descriptive comment. Enter as many lemporary or static variables os required.

5 To insert o lemporory or slolic variable before on exisling variable: Firsl selecl lhe
TEMP or STAT objecl from the left pane of lhe declaration table, to display the
c urrent records o f that type. Then. selecl on existing variable row. right c lick and
select New Declaratton Row . The new row is inserted before the row you selected.

6 To enter code for the block: Click inside the code sec tion. starting with network t.
then write the code for each network opera tion. using either absolute addresses or
symbolic addresses /if already definedl. Nole: Network 1 is au tomatically inserted.

7 To storl o new network. press the New Network bulton from the toolbar.

8 From lhe menu select Ale ► Save when done with lhe lost network: select FIie ► Exit
to c lose the editor.

249
STEP 7 in 7 Steps

Calling an FB without Formal Parameters


Basic Concept
With the exceptio n of organization blo c ks. oil blocks must be called in order to be processed.
A block is called by referencing its absolute address (e.g .• FB 60) or symbolic address (e.g.,
" FILTER4CH") IN'ith the appropriate call instruction. A call lo on FB con be unconditional. on
every CPU cycle; or conditional. when specific logic c onditions ore met.

Essential Elements
In LAD and FBD, an FB with no parameters is coiled os o CALL box. All user-created function
blocks. ore located in the FB Blocks folder o r the Program Elements tab. To coll the FB. you
must d rag the box fro m the FB blocks folder and drop ii onto the network. You must then
speciry the instanc e DB. belonging to the FB. above the box. The EN parameter allow you to
coll the FB IN'ilh or IN'ilhoul preceding logic. If the coll is based on logic conditions. the FB Is
called w hen the conditions ore satisfied; otherwise, the inslruclion immediolely follolN'ing lhe
coll is processed. In Sta tement List (STL). a n FB without parameters and without a ny static
variables can a lso be called conditionally. using the conditional call statement (e.g .• cc FB
60); or unconditionally. using the unconditional coll sta tement (e.g •• UC FB 50). Since no static
va riables or parame te rs are used. no insta nce DB i.s used; nor does one need to be specified.

Application Tip
Calls to an FB may be from the main organiza tion block (OB 1) or from another b lock (e.g ..
OB. FC, FB). Based on the purpose of an FB. you IN'ill determine where it is cotted from and
how often it is called. The analog filtering FB. for example. might be called from on FB
responsib le for processing analog 1/0 (e.g.• reading. sc a ling. filtering). at periodic intervals. By
supplying a d ifferent instance DB with each call. d ifferent data se ts may be used.

/t<A<'ru~ ,tmi-orrntnt\l~f~,.,·
I r.!: Nw, l'Ctworl: "'"71.nl-:--e<-,f_a<e_ _ ,.:---.,-N,-am""'e------'--------------,-
.
l t1 Gil Bt boc G O IN O IN
~ aJ Carp,-ator i.: :O OUT o "=o""ur= - - - - - - - - - - - - - - - --
Eb Ea c..,,..,t«
;; 0 lfl_OU1 0 IN_OVT
$ Ii! CC>JrUr • ~ Jl:Jq> :& TEMP
fjl lli! 08 "'' ® -0 RETURN O RFTIJFlN
(iJ (i) )Jmps
ljl @} tntooer fu.-.:tm FC19 : User Progran Concrol ~
Ill @) Fbbtl!Q-l>Clftt f<t,
m-(c) ~- fletvor• 1 : C001dic.ional Ca l! f'BSO: 4- c ruumel A.Ill Fl.le.er, '1/ lnscenc e DB.SO _J
m-G:a PrOQtomccrirol DBSO
(a) SMt/Rot<>:c
l!l 6i!J Status bts
Ir I 4. 1
1--
l
I4, 2
--111 - - t l l
FBSO I
!!lo ....- - - -
[jl eJTmers 1
m-Gii) Wordloglc
8-(gj FB bic:d<s Network 2 : Condlt1onol Coll f1160 : Totolitc< f11, vi.th lrult<1ncc I>B60
0B60
0
0
F65IO liltcriCH
F8S3 Fit«◄CH.,llox
0 R!60 Total,,.,
Ir 14, 3 14. 4
I1----1! 1 - -Ell
FB60
!IIOi-
I
1----
,e} f!!6 I Totalzet_Box
0 f8 l00
Network 3 : Un- Conditlon<>l Ce ll rBlOO, v!th In~t<II\Co DBlOO
0 FBIOI
l•l IC! FC blod:s DBlOO

·r' ICI SRI bbcl:s ; - - - - -EK


l'lllOO I
EIIO, - - - - - - - - -
li!BSFCbbo:s
• f,\jjop\! in<l-os
Al • Ltro1io1
llctworl< i : un-cond1tional Ce l l 1'81 00, "1th J.n.atanc e 0B101
◄ .!.l DBlOI
'-"CtlOn ~ al the
0/Ect
'£.i
~----Ell
FBlOO
UO---------
l
l!)P!o!l'"" - ~-~:~c.11
;;,wu
~ ~l!__ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __:·:,!!1
Figure 4-52. Cofling o n FB written without Formal Parameters in LA D/FSD. using CALL box.

250
Working With STEP 7 Programs a nd Doto


DUSO•· Drilbi,ntTr.-.inm!J\ 57 Pro!Jram(I)

Acldre$S Oecl8r11tlon NMle Type lnlll!i Vllkle Actllo!I v11lue Comment


'
1 llllilil il:at Oil ACC INT 0 0 Accu twfor I s l ~ Channel
'2 2,0 st~t CHI__ACC lNi 0 0 Accumuletcr for 2nd Anelog Input O)onoel
3 '!.O stat CHZ · c INT 0 0 Accumulator for ~d tChannel
<I 6,0 stat Cli3_ACC INT 0 0 AcC1Jrwlalxlr for ~h AM'og lop,t Channel
s e.o st~t SW.f',C.C lNl 0 0 ~ Cour~et

Figure 4-53. lnstonce DB 50. for F850, The DB is opened oulomolically when the FB is coiled.

Quic k Steps: Calling an FB without Formal Parameters

ACTION
'

1 Open the b lock (e.g .. OB 1) rrom which an existing !unction (FB) will be called.

2 Ta make a conditional coll in LAD. click in the code section of the block and enler a
new network in which to coll the function. To call the FB conditionally. enter the
control logic lo determine when the FB st1ould be called. then from the FB Blocks
folder of the instruc tion browser then drag ond drop the CALL COIL al the end of the
network. Enter the FB address above th e coil (e.g .. FB I)

3 To make an unconditional c al! in LAD. click in the cod e sec tion of the block and
enter o new network in which lo call the function. To coll the FB unconditionally.
simply open the Program Flo w C on trol fold er of the instruc tion browser then drag
and drop the CALL COIL ot the end of the network. Enter the FB address above th e
coil (e.g.. FB 2)

tn Statement Lisi (STL):

1 To make a conditional coll in STL, click in the code section or the block and enter a
new network in which to call the function; to coll the FB conditionally enter the
conditional logic and end the logic string with the condi tional coll instruction (CC)
referencing the address of the FB to call (e.g.. CC FB l ). No instance DB is needed.

2 To make on unconditional coll in STL. click in the code section of the block and
enter a new network in which to call the function; lo catl the FB unconditionally
simply enter the unconditionol call instruction (UC ) referencing the oddress of the FB
to coll (e.g .. UC FB 2). w ithout any preceding logic string. No instonce DB is needed.

251
STEP 7 in 7 Steps

Programming an FB with Formal Parameters


By using formol //0 parameters, you con develop FBs as o block-box operation. similar too
box addition instruction. that con be coiled whenever needed - supplying different values
or addresses on each coll. The formal parameters of the FB will represent the inputs and
ou tputs of the operation and act os address placeholders. An FB. for example, lo filler four
analog input channels would require o formal input parameter to represent the address of
each analog input and on output parameter ror each filtered result. On each coll of the FB
in your program. on actual address for each input and each output from the box is
plugged into the FB in place of the formal parame ters.
Essential Elements
Formal parameters ore specified using the IN. OUT. and IN_OUT. declarations. The FILTER FB
might inc lude inputs for reading lhe analog Input channels (e.g .. CHO_IN. CHl _lN, CH2_1N.
and CH3_1N); static variables for adding successive readings of each analog Input (e.g.,
CHO_ACC, CHl _ACC, CH2_ACC, and CH3_ACC; outputs from the FB might include the
filtered values (e.g., CHO_AVG. CHl _AVG, CH2_AVG, and C H3_AVG/. If temporary variables
ore required, they ore specified using TEMP declarations. After defining the formal
parameters and temporary variables. the block code is then written using one or more
networks just as you would normally. but instead of using actual input and output addresses.
you will enter the forma l parameters instead (See Figure 4-54).
Application Tips
Use of Formal parameters Is a great odvonloge in that while the actual code is written once,
the FB may be called repea tedly. Memory use is also minimized and errors ore reduced.

■ f853 - NewJ]rj\ SJMATI C 300(3)\ CPll 3 16 - 1□1 ~


!Contents Ci 1'Envlronmert\lritelface\5TAr
lntEfface
\lo/ Name OataTufe Ad<fress lnlffal 11a1ue Comment
EB-0 IN l":l CHO_ACC tnt 20.0 0
mo our 1D CH1....ACC Int 22.0 0
0 IN_OUT lll CH2..ACC In! 24.0 0
@ - STAT lll CH3_ACC Int 26.0 0
00 :lil- TEl"P
"!l:I SMP_ACC Int 28.0 0 .:::J
fBS3 : Fout Channel Anal og lnpuc filte c
tretmrk 1: Read Channels and score each 1n cortespondinq Suic.ic variabl e _J
I - - - - -£If
.
ADD I I
-£110, - - - - - - - - - -Dl
ADD I I
-ENO, - - - - - - . . - -
Mf

#CHO_ACC-Dll our ICHO_ACC #CHl_ACC - INl I


OtJT I Cfil_ACC

____.
ICHO_ni - Il/2 ICRl_DI - ~

- - - - -t:ll
Al>O_,I
E J I O , - - - - - - - - - -EN
J\l)li_ lI
ENO , - - - - - - - '

tCH2_.1.cc _ Il(1 our I I CH2_ACC #CH3_A.c c- IN1 Otrr #CH3_ACC

fCH2_IN -_Dl
_2 _ __, I CH3 _ DI -_lll
_ 2 _ __,

Net,,.,rk t: Incren ont SUP ACC; Countee f or number of oamples tclcen .


I
- - - - -Eli
ADO.I I
EJIO ~ - - - - - - - - -

#$MP_ACC - llll Olrr l #SMP_ACC


1-!N2
•I j
Figure 4-54. FB 53: 4-Chonnel Analog Input Filter Logic using Formal Parameters.

252
Working With STEP 7 Programs a nd Doto

Quick Steps: Programming an FB with Formal Parameters

ACTION

1 From the SIMATIC Monager, open the project and the required program Blocks
folder. and !hen double-clic k on lhe FC lo open lhe in the LAD/FBD/STL editor.

2 From the menu. selecl View :;. then the programming langua ge to use (e.g., LAD):
lhen select View :,. Overview from lhe menu, if lhe Program Elemenls/Coll Structure
window is not in view.

3 To declare a new fonnat p arameter: From the left pane of the d eclara lion table.
select the parameter type you wish to declare (i.e., IN. OUT, or IN_OUT), then c lick in
the Name field of the first declaration row and enler the name for the va riable. Click
in the Data Type field and select the data type from the drop list. Finally, click in the
Comment field and enter a descriptive comment. En1er os many variables of a
particular parameter type before moving to a new tonnol param eter type.

To insert o formal parome1er before an existing variable: F~I selec t lhe desired
fonnal parameter type (i.e .• IN. OUT. or IN_OUT) from the lefl pane. to display lhe
current records of lho t type. Then. selec t o n existing variable row , right click and
selec t New Declaration Row. The new row is inserted before the row you selected.
You may also select on existing variab le a nd drag it too new position.

4 To declare o new te mporary or static variable: First select the TEMP or STAT o bject In
lhe left pane of lhe declaration table; lhen click in lhe Name field o f lhe firsl
declaralion row and enter the name for the va riable. Click in the Data Type field
and selecl lhe dolo type for from the drop lisl. Finally. click in lhe Comment iield
and enter a descrip tive comment.

5 To insert a lemporory va riable. or slalic variable be fore on existing variable: First


select the TEMP or STAT object from the lefl pone, to d isplay the current records of
lhol type in the declaration table. Then. selec t on existing variable row. right c lick
and select New Declaration Row. The new row is inserted before lhe row you
selected. You may also select on existing variable and drag it too new position.

6 To enler code for the block: Click inside lhe code section, starting with nelwork l .
write the code for the device or opera tion as you would nonnally, using the formal
porometers w here you would no rmally use absolute addresses (See Figure 4-53).

7 From lhe menu, select FIie ► Save when done with the lost nelwork.

8 Select File ► Exit to close lhe editor.

253
STEP 7 in 7 Steps

Calling an FB with Formal Parameters


Basic Concept
An FC you developed with format parameters is meant to be called multiple limes
throughout your program. For example. the FC written in the previous task was developed to
con trol AC motors of a specific type. Each time you call the FC to control o d iffere nt mofor.
you must supply a new set of addresses (i.e .. actual parameters) for !hot motor.

Essential Elements
When called in LAD or FBD, an FC with parame ters appears as a box containing its input
parameters on the left side o f the box and output parameters on the right side. Each
parameter has a name that reflects the actual input or ou tput for which it is a p laceholder.
The FB for filtering four analog inputs includes CHO, CHl . CH2. CH3. and SAMPLE inputs;
CHO_AVG, CHl _AVG , C H2_AVG. CH3_AVG , and DONE are outputs. On each call of the FB,
you must supply on absolute or symbolic address al each parameter. As you use on FB with
formal parameters, you must ensure tha t lhe correc t addresses are en tered at the
appropriate parameters and match the data type (e.g.. BOOL, WORD. INT. and DINT) al the
parameter. For example, the parameters that accept the analog inputs ore of type INT, The
filtered output is also of data type INT.

Application Tips
A system function block (SFB) with parameters is handled in the same manner as a user-
developed function block (FBI with poromelers. In LAD/FBD. the EN/ENO signals allow the FB
or SFB w ith parameters to be used in a network like any other box operation. To use on SFB or
existing FB correctly. you will need appropriate documentation to know lhe purpose and
operation of the b lock. II is essential to know the type of memory variable (e.g., t. Q , M, Pf,
PQ, and DBDW) and data type (e.g.. BOOL. DINT. INT. and CHAR) expected at each
parameter.

• New netwo,k
.ii SIJ B1tbgc
• "'"""Int
-:-er
- f,--occ
- - 1::::-T.'.N~a;.;;
----
mc:.e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _, :::-l
• I
'
IN
:11 '.rt COIT'!>"••lor
l'll '.:il Convmcr llot 'IIOr k 5 : Call PB 253 4-Cbe.,u,el Ane.log Inpue l'ilur ;
3J £ii COlrtei
'al iill D6 ea~
i>BS3
1110 .6 1199. 0 1"8S3 I
.!l !.s) ""''
@ fill Jrt.eger f,mct;,n
.--I ,... - - - t ( p)1---DI DID i - - - -

3 '.5J) FIMtng•pont fct. PI112S6 - CHD_m CHO_AVC~m1100


$ !?!J M<MO
'of .i:fl Pr0<)ram <ort1ol PlUZ58- CBl_m Clfl_ AVOr nlllOZ
aJ ~ Shf tfl\Olble Pruzoo ~ CB2_m CH2_AVG n11104
ffi ~ St.otus tits
~ :ii Timers PI1TZ6z-CB3_lll
1
ra3_AVGr mrl06
S) ~ WordbQic 4 - _.S._
U_P_L!!_ _ _ _ _D_Olll~r-1!80 . l
8 '.DI FB bloc:ks
Q fliSO Flter-lCH
'-0 F6S3 Fltl!f'ICH_Box . llet .,.,r k 6 : Call FB 253 4-Ch&nl\el Analog Input Niter; Inst.a nee DB 54
6 Fe60 lotal,ei DBS'I
0 1'£6! lot•l•ei_llox IUO, 7 !lll9, l FBSJ I
QFBIOO .--1 1----( P}1----.Ell EllO ; - - - - -
0 FBIO!
PlU264-,CHO_Ill CHD AVG ~!Rll08
al ii) FC blod<>
31 i;;I SFD blod<s Pl\1266 - 0U._Ill CHl_AVG ll!'-lllO
• iii SFC bixks ~ Pll1266 - CH2_Ill Cll2_AYG llf<illZ
l';;::uo.t=;:bn::;::blocl:s::;::::;of;:;:the;::=p=o=l"'~t= t s Plll270-('H3_lll CH3_AVG rllllll4
4 -_
~_·_LC_· _ _ _ _D
_ant
___,r-l'!llO,Z

Figure 4-55. Coll lo FB 53 Filler: Four analog inputs ore filtered on each call to the FB.

254
Working With STEP 7 Programs a nd Doto

0853 •• BrilliantTraining\57 Pr<19ram(l

IAddress f~btlon N6me lType Inllal V6lue Actuel velie Comment

2.0 .,., CHO~


--
CHI IN
1
INT
INT
0
0
0
0
..,_
Accul'l)U,!ator.[or !St d\al1nel
Accumulator for 2nd channel
c ~ lator f0t l<dcfunneT
◄ ,O CH2_1N 1NT 0 0 _ _ __,_A~=
4 6.0 ... CH3_lN INT 0 0 Accumulator for 4th coannel
5 8.0 ... SAMPLE JNT 4 4 f,lJmber of readings to take
6 10.0 oot 00 AVG INT 0 0 filtered Result I st Channel
7
8 -12.0 00:
1 ◄ .0 00: --
CHl ..,AI/G
CH2 AVG
INT
INT
0
0
0
0
Filtered Result 2nd Channel
FIitered Result 3rd Cheonel
...;;;.:.._
9
-
16 .0 out CH3...AVG INT .o .. 0 F~tered Result qth chennel
10 18 ,0 out DONE BOOL FALSE FALSE
11 20.0 stat CHO ACC INT 0 0 Accumulator for 1st Chamal
12 22.0 stat CHI_ACC INT 0 0 Accumulator for 2nd Channel
13 24.0 st« CH2 ACC INT 0 0 Accumulator for 3rd Channel
14 26.0 stet CH3~ACC INT 0 0 Accumulator f°' 4th Channel
f-'-------i-----'-'---......C--'
f5
--
28.0 -stat
- -----
Sf>'P ACC INT
. 0 0 Sample Counte.-

~I _J ll
Figure 4-56. Instance DB 53, for FB53. The DB is opened automatically when the FB is called.

Quick Step s: Calling an FB with Formal Para meters

ACTION

1 Open 1he desired S7 program and the colling b lock (e.g.. OB I ) from where you will
make a coll lo an existing function block (FB) w ith parameters.

2 From the View menu, select LAD as lhe p rogramming language to use.

3 From lhe View menu, selec t Overview ii lhe Instruc tion browser is nol In view.

4 To moke first coll in LAD. click in lhe code section or lhe b lock. lhen from the toolbar
press the New Network icon to enter a new network in which to call the function.

5 From the Program Elements tob. open the FB Blocks folder to display oil user•
created Function Blocks (FBsJ of the currently opened S7 p rogram: locate the
desired FB number (e.g .. FB 40), then drag and drop the FB onto the network.

6 For each parameter. enter th e actual addresses for the first coll of the opera tion.
Insert logic in the EN input line for a conditional coll to the FB; insert the FB withou t
logic conditions preceding the EN Input line for on unconditional c o ll.

7 To make second call in LAD, insert a new network in which lo call the function.
Repeat the p rogramming process. o r steps 5 and 6. b ut supply the next se t or actual
addresses (absolute or symbolic) for the next device or operation.

8 From the menu, select File ► Save when done with the lost network.

9 Selecl Fite ► Ex.it to close the edilor.

255
STEP 7 in 7 Steps

Programming Basic Bit-Logic Operations


Basic Concept
Standard b it logic instruc lions provide instructions used in developing relay equivalent logic.
By providing the ability lo examine the ON/OFF status of any addressable bit variables. these
instructions ore combined to form series. parallel. and series-parallel combinations that
determines how internal or external outputs are controlled. These instructions o re also used in
creating the d living logic to trigger operolions like timers. counters. arilhmelic calculations.
program jumps. data move operations and communications.

Essential Elements
This group of operations allow the status of bit addressable variables or memory (e.g.. I. Q. or
MJ to be examined using normally-open and normally-closed contacls; or conlrolled using
the standard output or the set and reset ou tputs. Set and Reset outputs. provide the facility
for latching and unlatching o v tpul signals. In essence, these operations allow you lo develop
logic to examine or influence the result or logic operations (RLO) . For examp le. the NOT
conlact in LAD, and !he Negate (NOT} input in FBD. allow the RLO to be inver1ed.

Application Tips
The following two figures illustrate basic logic combinalions of series and parallel circuits. In
FBD these combinations you will use the AND gale for series logic. and the OR gate for
parallel logic. As many inputs os required may be input to o gate. Outputs may be placed in
parallel in bolh LAD and FBD, however when working in LAD. the secondary outputs must not
branch off the Jeff power roil. Finally, if programming in STL, remember that when combining
·AND' and 'OR' circuits. !hot lhe OR must be performed first, which is ensured by placing the
OR operation wilhin parentheses.

FCl : Simple Logic using Bit Instructions.


: 5111,ple ci r cul t 11:!th one 11.0. contect.

I I20. 0 017 . 0
r-1 ,- - - - - - - - - 0 - -11
tletwork 2 : Serie:, ci r cuit (AND loqic ) with two contactB.

r1
I I20. l 120 .2
1---~:l/ 1 - - - - - - - - ! ~
1
017 . S
:1
Ne tffllrk 3 : Pai:ellel circuit (OR logic) with two N.O . contacts.
I 120. 2 011 . 7
1 1 - ~ - - - - ------<!) i
1j 120. 3

r
ffet110rk 4 : Simple Latching Circuit.
017.7
1
, - - - - - - -,rJ :1

17.7

rl
Figure 4-57. Example In LAD: Using Basic Bil-Logic lnstrucflons lo form logic combinolions.

256
Working With STEP 7 Programs a nd Doto

FCl : Si11ple Lo gi c using Bi t Instructions.


Netllork 5 : AIID-befox:e-OR l ogic collbinat.ion.

I 120.1 120. 2 030 . 2


1I I! () I
!20. 4
I:
Uetoork 6 : OR- before - MID logic combinecion.
I 120. 1 120.2 030 . 2
I I
1 I: () I
j , 2 0. 3 120 .4
II I I:
tretwrk 'l: £xc l u:,ive- OR ilcple.mentation in Ladder logic .
I r 20.1 120 .2 030 . 3
I I
1 v: ( ) -1
j , 2 0. J 120 . 2

1111 I:
Ketwrk a: Logic Clt:CUit. \11th pat:aJ ell outpucs .

I 030.3
I:
017.S
() I
017 . 6
I R01": ()-1
Figure 4-58. Example in LAD: Using Basic Bil-Logic Instruc tions to form logic combinations.

Guidelines: Programming Basic Bit-Logic Operations

GUIDELINE

1 Open the Sil Logic folder of the Program Elements lob lo access bit instruc tions like
NO and NC contacts. NOT conlact and coils.

2 Use toolb ar bullons or hotkeys F2. F3. F7. F8, and F9 for frequently used operations
like NO and NC contac ts, branch open, branch close and coil.

3 Examine logic O or logic 1 status of memory operands including lnp uls (1) , Ou tpu ts
(Q), memoiy b its (M). g lo b al DB bits (DBn.DBXy.x), temporary local doto bits (Ln.y),
static local doto bits. limer status [Tn), counter status (Cn), or CPU stolus b its.

4 Use normally-open contact to examine for logic I to allow power flow: use normally-
c losed conloct to examine for logic O lo allow power flow.

S Combine bit-logic opera tio ns to c reate series (AND), parallel {OR). and series-
porollel (AND-be fore-OR. OR-before-AND) logic combinations (See Networks 1-7).

6 Combine multiple coils in parallel (See Network 8). Contacts may also be placed in
the parallel coil branc h, but only preceding th e coil instruc tion (See Network 8).

7 Use the NOT contact lo invert the result of logic operation o t the point of insertion, or
os lhe lost contocl lo invert the normal operation of o coil ( See Network 8).

257
STEP 7 in 7 Steps

Programming Set-Reset Operations


Basic Concept
The Se/ and Reset coils ore used when o bit location must be set to logic 1 when the d riving
logic is log ic 1. yet must remain set until rese t to logic O; even if the d.riving logic returns to
logic 0. The set and reset opera tions depending on your requirements or preferences. con be
programmed using two separate output instructions or using the Set/Reset or the Rese t/Se t
mp- flop, which combine both operations In a single box function.

Essential Elements
The Set and Reset coils ore generally programmed lo operate as a pair. but ore
programmed in s.ep orote networks that each re ference the some b it address. When power
flows to the Se t coil. the address is set to logic 1. When power nows to the Reset coil. the
a ddress is set lo logic 0. Na power flow to the Set or the Reset output. does not a ffec t the
sig nal stole o f the bit address. Whic hever of the two opera tions is programmed lost is
considered the dominan t of the two; this is true since when both coils o re activa ted
simultaneously, the o ne processed last overrides the status determined by the other.

The Functionality of the SR flip-flop and the RS flip-flop is the same as the individua l instructions
excep t that bolh functions ore handled in a single box inslruc tion. The dorninance of the set
or reset in o flip.flop operation is based on which of the two input lines is processed lost in the
box. In lhe RS flip-nap. the s is processed last. and therefore is dominant should both occur
simultaneously. In the SR flip-flop. the R is processed lost, a nd therefore is dominant should
both occur simultaneously.

Application Tips
Like standard outpuls and other bil logic operations. sel ond reset coils ond flip-flop
instructions ore generally driven by o combina tion of series-parallel logic tha t controls bit-
addressable locations. Logic may be inserted preceding or following set/rese t flip-flops . In
FBD. on AND gate is inserted lo create series logic: o n OR gate is Inserted for parallel logic.
Set/reset coils may be paralleled in both LAD and FBD, but in LAD. parallel branches for
secondary coils must not start ot the left power roil.

fet'llOrk 11: : I llustration of the Set Output


1) It I 3,1 AND I 3, 2 i~ at Logic l , nm1l Q 4,6 is set to logic l and wi l l
r~•ain at l ogic l until teset. A change in state ~t the drill1llg logic
bas n.o inf l uence on O 4. 6 while the output is set.

I 113 . l 13 . 2 04. 6
- -1 - - - - - (s) -J
1
lfe twur k , : Illus t cation of the Reset Output
1 ) If I 3.3 AND I 3.4 is at Logic 1, THDl Q 4.6 is reset to l ogic O and will
remain at 1011,1c o until set. A ehttnge in st.ate at the dciving logic
bas no infl uence on Q 4,6 vhile the output is r eset .

13 . 3 I3 .4 0 4. 6
--1 1 - - -l 1 - - - - - - - (R) -I

Figure 4-59. Example in LAD: Using Sel and Reset Ou tput Instruc tions.

258
Working With STEP 7 Programs a nd Doto

~~~~~~:~~! : I llus t.cat.i on ot an SR F'lip- F'lop (Dominant. Res er;)


1) lf th.e signal sr;ar;.e ar; input. S 1s ar; Logic 1 and at: R is ae toqic 0,
then JilOl. 5 is set to logic 1 end will reaain at logic 1 until reset. A
change in seai:.e -e.i:. tbe dcivJ.ng logic ae the s-1npue has no influence an
the set. address M 101.s. 'Ille output. Q wil l al~-e.ys f ollov M 101.s.

2) If the signal stau at input. R becomes logic l, the address 1'101. S is


reset to logic o independent oe the stat:US at input line s .

I I 3.5
MlOl . 5
SR
ol 04. 7

r,3.6
I
I!

I:
13 . 7
II
s

R
() J

lfetwr k 11 : I1lust cation of an RS Flip-flop (D ominant Set)


l) If the signal state a t lllput R is at Logic land at.Sis a t Logic O,
then !101.S is set to l oqic o ~d will ce•ain at logic o until set.. The
output Q vill always f ollow 11 101. 3 oc the address above the instruction.

2) If the signal staee at inputs bec omes l o',Jic 1, the address 11 101. 3 is
set t.o logic l and cuains at 1001c l. as long as input S ill !lC l OOiO 1,
end independent of the status at input. line R.

MlO l .3
!4.1 RS 0 4. S
. I I R al ( }-I
1'4-'2
I I:
14. 3
I: s
Figure 4-60. Example in LAD: Using Set/Reset flip-flop and Reset/Set flip-flop Instructions.

Guidelines: Programming Set-Reset Operations

GUIDELINE

1 Sel and rese t operations ore in the Bit Logic folder of lhe Program Elements tab.

2 Use the Set/ Resel coils a s a pair lo provide the latch/unla tch functions. Both
op erations should reference the some a ddress.

3 Use the SR or RS flip-flop box instruction lo implement both the la tching and
unla tching function .

4 Combine series (AND) and p arallel (OR) logic combina tions, lo d rive lhe set/reset
coils and SR or RS flip- flop opero lions.

5 SR or RS flip-flop operations may be placed in series a nd in parallel a nd combined


with c ontac t instructions p laced b efore or o tter the flip-flop opera tion.

6 Set and reset coils and SR and RS flip-flop operations Inside on MC R zone will
maintain their last sta te wh en !he MCR is no t activated.

7 Like stand ard coils, set and resel coils may b e combined as p arallel coils and
contacts may be placed in lhe branch preceding lhe sel or resel coil.

259
STEP 7 in 7 Steps

Programming Edge Evaluation Operations


Basic Concept
Edge evaluation operations ore mainly called upon to detect and ind icate when a discrete
tronsi1ion occurs (e.g .. motor switched o ffl . These operations are also often used to ensure
thal certain operatio ns (e.g., arithmetic colculotion. or move opera tion) ore triggered for
processing only once on the transition of some event from logic O-to- logic 1(positive-edge).
or from logic I-lo- logic O (negative edge). With the these operations. lhe need lo develop
comp lex binary logic lo detect negative and positive edge transitio ns is eliminated.

Essential Elements
There ore two types of edge detection opera tions. both of which support detection of
negative and positive edge transitions. The Address Positive-edge Detect instruction and the
Address Negative-Edge Detect instructions look for an edge transition in a specific bil
address. The second edge evaluation type looks for on edge transition in the result of a logic
operation [RLO) at any point in a logic network. The instructions include the RLO Positive--
Edge De/eel and the RLO Negative-Edge Detect. Bo lh types of operations signal that an
edge hos been detected by causing a one-shot pulse at its outpu t. The indicating signal is at
logic 1 for one CPU scan. and then returns lo fogic 0.

Het\'IOrk 1: !:xa.aple Us in9 Addc e:,11 Po si tive Ed9e Detection


l ) If the status of I 4. 2 is l o'Jic: l AND tlle stacus of input 14. l tz:ensitions
ftolL 0-eo- l then ou-cput 03 .7 qoe, HiQh( l ) foe one ,can and then ooe, Lov(O) .

I 14. l

II
14. 2 POS 03.7
ol () I
I
MlOl. l - M_BIT I
iii;i~ ~~ ·:ij: .Exwaple
I; ,~ ••
u, ino Adc1i:e,s lleqetive Edge Detection
l) l f the ,utus at 1cnput 14. 3 ti:ansition, t coa 1-to-o men the ,utus ot
output: QJ .IS goes High (l) foe one s can and thl!n go es 1o~CO ).

14 . 3
NEG Q3.6
al C}-1
·1 Ml 01 . 3 - M_BIT r

Ket,11>1:k 3 : Ex emnl e Usina RLO Positive- Edoe and RLO Nea a tJ.ve- Edae Detection
l ) If the i: esult ot the l ogic operation (RLO) pi:eceding M-Coi l t:1:ansitions
tcoa 1- t o-O, then 03.0 qoes High(l) tot one s een then goes Low (O) .
2) It the cesult ot the l ogic opecation (RLO ) preceding P-Coil tt8rulitions
tcoa 0-CO-l, then Q3 .l goes Hi~ (l) toe one ~can then goes Lov (O) .

I 14. 2 14, 4 HlOO. J Q3 . 0


1I I: (N! C}-1

I
G 4:3
I:
Ml 00. 2
(P!
Q3 . l
{) I
Figure 4-61. Example In LAD: Address and RLO Positive- and Negative-Edge Operations.

260
Working With STEP 7 Programs and Doto

treu10rk 1: ZKamole Usino Addtess Positive Edue Detection


1) If the status of l 4, 2 1s lolJic 1 AND tbe stecus of input 14,l txensitions
fIQa 0-to-1 then output 03. 7 goes High(l) toi: one scan and then goes tov(O).

&
14.l 03 . 7

HlOl. l - l'I BIT


POS
Q
l 14,2 -
_ _:_J
?!~~~!'~ ~~!: Example Using Address llegacive Edge Detection
J.) If tbe status at input 14. 3 ttensitions ftoa 1-to-o then the status of
output 03 , 6 voes Hlqh(l) for one scan and then voes L011(0). .
14.3 03 .6
~
HlOl.3 - Jl_BIT
NEG
Q 1

I
Het,10rk 3 : El<W))le Using RJ.O Positive-Edge and RJ.O Ueoative-Edge Detection
1) It the result of the logic operation (RLO) preceding N-C01l ti:ansit1ons
fIOlll l-to-0, then Q3.0 goes High( l ) tor one scan then goes Lov(O ).
2) It the cewJ.c of the logic operec10n (RLOJ pteeed:1n!1 P-Coil ttansitlo~
tctoa o-co-1, then 03,1 goes High( l ) for one ,~en thtn goe~ Low(O ) .

>; 1
14. 2 -
&
!4.3 - - 111 00 . 1 03 . 0

14.4 -
H
!-_:_J
11100 . 2 03 . l
p
_ _:_J
Figure 4-62. Example in FBD: Address and RLO Positive- and Negative-Edge Opera tions.

Guidelines: Programming Edge Evaluation Operatio ns

GUIDELINE

1 Access address edge detect and RLO edge detect edge evaluallon instructions in
the Bil Logic folder of the Program Elements lob.

2 Use the address edge detect operations to delect a signal change in a specific
address; use the RLO edge detect operations to detect a signal change in the RLO a l
the point of insertion of the instruc tion.

The address edge detect operations may evaluate a specific address alone or in
combination with other logic condilions(See Network I and Network 2); the instructions
moy be programmed in series and in parallel similar to a contact instruc tion.

4 The RLO edge delec l operations must b e placed ofter preceding logic conditions; the
ins1ruclions may b e placed in parallel branches, but only in a branch Iha! starts al the
left power rail.

261
STEP 7 in 7 Steps

Programming Counter Operations


Basic Concept
Progra mming o counter is first o matter or selecting the required counter type rram the
Program Elements lab, based an the name al the insid e lap al the box (e.g., s_cu is an UP
coun ter/. and p lacing ii into the LAO or FBD network. The counter address must be entered
just above lhe counter, using the absolute address (e.g .. CO, Cl , C2) o r the symbolic address
(e.g., Am Total) ii a lready defined. Inserting the driving logic ror counter Inputs (CU or CD. S.
and R), and entering fhe output addresses for lhe current count is all that is required.
Essential Elements
A box counter hos one count inpul line (CU or CD) or two [CU and CD) in th e case or the
UP /Down caunler. A counter only increments or decrements an the logic O -lo - logic I
transition ol CU or CD. When a logic O-to- logic I transition occurs on the set Input S, lhe
value specified at PV is loaded lo lhe counter ward as a slart or new current caunl. PV is
generally used as the slor1 value for a dawn caunler. Logic I al the rese t line R rese ls lhe
counter word lo zero. On lhe output side, the status signal Q . is set to logic I whenever the
coun t is greater lhan zero and is ofher,vise at logic 0. Finally, word locations specified a l CV
and al CV_BCD, allow the current count to be aulput in decimal and in BCD respectively.

Applic a tion Tips


A counter conlains a WORD value in BCD and either counts from ()(X) lo 999. or from 999
down la 000. The PV entry may be transferred lo lhe counter al any lime as a starting value,
or as on override value. PV may be specified os a BCD canslant (e.g., C# 525), os a local
variable of data type WORD. or as a word-width memory location /absolute or symbolic),

?'!~~~;~:~!: Example: Using the UP Countee - Box Instc\1ction


1) The countec .1.s CS . The v~id cange fee usable countecs is CPU dependent.
2) ihen the 101110 collb1neit1on dr1vin11 the cu inp\lt line ■!ll!'es 11n OFF-to-ON
transition, CS wi l l count UP by +l .
3 ) Tlhen the 101110 collbirteit1on c:IJ:1vin11 the s i nput 1-l.ne ■ues an Off-to-ON
traru1i tion, the preset value of 100 specified at PV is loaded to the count
valuelbe input specified at PV •ay be a constant BCD value as sholiltl bere,
oc may reference a •emory location vnece the pce~et v~ue ts etoced.
4) llhen the lo(iic collbination driving the R input line aakes an 017-to- OB
trcnsitJ.on, the co\Ultec 111 reset to zero.
5) Location (1'1ll42) specified at output CV st.ores the elapsed count in decimal.
Location (Ml144) specif~ed et output CV_BCD stores the elep~ed count 1n aco.

I IS.2
I
H3 . 7
v:
cs
s_cu I
aCr)
H101.1
I
Gs.
I
1 cu
3 CV !m42
I s.
f:o~.4
I

C#lOO - PV
-
CV BCD [IN·14.

I
11S.
I
1

4
I
r:o~.7
I R

I I:
Figure 4-63. Example in LAD: Programming a Counter box instruction.

262
Working With STEP 7 Programs a nd Doto

FC lO : Using Counter Box Instructions .


lett1Urk : Ex8lllple: Using the UP Counter - Box Instruct.ion

rs.2- cs
s_cu
M3 . 7 -0____,- cu

IS.3 -

MlOl.4 - ___ __,-- s


CV M\142
CllOO - PV
IS. 4 - ' MlOl . l
-
CV BCD MiJ44

RlOl . 7 - ___ __,- - - - - - - R ___ __.


O- - - - - - - ___- __,

Figure 4-64. Example in FBD: Programming a Counter box instruc tion.

Guidelines: Programming Counter Operations

GUIDELINE

1 Counter box and coil operations o re in lhe Counters folder o f lhe Program Elemen ts
lob.

2 Counters ore addressed CO, C l, C2, ond so on. Avoilobte number of timers is CPU
dependent (e.g., CO to C255)

3 Contac ts may be arranged in series/porollel ot eoch counter input (i.e ., CU, CD, S,
R), to achieve the desired control logic, as well as ofler the status signal (Q).

4 PV accepts valid BCD or Hex constants os p reset count values (e.g .. C/1525 or
W I/ 16#0525). The maximum counter range and value for PV is 000 lo 999.

5 PV may also be se t os o variable by desig no ling o valid word location (e.g.. MW 40.
IW 10) or using o local variable of data type WORD.

6 A counter is incremented (CU) or decremented (CD) by one, only when !he RLO on
the coun l input line or preceding the counter coil changes from logic O lo logic I.

7 You may check the status of o counter. using N.0 . or N.C . contacts that reference
lhe coun ler number (i.e .. C4). The status Q is logic I whenever the counler value no t
equal to zero.

8 You con c heck the value of the counter a l intermediate points for control o r other
purposes, using the compare operation and comparing the values al CV (decimal)
o r cv_sco (BCD).

263
STEP 7 in 7 Steps

Programming Timer Operations


Basic Concept
Progra mming a timer is first a matter of selec ting the required timer type from the Program
Elements tab. based on the name al the inside lop o f the box (e.g., S_ODT is an on-delay
timer), and placing it into the LAD or FBD network. Th e timer address must be entered just
above the timer, using the absolute address (e.g .. TO, Tl . T2) or lhe symbolic address (e.g.,
Strl_Delay_ I J if a lready defined. Inserting the timer start logic. specifying a prese t value.
inserting the reset logic, a nd entering output addresses for the remaining time value is all that
remains.

Esse ntial Ele ments


Inputs to a box timer include the timer address, specified above the box: a start logic S line,
for entering the control logic that starts the timer; TV, for specifying o p reset value lo load to
the timer; and o reset logic line R, to reset the timer. On the o utput side of the box, the timer
status signal Q, signals the running status of the timer; and Bl and BCD. ore both for specifying
where the current (or re maining) time is o utpu t. The remaining time is output as a decimal
value al the location specified o l Bl a nd in BCD at the location specifi ed a l BCD.

Applic a tion Tips


The timer value TV may be specified as a constant using the SSTIME format; the range is
SST#Oh_Om_Os_lOms to S5T#2h_46m_30s_Oms. where h = hour, m = minutes, s: seconds, and
ms =- milliseconds. Only the required units of the preset time need to be specified. TV may
a lso reference a declared WORD variable, o r a word-width memory loca tion (e.g ., MW 102)
that contains the preset. The status signal Q . whose operation varies depending on the timer
type, may drive a coil referenced with any unused bit (typically from bit memory). The status
bit can be checked in your program using a NO or NC contact.

rc12 : Using Timet: Box I ns c.ruc c.ions .


IC01111ent:
I
~!~~!'?~~~i!: Exalllple: Using the OR De l ay Timer - Box Inst.r uction
1) The ti11ei:: in this exll!lple :is T24.
. .
2) \lllen the logic collbina&ion on the S input. line &r:l!.lls1t1ons fro• 0- to-l, the
ciaer T24 vill scare cuing and will t:.ime down until reachino :ero. It the
RLO status ac s changes ft:oll 1-to - o before me cillei: delay expit:es, the tiller
scops . Ou;:;pu.r. Q is activaced (l) and z: emains acl.ivated vhil e T.be RLO on the
S input line i:eaain~ et logic l .

3) Off- ON cz:ansition of IS. 4 True (1 ) on the R l ine, z:esets- the ti•ez: co zei:o.

4) Locacion (MV60) ,pecitied at output BI St4tes the r:eaetninc, tbe 1n decimal.


1ocation (MW621 specified at. output BCD st.oz:es t.be i:eaaining tiae in BCD.

I IS . 2
I s
T24
S_ODT I MlOl. 3
( } -I
115:3 '"'"""' -,, ·+"""
I Q

r' : IS . 4~R BCDrMV62

Fig ure 4-65. Example In LAD: Programming o Timer box instruction.

264
Working With STEP 7 Programs a nd Doto

FC12 Usin g Timer Box In str ucti ons .


: Example: Us ing the ON De l ay Timer - Box I nstr u c tion

>=1
IS.2 - T24

IS. 3 - _ ,S -
S ODT
BI MtJ60

SST#SOOM:S - TV BCD MtJ62 MlOl . 3

IS. 4 - R Q. . . - - - - - - -
-----
Figure 4-66. Example in FBD: Programming a nmer box instruction.

Guidelines: Programming Timer Operations

GUIDELINE

1 Timer box ond coil operations ore in the Timers folder or the Program Elements tab.

2 Timers ore addressed TO, Tl , T2. and so on. Available number of timers is CPU
dependent (e.g., TO to 1255)

3 A timer box may be placed in any branc h that is connected to the left power roll.

4 Contac ts may be arranged in series and in parallel a t each binal'{ inpul (i.e .. s. RJ.
of o timer, ta achieve the desired control logic, as well as af1er the sta tus signal (Q).

5 A valid preset lime is SST# 10m_30s (10 MIN. 30 SEC.). Only lhe needed units of the
timer value need be used (e.g ., SST# 1SOOms).

6 The range of a timer preset is 10 ms to 99990 seconds


(= SSTIME# 10ms 10 SSTIME#2h46m30s).

7 The operation of the timer status signal (Q ) varies according to the timer type.

8 You may check the ru nning status o f a timer. using N.0 . or N.C . contacts that
reference the timer number.

9 You con c heck the remai ning time at intermed iate point for control or o ther
purposes, using the compare opera tion and comparing the values al Bl or BCD.

10 Time base unils ore binary encoded in b it- 12 and bit- 13 of the timer word o f each
timer. 00 =0.0 I second s. 01 = O. l seconds, lO =1.0 seconds. and 11 =10 seconds.

265
STEP 7 in 7 Steps

Programming Conversion Operations


Basic Concept
Progra mming a conversion operation is a matter of firs t selec ting the required instrucNon.
based on the name al the inside top of the box (e.g.. Dt_BCD is Convert Double Integer lo
BCD). and placing it into the LAD or FBD network. An input parameter must be specified as
the value lo be converted. and on output parameter as the location for storing the result.
Finally, inserting the logic for enabling lhe conversion is all fha l is required.

Essential Elements
The enable input line EN allows con trol logic to determine if the conversion is executed. The
pa rameter IN. w hich specifies the v alue to be converte d. may be a constant or local
variable of the correct data type. or a memory localion of the correct wid th. When EN is a t
logic 1, the conversion is executed and the result is placed in the loca tion specified at the
parameter OUT. The variable specified al OUT may be a local variable of the correct data
type, or a memory loca tion of the correct width. The enable outpu t line ENO. signals
execution of the instruction and whe ther on error hos occurred. If an error occurs w hile EN is
al logic 1, ENO is set to logic 0; otherwise. the sta tus of ENO follows the sta tus of EN.

Application Tips
Conversions o re used to change the form at or data type o f a variable. A BCD input value.
for example. would require conversio n before use in an integer a ri thmetic operation. The
result would o lso need conversion, were ii to be sen t to a BCD display. STEP 7 orithmetic
operations use integer. double integer or real numbers; values o f any other data type would
require conversion. Finally. when specifying the input and output variables of a conversion.
remember that input and o utput variables may differ in data type and size, based on the
operatio n. For lnslonce, in the INT_ DINT conversion. the inpu t is 16-b it and the oulput is 32-b il.

Network 1: Conversions on BCO end Integei: Velues.


1)'1hen M30.7 is True (1), each of the conversions are perfouted end the
converted result is placed in the locati on specified at our.

2) The output coil in after each conversion is activated (lt When l:he operaci.on
is perfor:aed mthout "Crror. Otl'.herwise, ENO is 'O • while Ell is at l ogic 1.

I H30 .7 BCD_I I HSO . O


I: Ell DIO () I
mr6o -m oUTlmno
D1_8Cl> I KSO .1
ER DIOC () I
IID6 2 - I P WT r-MD72

HEG_I I HS0,2
Efl E.NO () I
mT66-IB mrrl111n6
,_ 01 I KSO. 3
Efi
DiOC ( ) I
6
ftlif 8 -111 otn' 1 1ID78

Figure 4•67. Example in LAD: Programming a Conversion inslruclions.

266
Working With STEP 7 Programs a nd Doto

Detffllrt. Z: ConYets i ons Usinq Vai:ious Roundinq llethods.


l. ) If H30.6 is True (1), the Real value 1n MD 110 is i:otmded to the
neatest vhole nUJDl>ei: ot double integec tocmat (e.g. , 2.62 to 3) .
2) If H30, S i s Tcue (l), the treotionel put ot the Reel value in !ID 110
i -o t runca ted; yiel ding the whole nUllb er double i nte9er ( e.9., 2 . 62 to 2) .

3)If H30.4 is Tcue (1), the Real value in MD 110 is rounded to nearest
doubl e integer: v alue gceater than val ue at. DJ (e. !l·, 3 . 44 to 4) .
4 , If H30. 3 is True (l), the Real value in 110 i s rounded to neatest
}ID
double integer val\le less than value at IN (e.g., 3. 44 to 3) .
I H3 0 . 6 ROUND I MSO. 0
...--1 11---EJI ENO,..------,---r )J--
HD110 - _Ill
__· __O_U___,
T 1 MD210

1130. 5 TRUNO I
- -11 .o1 ENO - - - -,

IIDl l O- IJl Otn' ~ HD21 4

!00. 4 CEIL I
~-I I EJI ENO ~ - - - - 1

IIDll O- Dl OUT~MD 218

H30. 3 FLOOR I
, - -Ell
1-1 ENO ~ - - - - '
1I 11D110 - _nr
___o_trr....r MD 22 2
Figure 4-68. Example in LAD: Programming Conversion rounding instructions.

Guidelines: Programming Conversion Operations

GUIDELINE

1 Conversion operations are in the Converter folder of the Program Elements tab.

2 Series and Parallel conditional logic may be inserted before the enable (EN) input
and after the enable ou tput (ENO).

3 Conversion boxes may be inserted in series by connecting the ENO line of one
conversion box to the EN line of the following conversion box.

4 Conversion boxes may be inserted in parallel if p laced in o branch that is directly


connected lo the lef t power roil of the network. When conversion boxes ore placed
in parallel, the network must be terminoled with o coil.

5 If o network with two or more parallel branches contains conversion boxes in series,
boxes ore evaluated from left-lo-right slarting wilh the first branch.

6 Slalus b it instructions OV and OS may be used to check for errors resulting from
invalid REAL numbers at IN. or values loo large to convert lo 3-digit or 7-digil BCD;
status bit contac ts may also be used to ct,ecl: ir th e result or a conversion is
negative, positive, or zero.

267
STEP 7 in 7 Steps

Programming Compare Operations


Basic Concept
Progra mming a compare operatio n is a matter of first selecting the required instruction.
based on the name at the insid e to p of the box (e.g .. CMP > I is Compare Integer for g reater
than), and p lacing it into the LAD or FBD network. Each o f th e six compare types is available
for compari ng integers (I). double integers (DI), and real numbers (R), and is selec ted
a ccord ingly. The input parameters must be specilled for the two values to be compared,
and the enabling logic th a t causes the compare to be executed must be e ntered.
Essential Elements
The unlabeled input line to the compare, allows contro l logic to determine if the compare is
executed. If no logic is inserted. the operatio n is a lways executed. The pa rameters IN I and
IN2 o re where the two compare values o re specified. The specifled values, which must be ol
the some type , moy include constants in the permissJbte range, local variables. or memory
loca tions (e.g .. MD 46) of the correct width. The unlabeled logic output line may drive a
binary output lo signal the logic-0 or logic -I compare result. o r may b e used as d irect input
lo other box instructio ns tha t a ccept binary inputs (e.g .. the S-R Flip-flop, or UP Counter)

Application Tips
The compare operation con be placed in a ne twork, much like a normally-open conta ct
instruc tion, with preceding and following logic. When the c ompare is successful. power flows
through the compare; if the compare test foils. power flow through the compare is
interrupted. Also like a con tac t. multiple compare boxes may be placed in series or in
parallel. If in parallel. a logic 1 result is produced for the branch when any compare is
sa tisfied. lf in series. a logic 1 result is prod uced only when all o f th e compa res ore satisfied.

llet'ffl>r.k 1: Compa r e tor Equal , using I n ~ ge t, Doub l e I n teger and REAL value:,
1) In tl\111 ex$111Pl.e, any one ot the thte.e coapares ,11erJ.stied, ptoduces 1 0011: l
f or the parallel bcenob. An equalit.y OOJIP&te is pecfomed on wo IIIT, I>INT,
8!ld REAL values.
2 ) H 101.l is activated it 145. l OR 145.2 is T!:ue AND either coapare il!I True.
3 ) Note that the integer uses a v otd location, double integer uses a double vocd
l ooati~n , end the f l oatinu- po>.nt coapace u~e:, double voi:d l ocations.

I 145. l CMP=I
I MlO l . l
I I
1 () I
1 145 • 2 555 -Dll
IJ
Hli62 - I1l2

CMP ••D
I.
Lf5 5500 - llll

MD72-Di2

C!l,IP ••R
l-
s. sssoooe+
0 05 - INl

m>82 - Dl2

Figure 4-69. Compare Opero t·ions in LAD: Compare Eq ua l for two INT. DINT, and REAL values.

268
Working With STEP 7 Programs a nd Doto

FC7 : Ex emple Coa p&re box i n:sti:uctions


llet111:1rk 1 : Compare f oi: Equa l., us1.nq Int.eqei:, DoUble Inteqei: and REAL value,

145. J. -

145. 2 -·_ ___Jr--

CMP ==I
555 - DJl

Mll62 - '.i!
,Dl~2_ _jr--

CMP ••0
I,i 55500 - Ull

HD72 - ·Jlll~2_ _jr--

CMP ==R
s.sssoooe+
005 - I Nl tllO J. . l

MD82 - Ill2
-----'

Figure 4-70. Compare Opera tions in FBD: Compare Equal for two INT, DINT. and REAL values.

Guidelines: Programming Compare Operations

GUIDELINE

1 Compare operations ore In the of lhe Comparator folder of the Program Elements
lob.

2 Six compare types con be performed on variables of dalo type INT. DINT, and REAL.

2 The two values input at INl and IN2 musl be or lhe some data type. For example, if
lhe comparison is CMP.: DINT, bo1h IN 1 and IN2 must be of type double integer or
re ference two double word memory locations.

3 To compare values other than INT, DINT, and REAL, the values must tirst be
converted lo one o f these three data types. For example, BCD values ore da·la type
WORD or DWORD. Either a WORD - lo- INT or DWORD - to- DINT conversion may be
required in order lo compare two BCD values.

4 Contoc l instructions may be arranged in series or parallel ei ther p receding or


following the compare box.

5 Compare boxes ore like normally-open contocls and may be p laced in series or in
parallel. All compares in series must be sotislfed lo allow power now. Compares in
parallel require a t least compare to be satisfied lo p roduce logic 1 for the branch.

6 When REAL values ore compared. lhe tesl foils if either of the values IN I or IN2 ore
invalid (UO = 1).

269
STEP 7 in 7 Steps

Programming Integer Arithmetic Operations


Basic Concept
Progra mming on integer a rit hmetic opera tion is o matter of selecting the instruction. from the
Program Elements tab, b a sed on the name a t th e insid e lop of the box (e.g., MUL_D1 is
Multiply Double Integers), a nd p lacing it Into the LAD or FBD network. Two input parameters
must be specified for the two integer (I) or two double integer (DI) values to be used in th e
c a lc ulation. An output parameter must be specified for the result. With lhe parame ters
d efined, the enabling logic that c auses the o p eration lo be executed is all tha t is required.

Essential Elements
The two source va lues for lhe c a lcula tion. specified al IN 1 and IN2. must be of the sa me
data type. and may include constants in the permissible range. tocol variables. or memory
loca tions of the correc t w id th /e.g .. MW 42 for INT: or MD 42 for DINT). The va riable sp ecified
a t OUT may be a loca l variable of the correc t d ata type, or a memory location of the
correct width (e.g .. MW 42 fo r INT; or MD 42 for DINT). The enable inp ut line EN allows control
logic to determine 11 lhe opera tion is exe c uted. Wihen EN is a l log ic I, the operatio n Is
executed a nd the resull is p laced in lhe location specified al the pa ra meter OUT. The enable
oui p ul line ENO, signals execution of lhe opera tion and w he ther a n error occurred.

Application Tips
If on error occurs during operation. ENO is set to logic O while EN is a l logic I; otherwise. lhe
status of ENO fo llows the status o f EN. A lier each arithmetic operation. you may use sla lus bil
instructions lo check fo r overflow o r if the result is. neg ative, positive, or zero. Use Integer
instruc tions. w hen whole number results o re acceptable and your results o re expected lo fo ll
within the p ermissib le range (-32.768 lo +32.767 for INT; -21 4.783,648 to +2 14.783,647 fo r DINT).

lletllOrk 1: I nteqe t Mul tipl ic11t i on of two nlJJlb e i::s


l l Vhen the result of loqic operoti cms (RLO) ot EN i s l ogic 1, the in te9er
values at I Nl md IN2 ace added and the cesult placed in the location
s pe cified at OlTI".

I 11'31 . 4 1131 . 5 MUL_I l M4 7 . 6


I: VI EN EJl"O ) I

Mloll 2- IN2

lfet,,ork 2 : Doub l e Int ege c Addi e.ion of two numbers


1) When the ce,ul t of Jogic ope~~t.1ons (RLO) at EH 1~ loqic l , me
doubl e
int egei:: valuesa t IH.l and IH2 a r e added and the re s ult placed in the loc a tion
,pecii!ied at OUT.

I H3 1. 6 H'31 . 7 ADD_OI I M47 . 7


II Ill EN ENO () I

MD 62 - I f12

Figure 4- 7 1. Integer Arilhme lic in LA D: lnleger Multiply: Double Integer Add.

270
Working With STEP 7 Programs a nd Doto

Het....,r k l : Integer !lulciplici,t.ion of t1Ao m.llllher9


l) llhen- the re$\.llt of logic opei:at10~ (R~O) at DI ii< lp gic l, the :in1;ege1:
values at m1 end Dl2 ere added and the resuli; placed in the locaci.on.
:,pecitied at our.

&
!131. 4 -
MUL. I
!131 . 5-0 - El/

100 -IIIl Ot.r'l' -m:114 M47. 6

MU12 - III2 £HO _:_J


tlet-..ork 2 : Double Inte11et Al!d1t1 on ot ruo nu.i,ers
1) Vhl,n_ Chie [O lllllt o f logic op,era t~OM (RLO) at: EU is logic 1, thie doubl<!
inteqet val uesat INl lllld IIIZ ue added end the cesult plec:ed in the location
specified at Otrr.

&
!131. 6 -
JIDl)_l)I
1131. 7 -0 - En
1#1575 - Illl Otrr - lID66 M47,7

MD62 - I l!2 £HO _:_J


Figure 4-72. Integer Arithmetic in FBD: Integer Multiply; Double Integer Add.

Guidelines: Programming Integer Arithmetic Operations

GUIDELINE

1 Integer [INT/DINT) opero tions ore in the Integer Fune/ions folder.

2 Use the INT boxes. for 16-bit opero11ons: and the DINT boxes, for 32-bit operations.

3 Bit instructions moy be combined in series or parallel before the enable EN input
ond ofter the enable output ENO output o f th e arithmetic box, to achieve the
desired control logic that drives the integer box operations.

4 Integer arithmetic boxes may be inserted in series by connecting the ENO line of
one operation to the EN line or the following operalion. A following operation is only
processed if the preceding operation is processed without error.

5 Use o temporary local variable os on intermediate buffer if you need to use the
outpu t value of a preceding opera t·i on in a Following operation.

6 Integer arithmetic operations may be inserted in parallel if p laced in a b ranch that


begins direc tly connected to the left power rail or the network. In such a case, the
network must be terminated with on output.

7 If a network hos two or more parallel branc hes starting al the left rail, each of which
has two or more integer arithmetic boxes in series. the order of p rocessing is from
!ell-to-right starting with the top b ranch. lhen the second branch. and so on.

8 Use sta tus b it OV to check tor on overflow ofter each operation, or o fter a series of
operations use the OS sta tus bl1. Also use sta tus bit instruc tions to determine If the
result is negative. zero. or positive (e.g., <O, = = O. or >OJ. See Status Bit Instructions.

271
STEP 7 in 7 Steps

Programming REAL Arithmetic Operations


Basic C onc ept
Progra mming o REAL o ril hmetic operation is o matter of selecting lhe instruction. from the
c ata log, b ased on the name al the inside top of the box (e.g ., DIV_R is Divide REAL). and
p lacing ii into the LAD or FBD network. Two input parame ters must be specified for th e two
floating-point or REAL (RI values lo be used in the calc ulation, and on output parameter
must be specified for the result. Flnolly, the enable logic for the opero lion may be inserted.

Essential Elements
Entry o f each REA L arithmetic operation will require you to specify the source values Fo r lhe
c a lculation al parameters INl a nd IN2; a nd the result location at the O UT pa rameter. Valid
en tries for IN 1 and IN2 include o REAL constant in the permissible(± I .75495e-38 lo±
3.402823e+38), local variables o f d a ta type REA L, or double word locations (e.g .• DB22.DD 12
or MO 44); the OUT p arameter may b e specified as o loca l va riable of type REAL or a double
word memory loca tio n (e.g., 0B22.DD16 o r MD 42). The enable input line EN allows control
logic to determine if the opera tion is exe c uted. When EN is a l log ic I, the operatio n ls
executed a nd the resull is p laced in the specified location. The ena ble o utpu-t line ENO ,
sig nals execution o f the o peration a nd whether on error occurred.

Application Tips
After a REAL calculatio n, you may use Sta tus Bit instruc tions to determine if the result is
nega tive, positive. or zero, or if one of the input values (IN I /IN2J is on Invalid real number. If
an erro r occurs while EN is at logic I , ENO is set to logic O; o therwise, the status o f ENO follows
lhe status of EN. Use REAL instructions. when whole number accuracy is not suitable.

Net work 1 : RKA1 c alc u lation UJ!ling Addi tion and Mul t i p l ic ati on .
l ) Wilen the dl:iving logic 1, Truc (l ), the oddl.t 1on i , pecfo tmed and the ce, ult
in double • otd l!li66 is u11ed i n the aul ti:plicat ion,

H31. 4 H31. 5 ADO R I t.lUL_R I M47 . 6


,r--- 1 !.1--- -- VI t:» -£Ho~
, - - - - - - - - -l H rno ! )1--
s . 1 sooooe+ HD66 - I Nl ourl- 11014
00 l - I»l 0111' ll!D66
___
MI>l2- I H2 _,
- --~I
MD 62- !N2

tret ,101·)l 2 : REAL Addition o f t t.ro f l oe.t: inq-point numbec s .


l ) I t an er i:or t:esul.ts and DID is '0' a te.st 111 a ade f or an ov ei: flow (OS)
i:e9ul.l:1,ng ftoa the entice Cllloulat ;ion.

I 1147 . 6 OS 1147. 1

1 v:---, 1 :------1 >--.


Figure 4-73. Example in LAD: REAL Multiply and REAL Additio n.

272
Working With STEP 7 Programs a nd Doto

Hetwurk 1: REAL calcul ation usin cr Addi t ion and Mul tin licati on.
l ) Uhen the driVing logic: is Ttue(l), the addiuon is pert oo.ed and the ce wlt
in doubl e wocd lll)66 is Wied in the :aul t.:i~lication.

&
1'!3l. 4 -
AOO_R
1'1 31. S -0 - IN

5 .750000e+
001 - I Nl OUT - MD66
MUL...R
H062 - IN2 IND Ell

MD66 - Dll OUT - f1D14 1147 . 6

MD12 - IN2 ENO I


~

I
tret...,,rk 2: REAL Addition oE two f l oating~po in t numbers .
1) tt an er ro r cesUlt.11 and ENO i.s, ' o' a c.est. 1s made t oe an overtlow (OS)
i:csul ting ti:01 the entice calcula tion.

&
114 7 . 6 -<> 1147 , l
OS
I - - I
Figure 4-74. Example in FBD: REAL Multiply and REAL Addition.

Guidelines: Programming REAL Arithmetic Operations

GUIDELINE

1 Real (REAL) arithmelic operations ore in the Floollng-Poin t Functions folder of the
Program Elements lob. Use these instruclions, for 32-bit floating-poin t operations.

2 Bil instructions may be combined in series or parallel before the enable EN input
and offer the enable oulput ENO oulput o f th e a rithmetic box. lo achieve the
desired control logic that drives the inleger box operations.

3 REAL arilhmelic boxes may be inserted in series by connecting the ENO line o f one
operation to the EN line of the following operation. A following operolion is only
p rocessed If the preceding operation is processed without error.

4 Use a temporary local variable as on intermediole bulfer ii you need lo use lhe
outpu t value of o preceding operation in o following operolion.

5 REAL orilhmellc operolions may be inserted in parallel if placed in o branch lho t


begins direclly connected to lhe left power roil of the ne twork. In such o case. the
network must be lerminoled wilh on oulpul.

6 If a network hos two or more parallel branches starting at the left roil. each o f which
hos two or more REAL ori lhmetic boxes in series. the order of processing is from left-
to-right starting with the top b ranch. then the second branch, and so on.

7 Use the OV status bit to check for o n overflow o fter ea ch operation. or after o series
or operations use the OS sta tus b ll. Also use sta tus bil instruclions to de termine if lhe
result is nega tive, zero. or positive (e.g., <O, = = 0, or >0), or if either input value was
on invalid REAL number. See Sia/us Bit Ins/ructions.

273
STEP 7 in 7 Steps

Programming Trigonometric and Other Math Functions


Basic Concept
STEP 7 REAL moth func tio ns include trigono metric. ore functions, logari thmic, ond other
standard math functions. While these instructio ns each operate on rea l numbers. there o re
input range restrictions on some of the operations. Programming these operations. is a ma tter
of selec ting the instruc tion, from the ca talog. based on the na me a t the inside top of the box
(e.g .. SQRT is Square Root function). and placing ii into the LAD or FBD netw ork. Enlry of each
opera tion req uires tha t o sing le inp ut parameter be specified. as the value used in the
opera tio n; a nd a single output parame ter. for storing the result. Finally, the e nable logic for
the operation may be inserted using conditio nal or unconditionol togic.

Essential Elements
Entry of each REA L moth function require the p a rameter IN be specifi ed a s the source value
used in !he function; a nd a parameter OUT. tha t designates w here the resul t is stored. Valid
en tries for both IN a nd OUT include local variables of data type REAL. or d ouble word
loca tions (e.g .. D822.DD 12 o r MD 44). The EN line, w hich determines w hether if the operation
is executed. may be controlled by conditional logic or connec ted d irec tly lo the left power
rail without cond itions. When EN is al logic 1. the operation is performed using the noating-
p olnl value specified a l IN and the resufl· is placed in the locatio n specified a t OUT. If the
opera tion executes without error ENO is set lo 'l '. If a n error occurs. ENO is set to ·o·.
Application Tips
Like with REAL arithmetic calculations. Status Bit Instructions may be used o fter processing
each moth func tion. to determine if the inpu t value (IN) is on invalid real number; or if the
result is negative. positive. or zero. The OV a nd OS sta tus b its ore b oth set if the result is ou tside
the permissible range. (See Slo lus Bit Ins/ructions. and Programming Sia /us Bil Operations).

Retwor~ 2 : Calculating the Hyp ot enus e


l) The oz:der oc pcooessi ng of such an az:cangement i s cop-down, l et t - to-I ighc.
IC the equation is pi:oces sed vithout en:or , ft37.7 is energized

l EN
SOR
DiO
I
DI
SORT I
ENO ~
H37 . 7
() I
#side>. - IN OTJT r f ASO IAB _SQ- DI OlTI' r fsideC

EN
SOR
DIO
I
#sidee - I N ourl,aso
EN
Al>D R
-DIO
I
f ASQ- I Nl OTJT l f AB_SO
,aso- IN2
Figure 4-75. Example in LAO: Moth Func tions - REAL Addition. Square. and Square Rool. In
this exa mp le, first the squa re of side-a (#ASG) and side-b (# BSQ) a re found then the two ore
added. and finally. the square root of the sum (# AB_SGJ is determined.

274
Working With STEP 7 Programs a nd Doto

lfetTlllrk 2 : Cel culetinq the Hypotenuse


l) The ocdcc o:i: pcoccssin.g ot !lllCh an an:ang~1u1nt is t:op-doun, ll!!tt-t0-r1ght.
It the cqua"tion is proecssc~ without crcor, H37. 7 is cncrqizcd

S Oil
••• - EII OUT --IASO

#sideA - m EIIO

SOR
.. . --,E» ovr ....,aso
lsideB - IJI ENO 1 - - - - - - - 1

... -Ell'

fASQ - m1 OIIT .... , AB_sa

IBSO-D!Z DlOt------- ___ _.-


~ OFIT
Elf OUT-ls1deC M37.7

IAB_SO -IIf EHO

Figure 4-76. Example In FBD: Moth f unctions - REAL Addition, Square, and Square Root,

Guidelines: Programming Trigonometric and Math Functions

II 1
GUIDELINE

Real moth functions ore in the Floating -Point Func tions folder ol the Program
Elements lob,

2 Each of the trigonometric functions (StN. COS, and TAN) assume on angle in radian
measure (Le .. 0 lo 2n, where 11 = +3, 14593 e+OO ) as o REAL number input ot IN.

3 Each of the ore functions (ASIN. ACOS. and ATAN) assume a REAL number 1hot foils
within o specific range (i.e .. • 1 to + 1, ASIN; • 1 to+ 1, ACOS: entire range, ATAN). os o
REAL number inpu l of IN.

4 Contoc l instructions may be inserted in series or parallel before lhe enoble (EN)
input. os well os after the enable output [ENO) of math functions.

5 Moth functions may be inserted in series by connecting the ENO line of one function
box to the EN line o f the following function box.

6 Moth func tion boxes may be inserted in parallel if placed in o branch tho! begins
direc lly connected to lhe le ft power roil or lhe nelwork. In such o case, the nelwork
must be terminated with on output.

7 If o network has lwo or more parallel branches starting at the left roil. each of which
has two or more math function boxes in series, the order of processing is from lett-lo-
righl starting wi th the lop branch, then the second branch, and so on.

8 Use the OV status bit lo check for an overflow o fler each operation, or after o series
or operations use the OS stalu s b it. Furthermore, use slo lus bit instructions to
determine if the result is negative. zero. or positive (e.g .. <O, ==0. or >O). or if the
input value was on invalid REAL number, See Status Bit Ins truc tions .

275
STEP 7 in 7 Steps

Programming Jump, Label, and Return Operations


Basic Concept
Jump ond label operations ore used to facilitate jumps tha t la ke place internal to a b lock.
Whe n a Jump is executed the netw orks between the Jump and the Label a re skipp ed.
Processing resumes ot the network following the Lobel. The Return a llows the execution ot a
block lo be termina ted ot on intermedia te point in the block, prior to the norm al block e nd.

Essential Elements
A Lobel instruction, whic h moy consist of up to lour c t1orocters, is otwoys the d estination to
whic h a jump instructio n is d irected. Labels may consist o r up lo lour a lphanumeric
characters. the first of which must b e on a lphabet. There o re two LAD/FBD jump instructions.
lhe JMP and JMPN. The JMP con be programmed with or without p receding logic conditions.
With no conditio ns, the JMP is always executed. With logic conditions. the JMP is only
executed w hen the result o f the logic operation (RLO) is logic 1; ii the RLO is lo gic O.
execution con tinues with lhe following network. The JMPN instruc tio n must be progra mmed
with p rec eding logic. IF th e result of the logic operatio n (RLO) is logic 0, the jump la b el is
executed; if the RLO is logic 1, execution continues w ith the following ne twork.

Application Tips
Jumps may be executed in the forwa rd or b a c kwa rd d irection. However, o jump mode
inside an MCR zone must be too Lobel inside the so me zone. Finally. while severa l jump
networks may be directed to the some lab el. o label must appear o nly once in o b lock.

Retffllrk 1 : Con di tional J umn t o CASE No . l


l) When I 4. l .is et. logic .I. JUJIJ) to Ce..,e Do. l
2) OtheilJise pcocess the next .neq,ock.

I 14 . l CASl
1 :1-- - - - - - - -- (JHP ) -j
1
Ke~rk 2: Condi t ionalto CASE No. 2
J UllD
l) When I4. 2 i-s at logic l JUllp to Cue Bo . 2
2) Oth.etwise pcocess 1:be next neaiotk.

I I4.2 CAS2
1 : 1 - - - - - - - - - - ( JMP )-1
1
Kctvvrk 3: Con dition a l J WRp to Ci SE No. 3
1) When I4. 3 i3 at logic l JUJ1p to case 1Jo. 3
2) Othetv:1,se -process the next netarock.

~
I _4 .,1
.--3------------I(CA.53
L JMP)-1

llet'l10rk 4 : Return to c ell ing b l ock


l) Vben powez; flowii t.o thi s iruit tuction, pi:o~u conttol is pu:,ed be.ok
to the block f tom uhich the cw:cent block 'W!UI ~ le d t oJ: p coce~ing.

I l4.l 14. 2 14. 3


~
1
--v:----11:- ---v:- - -,ru:T)-I
Figure 4-77. Jump to Lobel in LAD: Each JMP Label, posses control to a subroutine.

276
Working With STEP 7 Programs a nd Doto

lfetmrk ~ : Ce:1e Ilo. l Logic


ICouent.:
1

CASl
I
I IS. l I S. 2 OS , 7

r-': I: () I
tretmrk 6 , Ret.w:n to calling block
l) Vhen po11ec flows to the Retum irusti::u~ci on, pcogcu conuol iii pesiied back
to the block fron whicb the current. bl ock "1SS celled foc proc:ealfing.

I I S .l
, 1: (RIT) -]

Ret,10rk l : Ce!!e Ho . 2 Log1c


IColllllent:

CAS2
I IS. 4 os. 7
~S:l
I: () I
lfetvork 8 : Re1;w:n to callin11 block
l) Uhen power tl~r.,s co the RetUin instr:uctlon, progtea conr;,r ol is passed back
to the bloc1t troa which the cw:cenc block wu called t oc proc.e ssinc;.

I IS. l
, 1: (RIT)-j

Figure 4-78. Jump lo Lobel in LAD: Each Subroutines ends with a Return.

Guidelines: Programming Jump, label, and Return Operations

GUIDELINE

1 Jump and Label operations are in lhe Jumps raider of the Program Elements tab; the
return operation is in the Program Control folder.

2 A lab el may consist of up to four alphanumeric characters. including the underscore.


l abels must begin w ith a letter. Upper and lower case le tters ore interpreted as being
different (e.g.. CAS 1 and casl are different).

3 Each label must be unique within a block: however, multiple jump coils from wilhin o
block may target lhe same label.

4 A jump is always lo a label within the same block.

5 If a jump instruction is used inside an MCR zone, the target label must also be inside
the some MCR zone and MCR area.

6 The JMP coil is used lo jump on RLO = 1 and may be triggered conditionally (with
preceding logic conditions) or unconditionally (without preceding logic conditions).

7 The JMPN coil is used to jump on RLO = 0 and may only be triggered conditionally
(with preceding logic).

277
STEP 7 in 7 Steps

Programming MCR Operations


Basic Concept
MCR inslru c lions ollow logic zo nes to be creo ted. in which the entire zone ond the enclosed
control logic to be en obied or disobled when the zone is enobled or d isabled.

Essential Elements
There ore four basic MCR operations. Eac h instruc tion, when programmed. is poiced with one
of fhe o thers. The MCR Activate (MCRA) and the MCR De-Activate (MCRD) instruc tions are
paired to control activating a nd deoctivating use of the S7 master c ontro l relay fu nction. The
MCR zone Start (MCR<). and the MCR zone End /MCR>), a re paired to create a zo ne in
which logic networks ore enclosed. Networks inside a n MCR zone ore processed only if
power flows (i.e., RLO = 1) to lhe MCR< instructio n. If MCR zone dependency is switched ON
(i.e ., RLO to MCR< transitions to RLO = 0) then a ll o utputs are reset lo zero, except the
Set/Reset ovtputs and flip-flops, which maintain their last sta tes. A value of zero is written to
all digita l values or variables in b ox inslruclions.

Application Tips
MCR zones may be p laced o ne inside another with up to eight nested MCR zones. If MCR
zones o re nested. th e firs! MCR zone con trols the dependency switching for a ll of the zones.

FC13 : lxanple of MCR lnstcucti ons.


of S7 MCR function •

...
I - - - - - - - - - - - - - - - {HCRA} -,1
Afttwork 2: Stace or ~CR zone 1.

ua·,
I .
,,_o_ _ _ _ _ _ _ _ _ _ _ _ __
(MCR< }-<J

Aet110rk 3 : Title:
I 0.7 14,3 08.5
: - - -1~- ------------oc )1a-- ,J
--:• -
M0.6
.;...._
1 _ _ _ _ ___,,r, )--J
ll'elllOrll 4 : Titl e :

Ket -,rk 5 : tnd of HCR zone 1.

1
~ - - - - - - - - - - - - - (Mcit> H
1

lletwrk 6 : Title:

I 1=~-l/:1 -- - - - - - - - -( )-{I
17V:
MS. S 14. 7 tl69 . 0

lletwrk 1 : De-Activate use of 37 MCR f:unction.

.
1-
1
- - - - - - - - - - - - - - - - - - . :McRD_h1
Figure 4-79. MCR Example: A single MCR zone.

278
Working With STEP 7 Programs a nd Doto

Guidelines: Programming MCR Operations

GUIDELINE

1 MCR operations ore in the Program Control folder o f the Program Elements lob.

2 To use the MCR capability in a block, you must define an MCR area w ithin a block:
MCRA (activate ) defines the slart of lne area and MCRD [deactivate) defines the
end of the oreo. MCRA and MCRD coils o re connec ted d ireclly to the left power roil
without logic conditions.

3 An MCR zone is defined as the networks between a zone start instructio n 'MCR<'.
and the zone end instruction 'MCR>' .

4 The MCR< coil, w hich stam o zone, must be driven by conditional logic.

5 The MCR> coil. which ends a zone. must be directly connected lo the left power roil,
without conditional logic .

6 MCR zones may be nested up to o depth of eight - that is. eight zones may be
opened using the MCR< coil, before a zone is closed wi lh the MCR> coll.

7 Overall MCR nesting depth is not ollecled when a new block is called from within
on MCR zone. The current MCR zone remains o pe n in the new block.

8 When a new block is called from within on MCR zone. the c urre nt MCR zone
remains open in the new b lock altho ug h MCR use must first be re-aclivoled with lhe
MCR-A c oil.

279
STEP 7 in 7 Steps

Programming Word Logic Operations


Basic Concept
Word logic instru c tio ns perform the specified Boolean logic operation o n two source
locations, based on the associated truth table. and place lhe result in a third loca tion.
Programming these operalions is a ma tter of selec ting the instruction, from the catalog.
based on the name at the inside top of the box /e.g .. WOR_DW is OR Double word). and
placing ii into the LAD or FBD netwol1<. Two input paramelers must be specified as the
variables used in the logic combination, and on output parameter for storing the result.

Essential Elements
Parameters tNl and IN2 must be specified as the source values of each word logic operation
and parameter OUT as the destination for storing the resull. The enable line EN may be
programmed with or without preceding control logic to determine if the opera tio n is
executed. When EN is a t logic 1, th e o peration is performed bit-by-bit, using the two values al
IN 1 and IN2. and placing the resul I in the corresponding bit positions in the location specified
at OUT. The enable ou tp ut ENO is set to ' 1'. signaling executio n of the operation.

Applic ation Tips


For word operations. valid entries include a WORD constant. a variable o r data type WORD,
or o word-width location (e.g., 0822.DW 12 or MW 28) may be specified. For double -word
operatio ns. valid entries include a DWORD co nstant. a variable of data type DWORD. or a
double ward memory location [e.g .. 0822.0012 or MD 44) may be specified. The variable
specified a t OUT must be of the same data type or memory width as tha t specified at IN I
and IN2.

trettta rk 1 : Uord Lo gi c Com.binat.ion according to Boolean AMD


l)The TiTocd AJll) operation is pcooe8sed uconditionaJ.ly on each s c an.

2)MW122 is AHDed vi.th hex FF'f'O. The result is stored in H1iT124. Toe ooal is to
c lear the l o11e1: 4-blts ot 9122, and keep the uppet bit. values es th.e y were.

WA.ND_W I H99. l
{)
EN £110 I

IJI 16ffTf'O -, Dl2

tret110rk 2 : llocd Looi c Comb i nation accoi:dl.n g to Boolean OR


l)The TiTord OR operation is processed ucondi tional ly on each scan.

2) 1118 (Input 1iocd) is ORed vi th the local viu:iable #patt.Un l . The result is
stored in 0118. -

WOR_W I M99 . 2
(}
DI DIO I

IPaccecn_ 1- n 12

Figure 4-80. Example in LAD: Word ANO, and word OR operations.

280
Working With STEP 7 Programs a nd Doto

t1ot-1·J\ 3 : Uot:d Loaic Collbinat1on 11ecot:dioa to Bool ean XOR


l)lbe Double Tlocd XOR opetat.i.on is proces3ed uconditionally on each scan.

2) ! D12 (I nput l)oub.le liJotd) J.:S XORed v1 th the loca.1 vai:1eble fpettecn_2 . Tbe
result- is stored in lml30.

- - I
WXOR OW M99 .3
EN -END () I

#Pat t ei:n_2--, IN2

llet-rk 4 : Title:
l) !99.7 is set ~f the i:esultenc val\le of the pi:e11iow, XOR (in HI) 130 ) is zeto,

I,, : ==O
M99. 7
(s} -1

Figure 4-81. Example in LAD: Word XOR (exclusive OR) opera ti on.

Guidelines: Programming Word Logic Operations

GUIDELINE

1 Word logic opera lions ore in lhe Word Logic folder of lhe Program Elemenls lob.

You moy insert contact instructions In series or parallel before the enable (EN) input
and ofter the enable output (ENO), to creole the desire control logic.

2 Word logic boxes may be inserted in series by connecting the ENO line o f one logic
box to the EN line o f the following logic box. A box in series is only execu ted if the
preceding box is processed without error.

3 Word logic boxes may be inserted in porallel if placed in a b ranch lhal begins
direc tly connected lo the le ft power rail or the network. In such a case, the network
must b e lermlno led with a coil.

4 If a network hos two or more parallel branches starting al the left roil, each o f which
ho.s two or more word logic b oxes in series. the order of p rocessing is from left-to-
right starting wi1h the lop branch. !hen the second branc h. and so on.

5 If the resultant bil-paHern al OUT is not equal to zero (all bits = O), CC l of the status
word is sel to ' I '. You may use the >O contact instruction to check for not equal 'O'.

6 IF the resultant bil-pallern at OUTis equal to zero (all bils =OJ. CC I or the status word
is set to 'O '. You may use the,,. = 0 contact instruction to check for equal ·o•.

7 You may use status bi t con tacts instruc tions to check the result or a logic operation
for all bits equal to zero or not all bits equal zero. See Sta tvs Bit Instructions.

281
STEP 7 in 7 Steps

Programming Shift and Rotate Operations


Basic Concept
Shift-ro tate operations move the contents of a source variable by o specified number of
positions lo the left or righ t. a nd place the resull in a destination variable. You would program
these operations by selecting a n instruction. from the cata log. based on the name al the
inside lop of the box (e.g.. SHL_W is Shift Left Word), and placing ii into the network.

Essential Elements
Para meter IN must be specified as the source value o f each shift-rota te operation, a nd
parameter N os the number of positions to shirt or rotate the doto. The enable line EN. which
d etermines if the operation is execuled. may be programmed wilh or without preceding
logic. When EN is at logic 1. the contents of the WORD. DWORD. or integer (INTor DINT)
variable are shifted (or rota ted) by N -bit positio ns and the result is p laced in the loca ti on
specified a t OUT. The e nable output ENO is set to · 1·. signa ling execution of the operation.

In a shift operation. the bits vaca ted on the shill e nd are filled with zeros and the b its shifted
out o n the opposi te end o re lost. In o rota te operation. bits shifted out on the for end ore
used to fill lhe b it positions vacated at the opposite end. Integer a nd double integer shift
operations shift lhe b its o f a n integer variable. thereby changing the in leger value, but While
maintaining the original sign bit. The b it positions vacated by shift integer operations o re
olwoys filled with lhe original sign b it (bit 15 for INT values. or Bit 31 for DINT va lues).

Application Tips
A lyplcol applic ation of the shift opera tion is to mulliply or d ivide o variable by any b inary
multiple o f two (i.e., 2. 4, 8, 16. etc.}. The variable o t IN is multiplied by 2, simply by shifting lhe
variable contents to the tert by one. Shlrling two posilions lo the lert mulllplies by 4. a nd so
on; conversely, shifting by 1 position to the righ t. results in division by 2: shilling 2 places lo the
right resulls in division by 4, and so on. The shirt operation is ofte n used in this manner. lo index
o value lhot controls on operation or w he n indexing o memory pointer value.

Krllunrl 1 : Ti ~I r-:
IColllitnt:
l
I I ¢. I
'I 01
'~'-""'
rno
I $H"-""'
;:ir IIJIO
I
' lll)40 - 111 OITTr l044 lJ!) «- UI OV1'r KD46
~.fl ~fl - ~ '11 1611 - !t

Net.vut"l 1 : Ti. tle ;


lcowne, ;I

I 1(.2' ROL w, I
II !II - t!IO

l'il>ZO - Ill Oll'l'r lOZ4

trl1 6f 2 -K

Nettmrk 3 : Tltt e: :
ICOl!Jlel\t:
j
I l 4. 3 GHA-_I 1
IJ 111 i:uu
IC./)0 - .Iii OITTr l!'JlZ
1!'110 - Ii

Figure 4-82. Example in LAD: Shift and Rotate operations.

282
Working With STEP 7 Programs a nd Doto

Guidelines: Programming Shift and Rotate Operations

Guidelines

1 Shifl-Ro tote operolions ore in the Shift-Rotate folder o f the Progrom Elements fob .

2 Contact instructio ns may b e inserted in series or parallel before the e nable (EN)
input and ofter the enoble output (ENO) of shift and rotote instructions.

3 Shift-rotote boxes may be inserted In series by connecting the ENO line of one box lo
the EN tine o f the following box.

4 Shifl-rotote boxes moy be inserted in porollel if placed in o branch tha t begins


d irectly connected to the left power roil of the network.

5 If o network arrongeme nt involves two or more parallel branc hes, ea c h o f whic h hos
two or more Shift-rotate boxes in series, boxes a re evaluated fro m left-to-right starling
with the first branch. and so o n.

6 In shift func tions bit positions vacated o fter 1he shift ore filled wii h zeros. excep1 in the
case o f shill integer and shill double integer. where vacated positions are filled w ith
the value o f the sig n bit of the original number (i.e., plus= ·o· minus= · l ').

7 In shift-rotate !unctions. the shift parameter (N), moy be o vo rioble or cons tant: if
equal to zero. the operatio n is not executed; is greoler !hon the highest b it position
( 15 in the case of word variables. 31 in the case of double word variables. then zero
is placed in the result locotion OUT.

8 Shift integer operations a lways cause the variable lo be d ivided by o bina ry multiple
of 2 (i.e.. 2, 4, 8. 16, etc). Shift by 1 divides by 2, shift by 2 divides by 4, shift by 3
d ivides by 8, and so o n. The result is a lways the whole number o tter round ing down.

283
STEP 7 in 7 Steps

Programming Status Bit Operations


Basic Concept
S7 controllers genero te o vo riety of sto tus cond itions thot result from softwore operations.
These sta tus b its. whic h are combined into wha t is referred to a s the CPU sta tus word. are
used by the CPU in controlling binary logic opera tions (e.g .. A ND/OR logic), and set by the
CPU as a result of various d ig ital operations (e.g.. compares. arithmetic, a nd word logic).
Allhough lhe CPU slalus word ls not d irec tly accessible to the user in LAD and FBD, ii is mad e
available indirectly using the status b it instructions. You may c omb ine these instruc tions with
o ther operations to e valuate the result of digita l o pera tions or as the basis of control logic.

Essential Elements
The overflow (OV) and overflow stored (OS) slo tus bits are bo th se t al the firs l time in a b lock
where on arithmetic or moth operation exceed the permissib le range. The ov bit is reset a t
the next occurrence of a n error-free arithmetic opera tion , and therefore c on be checked
immediately a fter each o peration. The ov bit remains se t until o new block coll. therefore
con be used lo check fo r overflow o fter a series of calc ulations. The unordered [UO) sta tu s
bit indicates that a t least one of the values inp ut lo o previous REAL opera tio n was invalid.

Application Tips
Condition code bits CCO and CC 1 o re bits of the status word tha t rep ort various results otter
integer and REAL oritl1metic opera tions, as well as ofter compare, conversion, word logic.
and shiH o pera tions. Th e various results indicated by CCO a nd C C I ore mode available lo
the user prog ram via the so-co iled Results Bits which where briefly d escribed bock ln Tobie 4-
21. In lhis toble. contact instructions ore listed for c hecking the results o f a ny arithmetic or
moth function rela tive lo zero (e.g .. equa l zero. nonzero, positive. negative, and o verflow).
Additional results. w hich con be evoluoted in your program. ore p rovided in Appendix E.

Netuork 4 : IJocd Logi c Colllbina tion a ccording t o Boole an XOR


l)lhe Double Vord XOR operation is processed ucoruiitional ly on eech sceA.

2)ID12 (Input Double 1101:d) is XORed nth the l ocal variable #pattel:n
result 1, stoted in HD1 30. -z. The

WXOR_ DW I M99 . 3
.---- --EU tl10 ; - - -- - - - i ( ) ~I

#Pattem _2 -1112

RetUDrl<. !j : Ti tle :
1) If the result value of t.he XOR istoced in HD 130 is z.ei:o , M9 9. 7 iis ~et.

~~ o M99 . 7
~-I :1-----------(s}-I
Figure 4-83. Example in LAO: Status Bit operation. using o Result b it Equal Zero contact.

284
Working With STEP 7 Programs a nd Doto

Ketuo rk 3: Usina St.atus bit:l! t.o check tor ovei:f lov and invalid Real v alue.
l) The t.wo teal values at. ml and 1112 a1:e alvays added and then t.be result
1s aultiplied v.th the val ue in IID12. Toe result is stored in HD16,

2) It the calcula14on is execut.ed t.be lllidline output m.J.01. 7 is act.1.vat.ed.

3) It 'the calculacion tails as 8 re5Ult ot M overtlov 1n eith.e r operacion


.ENO i:, logic O end the OS bit 1:, :,et and .teaainB set.

4) If the calcuJ.ac-ion fails a s a r esult of an invalid teal nu.abet at the


input ot eithet ope:tation !NO is logic O and Che 00 bic is set.
SJ ihen ENO is O and OS or UO is set, the cocresnondinq outnuc coil is also set.

I ADl>_R I HlOl.7
(1',
05 1144. 6
;EN l:Jll) INOT '. I! (s}-1
l . 537500e+ uo 1144. 7
001 - INl
Otn' I MD66 - ) NOT: I! (s}-1
HD62- IN2

EN
MUL R
- ENO
I
MD66-!Nl our I MD16
MD12-IN2

lfetltork 4 : Check resul t ot previous calculation toe greater than zero.


IComaent:
I
I >O M44. S
,1 : (s}-1

Figure 4-84. Example in LAD: Status Bit operations.

Guidelines: Programming Status Bit Operations

GUIDELINE

1 Status bits operations ore in the Status Bits folder of the Program Elements tab.

2 Use results bit instructions /e.g .. < 0. = = O, > 0) immediately ofter any arithmetic or
moth function, to check the result relative to zero. These instructions moy be
combined In series or porollel logic Vvilh other b it Instructions.

3 Use the OV (overflow) status b it instruction immediolely o fter a arithmetic or molh


function to check ii the valid range is exceeded: use the OS (overflow stored) stotu s
bi! immediately after a series o f c alculations. to check ii on overflow occurred Vvith
any one of the instructions. The OS status bit is set al the first overflow in a b lock,
and is not reset until a new block is called.

4 Use the UO (unordered) stolus bit instruction immediately ofter a REAL arithmetic or
moth function, to check ii either o f the input values to the operation was invalid.

5 Additional result information is available for arithmetic and moth functions, as well
os for digital operations (e.g.. word logic , comparison, shift, and conversions), using
status bits CCO a nd CC I (condition code bits). Combinations of CCO/CCl (e.g ., 0/0.
0/1, 1/0. and 1/1) may be evaluoled using lhe results bil contac t instructions. See
Appendix E.

285
STEP 7 in 7 Steps

Programming the Move Operation to Read and Write Data


Basic Concept
With the Move operation you con copy the contents of o memory location or variable to a
new location or variable. Programming a Move opera tion is a ma tter of placing the move
box into the LAD or FBD network. specifying on input parame ter os the value to be moved.
and on outpu t parameter as the location to which the value is copied. The move instruction
in LAD/FBD only handles elementary data elements of 8, 16. or 32 bils. You may however, use
system b locks SFC 20 (BLCKMOV) and SFC2 I (FILL) for data transfers involving multiple
locations or complex data types (e.g .. arrays. structures. user defined types).

Essential Ele ments


The enable input line EN allows control logic lo determine if the MOVE is execuled. You may
specify the parame ter IN, as a constant, a local variable of elementary data type (except
for BOOL) . or o valid byte. word. or double word memory location. When EN is at logic 1, the
value at IN is copied to the location specified a t the parameter O UT. You may specify lhe
p arameter OUT. as a local variable of elementary data type (except for BOOL), or o valid
byte, word. or double word memory location. You do not have lo specify the same data
type or memory width a t the IN and OUT porometers.

Applica tion Tip s


Valid memory a reas at IN include I, Q , M. L, T, c. Pl. and DB memory; valid memory a reas a t
OUT include I, Q , M , l , PQ. DB memory. In the S?-300, the addresses of the entire inpul/ouiput
image areas (I/ QI may be specified a t the IN or OUT parameter of the MOVE operation.
regardless of whether or not the a ddress is assigned to on installed module. In the S7-400,
however. an address should o nly be accessed if ii is assigned lo an installed module.

He twor.k 1 : Hove Operation:, - l


1) tJhen M22,7 is Ttue(ll, the input votd (ITiT2) is moved tight-lustitied to MD60.
2) lilben M22.6 is Ttue(l) , the lower byte (8-b1ts)ot oucput word (OW!O ) is aoved
to byte 64 (HB64) of the bit. memot y w:ee.

3) The concen,:;5 ot local memocy double wrd (LD6) is al ways moved to double
wotd 72 (Ml)72) of the bit. ae:aocy uee.
4 ) When M22.5 is Ttue(l), e 50 :,ec tiaec preset is cop ied to dato bl ock DB30
data word 1 2 (DB~l2).

I !f22 . 7 MOVE I Ml Ol . 7
II Di EBO () I
IIJ4 - Dl OITI' ~ MD 60

l'l22 . 6 MOVE I
II Ell £110

Q!Jl O-Ill our rlffl 64

£11
MOVE
£NO
I
LD6- Dl our r MD 72

!'122. 5 MOVE I
II £N £NO

J , S TISOS - fW 01.1T rDB30 . DBIJ12

Figure 4-85. Example in LAD: Move operations using d ifferent source/destination areas.

286
Working With STEP 7 Programs a nd Doto

llet.wrk 2 : Hove Ooe t ac1on:, - 2


l) Vbom 1(23. 7 is TcU• (l), UlJ>UC daea is re"'d via P•Iiphecal input 11e11ocy llOCd
(PI114l, directly fro11. the digit.al ioput module wo:,e s=t byte address is
input byte 4 (IB4); the data 1s cop1ec1 to input. uaqe wed 4 (I\14~ .

2) Vhen 1123. 6 is Tcuc (11, the hex con:,cant Ull6f 01'U 1, wtlt.ten vie pcc tphcre.L
11.e1101:y (PQW4) , d1%ccely i:o tl\c .L6- b1i:s of the cl1g1tel oui:puc aodulc vhose
start. byte address ~s outpui: byte 4 (0B4) in the output 111ege.
3) The 1:aw dot4 ot anG.l.og lJUJUC (PIV256 I :I,:, olways read fto11 the t1rst analoc;i
cbannel ot the 37-300 and trllllsterred to data block 30 vord 20 (D&30.DBV20).
4) Data block 30, vord 20 (DB30.DBU20) is always copied to the second ma.Log
ou,:pue channel of the S7-300, via petipheral output vocd ~sa ( PQV2581.

I M23 . 7 MOVE I H102 . 7


1 I- -E1l
.--1 !HO, - - - - . . - - ( ) I
PIT,J4 -_DJ our
___~r1u4
M23 . 6 MOVE I
..--I : Ell IH0 .------1

Ull 6 ffl'f" - Dl Ol'1"lP004

~ - - - -Ell
MOVE I
!110 - - - -- i

Pil/256 -_Dl
___
OOT
_,rDB30. 0B020

. - - - - -E>l
MOVE I
!HO . - - - - - - '

DB30 . DBU20 -_lll


___our
__,r1'00258
Figure 4-86. Example in LAD: Move operations using differen t source/destination areas.

Gudelnes: Programming the Move Operation to Read and Write Data

GUIDELINE

l The Move operation is in th e Move folder of the Program Elements lob.

2 If the size o f the variable at IN Is less than the size of the variable at OUT. the data is
moved into OUT right-justified; the bits lo lhe lef t ore filled with zero. For example, if o
WORD variable is moved too DWORD vorioble. then the word is moved to the right-
most 16 bits of OUT; the le ft-most b its ore filled with zero {Network I. branch I ).

3 If the size or the variable at IN is greater than the size or the variable ot OUT. the
least significant bytes of the variable a t IN, tho1 fit into the variable a t OUT. ore
moved info OUT. For example, if a WORD variable is moved to a byte variable. then
the least significant byte of the WORD variable is moved lo OUT (See Network I,
branch 2).

4 Use lhe MOVE box lo read digital inpuls d ireclly from the module; reference lhe
input start byte address o f IN . Use the MOVE box to write d igital outputs d irectly;
reference the digital output start byte address al OUT (See Ne/work 2. branch I and
branch 2).

5 Use the MOVE box to read row data from on analog input module; reference the
analog input channel address at IN. Use MOVE to wri le o value lo on analog output
module; reference the onotog output channel address o t OUT {See Ne twork 2.
branch 3 and branch 4 ).

287
STEP 7 in 7 Steps

Accessing Data in a Data Block


Basic Concept
Before occessing o DB vorioble. you must open the doto block firs t. using the appropriate
instruction to reference the DB number (e.g ., OPN DB n). Once o data b lock is open, any
variable may be accessed, using the correct identifier a nd address. Doto block variables
may be addressed in three methods - partially-addressed operands, fully addressed
operands, and symbolic addressed operands.
Essential Elements
With partial addressing, you must first use on open data block instruction that references o
global or instance OB. In STL. the open ins-truction is simply 'OPN OB n' (e.g.. OPN DB 22). o r
OPN DI n (e.g .. OPN DI 22). In LAD/FBD the open instruction is only valid for opening o global
DB a nd Is in the form of o coil instruction (OPN) placed in o network witho ut preceding logic.
After the open instruc tion, any data element can be accessed in the following networks (in
LAD/FBD) or in the following statements (in STL). until a new dolo block is opened. Example
partial addresses otter using OPN OB are DBX8.7, a data bit; D88 10. o dole byte; OBW20, o
doto word; and DBD 12. a double data word. If you hod used OPN DI, these locati ons would
be addressed DIX8.7. Dl810, DIW20. ond DID12.
Wifh fully-addressed operands, you w ill specify the DB number as port of the bit. byte, word,
or double word address or lhe locollon (e.g .. D822.DBXB.7, DB22.0BB 10. DB22.DBW20. or
DB22.DBD 12). Wi th fully-addressed operands, only possible in LAD/FBD. and only usable to
access global dolo loco lions, you do not hove lo open lhe DB first . Symbolic addressing con
also be applied with full addressing. The symbolic addresses ore derived by combining the
assigned symbolic name of the DB w ith the assigned name of each e lement in the data
block (e.g.. Zone_ 1.TMP_PRESET_3). The DB name is Zone_ I and the variable is TMP_PRESET_3.

lletwor.k 1: Op en DBlO to access da ta l ocations in the .f ol lowing netvo i:ks .


I 0B10
..--
, - - - - - - - - - - - 1! 0PM}-I

lletviurk 2 : Hove a eta uoi:d 20 (DBW20 ) to z,.e111ocy 11oca 20 (IW20) .


I U OVE I HlO l.l

l
- - - - -EH EJIO . - - - - - - - ( )f--

DBTJ20 ~ Ill 01JTlm.J20

llet-wurk 3: Open DBl l to access data l oca t ions in the f ol lowin g netuotks .

I
.-
· - - - - - - - - - - - ( OPN}-1
DBll

I
fret work 4 : Hove 111 1!110:ry liOtd 20 ( eccuelly 0B1"120 fi:oa DBlO) to DBil20 of DBll.

Move I
ruo1. z
~ - - -£Jr El l O ~ - - - - -,( } -I

m.J20 - IJT OITI' lDBrl20

Net-work 5: In LAD / FBD use ful l y- addcessed operands to access DB data.

_ _ _ _ _ £If
MOVE I MlOl. 3
.ENO ~ - - - - - - ,( ) I
DB10 . 0Bu20 - m our loa11. new20

Figure 4•87. Accessing dato locations using partial and using fully-addressed operands.

288
Working With STEP 7 Programs and Doto

lfet11or:k fi: CellinQ an FB in LAD/FBD; the instance DB aust be specified.


Colllten,::

D8100

EH
FBlOO
ERO
I

I
lfet11or :k 1 : Cellina second insc.ence of 1"8100 ; the DB must be soecified.
Comtent:

DBlO l

EN
FBlOO
l!:110
I

Figure 4-88. Specifying the Instance DB; the DB is opened when the FB is coiled

Guidelines: Accessing Data in a Data Block

GUIDELINE
'

The OPN DB coil is in the DB Coll folder of the Program Elements lob.

Accessing a Global DB with partial and full addressing (LAO/FSD/STLJ

2 The open DB coil con only be used to open a g lobal data block. and may only be
used in LAD and in FBO.

3 Only one OPN DB coil may be programmed In a network and it must be without
conditional logic or other parallel ou tputs.

4 Following the OPN DB instruction in LAD. FBD. o r STL. you may reference data
locations of the specified DB, using partially addressed operands for data bi ts. by1es,
words, or double words (e.g., DBXS. l , D884. DBW20, D8D4). The open data block
may be accessed until o new data block is opened.

5 In LAD, FBD, and STL you may using fully addressed operands for bits. bytes, words,
and double word locolions of g lobal data b locks. Full addressing means that you
specify the DB number and location. For example DB I O.DBW20, is DB 10 word 20;
DB 1O.DBX8.1. is DB I O byte 8 bit 1.). The OPN instruction is no t required in this case.

Accessing on Instance DB w l1h partial addressing (STL)

1 An instance DB may o nly be referenced in LAD/FBD when the associated function


b lock is called. The instance DB is opened when lhe FB is called.

2 Following the OPN DI Instruc tion in the STL {Statement Lis t) editor only. you may
reference data locations of the specified instance DB, using partially addressed
operands for data bits. by1es, words, or double words (e.g.. DIX8. l . DIB4. DIW20.
D1D4). The open da1a block may be accessed until a new data b lock is opened.

3 The instance DB is also opened in STL in the call statement for colling the FB (e.g ..
Coll FB 100. DB I00).

289
STEP 7 in 7 Steps

Programming Organization Block 1 (OB 1)


Basic Conc ept
Organization Block I (OB I ) is the main program b lock of o STEP 7 program - responsible for
the normal cyclical processing o f your program. As such, mos I other blocks (e.g., FBs, and
FCs), which collec tively makeup the control prog ram, ore coiled for processing from OB 1.
Property written. OB I will facilitate a well organized program w hose processing tasks ore
easily identified and followed . This task will introduce some basic g uidelines and
recommenda tions for writing the code for OB 1.

Essential Elements
Generally, most logic b locks of o STEP 7 program will be called either directly from 08 1. or
from anolher bloc k (e.g ., FC. or FB) thol is called from OB 1. The calls from OB 1 will be largely
d ependent on how you have d ivided the functional control tasks into blocks and fhe
processing requirements of each of these blocks. Blocks should be called from OBI if they
must be processed on each CPU cycle. or at least evaluated on each cycle bu t processed
only if certain enabling cond itions are met. When 08 l is used strictly for calling code b locks,
the task of testing. sta rtup. a nd d iagnosing problems in the program. w ill be much easier.

Application Tips
As you develop new blocks. especially o fter the orig inal startup. be sure that each newly
c rea ted block is called either directly from OB I . from anoltler b lock that is called from OB I.
or either d irectly or indirectly from another organization block.

081 : Main PtoQrtllll Cy cle

tletwork 1 : Cal l Program Segmen t Lh.unber 1 Uncondi t 1onally.


l) Call FCl alway~ ; on retw:n, proceed uitll Network 2 .

FCl
i - - - - - - - - - - - - - - -( CAtL}-j

lletwork 2: Call Pcoqi:WII SeQJ11ent lJ\llllbe r 2 Uncondii;ionally.


l) Call FC3 atvays; on tetw:n, proceed vitb. Network 3.

FC3
~ - - - - - - - - - - -,( CALL )-1

tr"t110 r k 3 : Call Pcogte.tn Seg»ent Nullbet 3 Unconditioi1al l y.


11 Call res alvays; on return, proceed Vit:.h ~eewotk 4.

FC S
. . - - - - - - - - - - - - - -,( CALL )-1

Het110r k 4: Call Program Segment NUlllber 4 Unconditional l y .


1) Call FC7 alvay~; on te1:U.Cn, p:coceed nth Neevo:ck 5.

f C7
~ - - - - - - - - - - - -( CALL }-I

Figure 4-89. Unconditional calls to b locks from OBI (organization block 11.

290
Working With STEP 7 Programs a nd Doto

lletvork 5: Call Proai:en SeQmenc. llUllber 5 Condit.ionally.


l) Cw.l 1C2 it 15. 3 is ac. l ogic l; otlle1:w1se pi:oceed w Uetvoa: 6.

I 1s. 3 f C2
( CALL )-1
I I:
lletvork , : Call Progt:8JI SeQment. lllllll)e t 6 Condi t.ionelly.
l) Coll fC4 it IS. 4 OR I S. S 1s ec. logic l; otherwise proceed t-0 lle wotk 7.

I IS . 4 , C4

ns.:s I
, 1
(CALL )-1

Hot.uork 1: Cell Pro<rron Segment. llwlher 7 Condit.ione.lly.


l) Cell lBlOO vitll Ins1;4llt:e DBlOO i t 14. l A!lD 14. 2 o.i:e botl'l At. lO(JiC l.

08100
I4.2 I
~ ·i .1 : t.11
flll OO
EJIO I

ll<!tffllrk 8: Cdl l Prog,:am Scg,tont IJunhcr B Condit iondll y .


l) Call .f'BlOO ui th lnstance 08101 1 t 14. :3 All]) I4. 4 are both ec. 1091c l.

D8101
I4.3 14. 4 m100 I
I l: I f-irn FNOI
Figure 4-90. Conditional calls to blocks in OB 1 [organization b lock 1).

Guidelines: Programming Organization Block 1 (081)

GUIDELINE

1 Write o b rief Block Title of OB 1 (e.g .. Main Cyclical Program Block).

2 Write a Block Comment describing the func lion and p urpose or 08 I .

3 08 1 should only contain unconditional or conditional calls to FCs, FBs, SFCs, or SFBs:
control logic for driving oulpuls or olher p urposes should not be p laced In OB I.

4 Program all uncondilional block coils firsl. using o separate network for each coll;
make unconditional calls to blocks that must be p rocessed on every CPU cycle.

5 Program all condilional block calls following the unconditional calls. using a
separate network for each coll. The entire conditional logic for o block coll should
be placed in one network.

6 Make conditional calls to b locks that musl b e p rocessed whenever the driving logic
conditions are met. If the RLO = I the block is processed; if the RLO =O the block is
not p rocessed and the following nelwork is evaluated.

7 Except for instance DBs, opened with associated function b locks, ovoid opening
data blocks In OB I. Global data b locks (D8s) should be opened in lhe blocks where
used.

291
Managing Online Operations
with S7 CPUs
STEP 7 in 7 Steps

Establishing Online Connections using STEP 7


As the development phase of your STEP 7 project p rogresses, more of your work will involve
online interac tions wi th the S7-300 or S7-400 CPU. With STEP 7 in the ontine mode, your will be
able to pertorm activities such as downloading and uploading the user program. compa ring
programs blocks, resetting the CPU memory, accessing CPU information. viewing and
switching the operating modes or the CPU, and many others which will ore introduced in this
chapter. Other ontine activities, associated w ith the use of monitoring and diagnostic tools.
and generally required during the debugging process and later during the start-up and
commissioning phases or the project, ore covered in the next chapter.

The Standard Physical Connection


A direc t online connection is established using the appropria te coble between the MPI
interface of a programming system (PG/PC) and the MPI port on th e S7 CPU. ti your
programming system is a PG, then a standard coble connects direc tly between the two MPI
ports. If o PC is your programming system, then the seriol coble is connected from the serial
port of your PC, then to on MPI/RS232 adopter, and then to the MPI port on the CPU. You
can then access lhe PLC via the Online Projec t Window or the Accessible Nodes Windo w,

If there is on MPI subne t with several CPUs connected, then each CPU must hove a unique
address. Initially, and before parameters ore downloaded, each C PU is hos the default MPI
address of '2.' You con set o new MPI address for each CPU as you assign the CPU
parameters for the stations of a project. Before connecting all of the CPUs to the subnet, you
must make direct a connection between the PG/PC and each CPU, to download the
hardware configuration. By downloading the Sys/em Dalo objec t fro m the Offline Blocks
folder o f the associated S7 Program, the new MP! address assigned in the hardware
configuration will lake affect immediately.

Using the Online Project Window


Using the Online Project Window is the preferred method of accessing o CPU online, if the
PLC you wish to access hos been configured in a project on your PG/PC. If a direc t or subnet
connection is established, then the Online Project Window is opened from the SIMATIC
Manager menu by selecting View ► Online, or by selecting the Online Window icon from the
loolbor. The online project window will display all Stations o f the project. and will display the
online data from !he selected station. From the online window you may open the objec t
properties for each online objecl. access the hardware configuration online, perform online
operations of the PLC menu, and open p rogram blocks online in the LAD/FBD/STL editor.

rea -- C: Patrick ts Malcing-e_ ONUNE


8· - Making_A.ea System Data 6 081
g .. lmJ SIMA TIC 400(1) oFB100 oFC1
. e -,1 CPU413-1 @FC2 o FC3
EJ-C] S7 Program(1 I oFC10 oFC11
, L.. ~ 1~t-m1 O FC12 G FC100
@·CJ S7 Program(11) O FC101

Figure 5-1 . Online Project Window: Blocks folder selected.

294
Managing Online Operations with S7 CPUs

Using the Accessible Nodes Window


You may open the Accessible Nodes Window from the SIMATIC Manager menu by selecting
PLC ;. Display Accessible Nod es. or using the Accessible Nodes toolbar bunon. From the
Accessible Nodes Window. you con access a CPU online and perform the online operations
o f the PLC menu without having to open the associated project. This method is often used
when the project is not yet created. or simply is not available on the PG/PC curren tly in use.
When the Accessible Nodes Window Is opened, on MPI folder is displayed for each CPU
module that con be reached over the MPI connection. The folder, w hich is identified by the
CPU's MPI address. conloins lhe online blocks of the CPU. In addition to allowing access lo
the ontine program of a CPU, it is also possible lo access the online PLC menu operations. An
important consideration when using the accessible nodes window is tha t you ore operating
without the o ffline project data. and conveniences such as symbolic addresses. comments.
ond program documentation will not be ovoiloble. Making changes ore not recommended.

Ale Edit l nsert PLC 1/lew Options Window Hefp

- 1□1~
(m MPI • 5 (direct)

Figure 5-2. Accessible Nodes Window with two stations found.

Standard Online Operations with STEP 7


At some point. you will wont lo start testing ports of your work or lhe completed hordwore
configuration and user program. The first S"tep. however. is to establish on ontine connection
to the CPU, in order lo download the required components. The user program, when
completed. will consist of the hardware configuration. the user program, the network
configuration and the CPU communication connec tion Jobie (data).

All of the hardware configura tion data for each station is stored In the System Dalo object,
which is located in the offline blocks folder of the associated CPU program. When these
components ore completed. you may then download individual blocks. or the complete
user program, which includes the Sys tem Doto object . If you wont lo download modifications
lo the Hardware Configuration only. then only the System Dalo needs to be downloaded.
Changes or modifications to the connection table con be downloaded from the Network
Configuration tool. or from the CPU objects folder. Core must be token to download
changes to all communications partners.

295
STEP 7 in 7 Steps

Downloading the User Program to the CPU


Downloodlng lo lhe CPU req uires the CPU to be in either lhe STOP or RUN-P operoting mode.
Although you may perform o download in lhe RUN-P mode. swi1ching lo lhe STOP mode is
recommended. When downloading. you may download a ll blocks or selected b locks. If lhe
d ownload is p erformed in RUN-P mode, you must consider the order in which blocks ore
downloaded. to ensure lhot b locks lhot ore called ore a lways trans ferred before the colling
block. Be fo re downloading the complete p rogram, you should c lear CPU memory to ovoid
having old blocks remaining in the CPU. To download hardware configuration changes only,
simply select and download lhe System Do to objec t from the otfline b locks folder.

To test individual blocks. you must download the block (e.g., FC, FB). and the block that call
the block lo be tested (e.g., OB 1). Required data blocks must also be downloaded.

Uploading the User Program from the CPU


Like the d ownload operation. lhe upload is on onllne o p eration tha t is performed from the
SIMATIC Manager. You c on only initiate the upload blocks operolion from lhe Online Projecl
Window . This restric tion ensures tha t lhe uploaded b locks ore d irected to the offline blocks
folder to whic h the CPU p rogram is linked. Uploading b locks lo lhe p rogramming device is
often useful for making a backup copy of lhe program c urrenlly in the CPU a nd perhaps for
o ffline diagnostic purposes. To maintain on unmodified copy of the offline blocks. you might
c reole o module-independent S7 Program and copy the ottline Blocks folder to the new
program before perlorming the upload. This backup con lhen be restored, for example, if
a ltera tions mode to the uploaded program proved und esirable.

Comparing Onllne/ Offllne Programs


The online compore o peration allows you lo compare the online b locks residing in lhe C PU,
to the olfline blocks of lhe S7 Program associated with the C PU in the p rojec t. The online
comp a re is initiated from lhe SIMA TIC Manager menu by first selecting View ► Online lo
open the online projec t window. With the online window open, you may select the b lock
folder or the individual b locks you w ont lo compare, and lhen from the menu select Option s
► Compare Blocks. By defa ult, the Online/Olfline compare option is selected and will
compare the CPU blocks o f the selected CPU lo its ollllne b locks fo lder.

Compare Olock1
Twe cl compari;on· r
♦ ONUNE/Olflirle r Palh 1/Palh 2
P' Including SDBs
P Execute code compai;on
r lnclo,!ding blocks created n different programmsig languages
- Selected- - - - - - - - - - - - - - - - - - - - - - - - ,
P~ 1: Moking,fat-4\SIMATIC 400(1)\CPU413-1\S7 Ptogram(1)

jBlocks

-Compare wit~. - - - - - - - - - - - - - - - - - - - ~
Pa\b 2.

OK 1t111~s the ONLINE/olflne Gomper~on.

OK
I Cancel I Help I
Figure 5-3. Compare Blocks d ia log: Online/Offline compare selected.

296
Monoging Online Operations with S7 CPUs

Comparing OHllne Programs - Path 1/ Path 2


You moy also compare b locks from any two programs by selec ting lhe Polh 1/Polh 2 option
as the type o f comparison. This option is typically used to compare two olfline programs but
may also be used to compare the b locks of two online progra ms. Using the Path I /Pa th 2
oplion. you may selecl any oflline blocks folder or you may select online blocks w hile using
the online p roject or accessible nodes window. Pa th I and Poth 2, for example may be used
to compare the online blocks o f o CPU lo the b locks ot a CPU-independenl program as
shown in lhe figure below.

To configure the Po th I /Path 2 compare. simply select the block folder or the individual
blocks you want to compare. Your first seleclion is entered inlo lhe dialog box as Pa th I . You
may then select o second block folder or selected b locks. which will be entered into the
dialog as Po th 2.

Compare Blocks

Type of comparison: 1 ONUNE/ Dfftine ft'. Palh 1/Palh 2


~ InclU011g SDBs

P, Execute code cornpa1ison


r lncludflll blocks created in <ife1enl ptogumning lar9Jages
Selected- - - - - - - - - - - - - - - - - - - - - - ,
Path 1: New.Jlfl'\SIMATIC 3~ )\CPIJ 316\S? Progr~ 1) (ONLINE)

!Blocks

Compace w~h... - -
Path 2 New_pii\57 F'Klgr61T!(l 0)

!Blocks

OK starts the comp~ P11th 1/Palh 2.

OK I Cancel Hefp

Figure 5· 4. Compare Blocks dialog: Palh I/Pa th 2 compare selec ted.

Providing CPU Access Protection


Some S7 CPUs support password protection to limit a ccess to the C PU' s control program and
online op erations. This protection Is in addition to the protection provided by the key-switch
on the CPU face-plate. With password proteclion, th e control program and its d a ta, and
online operations, such as upload/download blocks, are protected from unauthorized
a ccess (i.e.. write a ccess protection) regardless o f lhe key-swi1ch p osition.
Using CPU access pro tection involves setting the protec tion level and if required, defining a
password. Once configured. as parl of lhe CPU parameters, the proteclion level a nd
password is downloaded to the module wi th the configuration data. Comple te read and
write access is possible for all password holders, regardless of the key-switch position. bu l
lhree levels of protection may apply to non-passw ord holders. Level l is the defoull setting in
whic h standard key-switch access is in opera tion. Level 2 provides write-protection: read
access is possible, but write access Is denied without the password. Level 3 provides
reod/write protection, whic h means that both read and wrl1e access are denied,
independent o f the key-switch position.

297
STEP 7 in 7 Steps

Accessing CPU Information and Operating Chara cteristics


While in the online mode. using the online project window or the occessible nodes window.
you will be able to access information pertinent to ony CPU !hot con be accessed vio on
online connection. This information, which is resident in the CPU ond briefly described in the
table below, con only be viewed from on online connection.

Tobie 5-1. Overview o f S7 CPU Module Information.


lnfonnatlon Type Typical Information
Basic information such as the CPU type, order number, firmware.
General
and status informa tion.
Provides C PU clock information. currently set lime and dote, status
Tim e System
of CPU run-time meters, and other lime-relaled information.
A CPU diagnostic tool that tracks and displays the lost 100
Diagnostic Bulfer diagnostic events o r the CPU (e.g .. Stops, Startups. program roulls,
t/0 faults. diagnostic interrup ts, memory resets, power off, etc.).
Provides lnfom,o tion related to CPU Load memory and Work
memory. showing total amounts, amoun t used, and amount free.
Memory
Also allows the CPU memory lo be compressed {elimination of
memory gap s to free up space).
Communication Provides informa tion concerning the communication resources of
the CPU {e.g .. transmission roles of the CPU interfaces, maximum
connections. and percent of scan c ycle set for communications
load), a nd how they are currently used.
Provides C PU cycle time informa tion, displaying lne shortest scan.
longest scan, and fast sca n time In milliseconds. In a ddition. se t scan
Scan Cycle n me
cycle parameters including scan monitoring time (wa tchdog), and
set minimum cycle lime ore also shown.
Provides detail information on the location and cause of the most
rece nt CPU slop. The stocks also relate information prior lo the stop.
Stocks
such os the sequence of block coils leading up to the stop, lost
open data blocks. and lhe lost conlenls of the CPU accumulators.
Provides information on CPU features such os memory and 1/0
expansion limits, lhe total number and address range for digilol 1/0,
timers, counters. ond bil memory. Also reports. the number of each
Performance Doto
user b lock type that is supported /e.g .• FB, FCs, OBs, DBs), wha t
system bloc ks /i.e .. SFCs, SFBs) ore o vdilable, and the length of the
focal data stock.
Clear/Reset
Allows you lo clear the C PU memory if in the STOP mode.
Memory
Se t Dole and Time Allows you to set the CPU's internal c lock (e.g., Dole and Time).
Provides o view of the current CPU opera ting mode a nd allows you
Opera ting Modes
to switch the operating mode (e.g.. RUN, RUN-P, and STOP).
- - -

298
Monoging Online Operations with S7 CPUs

Comments on Managing Online Interaction with S7 CPUs


The STEP 7 programming system offers many online tools and utilities that aid in managing the
various components o r your program. as well as for d iagnosing problems in either the
program or in the control system. In this chapter we will present s1ondord online operations,
typically utilized in the handling of the control progrom. ascertaining and protecting
importan t information relo led to the CPU. The following chapter continues wilh online
opera tio ns by presenting S7 online monitoring and diagnostic tools.

Like in preceding chapters several brief tu torials hove been presented here. to offer a quick
overview of handling online operations. In the remainder of this chapter examples of
siandord online operolions such as accessing the CPU online without o projecl. uploading
and downloading blocks. comparing online and offline blocks. clearing C PU memory.
switching CPU operating modes, accessing a password protecled CPU ore all presented in a
step-by-step manner. The following checklist highlights some of the key points in working
online with the S7 CPU.

Checklist Managing Online Interaction with S7 CPUs


• Ensure a direct connection between CPU and programming system, using a
standard serial cabfe (and PC Adopter for PC} or on MPI subnet connection.

• Go online with a specific CPU using Ille ossocioled project and the Online
Project Window or without a project, using the Accessible Nodes Window.

• Verify the resources of o CPU: using on onfine connection, select the CPU
then right•click ond select Module Information, then select the Performance
Doto lc,b.

• Verify tha t the CPU Dote and Time are set correctly lo ensure accurate lime
stomping of messages sent to the CPU's diagnostic buffer and /he triggering
of Time-of-Doy interrupts.

• If p assword protecHon is enabled for your CPU, con$ider entering the


password once from the SIMATTC Manager to ovoid repeated interruptions
when a ttempting online operations.

• Before downloading oil blocks to the CPU. clear memory first to ensure fhol
a/I old blocks ore removed from the CPU ond that the CPU Is re.fnffiollzed.

• If changes are made lo a ny port of the hard wore configur-alion. you only
need lo download fhe system Doto object of fhe associated station. The
System Dato object is located in lhe offline Blocks folder of th e associated
CPU.

• If memory is insufficient when a download is attempted, compress the


memory lo free up oddiliono l memory by eliminating gaps.

• When downloading individual bfocl<s, with the CPU Is. in the RUN-P mode, you
must ensure that called blocks ore transferred to the CPU before colling
blocks.

299
STEP 7 in 7 Steps

Accessing Online Operations without a Project


Basic Concept
The Accessible Nodes u tility allows you to quickly access o n S7 CPU for monitoring and
d ebugging, as well as other online opera tions which involve C PU interaction. Using
Accessible Nodes you can connect online to all the S7 CPUs a nd other p rogrammable
modules that can be accessed over the MPI network. Often this method is used w hen the
programming [PG/PC) system does not have o copy o f the project, or you simply wan t lo go
online quickly without the delay of having to find and open the associated project.

Essential Elements
With o d irect or networked MPt link to the CPU, using the Accessible Nodes utility you con
access CPU module information, set lhe CPU c lock. c lear and reset memory, switch the CPU
operating modes, and transfer blocks to and from the CPU. As shown in the figure below, the
Accessible No d es window will contain on S7 fold er for each of the active S7 sta tio ns !h at con
be reached. Each fo lder. numbered w ith lhe MPI address assigned to the CPU. contains the
online blocks of the CPU. Th e PLC operations are accessed by selecting the desired folder,
then from the menu or lhe right click selecting PLC menu.

Application Tips
You con also access monitoring and diagnostic tools including lhe Monitor/Modify Variables,
Hardware Diagnostics, and the CPU Diagnostic Buffer. Monitoring and d iagnostic tasks o re
discussed in the following chapter. Allhough you may gain access to the program and data
for any CPU opened through the Accessible Nodes utility, this method should be reserved for
monitoring and troubleshooting. Editing CPU programs and doto w ithout the project is nol
recommended, since it could result in the loss or d istorting of critical project information.

File Edit Insert PlC View Options Window He_,

@) MPI "' 5 (direct)

Figure 5-5. Displaying active MPI slolions found using th e Accessible Nodes utility.

300
Managing Online Operations with S7 CPUs

F~e Edit Inse,t PLC View Option, Window Help


No F1lle1 >

Ac;a:ssible Nodes - MPI - 1□1 ~


i. Accessible Nodes
{±I @) MPI " 3 Cut
& @) MPI ,, 5 (direct) Ctipy
Paste
Delete De)

PLC ► Copy RAM to ROM ••.

Rename F2 CPU Messar;ies •..


Display Force Values
Monitor/Modf y Variables
Hardwate Diagnostics
Modue tnformation.. . Ctrl+o
Operat1ng Mode... Ctrl+ l
Clear/Reset .. .
Dlsp~ys the oper atlng mode of the selected module for ch. Set Time of Day ... /4
Figure 5-6. PLC menu o nline o p erotions usfng occessible nodes ulilily.

Quick Steps: Accessing Online Operations without a Project

ACTION
'

1 Launch the SIMATIC Manager application from the Windows Start button.

2 From the menu. select PLC ► Display Accessible Nodes. or from the toolbar p ress
the Accessible Nodes button. Each CPU that con be reached on the MPI subne t is
d isplayed OS a folder ldenlified by the MPI a ddress assigned lo the CPU.

3 Select the Accessible Nodes folder ond then rrom the menu selec t Vlew ► Expand
All lo view lhe online Blocks folder o f eoch CPU.

4 Se lect the Blocks fo lder ol the desired sto lion, then From the right pone double-click
on the block you wish lo open or righ t-click o n the b lock ond select Open Object.

5 To view performance chorocteristics or o CPU. right click on folder ond select PLC ►
Module Information. See task "Viewing CPU Resources a nd Performance Doto."

6 To view or change the operating mode of o CPU. select PLC ► Operating Mode. See
tosk "Viewing a nd Switching CPU Opera ting Made."

7 To open the dialog for erasing th e CPU memory. selec t PLC ► Clear/ Reset. See task.
"Memory Resel from the SIMATIC Manager."

8 To open the dialog For adjusting lhe CPU c lock, select PLC l- Set Tlme of Day. See
tosk "Selling the CPU Do le a nd Time."

30 1
STEP 7 in 7 Steps

Viewing CPU Resources and Performance Data


Basic Concept
Whether you ore working with on already installed CPU or ore planning to select ond install o
new one, you will need to be aware of fhe CPU performance and resources data. If, for
example. you ore planning on a particular program implementation or copying blocks from
a library or other program. you will need to verify the compatibility o r fhe resources.

Essential Elements
CPU resource inrormo tion is resident in the CPU and is accessed via on online conneclion
from eilher lhe SIMA TIC Manager or lhe LAD/FBD/STL edilor. Module Information for lhe CPU
d efines features such as memory and 1/0 expansion limits, lhe total number and address
range ror timers. counters, ond bit memory, and ror d ig itol 1/0. This inlormolion also reports.
the number of each user block type is supported (e.g .• FB. FCs, 08s, DBs), wha t syslem blocks
ri.e., SFCs, SFBs) o re available. and the length o l the local dala stack.

~ Proj_J - C:\ Patrldc\S7 _Projl!<b_of<I\Ptoj_J


8 P10L3 si SI Prc,g,a,r(1) CmnecbMs
a Iii! IAB_S7ol00_1
~ Mll•I -,.,. 'lrl+~
CPl43-111 ~'\' ~+c
CPU'.l-1·1 y..,..,,
ft .....
.., ~

CP4A3+ 2===========I
I!! CP 4'3-5 8 0®« 0cl
Iii 11!1 LAB_S7300_1 I ,.._._
l•l !iii SIIMT IC 30011 nscrt New vv,...t •
F1.C ►
~H!!l S7_f'rogran(ll
Pl fii) S7_Progar,(13
CR.I l"3-sSIJQ6S. •'
,,,.,,to,/1'-odfv v....i.1os
R...,.. F2
Obied ~erties-, A,'t+Rot<rn ~ • • °"'91os!u
Spcciol Obiecl l'rc>pOflln ►
o,,e,~,...... . Cttl+l
O~arJ11os«...
~ the '1atus d lhe s,eiea;d nx,dJe (~St.le bl.If«, - Y , scat Set Tmo d Oay .. , /4
Figure 5-7. Online PLC menu from right click o n CPU object.

ml)1odule rnronl'llltlOn · CPU •U4• 1 . . . . . . _ {f!J ><l


Po!h: jProL~B_S74.00_1\Cl'U~H•1 Opecabngmodeofthe CPU. <!>AUti
ilt.:Q,c
Goooial 0149"0•00 Bliler Mernay Scan C)'Cle r..,.,
line Spii<!m Perfamance 0a(a I Camoon~ l Stacks
Orgoritotion 8111(1<J: Sy~cm Block~
No. I Ft.Qdlon I•
081 Froe ocan cyde • •la,t """1't: Sia... _ SF80 CTU Court Up
0810 Tine-of-day inttrrupl •,tort-.. SFBI CTO CountOo""
0B11 fin,,,of-day inienupl • ,tart""'-·· SFB2 CTUD Count Up/00,,11
0B12 Time-of-day inten11PI • ,1.e,1e.e... SFB3 lP Genetate d Pube
0813 Tine-of-day intenu;,I • tlalC\le. .. SFB4 TOIi Gcnctote,., On ..
081~ Tine-of-day inteUUl)I · tll'II eve. . SFB5 l OF Cl enecale .in OU
0815 Tine-Ol•doy lntell\Jl)I • tl«I eve. •. .:J SFB9 URCV Unoocrdnoted R... .:J
Add'ettAle#
0 lo I IMO< I
Ptoce>t lff>ll!e lnpu4 8192 illl•l 10.0 11023..7
Piocei, Image Outp,..(• 8192181,) 00.0 01023 7
Bt Mcmcoy 131072 (Bts) MO.O "116383.7
Ttrneta 5 12 10 T611
Co.rte,, 512 co C511
Loc.,iData 32768 IByte<)
08
••
57
·-·- . . .... .
65570 (B)'les). .:J
acne Update P.rt...

Figure 5-8. CPU Module ln[ormotion: Performance Data tab.

302
Monoging Online Operations with S7 CPUs

l'U[Mockle JnformatlOn - i;PU4J4- • -.ia: ~Jn j~


Palh: IPtoL3\Wl_$7400_1\CPU 414-1 Opeiat,,gmodool lh• o>u: (!> RUN
Statu~· OK
I Perf«menoe D~~
Time'Sf$lem
Genord ) D~tic 8\Jfe, l

AUg"mmt
f$iitt ... t,y,~, 100% ~

Loaci Memory RAMj Load Memory EPROMI \1/altMemoty


F,..,, 14 126.662
■ Acsigted; 8.178 <t.410
Tot~ 8,192 131.072
LNgcsl l'ree 9bc:k: 14 ...
Max.~ 15.728.640 ...

Update Prinl.., I flelP


Figure 5-9. CPU Mod ule Info rma tion: Memory ove rview lob.

Quick Steps: Viewing CPU Resource s and Performance Data

ACTION

1 Open the SIMATIC Manager and select the desired CPU from the online project
window or fro m the Accessible Nodes utility to select lhe CPU.

2 From the menu, select PLC ► Diagnostic/ Setting ► Module Information to view CPU
resources and performance data online (also from right clic k with CPU selected).

3 Select the Genero/ lob lo view basic information or the open C PU, includ ing its port
number, firmware versio n. and the rock and slot in which the module is insta lled. The
Slolus window d isplays information on lhe c urre nt operolio nol sto lus of lhe CPU.

4 Select the Performance Data lob to view o summary o f the C PU resources (e.g ..
number of each b lock type. available system blocks. add ress range of inpul/outpul
image ta bles. memory range for timers. counters, bil memory, and local memory).

5 Select the Memory ta b lo view memory resource d ata; the d ia log shows tota l bytes
of assigned ond free memory for bolh w ork memory o nd load memory areas.

6 Selecl the Communication lob. to display lnlormotion on the supported number of


communications connec tions a s well as the number p resently available.

7 Select the Scan Cycle Time lab. lo view !he longest. the shortest, a nd lhe most
recent (or lost) CPU cycle time , since the lo st change from STOP to RUN.

8 Selecl the Time System tab to capture and display CPU time and dote information.
run-time melers. a nd o lher lime related data for the open C PU.

303
STEP 7 in 7 Steps

Viewing and Changing CPU Operating Modes


Basic C onc ept
The CPU operoting mode (e.g .. RUN. RUN-P. STOP), may be switc hed from the CPU face plole
(p hysically) or from the Operating Mode dialog (logically) of the STEP 7 software. The
operating mode dialog con be opened and viev,ed w ith or w ithout the associated p rojecl.

Essential Elements
In the STOP mode, the CPU program is no t processed. and unless access protec tion is in
p lace, complete read/write access lo the CPU program and data is p ossible. In the RUN-P
mode the CPU program is being processed, bu t may be modified. When the CPU Is in the
RUN mode , the main program block (OBl) is being called cyclically by the opera ting system
to process the user program. ln lhis mode, 'Mile access to lhe CPU is denied and program
d ownloads or o ther 'Mite operations ore not possib le.

Applic a tion Tips


II is also possible lo affect the operating modes o f a CPU through by colling system func tions
(SFCs) from the control program. Wilh the appropriate SFC. for example. ii is possible for one
CPU lo slop, and restart the CPU of a communications partner. System function blocks (SFBs)
for con trolling the opera ting modes o f a communications partner include: SFB 19 (START). for
executing a complete restart in a partner; SFB 20 (STOP), for swi tc hing a partn er to STOP; and
SFB 21 (RESUME), for triggering a warm restart in the partner CPU. See Appendix B.

Operating Mode ·

Path: jProL3\LAB_S7400_1\CPU 414·1

Current Operating Mode: RUN W-;;,rm A'estart


l
Cold Restart
I
Holfles!~l
I
STOP
I
Ciurent Keysw~ch Setting; RUN·P
Las.I Operating Mode: STARTUP

Update I Close I Help


I
Figure 5-10. CPU Operating Modes dialog: Curren t opera ting mode is RUN.

304
Monoging Online Operations with S7 CPUs

Operating Mode

Path: fProL3\LAB_S7400_1\CPU 414·1


Current Opeiating Mode: STOP Wa1m Restart
I
Cold Reslart
I
Hot flestirrt
I
STflP.
I
Current Keyswitch Setting: RUN•P
Last Opetatiig Mode: RUN

Update I aose 1 Help


I
Figure 5- 11. CPU Operating Modes dialog: Current mode is STOP. CPU ready for restart.

Quick Steps: Viewing and Changing CPU Operating Modes

ACTION
I

1 To open a CPU without a project, start lhe SIMATIC Manager and from the menu
select PLC ► Dlsplay Acc essible Nodes or from the loolbor press the Accessible
Nodes icon; then. select a specific node address (e.g .. MPI = S). righ t click and setec1
PLC ► Operating Modes.

2 To open a CPU with o project. start the SIMATIC Manager, open the desired project
and then from the from the toolbor press the ontine window icon; then open the
station folder, selec t the CPU module, right c lick and select PLC l- Operating Modes.

3 If the current operating mode is RUN or RUN -P. you may switch the CPU to STOP.

If th e current operating mode is STOP, you may switch the CPU to RUN or RUN -P.

5 To restart, selec t Warm Restart to retain all DB data. retentive timers, retentive
counters. and retentive bi1 memory; non-<etentive data ore reset. Triggers OB 100.

6 To restart. select Cold Restart lo delete system genera ted DBs. reinitialize user DBs
from load memory. and rese t all other memory areas. including retentive. Triggers OB
102.

7 To restart. select Hot Restart ($7-400 only) to re tain all data areas. a nd restart program
at the point ot which it wos interrupted al the lost stop. Triggers 08 10 1.

8 Press the Update but ton to refresh the dialog ofter changes hove been mode.

305
STEP 7 in 7 Steps

Resetting Memory from the SIMATIC Manager


Basic Concept
In the S7 world a memory resel. also called overall reset, is lo delete both the load memory
and work memory area s or the CPU and lo se t the CPU to its initial sta te (i.e.. default
parameters). A memory reset operation may be performed from the PLC menu o f the
SIMATIC Manager in STEP 7. or manually using the mode selector switch. on the front-plate of
the CPU. You can access the STEP7 memory reset opera tion from either the Online Project
Window or from the Accessible Nodes Window.

Essential Elements
To c lear memory, you musi first switch the CPU to STOP mode. Clearing memory. deletes user
program blocks from the toad and work memory. Address areas o re all cleared. connec tions
with communications partners are b ro ken and cleared. and the CPU and other modules ore
re-initialized to their default state. Both the CPU's diagnostic b uffer a nd MP! add ress are
reta ined, In CPUs where the program is also stored on a Flash EPROM cord the program is not
erased. At power up the EPROM contents are transferred to the CPU's work memory. The MPI
address is overwritten by the address found o n the EPROM.

Application Tips
Memory reset is generally recommended before downloading your program for the first iime
or whenever reloading the entire program. Suc h a case may exist. ror example. if you
suspect faulty program operation or that lhe program resid ing in the CPU is nol the most
current. The CPU may also request a memory reset ofter determining tha t the program is
corrupt or just ofter a PLC operating system update is performed. A CPU reques t for memory
reset is indicated at the CPU by a slow flashing (1/2 sec.) of the STOP indicator.

Resetti,g the memo1y is only permitted in STOP mode.


Do you wa~ to set the modt.k to STOP mode and carry
out a memory reset?

I Yes
I No Help
I
Figure 5- 12. S7 C PU operating mode dialog.

Clec1r / Reset
Path:
IProL3\LAB_S7400_1\CPU 414-1

Memory Rosel reset, the module.


All user data (incllclng the ha1dware confi(1Jlation) aie
deleted and al exi~ling comections to the module are
cleared.
Do you realy want lo execute Memory Reset?

__Ye_$. __,j !_ _ N_o _ ) Help

Figure 5· 13. Clear memory connrmation d ialog.

306
Monoging Online Operations with S7 CPUs

Quick Steps: Resetting Memory from the SIMATIC Manager

ACTION

1 Ensure that the CPU mode selec tor switch is switched to the RUN-P or STOP positions.
lhis opera tion is not possible if the key-switch is in the RUN posi1ion.

2 Start the SIMATIC Manager, open the desired project and select View ► Online or
press the Online Window icon to op en the online projec t w indow. Alternatively, you
may open the Accessible Nodes Window; press the Online Window toolbar icon.

3 From the project window, e xpand the d esired Station folder and select the C PU
module whose memory w ill be c leared; or fro m the Accessible Nodes window
select the CPU according to the MPI address.

4 Selec t the CPU object. right-click and select PLC , Clear/ Reset: Con firm your
intention to perform the memory reset by pressing the YES button. You will be
prompted to p lace the CPU in the STOP mode if necessary.

5 After a memory reset. you may download your program and then restart the from
the CPU mode selec tor switch or from the StMATIC Manager (i.e .. select PLC
Diagnostic/ Setting ► Operating Mode, and then select the Worm Res ta rt button.

Manual Memory Reset from the CPU Mode Selector Switch.

I Switch the CPU mode selector switc h to the STOP position (The STOP LED will light).

2 Turn and hold the mode switch in the (memory reset) position, until the yellow STOP
LED blinks ot leas.t twice al a 1 second period. after which It will remain illuminated.

3 Release the mode selector switc h lo the STOP position: and immediately return to
the MRES position and hold for 4. 5 second s: the yellow LED will flash quickly while
memory is being cleared and wlll llosh slowly when done.

4 Release lhe switch back to STOP position and the overall reset should be complete.

5 Open the online blocks folder to verify the memory reset (System blocks should list).

307
STEP 7 in 7 Steps

Accessing a Password Protected CPU


Basic C onc ept
If password p rotection is enabled for a CPU o r other module, then depending on lhe set level
of protection and the speci fic module. enlry of the correct password is required before
certa in online operations o re possible. Read and write access is possible for password
ho lders, independent of the key-switch position or the set level of protection. However.
operations. Involving C PU programs and data. ore denied to non-password holders. The Idea
is to p ro hibit unauthorized online access !ho t could result in adverse operation of the
program or process.

Essential Elements
During normal operations. with level 2 or level 3 protections. upon each a ttempl to perform
certain online functions you will be p rompted to enter the required password. For example,
Monitor/Modify Variables or Upload/Download blocks. ore affected by protection level 2. If
lhe correc l password is entered. access is permitted lo modules for which a particular
protection level wos set d uring parameter assignment. You con then es tablish online
connections lo the protected module and execute the online functions belonging to tha t
protection level.

Applic ation Tips


To ovoid being interrupted o f each attempt lo go online with o prolected CPU. you may set
the access rights once from the SIMATIC Manager. When the access rights ore set from the
SIMA TIC Manager, by e ntering a correct password, the access will apply until the last 57
applico lion is closed. unless lhe access rights ore canceled firsl. Using the menu command
PLC , Access Rig hts ► Setup, you con coll the "Enter Password" d ia log box directly, The
current password access is cancelled from the SIMA TIC Manager menu command PLC ►
Access Rights ► Cancel.

J l i\

The module CPU 315-2 DP is protected w~h a


password.

Pastword: 11

P Use password as default for other protected


modules.

OK
I Cancel j Help
I
Figure 5-1 4. Password access rights d ia log.

308
Monoging Online Operations with S7 CPUs

i4i,i,t§lii¥ii41MWJO·H (;\ t f t l - . 1 ~
I J
General J St<11l~
Trn~•Dey lr(er,~s

~ Level d Protecoon,=------,
I 4"Cle/Clocl<. Memc»_y
Cyclic Inlt'lrupC J
Retentive Memocy
Dlag00$tlct/Clocl,.
Mode- - - - - - - - - - - - - - - ,
lrtenuptt
Piotcc:lion
I

r 1: Keymitch Setting
(' Proces. Mode
P Ae:r.ov~e ••rtl?f'~R ,"IOld
Pe1111lltteo InC:S/lll 1n
r 2: w'11te>Protecbon Sec,, l:,IICl~ i llfle PY - "'5ff11r,cmm,.
r. 3; \1,11iw;/Read.f'rolecti011
Panwad: (.' Teu Mode

I, OK I Cancel , __H_e_lP_ _.

Figure 5-15. CPU Hardware Configura tion dialog for setting CPU Protection.

Quick Steps: Accessing a Password Protected CPU

II 1
ACTION

Starl lhe SIMATIC Manager and open lo the desired project; use the Online Window
icon to open lhe project online.

2 Expand the desired Station folder and selec t the CPU module you wish lo access.

3 From the SIMATIC Manager menu. select PLC ► Access Rights ► Setup or with the
CPU selected right click and select PLC ► Access Rights ► Setup. then enter the
correct password when the access rights dialog box appears.

4 Activate the Use Password as Default c heckbox in order to use the some password
ror any o ther installed modules that ore password pro tected.

5 To cancel lhe access rights for the current session you may selec l PLC ► Access
Rights ► Cancel, at any time from the SIMATIC Manager menu. Or rf you ore done.
closing the SIMATIC Manager will terminole the c urren t CPU access rights.

309
STEP 7 in 7 Steps

Setting the CPU Date and Time


Basic Concept
Most S7-300 and S7-400 CPUs incorpora te o rea l-time clock which you may adjust from the
STEP 7 software. Setting t11e date and time a re important if your applica tion w ill use functions
such as the run-time meter. or interrup t service routines that are triggered on o specific dale
and at a specific time.

Essential Elements
The CPU clock may be manually adjusted to whatever time you choose, or synchronized w ith
lhe sys tem time and dale or lhe STEP 7 PC or PG programming system. A lthough reot-lime
may not be req uired in your application, se tting th e CPU c lock with the correct time and
dole is still essential since the CPU c lock is used to assign the dote and time stomp to oil
events logged by the CPU Diagnostic buffer.

Application Tips
Not only con the C PU clock be adjusted manually as d iscussed here. but through the use of
system functions (SFCs) w ilhin your program, it is also possible to sel, stop, and read the
current date a nd time. The syste m fu nction for setting the dote and time is SFC O (SET_CLK);
the sys tem fu nction for reading the dote and time is SFC l (READ_C LK); and the system
function for synchronizing a ll CPU clocks is SFC 48 (SNC_RTCB). See Appendix B.

Set Time or Day

Path: rProi..3\LAB_S7400_1\ CPU 414-1


Date: Time of Day.

PG/ PC time: Jos, 24 103 j11 : 54 : 55 am •

Module time; los 124 103 j jos :oo :12 am I


r Take horn PG/PC

Apply
I I Close ] Help
I
Figure 5-16. Set S7-300/$7-400 CPU Dale/Time dialog.

310
Monoging Online Operations with S7 CPUs

5et Tin,e of Day

Path: IProi..3\LAB_S7400_1\ CPU 414-1

Date: Time of Day:

PG/ PC time: fos 124 1 03 11 2: 13: 22 pm I


Module lime: los 124 103 112 :1 3 :22 pm

P Take horn PG/PC

I I Close
I I
Figure 5-17. Synchronize CPU Dote/Time w ith PC System Dole/Time.

Quick Steps: Setting the CPU Date and Time


ACTION

1 Start the SIMATIC Manager and open lo the desired project.

2 Open the station folder and selec l the CPU module for which you in lend to set the
time and dale.

3 Wflh the CPU selec ted right-click and selecl PLC ► Set Time of Day; or from lhe
menu select PLC ► Diagnostic / Setting ► Set Time of Day lo open the C PU c lock
dialog.

4 In the Time field under Module , enter the CPU lime as hour: minute: second, in the
formal hh:mm:ss followed by om or pm.

S In the Dale field under Module , enter the CPU dote as month/day/year. in the
format mm/dd/yy.

6 Activate the "Take from PG/ PC" check box and then press the Apply button. lo set
C PU lime and dote to match lhe operoHng system time ond dole of the PG/PC.

311
STEP 7 in 7 Steps

Compressing CPU Memory


Basic Concept
Similar to your PC hard drive. the work memory of on S7 CPU will sometimes require de•
fragmenting. In this c a se, however. the process is referred to a s "Compressing." During
program development. many corrections and deletions toke place on tine, that result in o
fragmented memory, When on existing CPU block is edi1ed and resoved, in actuality the new
block is appended to the end of memory w hile the existing block is marked inactive. By
pushing the b locks together. compression eliminates me mory gaps fo rmed by inactive
blocks.

Essential Elements
The memory compress operation is activa ted rrom the Memory lob of the CPU Module
Information dialog. With an online connection established you ma y open the project w indow
or 1he accessible no d es window. With the desired C PU selected in the online project window
or the desired MPI address folder selec ted in lhe accessible nodes window, right click and
select PLC ► Module Information, then select the Memory lob. The best possible compression
Is achieved when you compress memory w hile the CPU is In lhe STOP mode. Compressio n is
possible in the RUN-P opera ting mode - however b locks that ore being execu ted cannot be
shilled in memory whne they ore open. The compress function is not possible in RUN mode,
since memory is the n write-protected.

Application Tips
The memory comp ress operation may a lso be executed o n demand from your S7 p rogram,
using the system function COMPRESS (SFC25). When coiled lrom SFC 25, the complete
operation is performed over o number of CPU cycles. While still in progress, the SFC BUSY
ou tp ut reports logic 1: the DONE oulput reports logic l when the operation is comple ted. As
mentioned before, the memory gaps ore completely removed only when you perform lhe
comp ress opera tion with the CPU in STOP mode.

~ Edt Insert Pl.C view Options wtndow I-le~

D ,~, ~ 1-, I~l@I ~ ~ ~ :::: rm fill I 'In Fllei

Pro.· 3 - C: Patrick 57 Pro ·ects old Pro· 3 ONLINE -15J x]


ProL3 S7_Program(2)
liJ mD LAB_S7400_1

El~-
~l lill LAB_S7300_1
I1
1
i
$·1
1±1
) 1±1
Et! CJ S7_F
CP 343-1
"t
Ccpy,
CP 343-1 Paste
CP 3 4 3 - e - - - - - - - - - - - - - 1
$HID! __e_ _ _ _ _~
SIMATIC 30C _ OeJet D~
el - - -•
ijJ-CJ S7_Piog1aml Copy RAM to ROM ...
[B CJ 57_P,ogrlJITll
Ru1-Tlme F!ropertles... CPU Mes~s, ..
Display FOl'Ce Values
ReMrne F2
Monitor(Modfy Va-Jables
Object Properties, •, Al+Retu-n
Hardware Diagill>Stics
Module lniormatic,n... Ctrl+D
Operatill9 ~ . . . Ctrl+l
Clear/Reset...
Oisplll','$ the status of the seleded module (diagnostic btlfer, memor\ Set T~ ct Day., ,
Figure 5-18. Online PLC menu lrom right click on C PU object in online project window.

312
Monoging Online Operations with S7 CPUs

ffitModule lnl'onnetfon • CPU 3 1S


Path: jP10L3\lAS_S7300_1\CPU 315 Operating mode ol the CPU: I!') STOP
Status. OK
I
Time System
Get1e1al I
Pedoonance Data
Diagnostic Bui/er
I Commurication
Memory I
Stacks
Scan 4'Cfe Time I

Assignmeri:
!sizes in bytes)

Load Mem01y EPROM I WOlkMemor


Free: 10,660
■ As#igned: ... 38.492
Tota: 49.152
Largest Free Block; -·- ··-
Max. ~ 4,194,304

Compiess
I
I Close
I Update
I Prlnl... Help
I
Figure 5-1 9. CPU Module Informa tion: Memory tab.

Quick Steps: Compressing CPU Memory

ACTION

1 Start the SIMATIC Manager; open the desired project and Sia/ion.

2 Under the station. select the CPU w hose memory you intend to compress.

3 With the CPU selec ted righl-click select PLC ► Module Information.

4 Select the Memory tab rrom the Module Information dialog.

5 Press the Compress button to eliminate gaps from the CPU memory.

6 Press the Update bu tton to refresh the dia tog ond view the compression results.

313
STEP 7 in 7 Steps

Downloading the S7 Program or Selected Blocks


Basic Concept
In order to be processed. o STEP 7 program (i.e .. 08s. FCs. FBs. and DBsJ must first be
d ownloaded lo the CPU. In a project. each CPU has an a ssociated 57 Program folder that is
located d irec tly under the CPU object. Downloading a program involves selecling the
correct CPU, opening i1s Program folder, and then selecting the o ffline Blocks folder. Only
o l fline blocks may be downloaded. You may download the Blocks folder ji.e., entire
program), or one o r more selected blocks.

Essential Elements
To download an e ntire program or selected b locks. you must first ensure tha t th ere is an
established online connection lo lhe associated CPU. To download b locks. the CPU mode
selector switch must be in either the STOP or RUN-P operating mode. If you are operating in
the RUN-P mode during a download. you will be prompted lo switch the CPU lo the STOP
mode prior to the download and to restart the CPU ofter the download. If you attempt top
d ownload all b locks. you will also be asked if the Sys/em Data should be transferred. Recall
that the System Do to contains the station ho rdwore configuration. To download hordwo re
configuration changes only, simply selec I and download the System Data objec t.

Application Tips
Whe n downloading blocks. if the available load memory is too small you will be asked by
STEP 7 if you wish to compress th e CPU memory. Compressing the memory will make o la rger
contiguous space In me mory lo complete the download , by eliminating memory gaps. An
alterna te download method is to open both the offline and online project windows. selec t
the block folder of each program. then from the offline window select the objects you wont
to download and drag them to the online window.

1,;t1 1'ro)_3 •· C:\ Palr,ck\ !i"I_Project,_old\ Pro1_:l


El . Plol.3 Sy~lemdal<1 oDBl Q 0B10 Q FBl
ai·WI
I
ffi·WI
i:::
LAB_S740!l_1
LAB_57Dl_l
IWJ Slt.tATIC~~l)
.
'" F82
, F825
FC1
o F83
pFB41
oFC2
o FB4
p F842
o f'C4
o FB5
p FB43
o FC5
El la) CPU 31 5-2 DP
• FC6 o FC7 o roi o F~
S @J S7Prog,aml18J
- ~ Sou1ces • FC15
Fel l o FC12 o f'C13 o FC14

~ rm1 • eFC20 o FC40 oDBl

·@ 57_P,ogiamfl t
:£·@) 57_P,ogrem[13)
Figure 5-20. Offline Blocks Window: Downloading offline blocks folder (all b locks) lo the CPU.

;i,11~ ~
data o OBl 0 0810 o FB t
I
LAB- S740(!- 1 B2 QF83 QF84 Q F85
£t1 lilJ LAB_S?300_1 25
~ WI
;i
SIMATIC 30~1)
f
I
i
aI cPU31s-20P
8 @:) S7 P1ogrom(l 8J
(g:J Sourca.
(iil Block~
:I
Q FC15
i
oFC20 QFC40
i
0 081
$ €i) S7_Prog am(l )
@] S7_Progam(l 31

Figure 5-2 1. Offline Blocks Window: Downloading selec ted o ffline b locks lo lhe CPU.

314
Monoging Online Operations with S7 CPUs

Quick Steps: Downloading the S7 Program or Selected Blocks

ACTION

Download Program:Wilh the ofrnne Bocl(s folder selec ted. download entire program

1 If your CPU is in the RUN mode, you will need to switch to STOP before attempting the
download.

2 Although ii is not required. performing on overall reset on the CPU is recommended


when downloading the entire program.

3 With the SIMATIC Manager open to the required project. from the oflline blocks
window. double c lick on l he program fo lder under the required C PU, and then select
the b locks fo lder under lhe program.

4 With !he program folder selec ted, click on lhe Download icon from !he loolbar: or
from the menu select PLC ► Download. to start the download operation. When
prompted by STEP 7 as to whether a block already in the CPU should be overwritten.
You may respond Yes . All, None, No. or Cancel.

5 Choose Yes to overwrite the current block: All. to overwrite all blocks that already
exist in the CPU; None, to not overwrite any existing blocks; No, to skip the current
block; a nd Cancel. lo abort the Download.

6 Af1er a complete download. switch to the CPU operating modes d ialog and perform
a Worm Restart of the CPU (STOP lo RUN).

Download Blocks: Wilh the offline Blocks folder open. download one or more blocks

1 If your CPU is in the RUN mode, you will need to switch to STOP before attempting the
download. RUN P is a llowed.

2 With the SIMATIC Manager open to the required project and lhe desired CPU folder
open, selecl the offline Blocks folder. The b locks ore d isplayed in the right pone.

3 To select two or more non-adjacent blocks to download. press and hold the CTRL-
key down. and click on as many non-adjacent b locks as required.

4 To select o group o f adjacent blocks in a row or column, press and hold the SHIFT-
key. then c lick on the first the n the lost block of the row or column; press and hold the
CTRL-key down. and click on non-adjacent blocks lo include additional b locks to lhe
already selected blocks.

5 With one or more blocks selected, click on the Download icon from the toolbor; or
from the menu select PLC ► Download, lo start the download operation. When
prompted by STEP 7 as to whether a b lock already in !he CPU should be overwritten.
You may respond Yes . All, None, No. or Cancel.

6 Choose Yes to overwrite the current block; All. to overwrite all blocks lhat already
exis t in the CPU; None. to nol overwrile any existing blocks; No, to skip the current
block; a nd Cancel. lo abort the Download.

7 Return the CPU to RUN mode ii ii was slopped.

315
STEP 7 in 7 Steps

Uploading the S7 Program or Selected Blocks


Basic Conc ept
To upload on S7 program is to trons ler the online b locks of o C PU bock to the offline blocks
folder o f the associoled S7 Program. The blocks displayed in the online blocks wind ow, are
the blocks contained in the CPU's memory ond can only be d irected to the offline blocks
folder o f the program associated w ith the CPU. Yau may upload the entire o nline Blocks
folder (i.e., comple te S7 program), or one or more selected b locks.

Essential Elements
To upload the entire S7 program or selected blocks of o CPU, you mus1 first ensure tha t there
is on es tablished o nline connec tion to the ossocio ted CPU. There ore no o ther requirements
for performing the upload unless the CPU is password protected. In this case. you will be
prompted to enter the correct password before th e operation can be c ompleted. If yo u
attempt to upload all blocks. you will a lso be asked if lhe System Dalo should b e transferred
- this process w ill overwrite your offline System Da ta. Recall that the System Data contains
the hardware configuration fo r the selected PLC Station.

Application Tips
You may a lso use Copy and Pa ste to tra nsfer the online b locks of a C PU to a program not
associated w ith a p articular CPU (i.e., CPU independent program). Simply open the online
blocks w indow ot lhe CPU, select the desired blocks. open the target offline b locks fo lder
and perform the paste.
Whe n you perform an upload of the online blocks folder, the comp lete offline blocks fold er is
overwri tt en. Prior lo the upload. you may consider copying the offline blocks folder to a CPU
independe nt program, in case for som e reason you may need lo revert lo these blocks.

ffl Prol. 3 - C:\Patrkk\ STJ'toJects.old~ProJ. 3 Ol'llll'IE 1£


8 l!!J) f>roi..3 ~ Syslem Dllt~ 0 081 130810 GFBl
ID-ii lAB_S7400_1 ta- FB2 QF83 QF134 o ms
El ID LAB_S7300_1 ti;} F825 0 F84 1 O Fl342 O FB43
El cltl CPU 315 O FCl O FC2 oFC4 QFC5
El Cl 57_Ptogiaml2J o FC6

1
oFC7 oFC8 oFC9
' fil.l i1 dl O FCl 1 O FCl 2 QFC13 O FC1<1
l!l· CP 343·1 ISO O FC15 0 FC20 0 l'C40 o DB1
~· CP 343·1 TCP
EE CP'.!43,5
1£ IU SIMATIC300f1)
IE Cl S7_Prog,am(l )
S Cl 57_Ptogr4m(13)

Figure 5-22. Online Blocks Wind ow: Uploading a ll CPU blocks to the offline blocks folder.

. Pic,_3 ystem Dala ,o OBl ,o 0B10 Q FBl


1E·Wl LA9_S7400_1 92 o FBJ €}F84 o FB5
e !ill I.All_S7300_ 1 o FB41 o FB42 o FB~3
9-"1J CPU 315
:I
GI-
8 D S7_Ptograrn[2)
,
I:!:
fl!-
~
I -{clSlocks
CP 343-1 150
CP 343-1 TCP
CP343-'5
GI-
GI-
GI- Q 0 81

ffi Iii) SIMATlC 300f1 I


1B CJ S7_Plog~1)
!£ CJ S7_Ptog~13)

Fig ure 5-23. OnHne Blocks Window: Uploading selected CPU b locks to offline b locks folder.

316
Monoging Online Operations with S7 CPUs

Quick Steps: Uploading the S7 Program or Selected Blocks


ACTION

Upload Program: Wi th ihe online Blocks folderselectetf, upload the entire program

1 With the SIMATIC Manager open to the desired projec t, p ress the online window
icon ond then navigate to the correct Slolion ond CPU.

2 Expand the CPU folder, then S7 Program folder, and then select the Blocks folder.

3 With the online blocks folder selected, click on the upload icon on the toolbor; or
from the menu select PLC ► Upload to start the upload operation.

4 When prompted by STEP 7 os lo whether on uploaded b lock !ho t alrea dy exists in


the olfline folder should be overwritten. respond Yes, All, None, No, or Cancel.

5 Choose Yes to overwrite the currenl block; All , to overwrite oil blocks thot already
exist in the ofrtine blocks folder; None, lo not overwri te any exis ting blocks; No, to
skip lhe c urrent block: and Cancel. to abort the Upload.

Upload Blocks: With the online Blocks folder selected. upload one or more blocks.

1 With the SIMATIC Manager open lo the desired projec t, p ress the online w indow
icon ond then navigate to the correct Slolion and CPU.

2 Expand the CPU folder, then S7 Program folder, and then select the Blocks !older.

3 With the online b locks folder selecfed, the CPU blocks ore listed in the right pane.

4 In the online blocks window. hold the SHIFT-key ond use the mouse to select a group
of adjacent blocks in a row or column; lo select two or more non-adjacen t blocks,
select each block whfle holding CTRL-key.

With lhe highlighted b locks selected, eilher click on lhe upload Icon on the toolbor;
or from the STEP 7 menu select PLC ► Upload, lo start the up load operation.

6 When prompted by STEP 7 as to whether on uploaded b lock fho l already exists in


the oflline folder should be overwrillen, respond Yes, All, None, No, or Cancel.

7 Choose Yes to overwrite the current block: All, lo overwrite all blocks that already
exisl in the ormne blocks folder: None. lo not overwrile any existing blocks: No. to
skip the current block; and Cancel. to abort the Upload.

317
STEP 7 in 7 Steps

Comparing Offline/ Online Programs


Basic Concept
One of the options of the compare opera tion tels you compare the offline blocks or a
sp ecific p rogram to the corresponding online b lo cks of the a ssocia ted C PU. This compare
operation c on b e executed from the SIMATIC Manager or from the LAD/FBD/STL editor.

Essential Elements
When d efining the online/offline comp are dialog, you must select a CPU p ro gram; you may
selec t the oftline blocks folder to comp are all b locks or one or more selected b locks. You
may include or exclude the System Doto. and include or exclude blocks created in differen t
languages. The compare outcome is presented in a Results w indow tha t lists the bloc ks w ith
differences and allows you lo go directly to the LAD/FBD/STL editor lo view any differences.

Enable the ''Compare code" check box lo compore code blocks o f the program. Once this
function is enabled. you can also specify in the next check box whe ther blocks generated in
different programming languages should b e compared (e.g . OB I in STL with OB 1 in LAD}.

Application Tips
When on off-line b lock folder Is compared w ith on on-line b lock folder. only downloadable
user b lo cks (e.g .. OBs, FBs, FCs. and DBs) ore c omp ared. Variable fables {VATs), user d efined
types (UDTs) SFBs, and SFCs. are not compared.

Compare Blocks - Results -


Thi, block comoatiwn 1es1.1lled in Iha tolowini;i differences-
Path 1: JMakinri...A,e11\SIMATIC40~1 )\CPU413·1\S7 P,oi,en(l)\Blocks
Storage Location: JC:\Patrick\S?_Piojei:ts\Mak.ing_A

Path 2: ONLINE jMaking_A,~\SIMATIC 40~1}\CPU413·1\S7 Progre«{IJ\Block$


Storage Location:

Block List:

I Result or comparison
FC ll Qi Path 1 contans newer version
0810 lS) only exists in Path 2 ONLINE

r Hide insl!li"ICe data blockt ol the , - length


Note:
jr
he block codes are dlfeient.

Dctarls;, j Go To... !
Close I Update I Prnt ... Help I
Figure 5-24. Compare Blocks Results dialog lists differing blocks.

3 18
Managing Online Operations with S7 CPUs

'
; ilID-be fo s:c- OR 1oqic:: c oJlbin~t:.on..

120 . l I.20. 2 Q, 0 . 2 I r2 a. 1 120.Z 030.2


111 ( }-( ( }-I
120. 3
~ I
20 . 3

r'
1~~4 I ~O~ 4

IL/1 .J .J
Ret.-w..n:k 5 : OR-be f ~ ct-iJ.lD l ogic:: c::Obbir-.e.t.ion.

µ0 .1 r 20. 2 OJ0. 2 I I2~. I 120.z (130.2


I II ( )-1 ~ I I ( }-I
I
.!!l
..u _a:ff)U
I lte>l !Jpdo4o

Maln,.J\f••\SIMATTC◄03(1)\Cl'UI 13-l\37 Pr(O'am( l)Wlodis\'Cl I 1-lal",ilo.,'r &s\SWll11C 100(1)\Cl'U!l3-l\51 PIOQ1a-r(l)l,fllaoo\R'.I


~•od<.-1 lldd1<1s1 20".I' C., 4t l 20. 1

I. • 1 EICI i.1r10 l Cro=«!fet...,et , fl; Oio ici 7. C .


!'nm ~1 to IJOl 11e1p. @r '«> )ll.l>j ~< s:z r ,-o If;

Figure 5-25. LAD/FBD/STL editor wi th Online/Offline windows open to first difference found.

Quick Steps: Co mparing Offline/Online Progra m s

ACTION

1 Start the SIMATIC Manager with the desired projec t; Open the CPU program folder
and select the oflline blocks fold er or a selected group of b locks to compare.

2 With the offline blocks folder or one or more b locks selected, from the menu select
Options :.- Compare Blocks: or right-click and select Compare Blocks.

3 When the Compare Blocks dialog is presented, activa te the Onllne/ Offllne radio
button, if not already selected. n,e selected offline block folder or lhe group or
b locks you selected should already appear in the Path I field.

Activate or deactivate lhe lncludlng SDBs check box lo include or exclude the
system hardware configuration in lhe comp are operation.

5 Activate or deactiva te Execute Code Compare to compare actual code or simply


compare by dote-time stamp of tasl time each ofnine/online b lock was saved.

6 Confirming your selection with OK starts the compare opera tion.

7 When, the Compare Blocks Results diolog is presented; it lists each block that differs
In the online IPolh l ) and ofrnne (Poth 2) programs. The result indico les which block
wos the newer version, and whether a block: only exists in the online or offline folder.

8 Press the Go To ... button opens the LAD/FBD/STL editor with online and offtine
windows of the b lock: lhe first round executable code difference is displayed.

9 Use the Next and Previous b uttons to navigate forward to th e next network with
difference or backward to the previous network with a lound code difference.

10 As corrections ore mode and the c hanges ore saved. use the Update b utton to
re fresh the difference list lo reflect the remaining networks with a code difference.

319
STEP 7 in 7 Steps

Comparing Two Programs (Path 1 / Path2)


Basic Concept
The STEP 7 compare operation allows b lo c ks of any lwo ofnine p rograms lo be compared for
code differences. The operation may involve CPU or CPU-independent programs fro m lhe
some or differen t projects. Outcome o f the compare will present o w indowed list of
compared b locks having differences. This compare operation con be executed from lhe
SIMATIC Manager or from the LAD/FBD/STL editor.

Essential Elements
When defining the o lmne compare dialog. you may use any two offline programs. including
programs not associa ted with a C PU. You may select on o ffline blocks folder lo compare th e
en tire program, or sele c ted blocks. You moy inc lude or exclude the System Do to (the statio n
configuration). a nd you may include or exclude blocks that were created in d ifferen t
languages. The compare o utcome is presented in a Results window that lists the blocks w ith
differences and allows you to go d irec lly lo view the d ifferenc es in the LAD/FBD/STL editor.
Whe n the editor is open. ensure lhot the Detail view is activated from the menu.

Con1pdrt: Blocks - Results


The block comparison 1esulted in the f~ng cifferences:
Pa\h 1: lProi...3\LAB_S7400_1\CPU 414-1 \S7_Progiam(1 )\Blocks
Sto1ar,e Location jC:\Palrick\S7_Pl()jecl$_old\ProL.3

Path 2: JP!oi...3\LAB_S73Xl_1 \CPU 315\S7_Progiem(2)\81ock;


Storage Location: )C:\Petrick\S7_Projects_old\Proi...3
Block List:

: ' I Result or companson !!


OB I
I; I
• Path I cont3,r,s newer version
~ only exists In Path 2
II
0B100 ~ only exists in P~th 1
1
--tFBS Qi Path 2 contains newer version
D842 ~ only exists in Path 1 ....
r Hide instance data blocks of the $cllle len!lth
NO(e:
A code cc,mparison we; not executed ck.le to different authoring l1.1nguegetl

Details... I Go To.,.. j
Close I Update Print ... Help I
Figure 5-26. Compare Bloc ks Offline compare result. lists b locks found d ifferent.

320
Monoging Online Operations with S7 CPUs

'
; ilID-be fo s:c- OR 1oqic:: c oJlbin~t:.on..

120 . l I.20. 2 Q, 0 . 2 I r2 a. 1 120.Z 030.2


111 ( }-( ( }-I
120. 3
~ I
20 . 3

r'
1~~4 I ~O~ 4

IL/1 .J .J
Ret.-w..n:k 5 : OR-be f ~ ct-iJ.lD l ogic:: c::Obbir-.e.t.ion.

µ0 .1 r 20. 2 OJ0. 2 I I2~. I 120.z (130.2


I II ( )-1 ~ I I ( }-I
I
.!!l
..u _a:ff)U
I lte>l !Jpdo4o

Maln,.J\f••\SIMATTC◄03(1)\Cl'UI 13-l\37 Pr(O'am( l)Wlodis\'Cl I 1-lal",ilo.,'r &s\SWll11C 100(1)\Cl'U!l3-l\51 PIOQ1a-r(l)l,fllaoo\R'.I


~•od<.-1 lldd1<1s1 20".I' C., 4t l 20. 1

I. • 1 EICI i.1r10 l Cro=«!fet...,et , fl; Oio ici 7. C .


!'nm ~1 to IJOl 11e1p. @r '«> )ll.l>j ~< s:z r ,-o If;

Figure 5-27. Compare dialog sel to compare offline b locks folders of two progrom.s.

Q uick Steps: Comparing Two Program s (Path1 / Path2)

ACTION

1 From the SIMATIC Manager, open the desired project and program. I hen selec l the
offline blocks folder or o group of selected blocks (Path 1) lo compare; then from lhe
menu select Options ► Com pare Bloc ks: or right-click and select Compare Blocks .

2 When lhe Compare dialog is presented. activate lhe Path1 / Path2 radio button. as
the "Type of Comp a rison". Your first selection will already appear in the Path -1 field;
navigate to lhe p rojec t and lhe second p rogram folder to select lhe o ffline blocks
fold er or o group of selected blocks to be compared (Path 2).

3 Activate or deactivate the Including SDB.s check box to include or exclud e the
system hordwore configuration in the compare operation.

4 Activate or d eactivate Execute Code Compare to compare a c tual cod e or simply


compare by dole-time stomp of tosl lime each ofnlne/online b lock was saved.

5 Con firm your selec tion with OK lo start the compare opera lion.

6. When, the Compare Blocks Results dialog is presen ted; it displays o lis1 of each block
that differs in the Polh l and Poth 2 programs. The result indicates which offline b lock
was the newer version, and whether o block only exists in Path I or in Path 2.

7 Press the Go To ... b utton opens the LAD/FBD/STL editor ,...-ith online and offline
windows of the block: the first found executable code difference is displayed.

8 Use the Next and Previous b uttons lo navigote forward to th e next network with
difference or backward lo the previous network with o found code difference. As
you press Next or Previous, both editor windows ore positioned al the selected
network.

9 As correc tions ore m ode and the changes ore sa ved, use the Up da te b utton to
re fresh the difference list lo reflec t th e remaining networks with a code difference.

321
Working with Monitoring
and Diagnostic Tools

Ob j ectives

Use Debug Monitor to Evaluate S7 Program

• Create ond Use Variable Tables (VATs)

• Introduce Monitor/Modify Variables Utility

• Introduce end Apply Force Variable Utility

Introduce the Diagnose Hord•Nore Ulilily

Introduce the CPU Diagnostic Bulfer

• Introduce the CPU Sleeks as Diagnostic Tools

Introduce 1he Program Reference Dal o Utiliiy


STEP 7 in 7 Steps

Tools for Monitoring Programs and Data


Using the Debug Monitor to Evaluate the Program Status
The STEP 7 Debug Monitor is on o nline debug u tility. ovoitobte in lhe LAD/FBD/STL edilor. when
o n ontine connec tio n to a CPU is established and the CPU is in eilher the RUN or RUN-P
operating mode. Displaying a block in this mode allows you to view and to evalua te lhe
code of a block as ii is being p rocessed. Combined with the Monitor/Modify Variables utility
you ore able lo monitor and evalua te both your program and data onllne.

Using Variable Tables


A variable table (VAT) is a table ol specific memory addresses tho t con be created and
used to assist you in monitoring, modifying, or forcing memory a nd process variables in your
program. VA Ts o re generated from the Simotic Manager. like other blocks, and ore p laced
stored in the o ffline Blocks folder. Since VA Ts o re not code or data blocks, they ore not
downloaded lo the PLC. Once created. the VAT c a n be recalled ta view and manipulate a
particular variable set in the Monitor/Modify Variables or Force Variables utilities. Up to 255
VATs may be genera ted. numbered from VAT l to VAT 255.

Monitoring and Modifying Variables


The Monitor/Modify Variables utility allow you to bo th monitor and modify the defined
constants and variables of your process and S7 program. Using this utility. you will be able to
view and manipulate. in real time, the various S7 memory areas (e.g., bit memory, timers,
coun ters, inputs. outputs, peripheral inputs. peripheral outp uts, and data block variables),
that you hove defined in a variable table (VAT). Using the mo nitor icons (eyeglasses in Fig. 6-
1) you con stor1 the monitor utility a nd view the screened variables as they update. This
operation c on b e performed using a d irec t or network connection lo the appropria te CPU.
As you modify variables. you can use the appropriate toolbor icons, to trigger updates that
cause new values lo be written once or continuously.

Figure 6- l. Debug Monitor loolbor.

Forcing 1/ 0 and Memory Variables


Forcing is o useful program and 1/0 diagnostic tool available in a ll S7-400s. and with limited
scope in some S7-300s. This fea ture allows you to selectively override the normal program
influence o n memory variables of your S7 p rogram. as well as the infl uence of the normol 1/0
update on the actual status of inpu t and output devices. Using !his utility. you will be able to
force the desired statuses of 1/0 devices or the values of memory variables, until they ore
released by your command. With forcing, output w iring con be checked, a nd control logic
con be fully tested without having to go out a nd manually open or close switch contacts or
to wait until a temperature or speed selpoint is reached.

Using STEP 7 Program Reference Data


STEP 7 provides severa l types of program reference data that can be d isplayed or print as
reports. When you decide to use these reports, available from the Optio ns menu, you have
the option of d isp laying. filtering, or deleting the current program re ference data (e.g..
Options ► Refere nce Data ► Display). From this some menu. you may filter the reference
data lo determine what is reported. and regenerate it lo process newly created b locks, or
b locks that may hove been edited. From the LAD/FBD/STL editor, you can a lso ensure that
the re ference data is outomoticolly genera led for eoch newly created block. Select Options
► Customize then on the Blocks lob, activate the "Creole Reference Do/a" checkbox.

324
Working with Monitoring and Diagnostic Tools

Program Rererence doto reports include the Assignment Lists. Program Sfrucfure. Cross
References. Unused Symbols. and Addresses without Symbols.

Assignment List
The assignment lisl is o memory usage overview ol lhe inpu ls [IJ. outputs [Q), bil memory (M).
limers [T). and counters (C). Th e report is actually divided Into two parts - the so-called
1/Q/M list. and the Timer/Counter list. Since the entire area is shown for each of these memory
areas, you con easily determine who I locations ore avoiloble and ii any were lmproperty
assigned.

The 1/Q/M assignment list, as shown in the figure below, is a table in which the byte locations
ot each areo are depicted as rows in 1he table. Each byte is divided into eight boxes. each
or which indicates a bit location. The b ils are numbered rrom the least-significant b it starting
from the right, as seen in the table header. Each b it location that is used in your p rogram, is
marked by on ·x·. Furthermore. the column header otso indicates w hether lhe loc ations ore
accessed in the program as a byte IB), word (W), or doubleword ID) location. As seen in
Figure 6-1a. the individual bits of by1e-4 and byte--5 are each used; these two bytes are also
accessed as o word location IW 4. The Timer/Counter list also shows uses a table formal to
show which timers and counters ore used in the program.

•··
lll>'Jtc, outpub, ~ melllOi)'
,. Input$, output~, ~ l'MfllOI)'

IB 0
7 6 5 1 3 2 I 0 8 W D
I
MB229
7 !12.l.tl.! 2 I 0 8 W D

IB 1
18 2 X X X X X X
MB230 I l
IB 3 X X
MB23l I I
IB 4 X X X X X X X X MB232 I I
18 5 X X X X X X X X MB233 I .I
IB 6 X XX X M8234
Figure 6-20. t/Q/M list: Input Memory Area b) 1/Q/M list: Bil Memory Area. MD 230 is used.

Program Structure
The program structure provides a visual mop of how b locks ore called within your S7 user
program. In a tree-like struc ture, that can be expanded and collapsed, all of the nesting
levels of b lock calls of the program con be viewed. This graphical view of the program con
be a useful tool to quickly see wha t b locks ore called from a given block os welt os the
nesting depth or o given coll path. Furthermore. lhe p rogram structure gives you the exact
temporary local data requirements for each coll path (i.e .. O B colts}.

Program Cross Reference Data


The program cross-relerence report provides a detail listing of where memory addresses ore
used throughout the entire user program. For each address, this reporl will list the absolute
address, its assigned symbolic address if ii has been defined, the language used, whether the
address is used in o read (RI or write (W) operation. ond the networks and blocks in which lhe
address is found . In the on-screen report. you con select on address. right click and navigate
direclly to the specific loc ation where the address is used.

Unused Symbols List


The unused symbols list is on account of alt symbol addresses that were defined. yet not used
anyWhere within the S7 program. As shown in the figure below. the table lists each symbol
address. its corresponding absolu te address. the data type, and o comment if it was defined.
This report may reveal blocks that may have inadvertently been overlooked and not called
anywhere in the program.

325
STEP 7 in 7 Steps

LOOPBCONT F820 FB20 TMk B Loop Control


Fbr_'ICH FBSO FSSO 4·ChMnel Analog Input Filter With no block parameters
Fll.TER_BOt FBS I FBS I Analog Input 1/alue Fileter &-charmel
Totalizer FB60 FB60 Totalizer withcu block paremeters
Totalizer_Par FB61 Rl6 1 Totall~r with block parameters
VAi.VE TAI« A Q40 . I 600l Mi.n Valve H11'1k A
V/lLVE TM')( B Qi0.7 600l Mein Velve Tri 8

Figure 6-3. Program reference data: Unused Symbols report.

Addresses without Symbols


The Addresses wilhoul Symbols report is on account of all absolute addresses tha t were
fou nd within the program, yel o re without assig ned symbolic address. As shown in the figure
below, the table lists each symbol address. ils corresponding absolute address, the data
type, and a commen t ii it was defi ned.

Determining the Cause of CPU STOP


When the S7 CPU makes o transition from a RUN sta te to STOP, the cause of the stop. whether
hordwore-reloled or progrom-reloted, can be ascertained by accessing the CPU's
diagnostic buller. There, you can determine the general nolure and cause or the fault and
should be able lo determine w hether ii is resulting from problems in the hardware or in the
program. If the cause is p rogram -rela ted you may !hen use the CPU stocks to further
diagnose the problem and the specific cause.
Using the CPU Diagnostic Buffer
An S7 CPU togs up lo one hundred or more significa nt event messages in its d iagnostic b uffer.
Me~soges entered into the buffer include module faults, process wiring errors. system-rela ted
errors, program-rela ted errors, CPU operaHng mode transitions, and user-defined events and
messages. As a primary tool In diagnosing problems, lhe diagnostic butter is the first c heck
when a fault has resulted in a CPU STOP. If the CPU automatically swi tches to STOP, you con
determine the cause by evaluating the last events leading up to the STOP. The dlagnostic
bu t-fer behoves a s o ring buffer for a maximum number o f entries, which is CPU dependent.
When the maximum number or entries is made, the next new event is p laced a t the lop. the
remaining entries are all p ushed down by one positi on, and the o ldest entry is deleted. The
newest entry is a lways the first (top) entry in the buffer.

Diagnosing S7 Hardware Online


When the c a use of o CPU STOP is d etermined lo be hardware-related. you can obtain further
d e tails of the actual component in question by opening lhe Diagnose Hardware o nline
utility. With the Simatic Manager open to ttie desired p rojec t, select View ► Online lo open
the o nline p roject window. With the station selec ted, right click and select Open Object. If
lhe project is not on the PG/PC, then from the Simotic Manager menu selecl PLC ;.. Display
Accessible Nodes. Select the appropriate CPU and then PLC ► Diagnose Hardware. A quick
view of any fault modules will be displayed.

Diagnosing Program-Related Faults Using the CPU Stacks


When the c a use of o CPU STOP is determined to be program -rela ted, using the diagnostic
burler, you c on obtain further detans of the ac tual causes by examining the CPU stocks. For
instance, fhe B-slock (short for b lock-slack), lists all or the blocks called In the program jusf
prior to the STOP. a nd !hot d id not complete execution. The I-stock (short for interrupt-stock).
con ta ins important data or statuses that were in effect a t the time the CPU ,lopped. For
example. accumulator contents. numbers of the open data blocks a nd their length. sta tus
word contents, number of the interrupted b lock. and the block where processing should
resume. Th e stock information can o nly be accessed w hen the CPU is in STOP mode.

326
Working with Monitoring and Diagnostic Tools

Comments on Working with Monitoring and Diagnostic Tools


The STEP 7 programming system offers many online tools and utilities that aid in managing the
various components of your program, as well os for d iagnosing problems in either the
program or in the control system. In this chap ter we will presen t several online monitoring and
diagnostic tools, typically utilized in the runtime diagnosing of problems associated with the
installation, startup, and maintenance of the control system.

Like in p receding chapters several brief tutorials have been presenled here, to offer o quick
overview of working with onllne monitoring ond diognoslic operations. In lhe remainder of
this chapter examples of monitoring and d iagnostic operations such as monitoring program
status with or without a project, forcing variables, diagnosing hardware, and using the CPU
diagnostic butler, are all presented in o step-by-step manner. The following checklist
highlights some of the key points in working w ith the S7 monitoring and diagnostic tools.

Checklist: Working with Monitoring and Diagnostic Tools


• Ensure /hat there is a direct connection between lhe CPU and programming
sys/em. using standard serial cable (and PC Adapter for PC} or on MP/ subnet
connection.

• From lhe Simotic Manager. use the Online Window loo/bar button lo access
lhe onf/ne operations ofo specific CPU with /he project.

• From /he Simotic Manager, use the Accessible Nodes loo/bar buHon to
access the online opera/Ions of a specific CPU wi/houl a project,

• Use the Debug Monitor tool in RUN mode to view the S7 program logic and
data, with visual aids, as the program is being processed.

• Create Variable Tables {VATs} as o convenlen/ looJ and starting pain/ for
Monitoring/Modifying Variobfes and Forcing Vanobles.

• Use the Monitor/Modify toot to view and assign new values lo memory and
program variables as /he conlro/ program is being processed.

• Use the Force Variables tool for overriding /he actual stalus/vo/ues of
memory and 1/0 variables as the control program is being processed.

• Use lhe CPU Diagnostic Buffer to quickly determine the cause of o stop by
ascertaining what events lead up lo /he CPU entering /he STOP mode.

• Use the Diagnose Hardware toot to quickly pinpoint errors or faults in the
hardware of a station tho/ hos stopped.

• Use /he CPU S1acl<s {e.g., S.Stock, I-Stock, L-Stacl<J to determine the causes of
a CPU STOP, due to program-related faults.

• Generale lhe various program reference data and memory address usage
repor1s to ossisl in diagnosing program-related problems.

327
STEP 7 in 7 Steps

Monitoring Program Status with a Project


Basic Concept
The STEP 7 Debug Monitor is on o nline debug u tility. ovoitobte in lhe LAD/FBD/STL edilor. when
on ontine connectio n to a CPU is established and the CPU is in the RUN or RUN-P o perating
mode. Disploying a block in this mode allows you lo view and to evalua te !he code of o
block as it is being processed. Combined with the Monilor/Modify Variables utility you ore
able to monilor and evaluate both your program and data o nline.

Essential Elements
An online connection musl be established with lhe CPU to d isplay a block in lhe monitor
mode. With the connectio n In p lace and lhe block o nscreen. simply enable the Monitor
mode rrom lhe menu (Debug ► Monitor), or using the Monitor toolbor bu I to n (eyeglasses).
Each LAD network is highlighted to show b inary resul ts a long the network , as contac ts open
and c lose. Similar logic continuity is shown in FBD, and STL. In oddi1ion lo showing the logic
continui ty, the digital con lents of each program variable is also shown.

Application Tips
While in lhe Debug Monitor mode. the screen is only updated from the poinl of the cursor
forward. If you need lo switch between the language representations (i.e., LAD/ FDB/Sll) , the
status mode must first be turned off temporarily.

BO • @OBI
Fib Edi Insert fl.C Oebug 'l1ew o,,bons Wi,dor, lt,lp
-----
D 1~1
~--l,'ffL~ ~ 1~161.,, I · ICJr~l• lf0 ~~ 11'.Jll§II t'::1➔~111-l-01 ~14 l_j'l1-d~
Isl @OBI - Maliinjj ~c:•\SJMAm <100(1t;:~<113-I DNLXl;lf}
: 1'10 Set1es-Patal1e1 citC:Ult$ in secics ~i!:h a •inglc NO contac,.

I20, 1

I20.3
I:20. 2

120.4
, 120. 5
... ... ..... - .... .I ,' ..... ........" .......
'
-.....
030 . '1
'. .. .... .
....
- - : :···--· .. ···I r.....
Network 12: 3ecies-Patall el citcui~ c0Db1na~1on.

120.l 120. 3 030.S


Hetmrk 13: Tvo Patallel c1tcuit• in set>•• vith a s1ng l e UO con.ace.

I20. l I20. 3 I20 . 5 030 . 6


•' ..' . -...
• '
120 . 2
' '
r~o;.~--- r II ,

~ I

Figure 6-4. Block in Monitor mode. Status fulfilled = Green; Nol fulfilled = Red Dosh.

328
Working with Monitoring a nd Diagnostic Tools

01~1~1'11 ~ ;it l~ l@t:::t:l£11jit.lF:l ~ !r;.; j ! ~ ~ ~~l-lt!-O!~l4IJIHI~


■ ■ ~ OBI - Making.ArN\SlMATIC ◄OO(l)\CPU.f 19-1 01'1.INEl
llt!t oork 9 : P0Iellel- Ser1es circuit col>?>Lnet10n.

I l 20 .l l 20 . 2 Q30 , 2
1 1-I----11 1 - - , - - - - - s 1 }-I
1I 120 . J 1 20.4
1 I t .-~
let\,orl< 10' : !:xclu:uv~- OR implencnt.et.1.on in Lcdde-1:: !09lc .

120 , 1 120 . 2

1--,, 120. l 1 20 . 2
.-1-

Pross Fl t:o90t Ho\:,. @ 1 ,<!> RUN


t,V, to Rd /4
Abs< 5.2
Figure 6-5. Block in Monitor Mode with cursor a l Network 10; prior networks ore not updated.

Quick Steps: Monitoring Program Status with a Project

ACTION

I Launch the Simo tic Manager application from the Windows Start button and open
to the desired projec t and the S7 Program whose status you wish to monitor.

2 Selecl the Blocks folder of the Program. and then from the right pone double-click
on the block you wish to open or righ t-click on the b lock and select Open Object.

3 From the STEP 7 menu, selec t View ► fhen select LAD, FBD. or STL as the language
represenlolion in which 1he b lock was created.

4 From the menu select Debug ► Monitor or p ress the Monitor foolbar icon (eye
g losses/ to view fhe block status, while processing (CPU in RUN or RUN-P mode).

S Select the network header (e.g .. Network 11 ), for the network you wish to evalua te
first. Alfhough the entire block is being p rocessed. only networks below the selec led
network are updated - thereby minimizing the overhead due to status update.

6 If 1he program status does not appear to be updating. check the status bar o f the
editor window 1o verily tha t the CPU is in the RUN or RUN-P o pera ting mode.

7 After the editor opens. maximize the window and use the View menu to hide the
Program Elements browser (de-oclivo le th e Overview), lo enlarge the viewing area.

8 For additional diagnostic aids while in the monitor mode select View ► Detail.

9 To open and monitor another block, select Ale , Open from the menu.

329
STEP 7 in 7 Steps

Monitoring Program Status without a Project


Basic Concept
In some coses you will need to a ccess and monitor the program in o C PU. wi thou t opening
the associated project. It may be tha t the PG/PC that you currently have occes-s to does not
have a copy of the projec t or that you simply won t lo quickly go ontine without the d elay of
having to find and open the project. Any CPU program can be accessed without the project
while using the Accessible Nodes utility.

Essential Elements
Accessing o C PU program without the project means that you a.re not accessing the o rmne
program. but instead the program residing in the CPU. Either a direct MPI link to the CPU or
on MP! o r Profibus network must be in p lace since the Accessible Nodes utility o nly opera tes
over these links /Accessible Nodes Utility is not p ossible via Ind ustrial Ethernet). To view the
program while it is p rocessing, the CPU must be in the RUN or RUN-P operating mode.

Application Tips
Although you may gain a ccess to any CPU program and data opened through the
Accessible Nodes utility, this method should be used only for monitoring a nd not for editing a
program. Editing CPU programs and data w ithout the project may result in the loss or
distorting of critical project information.

File Edit Insert PlC View Options Window He~


-·- .....
..... iii
- •-

@] MPI = 5 (direct)

Figure 6-6. Displaying active MPI stations found using the Accessible Nodes utility.

File Edit Insert PlC View Options Window He~


1

;. Accessible Nodes -- MPI


i Accessible Nodes ~ System cleta O FC4 O SFB2
lfl··@l MPI • 3
El·•@I MPI = 5 (direct)
~~l~il§dl
--
O FB100
O FCl
O
O
O
FC10
FC11
FC100
O
O
O
SFB3
SFB4
SFB5
O FC2 O SFBO O SFB16
O FC3 O SF81 O SFB32

Fig ure 6-7. Accessing o n/ine blocks folder of MPI address = 5, withou t project.

330
Working with Monitoring a nd Diagnostic Tools

01,~1~11111.~ ;;, l~l@I...,('"slr1,!at~ f&t.!.ill:!JIDJl§il1j~rl*l-{>llfll1.. J~1--I~


■ • 11001-- MalcinfbAr~a\ SIMATTC-f00(1)\ CPIJ41 3-I 01'1.lNE)t .=Jg)~
Netvor k ' : P8t8l l e l-Sec1e• ClCCUlC COll!llnauon .

I I Z0 . 1 I 20.2 OJ0 . 2
11
i----11 t - ~ - -- 1 }-I
1I I 20 . 3 I 20 .4
1 I I
lchmrk lG : Exc lu31vc- OR 1nplenent c t 10n 1n Loddcc logic .

''
I
.
I20 . l
I
.
120 . 2
ti
·•
•• • ••••••••• , i o- • • · -
I
030. 3
_J
I 20 . l I 20.2
--, A

Press Fl to 9et Hdi,.


1 - - - 1-

(el <!)[RUf /Abs< S.2 -Nw


~.
_ l_O_ _ _ ,:;f u.

Figure 6-8. LAD/ FBD/STL in Status mode, with the view set lo LAD representation.

Quick Steps: Monitoring Program Status without a Project

ACTION

I Launch the Sima tic Manager applica tion from the Windows Start button and from
lhe menu. select PLC ;.. Display Accessible Nodes; or from the toolbor p ress the
Accessible Nodes Jeon. Each sta tion folder is id entified by the station MPI address.

2 Select the Blocks folder of the desired s1olion. then from the right pone double -click
on the block you wish lo open or righ t-click on the b lock and select Open Object.

3 From the menu, select View ► then select LAD. FBD. or STL a s the langua ge
representation in which lhe b lock was created.

4 From the menu select Debug ► Monitor or p ress the Monitor toolbar icon (eye
glosses) lo view the block status, while processing !CPU in RUN or RUN-P mode}.

S Select the header (e.g., Network 10) for the network you wish lo evaluate First.
Although the entire block is being processed . only networks below the selected
network ore updated - thereby minimizing the overhead due to status updale.

6 If th e p rogram status does no t appear to be updating. check the status b ar o f the


editor window to verify that !he CPU is in the RUN or RUN-P operoling mode.

7 After the editor opens. maximize the w indow and use the View menu to hide the
Program Elements browser (de-ac tivate th e Overview). to enlarge the viewing area.

8 For additional diagnostic aids while in lhe monitor mode select View ► Detail.

9 To open and monitor another btock, select F1Je ► Open from the menu.

331
STEP 7 in 7 Steps

Creating and Editing Variable Tables (VATs)


Basic Concept
A variable table (VAT) is o table of specific memory addresses lhol con be created and
used to assist you in monitoring, modifying, or forcing memory and process variables in your
program. VA Ts o re generated from the Sima tic Manager, Oke other blocks, and ore placed
stored in lhe o ffline Blocks folder. Since VATs ore not code or dolo blocks. they ore not
d ownloaded lo the PLC. Once created. the VAT can be recalled to view and manipulate a
porticulor varia ble set in the Monitor/Modify Variables or Force Voriobles utilities. Up lo 255
VATs may be generated, numbered from VAT l to VAT 255.

Essential Elements
VATs may be comprised o f any S7 memory locations, including lhe peripheral area, and
timers and counters. Bit, byte, word. ond double word locations from the Input (I), Output (Q) ,
Bil memory (M) , a nd d ata b lock memory (DB) areas may b e used in the table. For example.
bit Q 4.7. byte QB 4, word QW 4. ond double word QD 4 are all valid entries. Only byte, word
and double word a reas of the Peripheral memory area are allowed (e.g., PIB 256, PQW 512).
When defining each variable , you may use either its absolute or symbolic address.

For each VAT. you may define a Trigger Point and Trigger Freqvency ror managing how lhe
variables ore monitored ond modified. The trigger point. defines the point of w hich the new
valves ore as.signed to variables being modified, and at which variables being monitored
ore updated. The trigger frequency defines how often variables you are modifying should be
assigned the new values, ond how often the variables you ore monitoring should be
updated. You moy se t the trigger point for the Beginning of Scan Cycle, End of Scan Cycle,
or Transition to STOP. You may set the trigger frequency for only Once, or Every Cycle.

Application Tips
Using VATs con be o great monitoring and troubleshoo ting tool. Try to creole tables for the
sections of your machine or process where you a nticipate problems. To e nhance readability
o l each loble, limit the number of entries to only those memory locations tha t ore essential.

Modify value
1 MW 30
........ •·••·•·••·•• .. ·• i !
' ............... . ,... .
, ..................
' DEC .................... ····•·• ..• .............. ..... . ............. ···11
·
2 .T...... ~ ..... •··•--···..... , .. [ ~IM~!l.~.,,_TI_ ~ ~- .: .............. ···----·.. , ·f
3 C i
3 •---1·--·---·--··--....
----..··--·•· \COUNTER
. . -....--.--............_._._,............______,., ____._... .__.. ,..._._____..... .__.............r
.-.....
It I 32.0 i i BOOL
····--..·····-·····-····~----·····-...---·-~----·------·-·-·····
5 I 32.1 \ , BOOL _ -
. . . . . · - - ··· • · • I t - ' ' - . · - -. . · - - · - - · ' . . . . . . . . · · - · · . . ····•"' · - · - ·•·· , . . . . . . . . 1· .. . . . . . . . . . . . . . . . . . ·• ................... ' ...

6 I 32.2 t 1BOOL
....··-···---~····---····+-·-···-·-----··-·-···•-+-•---····--··--·-·--·..._. --- --- ····-·..···------·-··-····-·-·--··· i
7 I 32.3 ! I BDOL ~
8 . i. . . . . 32·4··•---H••r·••H-..........................!.B Oo-c.··.... --..-......,..-....... - . . ····-.. ·-·--·---.....-,.-...........-.!
.... ......,,..,_.,... .........- ..........,_, ,....... ...........................,.. ,......
.- _. _. ,, ... ..... -............ _, ..............
,._. ,,(",

9
10
I 32.5 ! BOOL
·ci··--·32~·0-·-••1••,o•·-···--..-·-····. -re·oo-c·. . . . . . . . . . . ._,. , _ !
·····-••«••··--"•-·--·-..............~---~
.......-..,....- ..........................._....,.... ·-·..-··......~---·---····....·····-...... ... .. ...·-·......·-·.....-·-........-··--··-·-<
11 Q 321 i [ BOOL ' [
t-1-2---i.-...;•.. ' ......... . . ... ,.. . ·-·•· ..... -: ' ' ...... .. . ·• ..... ..... . . ·--··--· ··- ....... - . ·•1
i-:::....11-...ii..,...... --··.. ·····-·- .........,, .... ,__ .....-... ,_,_,.... ~············-··•--~--.. ··· ····••·-••· ....·- - - - - - ·····-·"···-......,."rl............-. ...... ...5

Figure 6-9. Variable Table (VAT) entry d ialog. Enter absolute address, and display format,

332
Working with Monitoring a nd Diagnostic Tools

Trigger ,
Trigget Point fOf Moniloring- - ~ Trigger Cond~ion for Monitoring-~
C.- Beginning or Sean Cycle 1 Once
(" End of Scan Cyde C.- Every Cycle
(" Transition to STOP

Triggef Point for Modifying- - - . Trigger Cond~ion for Modifying--.


r
♦ Beginning or Scan Cycle (.' Once
(" End of Scan Cyde r Every Cycle
1 Transition to STOP

DK I Cancel I I..._H_e1p_ _l
Figure 6- 10. Default VAT !rigger se ttings for Monitoring and Modifying.

Quick Steps: Creating and Editing Variable Tables (VATs)

ACTION

1 Open the Simotic Manager to lhe p ro jec l and S7 Program you v,1ish to use.

2 From the menu, Insert S7 Block ;.. Variable Table and accept lhe next available
number (e.g., VAT 1). The number [or each new VAT is outomolicolly assigned
Confirm the new VAT with OK.

3 Next. double-click on the new VAT to hove ii open in lhe variable table editor.

4 To odd or remove a standard column from the variable table, select View from the
menu and activate or deoctivole lhe desired column (e.g.. Symbol Commen t) .

S Next, build the table with o group of variables you wish to mo nitor or modify; enter
each Address, a nd right-click in th e Display Format field lo select the formal in
which you wish to view the data (e.g .. BOOL. Decimal. Hex. Binary, or Counter/.

6 To enter a range of addresses click in the address field , right-click and select Insert
Range of Vorlobles - the n in the appropriate Field , type the starting address, the
number o f locations. and the d isplay format to use. Co nfirm your entries with OK.

7 To insert o comment line lo describe a variable en try, selec t the entry and lhen from
the menu or the right c lick, select Insert ;.. Comment line. The comment is inserted
above the variable row.

8 From the menu. select Variable ► Trigger lo set lhe trigger point and trigger
frequency for both monitoring and modifying the variables of the VAT.

9 From the menu, select Table ► Save to save entries und er th e VAT you opened;
select Tobie > Save As to save en tries unde, another VAT number.

333
STEP 7 in 7 Steps

Monitoring and Modifying Variables


Basic Concept
The Mo nitor/Modify Variables utility allow you to bo th monilor and modify the defined
constants and variables ol your process and S7 program. Using lhis utility. you will be able to
view and manipulate. in real lime. the various S7 memory areas (e.g .. bit memory. timers,
counters. inputs. outputs. peripheral Inputs. peripheral outputs, and data block variables),
that you hove defined in a variable table (VAT).

Essential Elements
To monitor or modify the variables you entered in o variable loble (VAT). you must a lready
hove a physical online connection lo the desired CPU. You must also establish a logical
connec tion to the CPU. The logical connection is established using the PLC menu oplion
Connect To► . You may connect to the Configured CPU. which is the CPU associated with the
S7 program in which th e VAT was c reated; lo a Direct connect CPU. which is lo any C PU that
you have o d irect connection; or any Accessible CPU, which con be reached via lhe
accessible nodes utility. Whenever a VAT is open with on online connection, you will see
"Online" in lhe title bar. The status bar will display the opera ting stoles "RUN," "STOP,"
"Disconnec ted," or "Connected."

Application Tips
You may open as many VAT windows as required, all of w hich may be online simultaneously.
Allhough each VAT you create is generally connected to the CPU of the associated
program. ii is possible to link each varia ble fable wi th any C PU. For example, you might
create o VAT in a CPU-independenl program, which hos variables tha t ore common to
several CPUs. You may then connect to any one of the CPU lo a nd use the VAT.

lii$[YAT.1 --@Making. Area~SIMATIC 400(},2~CPU413'-1\ S7 Program(... ,- l,□j2SJ


l-JJ.li~Ad~d~res~S~_J_;S~ym~b~ol~~D:'.!:is!!:p~la~y~Fo~r~m~at:...__J_:S~ta~l:1.J~s~v~a~lu~e'.._.!..!:Mod~i~fy~v~a~lu!:e_ __j •

2
1 ~Y'! . .
MW
~~-
50 l
.! ..
o_ E~. ... . .. . ... . . .;.-21 ~
' DEC
2~qo ... ·-· ... __
....,.._, ..................... ,.. _,, ___,, ......;,, ........................ .....................
999
I.
.... ............ •............- .........., c
J
[
3 MW
..... , .. ,
52 {i . ,
.,,, .. i~. HEX
' ..... ,,
Win 61t0999 ',.,,, ... '
i
{
4
.MW' '
60
., ..,.
i
.;, . ...
i;, DEC
. " . " ... ...
'
11178 2500 .,.,. - . 'i
... i
5 T.. • O ,.,
l
j ' . • ... ' ' '··-:• ' .
1SIMATIC_TIME ,. •. " ....
S5T~Oms .. . __,,.. . .' ' . <
'i
•H•O ..

6 C 3 ••••• • .., •1•••


.. ' • .. v••

I 32.0
l ,.,,,., • ' •••' •;•i COUNTER
l l BOOL
• "" ,,._ ' • " ' ! • •
Clt999
false
..
_.,,. ,., - ... -·- ..... ~
'" ~
'
7
,.._ •.• ·-· • · -... ' - · - -..~' ., _ ....._ ••• ·- ·..- i. .. - - · ,._, ,. · - · ..... -... ·- · - - · · - · ..... ...............-.... . . . . . ·-·-·-·-···---!'
8 32.1
.... . .. , ....
i , BOOL
.l... .. ..........:......... _,,., ., .. , , ..
false ,,_..., ................... t ,(
!
9 32.2 l · BOOL false !

10
···- ···-· ........ _,_., .. J. •.•- ... ·--··· •..,.,,_!,_ - ·--···"'· ,. ·-····"-". ·-·---·-· .....
I 32.3 i iBOOL false
' - ...............-..--····· .....-..........-,, t
;
• - -..••~••••~•••-••-..••1•••-,oo_,,_,_,._,.,, ..:••••••••••..- ...•-••--•••-••••-•••-••T•••--- . '•t
- · · - · ....... ·-··--···· ......... - ....- ...... C:

11 1 32.4 l ; BOOL false . . . . . . . . . _.__. . . ..........·-···-··t


12
,·-..32·5-..--..- ·-···-~·soo·i~-... . . --···. . . . . -......
= • ............- . ·•
..
false
····--··-· ---.. - ·--·1...........- ..........!.., ...... ,··-••·.........._ ....- .......... ·•-· . -··-, ..........,--..··· .................... tr
13 I·••· ..32..6 I · BOOL
~....... . ..J............. .. •···•·1•· ' .. ,...... ..... ·•·•··· ·- ·•-·-· false !
!
••••••• .. •••• .....- •-"••-•-H•-•-•• ~
14 I 32..7
............................... j .....,-..... .. •-:•(BOOL
t... -·-•·--•·"··". ....................-.. ·~• ·-
~
false
- -···--....... ·-····-····· ..---•• - .......... t
r
!
15
16
a. . 32·:,.
Q 32.0 i
.. ' .. , .
soi:JC' ... -·. ·--·---··
'T
1... .._
..... -
i BOOL
. "'"'"''.'
.j. ..
true
true
'

17 Q 32.2 I ! BOOL ·false


18 a 32.3 ·T ·-..·-- · rsooc·-·
' " ,., •. ....... .. • " ...... !, • • ·• .. • .. ., .... ~-- ......
true
'19 Q 32.4 i lBOOL
Figure 6-11. Variable Tobie (VAT l) in use with Monitor/Modify utility. Direct CPU Connection
and Monitor (plain eyeglasses) tootbor buttons o re selected.

334
Working with Monitoring a nd Diagnostic Tools

Quick Steps: Monitoring and Modifying Variables

ACTION
I

1 Open the Simotic Manager lo the desired project and program: lhen from the
Blocks lolderdouble click on the desired variable table (VAT), lo open the table in
the Monitor/Modify utility.

2 Based on your actual situa tion. from the menu. select PLC ► Connect To ►
Configured CPU: Direct CPU; or Accessible CPU to make an online connec tion to the
desired CPU (e.g., the Configured CPU or any accessible CPU).

3 To start updating your monitored variables, from the toolbar. press lhe Monitor Icon
(eyeglasses); or form the menu select Variable ► M o nitor,

4 To a:;sign a new value to one or more of the variables of your VAT, select the row of
lhe address and click in lhe Modify column and type in a new value: then from the
menu. selec t Variable ► Modify: or from the toolbor. p ress lhe Modify icon.

5 From the menu. select PLC ► Disconnect to break the online connection be tween
the CPU and the active variable table.

The Configured CPU is th e CPU linked lo the S7 program in which lhe VAT was
created; the Direct CPU, would be a CPU lo w hich the PG/PC is directly connected
via the standard coble; on Accessible CPU , is any one of the p roject configured
CPUs or other CPU tha t con be accessed.

Note: Any variable modified while in the STOP or RUN mod e will remain as set unless
overwritten by the program when the C PU Is in lhe RUN mode. If the sta tuses or
inputs ore modified o l lhe beginning of lhe scan, th e actual slates ore only
overwritten until the next 1/0 upda te.

335
STEP 7 in 7 Steps

Forcing 1/ 0 and Memory Variables


Basic Concept
Forcing is o useful program ond 1/0 diagnostic tool available in oil S7--400s. and with limiled
scope in some S7-30Ds. This fea ture allows you lo selectively override the no rmal program
influence o n memory variables of your S7 program, as well as lhe influence of lhe normal 1/0
updale on lhe actual slotus of inpu t ond oulpul devices. Using this utility. you will be able lo
force lhe desired staluses ol 1/0 devices or the values of memory variables, untll they are
released by your command. With forcing. output wiring con be checked. o nd control logic
can be fully tested w ithout having lo go o ut and manually open or close switch contacts or
to wall unlll a temperature or speed setpolnt Is reached.

Essential Elements
The voriobles you wis h to force ore hand led from o so-coiled "Force Va lues Window.'' like
with monitor/modify variables, to force varia bles, you can create the loble of variables as
needed. or you can use an existing vorioble toble (VAT). A connection with the CPU is also
required. The co nnection can be set to co nfigure automatically, in the Options menu. or you
con use the menu command PLC ► Connect To ► . You may connect to the Configured CPU,
associaled w ith lhe S7 program; a Direc t connect CPU; or any Accessible CPU. In the S7-400.
you may force bit memory (M), input (I) , o utput [Q), peripheral input {Pl), and peripheral
oulpul (PQ) memory. In the S7-300 you may force inpul (I) and oulput (Q) memory.

Application Tips
Before you slar1 a Force job you must ensure lhat a force job is nol already oclive in the CPU.
To ensure safely, however, you should not sto p a force job started by someone else. unless
you ore owore of the total impact o n the con trol system. When you are done with a forc ing
job. you must explici tly termina te the job. A force job is not termina ted by closing the
applica tion or by breaking the CPU connection; instead, forcing is o nly terminated by the
menu comma nd Voriobte ► Stop. UnHI a force job is stopped. the force values are still In lhe
CPU and not deleted. An ac tive force job is indicoled by on LED on the CPU face p lole a nd
on the Force Values Window status bar.

flt Yar • force Values : Hrdware\ 57,300. 1.lJer,,fbced=~!lf!.\CPU JIS\57 Progran,(20) :, tel~
Table Edit Insert PlC V&tlable View Options Window Help

~ Dl~llill ~ .~l~l@I -njr-~I ~ ~..!J ~ ~(wil-v-1~ ~


Mfon;c Values : Hrdworc~S7300.l 0 Tler 0 fbced..EMf!\~PU 3 15\57 Progrom(ZU) (ll'jlJNE -mtxJ

••• • - t....
.
Time of l11st Upd&te: 17:02:27
Figure 6-12. Force value table shown normal, to reflec t that the table volues are being edited
ond not yet " forced" in CPU.

336
Working with Monitoring a nd Diagnostic Tools

i8Var - Force Values : Htdware\ij7_300.J:;i;,ier~-Exp - 1□I~


Table Edt Insert PLC Variable View Options Wil'ldow Help

~ Dl~lli11~ .l'b l~lel ,e)l ~l ~ ~..!J ~ E;,j6li1'1~1 5


lj;{Force Values : Hrdware\ S7300: 1. Tier.,.F0<ed_Exp ONLINI: ,1- (□JE
Address Symbol Oispl Forre value •
I F I•~ 32.0 I
. . . _.... , , ,
BOOL
,.,M. , M,,
true ...
2 'F' ....I ..........
32.1 -f.,
1 ..._ .. ,,.,. BOOL..... .....,bue '
3 ~ •, 32.2 . , DOOL tahe
4 F j "- 32:J""·..----··- -··1·eo-iii.--·····hu;···- '
5 ,·. 32:4 r. . ... ··- -·· iui"i:ii.- ... .,ah~-- .
1

6 F Q 42.01 · IBOOL ·· true


.. - - · · · - -.....···--~~ ..- -, ! - - ~ · - - - · --·····- - - -
7 'F' ......
Q . .42.
. . 1-...................
1 Ii OO........
□L · . ··-
bue
e -----M
Q .. '.
42.2 . BOOL true
_ ::-t"'''_ _...,,,_,,,; _ _,,,......__,,,,, .... ---••·~
.
9 F Q 4_2.3 ~ _ __ .J BOOL _true _ .:J
Time of Last ~date:20:48:20 [FRCE ~ [RUN
Figure 6-13. Force value table shown bold. lo reflect values already " forced" ln CPU.

Quick Steps: Forcing 1/0 and Memory Variables

ACTION

1 Open the Simatic Manager lo your project; and select the CPU where you w ish lo
initiate or work wilh "Forcing." A physical connection should already be established.

2 You may also establish an online connection with the desired CPU, from the menu, by
selecting PLC ► Connect To ► Configured CPU: Direct CPU; or Acces.slble CPU.

3 With lhe CPU selected. from 1he menu or the righ1 click, select PLC ► Dlsplay Force
Values; this opens the Force Value Window. Forcing menu options are grayed oul if
forcing is nol supported on 1he CPU.

4 If a force job is active already, it will be indicated in the Status bar as ..FRCE." You
must decide if the existing force Job can be removed or replaced. (See Figure 6· 12).

5 Wilh the Force Value window open. you may en1er the memory variables you wish lo
force in lhe table. or use an existing variable Jobie (VAT).

6 To use an existing variable Iable [VAT). from 1he menu select Insert ► Variable Tobie;
If there is no existing VAT for the force job. then enter each variable you wish to force
in the Address column: then, in the Force Value column en1er the values thal you
want to assign to each variable (Figure 6-11 ).

7 To Initiate the force job, from !he menu select Variable , Force. If no force Job is
curren 11y aclive. 1he variables ore assigned the new rorce values.

8 To save a force window as a variable table, from !he menu select Table ► Save As.

9 To stop a force job, select Variable ► Stop Forcing. This causes the forced job lo be
deleted from the CPU and the forced values to be released to normal behavior.

10 Fram the menu. selec t PLC ► Disconnect to break the anline connec tion between
the CPU and lhe active variable table.

337
STEP 7 in 7 Steps

Using the Hardware Diagnostics Utility


Basic Concept
Traditionally. diagnosing problems in the hardware hos involved methods that include use of
the programming system (PG/PC) and of course visual inspection of module ind icators. While
these methods ore still viable, having a complete object-based configuration of each PLC
station in the project and resident in the PLC itself. diagnosing hardware problems ore
drastically simplified and con be largely managed visually from the p rogramming system.

Essential Elements
Diagnostic information obtained via the PG/ PC. comes rrom a number of sources. SIMA TI C
S7 provides various diagnostic functions. Some of these functions a re integrated o n the CPU,
o thers ore provided by the modules (SMs. CPs. &FMs). System diagnostics detect. evaluate.
and report errors that occur within a programmable controller. For this purpose, every CPU
and every module with system diagnostics capability (for example. FM 354) has a diagnostic
bu ffer in which detailed informo lion on each diagnostic event is en lered in the order it
occurs.

Application Tips
The online diagnostics con also be opened trom on online projec t window in the Simatic
Manager. With the Simotic Manager open to the desired project, select View ► Onllne to
open an online project window. With the station selected. rig ht click and select Open
Object, or double click o n the station' s Hardware object to open the Hardware
Configuration o nline.

Diagnosing Hardwa re · Quick V iew £3


fath: IAcce1cflble Nodes-\MPI • 2 (daect)
=-
CPU I f~.Y modi.lies:
Module Addi. DP R S
lfilcPu 0 2
1l AndlJ;i SM E 272 - 0 5

Open ~t~tion On~ne... l


!.!pdate I
P' Q.isplay quick view when diagnosing hadware
-
Close Help
I
Figure 6-14. Using Hardwa re Oignostics in Quick View. Further details ore
available by using the Module Information bu tton or Open Station Online b utton.

338
Working with Monitoring a nd Diagnostic Tools

ffl Module lnfonaalion · Analog lnpul ONLINE


P<ljh: IAccoclile N~s\MPI • 2 (d•ecil C!"IJ op«"ating mode( STOP
S1«,u:; En01 Module ope,w,g mode; , • ·
~eoe1e1 1

System ID SIMATIC :nJ

I Ver.ioo j

0 Ackr=; I 212

5 Modlie witlh: 1

Mocl.Je ,;onfigtqd ~ not pe,ent


Pte<oVActwi Diffeieneoc
(inseited iJod pomgu:ed module Jw!l$. do not ma«lh)
• Pieie\ IJ.lii&f Analog tniu[O,der No. -- m J T
· Aclual IJlpe: Not avlliable.

r ~ I .!Jpdate Help

Figure 6-15. Module Information view.

Quick Steps: Using the Hardware Diagnostics Utility

ACTION
'

1 Open the Simatic Manager and the project to go o nline with lhe problem PLC. or
without the project use Accessible Nodes to select and go online wi th the sta tio n.

2 From the menu, select PLC ► Dlagnosllcs/ Selttngs ► Hardware Diagnostics or w ith
lhe CPU or MPI folder selec ted. right click ond select PLC ► Hardware Diagnostics.
The Quick View dialog will be d isp layed (unless the check box on the Quick Vi ew
dialog hos been deactivated. Along with the CPU, the Foully Modules ore listed.

3 Select a mod ule that is indicating a fault a nd press the Module Information button,
to obtain furt her d iagnostic information on lhe selected module.

4 You con view b rief diagnoslic information tor the module. In the Status box on the
General p roperties fob. The available d iagnostic details will depend on the module.
CPUs. FMs, and CPs. for example may have additional diagnostic screens.

5 Next, you con press the Open Station Online b utton, lo open the station's hardware
config uration online, as o g raphic diagnostic fool.

6 With the Hardware Configuration tool open online. the rac ks a nd any faulty modules
will be shown. with visual sta tus indicators; use the STEP 7 o nline help sys1em for
context-sensitive assistance with lhe visual error indicators.

7 In the configuration, you wm be able to verily the module's address, and obtain
specific information by opening the module's properties d ialog.

8 Finally. you may also selec t the C PU irom the Quick View d ialog or from wilh the
hardware configuration anline. to then select Module Information. By viewing the
d iagnostic buffer, you may see the events leading up to the CPU going into STOP.

339
STEP 7 in 7 Steps

Using the CPU Diagnostic Buffer


Basic Conc ept
An S7 CPU logs up to one hundred or more significant event messages in its diagnostic bu/fer.
Messages entered into the buffer includes module faults, process wiring errors, sys tem-rela ted
erro rs, program-rela ted errors. CPU operating mode transitions, and user-defined events and
m essages. As o p rimary too l In diagnosing proble m s, the diagnostic b uffer is lhe fist check
when o fault has resulted in a CPU STOP. If the CPU automatically switches to STOP. you can
d etermine the cause by evaluating the last eve nts le ading up to the STOP.

Essential Elements
The Events list box of the d iagnostic buffer contains a list of each diagnostic even t that has
occurred. Each event Is listed with the event number (e.g .. 1-100, where 100 is the oldest
event); th e Dale/Time of the event; and the Event with description. In the lower window
Detalls of Event, additional informatio n is d isplayed for the currently selected event. This
information provides a more detailed description, such as CPU Mode transition caused by
the event, and reference to the location o f the error in a block (e.g .. block type, number.
and rela tive address).

Application Tips
The Information entered in the diagnostic buffer when o system dia gnostic even t occurs Is
identical lo the start informatio n tra nsferred to the corresponding organization bloc k.

mlModule Information - CPU 315 '-lllllllla:______


Plllh: jH,dware\S7300_1_Tllef_Fixed_EkP\CPU 31" Opeiating mode ol lhe CPU: (!>RUN
Status: ~=•
Enor Not a force job
Time Sy$lem II Performance Data ] Comm~icatlon I Stacks l
General Oieg,ostic Buffer l Memory I ScanCyc.le Tine I
Description: CPU 315 System SIMATIC300

Version: Ordei No,/ De.sa tion Com ent Version


6ES7 315-2AF02-0ABO 3

0 Addresg;
2

Status: Module avalable-and o.k.


Diffelent 01der numbers detected'.
• Configuted module. 6ES7 315,1Af02·0ABO
· ln$e.ted modulec 6ES7 315-2AF02-0ABO
Batter_y eiro, LED (BATF)

Close
I Update !__P_r_i'lt_..._..,l Help

Figure 6-16. The CPU General Properties lob: Stolus box g ives brief d iag nostic information.

340
Working with Monitoring a nd Diagnostic Tools

!'D'[Modulelnformation -CPU 3 15 ~ -- -
Path; jHrdware\57300_1_Tiei~Fllled_El'.l)\CPU 31 Operatng mode ol the CPU: @STOP
St~:: •!1 Errot Not a force job
I I
Time Syi~
Geneid
Pedormence Dete
Oiligll0$lio Buffer I
Communleetion
Memory I
Stecks
Sean C}ocle Time I
Events: r Filter .e..'trlg~active r T1meinc~C?U/localtfmedf.e-ence
No. I Time oi deu I Date I Event I•
1 05:49:54:071 pm 02/08/05 STOP caused by stop swtthbmg activated -
2 05:28-« :254 pm 02/08/05 Mode tramition from STAR TUP to AUN
3 05 28 44 248 m 02/;)8/05 Re ue~• to, manulll w~rm reit~rl
4 05:28,44:158 pm 02/08/05 Mode tr~sition from STOP to STARTUP
5 05:19;51:752 pm 02/08/05 STOP ceused by stop swtchbeing activated
6 05:18:46:183 pm 02/08/05 Mode tramition from STARTUP to AUN
7 05:18:46:178 pm 02/08/05 Request for autometic warm res.tart
8 05:18:46:090 pm 02/08/05 Mode transition from STOP to STARTUP
Details 6n Eve~ 3 of 100 Event lD: 161t 1381
R8Ql.lest for manual waim renlail
...
TOP due to. STOP ce,.ised by $l01> sw~eh being ~Weted
tartup infounalion ·
• Startup withed moafied syitem coriigur11tion
No difference betwe~n ~etpo!nt and actual config..alion
Time for lime staino at t~la$t ~eqiip oower on ~
SaYeAs..
I I Het>~Event I
Close
I Update j __P_lin_t._.._ _. Help
I
Figure 6-17. The CPU d iagnostic buffer screen.

Quick Steps: Using the CPU Diagnostic Buffer

II 1
ACTION

With the Simotic Manager open to project and station. from the menu select View ►
Online; or selecl PLC ► Display Accessible Nodes to go online w ithout lhe project.

2 From the online projec t w indow (or the accessib le nodes window), select the CPU
module whose diagnostic buffer you wish to open; then right click and select PLC ►
Module Information.

3 You con view b rief d iagnostic informa tion for the CPU, in the Status box of the
General properlies lob. For e xample . o boltery failure is Indicated: or a difference in
lhe config ured CPU order number and lhe inserted order number may be shown.

4 Open the d iagnostic bu ffer by selec ting the Diagnostic Buffer tab.

5 The events leading up lo the CPU stop ore listed in lhe Events box. starting with lhe
most recent event. As you step down through the list. o list of information details
about the specific even t ore shown below in the Detail on Event box.

~ To get further assistance on on event, and possib le ca uses and corrections for
eliminating the error. press the Help on Event butto n.

7 If you make any corrections, while still in lhe diagnostic buffer. you con press the
Update button to view changes in the CPUs ability to sta rtup.

3 41
STEP 7 in 7 Steps

Using the CPU Stacks Dialog to Diagnose Program Faults


Basic Concept
When some fault hos caused the CPU to transition too STOP mode. the likely cause o f th e
interruption con be generally determined by using the CPU's diognoslic buffer. tf the exact
c ause is not immediately apparent ye t it is d etermined that the interruption is progrom-
relo ted. then you con obtain further details of the actual causes by examining the CPU
stocks.

Essential Elements
The &-stock (short tor block-slack), lists the o il of the blocks called in the program just prior lo
the STOP. bu t d id not comple te execution. The I-stac k [short for interrupt-slack), contains
important dala or statuses that were in e ffect o t the time the CPU stopped. For example.
accumula tor conten ts, numbers of the open data b locks and their length. status word
conte nts, number of the interrupted b toclc, and the block w here processing should resume.
The stock information can only be accessed when the CPU is in STOP mode.

Module Information - CPU 316


Path: jNew_pij\SIMATfC 300(11\CPU 31S Operating mode ol the CPU: (i) STOP
Status: •!4 Eiror
I
Time System
Gen!lfal
Pelfonnance Data
Oiagnouic Buffer II Cornmtncation
Memo1y I
Stacks
Scan Cycle Time I
Events: r rilter ·«ti!Jgi ective r r1rne ln~ludmg CPO/loel>I timed l i e ' ~
_Timeol day I Date Event ....
03:29:57:704 pm 07/25/05 New startup inf01mation in STOP mode
03:29-57:704 m 07/25/05

4 03.26.34.706 pm 07/25/05 Mode tJaniition from STARTUP lo RUN


5 03:26:34:702 pm 07/25/05 R equesl fos manual waim reuait
s 03:26:34:689 pm 07/25/05 Mode tJarnition from STOP to STARTUP
7 03:26:34:689 pm 07/25/05 New startup information in STOP mode
8 03:25 07:802 pm 07/25/05 New ~tup information in STOP mode ..:.l
Deta is on Event. 3 ol 11 Event ID: 16# 25X
FC not loaded
FC number. 1
8 number: 1
Module address: 12
Requetted 08: Progr6mming en°' OB (OB121)
rioritv class: 1 ..:.l
S..tti-,gs._ ] ~ -O_pen_B_lock_~ Help oo Event I
Close J __u_p_d_11_te_ _, ___P_rih_t._.. _ _, Help
I
Figure 6-18. S7 CPU Diognoslic Buller. Entries 2 and 3, indicate o fault in the program.

342
Working with Monitoring a nd Diagnostic Tools

ItitH144·!GI§ii·is\14,itJGJ 4Mli46EtiJ❖11 ! •►
Point ol ln1e11uption RegisterValues el I~ Port ol Interruption
Priority Cless; 1, 081 Regiuer Value Display Formal
ACO.J 1: 0000 DODO IHex .::)
lnlen~ Block; FC l
ACOJ 2: 0000 0000 Hex
Open Block
ACOJ 3: 0000 0000 IHex .::I
Cont~on in Block· FC 1
ACQJ 4: 0000 0000
DBs Se'.ected1- - - - - - - - .
1st DB 2nd DB Addi. Reg.1 0.0 jAddiess

Number. DB 10 Addr. Reg.2.: 0.0 )Addiess


Status BR cc, ccoov OS OR STA R JFC
Siie in Bytea: 4 WOid: 0 0 0 0 0 0 1 0 0

Close ] Pm.. I I
Figure 6-19. S7 CPU I-Staci< dialog. This d ialog can o nly be opened in lhe STOP mode.

Quick Steps: Using the CPU Stacks to Diagnose Program Faults

ACTION
'

I Wi1h the Simatic Manager open lo project a nd station, from the menu select View ►
Online: or selecl PLC ► Display Accessible Nodes lo go online witho ut the project.

2 From the online projecl w indow (or lhe accessib le nodes window). select the CPU
module whose diagnostic buffer you wish to open; then righ l c lick and selecl PLC ,
M odule Informa tion .

3 Select the Stocks lab, and the Block Stock will be displayed. with a listing of lhe
complele b lock coll sequence leading up lo !he STOP. The lost execuling block
(e.g., F822), the b lock tho I was interrupted, will be at the top of the stock.

4 Click lhe I-Slack button, ot the bollom of the dialog. lo display lhe interrupt slack os
shown in Figure 6· 19. Note Iha! the dialog indicates the inlerrupled block as well as
the block in which execution will resume when the fault is corrected.

S Click lhe Open bulton. lo la unch the LAD/FBD/STL edilor ond open lhe interrupted
block.

6 Click the L-Stack b utton, ol the bottom o f the d ialog, lo d isplay the c urrent contents
or !he local dolo stock 0.e .. temporary local variables or !he inlerru p ted block].

343
STEP 7 in 7 Steps

Generating and Displaying Program Reference Data


Basic Concept
STEP 7 Program reference data provides useful informa tion about your program that con be
used during development and later w hen making modifica tions. or w.h en troubleshooting
problems. The main report elements of the program reference data include cross-references,
address assignmen ts, program structure, unused symbols. and addresses without symbols. As
a developer. you will likely generate program reference reports lhrougt1oul development
and upon completion. as port o f the documenta tio n provided to the end user.

Essential Elements
The cross-references report is lo list each address found in the program. the various locations
where used, and how used. The assignment 11st is an overview of how S7 memory areas
including timers. counters, bit memory, inputs, and outputs ore being used. Input (I), output
(Q), and bit memory (M) addresses are lis ted by byte. with individual b its. and shows whether
program usage Is by bi t [X). byte (B). word (W). or double word (D).
The program structure describes 1he coll path of all of the blocks in on S7 program. The
program structure is represented as o tree. showing the b locks called from each O B. starting
with 08 I . The structure shows the nesting depth of each call pa th as well as local memory
usage for each block a nd th e complete call path. The unused symbols report lists assigned
symbols tha t are not used anywhere in the program. Finally, the addresses without symbols
report list all addresses used in the p rogram, b ut do not have an assigned symbol address.

~,""""-r, bi! fflet>Oly 1111\Eft, CO.dt!liC


I 76Sil2l08'110 • ' 0 2 3 s 7 9
IB o ro-9 T~
IB l X T l0 · 09
LB l XIX X X x ix
IB 3 X 'x
18 4 X XXX X X X X
IB 5 X XXX X X X
lD 6 )( X X
rs
-IS 7 X X X X X x,
8 )( X X
IB 9 ')f: X X
~ -·L
I& 10 I
18 ll
IB 12 X XX X X X X
18 13 X XX X X X X •
Figure 6-20. STEP 7 Program Reference Data: Inputs/Outputs/Bil Memory (1/Q/M) Assignmenls.

Blod:(symbcl), Instance DB(syrrboO ILocal d¥.a (Fo, blocl:s)


8 -0 061 [maxill'Ol): JO] [,26] (26]
0 F< l [26] LAD IIW l [OJ
0 F<a {26] LAO llW 2 [OJ
0 FC7 [26) LAO I.W 3 [O}
8-0 FC6 [26) LAO IIW 4 [Ci}
e 006 (26] LAO NW l [O}
ffil-0 FBl, DBI (30) LAO l.'W s (4]
e 066 (26] LAO IIW
,.w
6 [OJ
0 R:3 [26) LAO 7 (Cl]
0 F<:9 [26) LAO ,.w 8 [OJ
0 f<S [26) LAO r.w 9 [OJ
0 F<'I [26] LAO rl\~ 10 [OJ
0 R:2 (26] LAO llW 11 [OJ
0 FCIO [26] LAO IIW 12 [OJ
0 0B121 [OJ [OJ
Figure 6-2 1. STEP 7 Program Reference Data: Program Structure Report: starting from OB 1.

344
Working with Monitoring a nd Diagnostic Tools

Address I !t<ili (symboQ Typo L.onouaQe Loc.otion Loc:<llion

-- --
!tJ C 2
@ C3
ltl cs
FCIOO
FCIOO
FCIO (Box_Ccuters)
P.
P.
P.
STL
.
STL
LAO
-
tit/
ti,/
ti,/
31
31
1
--
Sta
Sta
/A
10
25
/l
/L
11,1
e-
lt,I
11,1
31
31
1
Sta
-
Sta
/l
12
27
/ LC
/ LC-
0 Co FC IO (Box~Cotrle,s) i P. LAD t1,1 2 /A lfiJ 2 /l
EiJ C 7
fC I
FC!O (Box_Ccuten)
081
P.
P.
LAD
LAD
"ti
tit/
3
1
/A.
/CC "" 3 /L

I LO FBlOO P. LAD tit/ 1 /A


12,0 FCIOO R sn tit/ 24 St.a 6 /A
12. 1 FCIOO P. Sfl tit/ 19 st.. 1 /A Jf,1 22 st., 1 /A
I 2,2 FCIOO IP. STL tll/ 1-9 Sta 2 /A ff/I 22 Sta 2 /A
12.3 FCIOO ,P. srL t1,1 Sta 2 /A 22 Sta 5 /A
20
"''
12.q
12.5
FCIOO
FCIOO
R
P.
'w
sn
sn
SrL
-
t11/
tit/
20
21
St a
Sta
3
2
/A
/A
lftl
Jf,I
22
22
Sta
Sta
6
9
/A
/A
I 3.0
I 3.3
-
FCIOO
FCIOO P. sn
If;/
tl1/
35
36
Sta
Sta
10
2
/•
/A
I '1,0 FCIOO 1P. STL If;/ 27 Sta 2 /A
P. srL Sta /A Sta /A
I 'I. I
I 4.2
FCIOO
FCIOO P. Sfl
rftl
If,/
23
26 Sta
l
2 /0 "''
If,/
27
29 Sta
5
25 /A
m r 4.3 FCIOO R srL rf,I 26 Sta 3 /0 tr,/ 29 Sta 4 /A
00 14.q FC!OO P. Sfl 11,1 31 Sta 2 /A Ifill 33 Sta 1 /A
I '1.5 FCIOO srL s /A
R rt;/ 31
"''
Figure 6· 22. STEP 7 Program Reference Doto: Cross-References Report.
Sta /A 33 Sta 4

Quick Steps: Generating and Displaying Program Reference Data

■ ACTION
'

1 With lhe Simolic Manager open to the desired project and S7 program. select the
offline blocks folder for which you wish to genera te or display reference doto.

2 With the Blocks folder selected. from the menu select Options ► Reference Da ta ►
Generate; when prompted, to update or regenerate the reference data. Select the
Re-g enerated option lo delete existing reference doto and lo generate the
re ference doto os new; select the Updated option to ensure data is generated for
modified or new blocks, a nd tha t reference data for deleted blocks is removed.

3 lo display reference dalo onscreen or to print reports, first selecl the desired Blocks
folder, then right c lick and select Reference Data ► Dtsplay. If prompted by the
Customize dialog to select a report to open. you may choose o report and then
decide whether this dialog should always be opened when displaying reference
doto.

4 After the report you selected is displayed. from the menu select Reference Data ►
Print. to hove the report p ri nted. You may need to adjust the Print Setup first.

s Use the View menu or the appropria te toolbor icon to disptay other reports.

6 To filter the content data for any report tha t is currenNy open, select View ► FIiie r
from the menu, then use the appropria te tab (i.e., Cross References, Assignments,
Program Structure. or Unused Symbols) to select the elements you wish to have
filtered out or shown in the report.

345
STEP 7 in 7 Steps

346
Working with
SIMATIC NET Networks
STEP 7 in 7 Steps

Introduction to SIMATIC NET Networks


SIMATIC NET represents a family o f communications components and services, designed to
cover a comprehensive range of networking requirements. With components lhot comply
with international standards, SIMATIC NET provides open communica tions that supports a
multi-vendor environment ror PLCs, HMls, computers, 1/0 devices, electric drives, and a
variety of factory and process automation systems and devices. SIMA TI C NET encompasses
componen ts such as communications processors (CPs) for PLCs and PCs. network media.
attachment components, configuration and diagnostic software, and software drivers.
As shown in Tobie 7-1. the SIMATIC NET family includes MPI, lnduslriol Ethemel [IEEE
802.3/802.3u), and PROFIBUS (IEC 61 158/EN 50 170) networks. In addition to these networks,
SIMA TIC NET covers communications processors for point-to-point connections, including
printers and olher serial devices; and the AS-In ter face (EN 50 295), a device level network for
direct connection of field level sensors and actu a tors. The AS-Interface network and point-to-
point communications topics ore not covered in this book.
Networks and Subnets
In a manufacturing p lant, a network connects devices such as PLCs. computers. human
mac hine interfaces (HMls), and other devices for the purposes of communication. Olten, the
range of a p lan t network spans one or more buildings. and is comprised of one or more
subnels. In a subnet, all stations ore connected lo a common medium. of the some physical
and operating c haracteristics, and communica te via the some pro tocol. A subnet may.
however. involve two or more identical cable segmen ts joined via repeaters. In your STEP 7
project, you will be able to work with MPI. PROFIBUS. Industrial Ethernet, or Point-lo-point (PTP)
subnets. Lorge projects, may involve multiple subnets lo complete the network.

MPI (Multi-Point Interface)


In lhe S7 environment. the multi-point interface (MPI) serves as a low-performance network.
supporling small amounts o f dolo exchange between S7 PLCs, programming devices.
human machine inlerface devices [e.g., operator panels). as well as other Sima tic systems,
Each S7 CPU hos on integrated MPI interface. w hich allows ii to connect as on MPI node
without additional network modules. As a network. MPI supports up to 32 nodes, uses the
some RS-485 and fiber tra nsmission media and components os PROFtBUS. and typically
operates a t 187 .5 Kbs. You can access a ll MPI nodes by placing a programming system
(PG/ PC) on the MPI subnet.

PG/PC $7-400
O P Devices

$7-300 Sl-300 S7-300

1111 I II ITI
Figure 7-1. Typical MPI (Multi-Point Interface Subnet.

348
Working with Simalic NET Networks

PROFIBUS
PROFIBUS, a cronym for PROocess Field BUS, is a standard according lo European standards
IEC 6 1 158 and EN 50170 Vol.2. Comprised of three major protocol definitio ns. lhis sta nda rd
protoco l. serves networking of co mpliant devices at both the cell and device le11els of the
plant. Th e DP-component of this protocol supports high-speed d istributed 1/0 connections to
devices like ET-200, while the PA (Process Automation) component extends the DP protocol
lo Include a transmission system that meets intrinsic sa fety requirements. The FMS (Fleldbus
Message Sp ecifica tion) component of PROFIBUS ,upports client/server communications
between compliant partners (e.g., S7-to-S7, S7-to-S5) in a multi-vendor environment.
The PROFIBUS network uses shield ed twis ted pair. glos.s or p lastic fiber transmission media,
supports 126 nodes, an d transmission rotes of up to 12 Mboud. SIMATIC S7-300. S7-400. a nd
PC stolions require o communica tions processor to connect too PROFIBUS subne t. CPUs thot
hove on integrated PROFIBUS-DP interface (e.g., CPU 3 15-2 DP. CPU 416-2 DP), for
establishing o statio n as o DP-Moster or DP-Slave do not require additional modules.
PROFIBUS CPs and the communications seNices they support ore described later.

SIMATIC SS
PG/PC
OP Dev ices

Third Porty
Sl-2()0 Sl-300 S7-300 De\lioej
• ••
111111111 II
Figure 7-2. Typical PROFIBUS Subnet.
D
Industrial Ethernet
Industrial Elhernet ser11es the requirements of p lant areas and cells, where manufacturing
system s ore monitored and coordinated - , and perhaps tied into plant informa tion systems.
Supporting both the ISO and TCP/IP transport protocols. Industrial Etherne t supports
tronsmi;,sion of large d o to quantities 011er standardized local networks with access to
worldwide networks according to IEEE 802.3/802.3u.
The Industrial Ethern et network uses double shielded coaxial coble, industria l twis ted pair,
gloss. o r p lastic fiber transmission media, and supports 011er 1000 nodes o t transmission rotes
of 10 Mbit/s or 100 Mbil/s. SIMATIC 57-300. S7-400, and PC workstations require the
app ropriate communicatio ns processor to connect to on Ethernet subnet. Industrial Ethernet
CPs and lhe communications services they support ore discussed ta ler.

PG/PC
OP Oevkel
_, ON
OM

-••••••••a
OM

·-
OM
OM

lhi-d Paty
Device$ S7-300 S7-300

111(111'1
Figure 7-3. Typical Industrial Etherne t Subnet.
111111111
349
STEP 7 in 7 Steps

Tobie 7-1 Overview of MPI, PROFIBUS, o nd Ethernet Subnet Chorocterislics.


Characteristic MPI PROFIIUS Ethernet
Standard Siemens Procedure EN 50170Vol. 2 IEEE 802.3
Transmission Media Twisted Pair
• Bectricol Shielded 2-core Shielded 2-core Shielded Coax
- Fiber Optic Gloss Aber Gloss Fiber Gloss Fiber
Plastic Fiber Plastic Fiber Plastic Fiber
Transmission Rates l 9.2Kbits/187.5 Kbits 9.6 Kbits/s lo 10 Mbits/s
12.0 Mbits/s 12.0 Mbits/s 100 Mbits/s
LAN Distances
- Bectricol 100 m (mox.) 9.6 km (mox.) 1.5 km (max.)
-Optical 90km (max.) 200 km (mox.)
WAN Dfstances Wortdwide vio TCP/IP
Access Methods Tolcen Passing Token Passing CSMA/CD
Number of Nodes
• Typical 2- 10 2-16 2-100
• Maximum 32 126 > 1000
Topology Line, Tree. Ring. Line. Tree, Ring. Star.
line
Star. Redundant Redundant
AutomaHon level Cell/Field Cell/Field Cell/Monogemenl
Attachable Systems SIMATIC S7/M7/C7 SIMATIC S7/M7/C7 SIMATIC S7 /M7 /Cl
StMATIC PG/PC SIMATIC PG/PC SIMATIC PG/PC
SIMATIC HMI SIMATIC HMI SIMATIC HM!
SIMATIC S5 SIMATIC S5
Host Computer Workstation
CommunlcaHon • PG/OP Functions - PG/OP Functions - PG/OP Functions
Services • S7 Functions • S7 Functions - S7 Functions
• Global Doto • PROFIBUS FOL - ISO Transport
• PROFIBUS FMS - ISO-on-TCP
• TCP/IP
- E-Mail

Note: S5 Compatible communication is poss[ble via PROFIBUS FMS and PROFIBUS FOL. and o n
lnduslriol Ethernet using the ISO transport. ISO-on-TCP. and TCP/IP lransport services.

Communications Connections and Services


The follow ing discussio ns provide a brief overview of the communica tions with S7 controllers
and with other communicalions partners. S7 communica tion with a partn er a lways tokes
place via a connection. A connecrion. also called a "link," Is o logical relationship
established b etween two partner.; for the express purposes of a specific type of
communication service. A communication service, as described later, represents a set o r
supported communications functions. The "Communicating wilh SIMATIC" manual provides a
more detailed descrip tion of lhe Simotic NET communicolions connections and services.
Communications Connections
There ore two types of connections. un-configured and configured . You determine lhe lype
of connection needed. based on its inherent cha racteristics. ond on the require me nts or your
application. In addition to this. each CPU supports a fixed number of connections. which
includes both configured a nd non-configured connectio ns. In each CPU. o ne connec tion is
reserved for a p rogramming d evice and one for an opera tor panel jOP).

350
Working with Simolic NET Networks

Un-Config ured Connecti ons


Un-configured connections are possible between S7 partners on MPI. wh ereby the
connec tion is set up a t Nnlime, when you colt the rela ted system function (SFC). The roct
that the connection is set a t Nnlime makes ii a dynamic connec tion. With un-configured
connections, a CPU can exchange small amounts of data with an external partner (e.g., S7
PlCs on MPt) or with on internal partner over the MPI backpla ne (e.g., S7-400 CPUs, or CPU-
to-FM). On ty one non-configured connec tion can exist between two partners.

An un-configured connec tion. because of ils dynamic nature, might be used to make
e fflcient use of the ovoitable link resources of a CPU. At least one connection resource must
always be available in each partner, since the connectio n is established when the SFC is
coiled in the S7 program. Wilh this single link. a CPU moy exchange data, in o sequential
manner, wi th several partners. The following SFCs are used for non-configured connections.

Tobie 7-2. Sys tem Functions for Communication vio Un-Confiaured Connections
SfC NAME Bltef Description

SFC 65 X_SEND Send Data to External S7 Portner
SFC 66 X_RCV Receive Do to from External Portner
SFC 67 X_GET Read Dato from External S7 Portner
SFC 68 X_PUT Write- Dato to Exterhal S7 Portner
SFC 69 X...ABORT Abort Connection to External S7 Portner
SFC 72 I_GET Read Doto from Internal S7 Portner
SFC73
- I_PUT Write Data to Internal S7 Partner
,..
SFC74 I_A BORT Abotl Connection lo Internal S7 Portner
Note: lntemat partners shore the MPI bus in o station (e.g .. S7-400 Multi-CPU configurationl

Configured Connections
Configured connections support connections between S7 partners, and non-S7 partners
(e.g., computers, Simo tic S5, and other systems). Whereas an un-configured connection is
dynamic. configured connec tions ore static. In a sta tic connection. the properties !hot
establish the relationship between the partners is b uilt-up al the start-up o f the CPU and
remains even when the CPU is switched to STOP. To use configured connec tions. you must
define the connection in the CPU's connection table. using the NelPro configuration tool.

When defining configured connections. you may specify as many as required, within the
limits o r the a vailable connection resources of the CPU. The connection type you choose will
be based on the communications service you wish to imple ment (see Table 7-9). Multiple
configured connections are possible between different partners or between the some
partners. A Local ID is assigned in each partner for each connection you con Figure. This loc al
ID is required as a n input parameter to the communications b locks that you call in your
program. to communicate over configured connections. Configured connections ore
always required when the communications Involve communications processors (CPs).

Communications Services
Performance features ore wha t characterizes a specific communications service. For
example, o data service operates on o specific subne t (e.g., MPI, PROFIBUS, or Industrial
Ethernet), and is based o n a specific transmission procedure. User access lo a
communications service is via a particular interface. Access to a service in the S7 program.
for instance, may require system blocks (SFCs or SFBs) or loadable user blocks (e.g., FCs, or
FBs), available in the STEP 7 librory. Access lo a service in a PC sta tion might involve on OPC
Server. or C-functions. SIMATIC NET encompasses the following services. each o r which
requires that you configure o connection in the connection table of the partner sta tions.

351
STEP 7 in 7 Steps

Tobie 7-3. SIMATIC NET Communications Services.


Communications Services
MPI PROFIBUS lndustrlal Ethernet
S7 Functions S7 Functions S7 Fune lions

Global Doto Transfers PROFIBUS DP ISO Transport


PROFIBUS FOL ISO-on-TCP
PROFIBUS FMS TCP/IP
UDP

S7 Functions
S7 Functions provides optimized services for communication among S7 systems (e.g., PLCs.
operator panels (OPs), and HMls). You must configure an S7 connection for the partner
slotions to use this service. The S7 services o re supported on MPI, PROFIBUS. and Industrial
Ethernet. With these service S7 PLCs may participate in send/receive. and direct memory
access communications with other S7 PLCs or with PC slotions.

In the S7 program, you may implement secure data transfers of up to 64 Kbytes per job. using
the integrated blocks B_SEND (SFB 12) and B_RCV (SFB 13). You may implement high-speed
unsecured data transfers (i.e .• without acknowledgement), of up to 440 bytes. using the
blocks U_SEND (SFB 8) and U_RCV (SFB 9). Using GET (SFB 14) and PUT (SFB 15) blocks. d irect
access to the memory in S7 PLCs is possible w ithout programming in the remo te partner. The
coll interlace for lhese system b locks a re Included in the STEP 7 slondord library of
communications block.s so that you may incorporate them in yo ur control program.

Ta b le 7-4. C ommun1ca tians bl ocks for services over C on f'1auredS7 C onnec rions.
57-400 S7-300 Name Brief Description
SFB8 FB8 USEND Uncoordinated Send - Mox. Length 440/ 160 bytes
SF69 FB9 URCV Uncoordinated Receive - Mox, Length 440/ 160 bytes

SFB 12 FB12 BSEND Send doto blocks • Mox. Length 64/32 Kbytes
SFB13 F813 BRCV Receive data b locks - Mox. Length 64/32 Kbyles
SFB14 FB 14 GET Read data in remote partner • Mox Length 400/ 160 bytes
SFB15 FB15 PUT Write doto in remote parlne, - Mox. Length 400/ 160 bytes
SFB19 NA START Execute a Worm Restart on remote partner

SFB20 NA STOP Switch remote partner to STOP mode


SF821 NA RESUME Execute o Ho t Restart on remote partner

SF622 NA STATUS QuefY status o f remote partner


SFB23 NA USTATUS Receive status From remote partner

SFC62 NA CONlROL Query sta1us of a connection belonging to SFB Instance

FC62 NA C _CNTRL Query status of a connec tio n (in S7-300)


Note: The S7-300. depending o n the PROFIBUS CP, may participate a s o server only in S7
Communication functions. See these blocks in the SIMATI C NET C P Library folder in STEP 7.

352
Working with Simolic NET Networks

PROFIBUS FMS
FMS services facilitate open communications with any p artner tha t supports the tra nsmission
of structured doto (FMS variables) in accordance with the Field bus Message Specification
services of PRORBUS. FMS supports the reading, writing. and reporting of named variables in
a client-server rela tio nship. In the c lient-server transaction, outside of defining variables. no
furt her programming is required in the server. FMS communica tions is possible between S7
Pl Cs. wilh SIMATIC S5 PLCs (via CP 543 I). and with PCs and o ther FMS sys I ems.

In the S7 program, data transfer or up to 240 bytes ore handled using the READ (FB 3) and
WRITE (FB 6) blocks, over a configured FMS connection. Yo u co n !ind these loadable user
blocks in the STEP 7 standard library of communication blocks. You need lo define the FMS
variables on the FMS server only for READ/WRITE services. and only on lhe clien l when using
th e REPORT service. Since these ore FBs, you must c reole on instance DB as memory for each
FB. FMS services in PC stations o re implemented as C functio ns and in the OPC server.

Ta b le 7.5. C o mmun1co tions bl oc ks for services over C on f1a ure d FMSC onnec fions.
Name 57.400 57-300 Brief Description
IDENTIFY FB2 FB2 Identify lhe remo le porlner ror lhe user

READ FB3 F83 Read on FMS variable from specified remote partner
REPORT FB4 FB4 Report on FMS variable to o remote partner

~TATUS FBS FBS Provide the status of a remote device on user request
WRITE FB6 FB6 Write on FMS variable to a remote device
Note: See these standard blocks in the SIMATIC NET CP Library folder in STEP 7.

PROFIBUS FDL
This service allows communication on PROFIBUS, between partners that suppar1 the SDA Send
Dalo with Acknowledge (SDAJ and Send Do to with no Acknowledge (SDNJ features of the
Field bus Dalo link Services of PROFIBUS. Wi lh FOL services, S7 PLC s may p a rtic ipate in
send/receive, broadcas t. and multicast communications with the SS I t SU/ 115H. S5
l 3SU/ l SSU (via the CP 5431 FMS/DP), o r lhe SS 9 SU DP.
Use of this service requires that you configure on FDL connec tion in the partner stations. In the
S7 program. FOL secure d o la transfers of up lo 240 bytes ore handled using the b locks
AG_SEND (FC 5) and AG_RECV [FC 6). This is lhe so-called Send/Receive user interfa ce. which
corresponds to the PLC/PLC connection in the StMATIC S5 PLCs. Doto receipt is
acknowledged by the remote partner. a nd con be confirmed in the sending station. These
blocks, listed in the table below, o re included in the STEP 7 standard library for
communications blocks.

Ta b le 7.6. C ommun co r,ons b loc ks Ior serv ces o ver C on rinured FDl C onnec rions.
Name 57.400 57-300 Brief Description
AG_SEND FC5 FC5 Send data up to 240 bytes on configured connectio n

AG_RECV FCo FCo Receive data up to 240 bytes on configured


connection
AG_LSEND FCSO FCSO Send d ata up to 8 Kbytes on configured connection
AG_LRECV FC60 FC60 Receive data up to 8 Kbytes on co nfigured
connection
AG_LOCK FC7 FC7 Lock data access by Fetch/Write from remote partner
AG_UNLOCK FC8 FC8 Unlock doto access b y means of Fetch/Write

353
STEP 7 in 7 Steps

PROFIBUS DP
PROFIBUS DP is a part o f the PROFIBUS protocol designed to facilitate o pe n distribu ted 1/0
communications between complion t PROFIBUS DP-master and DP-slave devices. These
compliant devices operate according to the European standard EN 50 170 Vol. 2. The DP
communicotions services operate o n PROFIBUS subnets, and support both Mono-Moster
(single masier) and Multi-Master /two or morel systems and their associated DP slaves.
As detailed in Chapter 3, you can configure the S7-300/S7-400 CPUs with integrated DP ports
as DP-master of modular and compac t slave devices (e.g., ET200 M , ET200 Bl. In these
configurations, you will address the DP slaves In the some manner as you would the t/0 in lhe
centra l, local, and remote 1/0 rocks. When the S7-300 is configured as on intelligent slave,
using the C P 343-5. then the communicotlon between a DP-master and DP-slaves involves
the use of standard function calls DP_SEND (FC l) and DP_RECV {FC 2) in the S7 programs of
both the master and slaves. PROFIBUS DP services for PC stations are provided as C functions.

Ta ble 7. 7. C ommun1c a tians bl oc ks for DP. Mas ter/DP-SIaves .1n In te II''1aen t SI ave con fi1aura I'10 n
Name FC Brief Descrlplfon
DP_SEND FC 1 In M aster. transfers data of a specified DP output area to the
PROFIBUS C P for output to lhe distributed 1/0.
In Sla ve. tra nsfers data of o specified OP doto o re-a on !he CPU lo
the send buffer of the PROFIBUS CP for transmission lo OP master.
..
DP_RECV FC 2 In Master, receives processed data of the d istributed 1/0 and sta tus
lnlormolion in o specified DP input area,
In Sla ve, la kes d ata transferred by the DP master from the receive
b uffer of t he PROFIBUS CP and enters ii in a data a rea on the CPU.
DP_DIAG FC 3 Queries d iagnostic dolo on the DP master and DP slaves.
DP _CTRL FC4 Executes control functions in tor the DP stove stations.
Nole: See these standard blocks in the SIMA TIC NET CP Library folder in STEP 7.

Globa l Data Communication (GD)


Global data communications is o cyclic dota transfer service. integrated in every S7 CPU.
and is possible on MPI subnets only. Wifh lhis service, S7 PLCs may exchange small areas of
input. output. data b lock. and b il memory. Since the data ls lranslerred cyclically during lhe
normol 1/0 update, no block programming is required. The response time of global dole
exchange is dependent o n the program cycles of the partners involved in the excha nge.
To implement global data trons rers you mus! simply define the global data table. using !he
Nef Pro Network Configuration Tool. The table defines the CPUs involved, the memory a reas
sent. a nd memory areas used to receive data in each CPU. Global data exchange operates
on the broadcast method. and t11e receiving partner does nol acknowledge data receipt. II
your particular applicatio n requires secure data exchange, then g lobal data transfer is nol
the appropriate solution. In the S7-400, g lobal data exchange can be triggered in the S7
program. using the system funclions G D_SND (SFC 601 and G D_RCV /SFC 6 l ).

ISO Tran spo rt


This service allows communication on Industria l Ethernet. betwee n any partners Iha! support
doto transmission in accordance with the ISO transport protocol. The ISO transport services
supports S7-to-S7 data transfer, but also allows 57 PLCs to communica te with SIMA TIC SS PLCs
that use the CP 1430 TF. To use this service you must configure on /SO connection in partner
stations. using lhe NetPro Nelwork Con fig uration Tool.

354
Working with Simolic NET Networks

In the S7 program, you may initiate secure data transfers o f up to 240 bytes. using AG_SEND
IFC 5) a nd AG_RECV (FC 6) functio ns; or up to 8 Kbytes, using AG_LSEND {FC 50) and
AG_LRECV (FC 60). In both coses. the remote partner acknowledges doto receipt. S5 PLCs
may use its FETCH/WRITE handling blocks to gain d irect access to S7 memory, Tobie 7-8 lists
the S7 communication b locks used for exchanging data over ISO transport connections.

ISO-on-TCP
This service allows communico1ion on Industria l Ethernet, between any partners that supports
the mopping of the ISO transport protocol on to the standard TCP/IP protocol. using t11e RFC
1006 extension. ISO-on-TCP services allow S7-to -S7 data transfer, bu t also allows S7 PLCs to
communico1e with S5 PLCs that use the CP 1430 TCP. In both coses, the remote partner
acknowledges data receipt. To use this service you must configure on ISO-on-TCP
connection in partner stations. using the NetPro Network Configuration Tool.
In the S7 progra m, you may initiate secure data transfers o f up to 240 bytes, using AG_SEND
IFC 5) a nd AG_RECV (FC 6) b locks; or up to 8 Kbytes, using AG_LSEND (FC 50) and AG_LRECV
IFC 60). SS PLCs may use ifs FETCH/WRITE blocks to gain d irect access lo S7 memory. Tobie 7-
8 lists the S7 communica tion b locks used for exchanging data on ISO-on-TCP connectio ns.

TCP/ IP
The TCP service corresponds to the widely used TCP/IP protocol. With this service S7 PLCs may
communicate with one another or with SS PLCs (CP 1430 TCP), PCs. or any partner that
supports the TCP/IP standard, Communication on TCP/IP networks uses data streaming
wi1hout blocking the data Into n1essoges, so o transmitting partner does not receive an
explicit acknowledgmen t for each job. Do to securi ty, however. is achieved by ou tomolic
re p etition and block checking (CRC) at Loyer 2. To use this service you musl configure o TCP
conneclion in the porlner stations. using lhe NetPro Network Configuration Tool.
In the S7 program, you may use the AG_SEND (FC 5) and AG_RECV (FC 6) blocks to handle
data exchange of up to 240 bytes; or the AG_LSEND (FC SO) and AG_LRECV (FC60) blocks. for
up to 2 Kbyles. The TCP transport services for PC communication ore provided as C functions
within the framework of the Socket interface. Tobie 7-8 lists lhe S7 communication b locks
used for exchanging data over TCP/IP connections.

Tobie 7-8. Communica tion blocks for ISO, ISO•on-TCP. TCP/IP, UDP, and E-Mon Connections.
Name S7-400 $7-300 Brief Descrf~ffon
AG_SEND FCS FCS Send data up to 240 bytes on configured connection
A G_RECV FC6 FC6 Receive data up to 240 byte.s on configured connection
AG_LSEND FCSO FCSO Send data up to 8 Kbytes on configured connection
A G_I.RECV FC60 FC60 Receive data up to 8 Kbyles on configured connectio n
AG_LOCK FC7 FC7 Lock doto access by Felch/Write from remote partner
AG_UNLOCK FC8 FC8 Unlock data access by means of Fetc h/ Write
Note : See these blocks in the SIMATIC NET CP Library folder in STEP 7.
UDP
This service allows communication on Industria l Ethernet, between any partners tha t supports
the standard UDP (User Datagram Protocol). The UDP pro tocol offers services for S7-to-S 7, a nd
S7-to-S5 communication for cross-network doto transmission to SIMA TIC SS 1I SU, I 35U, and
lSSU stations that use the CP 1430 TCP. Doto transfers using UDP is no t acknowledged by the
partner, and is therefore intended for simple data grams where acknowledgement is
o therwise implemented, or the guarantee of correc t dalo transfer is nol required. To use this
service you must configure o UDP connection in the partner statio ns, using the NetPro
Network Configuration Tool. The connection, will operate on on exclusively TCP/IP network.

355
STEP 7 in 7 Steps

In the S7 program the unsecured data transfer o f up to 240 bytes is handled. using the b locks
AG_SEND (FC 5) ond AG_RECV IFC 6} blocks; or up to 2 Kbytes. using the b loc ks AG_LSEND
(FC 50) and AG_LRECV (FC60}. The UDP transport services for PC communication are
provided as C functions within the framework or the Socke t Interface. Tobie 7-8 llsts the S7
communication b locks used for exchanging data over UDP connec tions.

Configured Connection Summary


Tobie 7-9 briefly describes the main charac teristics o f the various types or configured
connections a vo itobte b etween Simotic S7. Simotic S5. PC stations. and o wide variety of
no n-Simotic devices. These connec tio ns ore configured in the NetPro Configuration toot.

Tobie 7-9. Possible Confi ured Conneclion Services with S7-300/57-400.

- Communication among S7 PLCs (S7-300 Server only)


- Communication with PCs. and Operator Panels [OP)
- Supp orted on MPI, PROFIBUS, and Industrial Ethernet subnets
S7 - Integrated in all S7 /M7 /C7 systems
- Secure data transfer between stations using BSEND/BRCV SFBs
- High-speed unsecured d ata transfer using the USEND/URCV SFBs
- Acknowledgement of data receip t from remote partner
- Supported on PROFIBUS ond Ethernet subnets only
S7 Redundant
- S7 connections. restricted lo use in S7 H-Systems
- Supported on PROFIBUS subnets o nly
- Field bus Doto Link Layer, According lo IEC 61 158
• Medium Volume Doto Trans fer up to 240 by tes
PROFIBUS FOL • Error-tree S7-to-S5 Dalo Exchange via FOL Services
- Supports data exchange
- Send/Receive Data Exchange with SDA Request
- Broadcast ond Multicast wilh SON Request
• Supported on PROFIBUS subnets only
- PROFIBUS Variant. According to IEC 61 158
- Supports Dato Transfer of structured FMS Variables
PROFIBUS FMS
- Supports Open Communication to all FMS Compnant Systems
- Acknowledgement of data receipt in the ,emote partner
- In accordance w ith European stand ard EN 50170 Vol.2 PROFIBUS
ISO Transport - Supported on Industria l Ethernet Subnets only
- Communication with ISO transport compliant systems /e.g . S7-S7. S7-S5)
- Supports Send/Receive ond Fetch/Wrile functions as used in SS PLCs.
- Acknowledgement of data receip t by the ISO Transport in the partner
- ISO Transport (ISO 8073 c lass 4) corresponds to layer 4 o f the ISO model
ISO-on-TCP • Supported on lndu$lriol Ethernet Subnels only
• Fvlfills the TCP/IP standard with the. RFC 1006 extension
• Communication wilh ISO-on-TCP c omplianl partners (e.g. S7-S7, S7-SS)
• Supports Send/Receive and Felch/Write functions os used In 55 PLCs.
• Acknowledgement of Doto receipt Is confirmed by remote partner
TCP/ IP - Supporled on Industria l Ethernet Subnets only
• Complies with Transmission Control Protocol/Intern et Protocol (TCP/IP)
- S7-S7, S7-S5, o nd communication with o ther TCP/IP compliant partners
- Sup p orts Send/Receive ond Fe tch/Write functions as used in S5 PLCs.
- PCs generally use the TCP/IP implementation of lhe operating system
UDP - Supported on lndusirial Ethernet Subnets only (via TCP/IP protocol)
- Unsecured transfer or contiguous blocks of doto between partners
E-Mail - Supported on Industrial Ethernet Subne ts via the TCP/IP protocol only
- Enables process dalo transfer via e-mail IT services
• Evenl-triggered e--moil delivery

356
Working with Simalic NET Networks

PROFIBUS Communications Processors


In the SIMA TIC NET world of communications. a PLC or PC node is connected and
established on the network using a comm unications processor fCP). You will determine wha t
CP is required, based primarily o n the required communications services. We reviewed
PROFIBUS communications services in the previous discussion. Here. we will first look at the
communications processors needed to connect the S7-300 and S7-400 PLCs to PROFIBUS;
following this, we will look at the CPs required lo connect PC stations to PROFIBUS.

PROFIBUS CPs for 57-300 and 57-400 Stations


The CPs in the table below. allow you to establish lhe S7-300 or S7-400as o station on o
PROFIBUS subnet. With the appropria te selection. the S7-300 may serve as a PROFIBUS DP-
Master. as a DP-Slave, or as on FMS Server. As PROFIBUS nodes, all S7-300 or S7-400 CPs will
support remote programming, via PG/OP services; S7-to-S7 communication, via S7 functions;
and communication with S5 PLCs (CP 5431). via the FDL services. Given these standard
services, available on all PROFIBUS CPs. you must select o CP according lo the specific
protocols and communication services needed in your application (e.g .. FMS Master, DP-
Moster/DP-SlaveJ.

PROFIBUS CPs for the S7-300 include the CP 342-5. the CP 342-5 FO, and the CP 343-5: and for
the S7-400. the CP 443-5 Basic and the CP 443-5 Extended. Each short name listed in the CP
Module column actually represenls several CPs - each of whose full port number contains
the numeric part of the short name (e.g.• 342-51. These short names are used as CP folder
names in lhe catalog ol the Hardware Configuration Tool. The CPs found in o folder ore of
the some type a nd basic feature set. For example. the CPs in the CP 342-5 FO folder support
direct fiber attachment. and incorporate the some basic communications services. The
different part numbers in a CP folder may reflect the CP al d ifferent revisions. resulting from
different firmware. Feature enhancements are briefly described when you select 1he part in
lhe catalog.

Tobie 7-10. Overview of PROFlBUS Communicatio ns Processors ICPsl for S7-300/S7-400 PLCs.
CPModule Brief Application Description I Comm. Services
This CP may serve as OP-master or slave in the S7-300 • PG/OP Comm.
using copper or fiber attachments. As OP-master, lhe -S7 Comm.
CP 342-5
CP 342-5 supports connection of modular. compact. or -S5 Comm.
CP 342-5 FO
intelligent slaves such as the S7-300 with a DP-slave - PROFIBUS OP [M)
porl or via an installed CP342-5 serving as a OP-slave. - PROFIBUS DP IS)
This CP is required lo estoblish lhe S7-300 as o PROFlBUS • PG/OP Comm.
FMS master on PROFIBUS subnets. Communications • S7 Gomrn.
CP 343-5
services support communication with other PROFIBUS -S5Comm.
stations (e.g .• S7. S5. 505. C7, HMts, OPs, and PCs). - PROFISUS FMS

This CP is required lo establish the S7-400 as a PROFIBUS - PG/OP Comm.


CP 443-5 master (FMS) on PROFIBUS subnets. Communications - S7 Comm.
Basic services also allow communication wi lh other PROFIBUS -S5 Comm.
stations (e.g .. S7. S5. 505. C7, HMls. OPS. and PCs). - PROFIBUS FMS

This CP rs required to establish the S7-400 as a OP- - PG/OP Comm.


mosterhaving OP-stove connections to modular. -S7 Comm.
CP 443·5
compac t, or intelligent slaves. Communicolions -S5 Comm.
Extended
services support communication with other PROFIBUS - PROFIBUS DP [M )
siolions (e.g., S7. S5. 505. C7. HMls. OPs. and PCs).
Note: PROFIBUS DP (MJ = DP-master; PROFIBUS DP (SJ= DP-slave. S7-to-S5 Communication is
via PROFIBUS FDL (loyer-2) connection services, using the Send/Receive inlerface.

357
STEP 7 in 7 Steps

PROFIBUS C Ps for PC and PG / PC Sta tions


SIMATIC NET c lassifies communications processors for PCs, os eith er o HARDNET CP or SOFTNET
CP. The HARDNET CP design incorporates o dedicated microprocessor. w hich makes ii
suitable in applica tio ns with more stringent performance requirements. HARDNET CPs
supports loadable firmware, and allows au tonomous handling or multiple p rotocols onboord.
SOFTNET CPs. do no! incorporate o microprocessor and must rely on the resources of the PC
for implementing th e pro tocol software. They support single-protocol operation and suited to
less stringent requirements . The PROFtBUS CPs in fhe fable below. allow PC stations to serve in
a variety of industrial applications.

The CP 5613 and 5614 ore HARDNET CPs, and ore typically used where several CPs are
required in one PC. in high performance HMI systems. (e.g., WinCC), or in large
supervisory/data acquisition systems (e.g., more !hon five S7-PLCs) . SOFTNET CPs ore typically
used for STEP 7 programming systems. and in smoll supervisory/data acquisition systems (e.g ..
less !hon five S7-PLCs). In the catalog or the Hardware Configuration Tool. these modules ore
found under the SIMATIC PC Slot/on in the CP PROF/BUS folder. Software d rivers for operating
PCs on PROFIBUS ore described later in PROF/BUS Communications Services and Software.

T0 b le 7. 11 . PROFIBUS C ommun1co ti ons processors for PC ond Proaromm1na SI o tions.


CPModule H/S Brief Desc,tpllon Comm. Services
I This PC network card is certified for use with oil - PG/OP Comm.
PROFIBUS SOFTNET drivers. The CP 5511 co n serve -S7 Comm.
CP 5511 s as both DP-master and DP-stove, and is intended • S5 Comm.
(PCMCIA)
for use in non-critical/non-stri ngent applications • PROFIBUS DP (M)
(e.g .. PG/PC, small HMI system) . • PROFIBUS DP (S)

This PC network cord is certified for use with all - PG/OP Comm.
PROFIBUS SOFTNET d rivers. The CP 5611 co n serve -S7 Comm.
CP 5611
(PCI)
s as both DP-master and DP-slave, and is Intended -S5 Comm.
for use In non-critical/ non-stringent applications • PROFIBUS DP (Ml
(e.g., PG/PC. small HMI system) . • PROFIBUS DP (SJ

This PC network cord is compa tible with oil CP - PG/OP Comm.
CP 5613
54 12 A2 software. The CP 5614/CP 561 4 FO con - S7 Comm.
CP 5613 FO
serve os DP-master. and is able to handle high- -S5 Comm.
(PCI) H speed PROFIBUS applications (e.g .. PC-Based • PROFIBUS DP (M)
Conlrot. HMI. or redundon l systems}. • PROFIBUS FMS

- PG/OP Comm.
This PC network cord is compatible with all CP
• S7 Comm.
CP 561 4 5412 A2.softwore. The CP 56 14/CP 5\$14 FO con
-S5 Comm.
CP 561 4 FO H serve as DP-master a nd DP-slave. and is able to
(PC!) • PROFIBUS DP (Ml
handle hlgh-speed PROFIBUSopp1icatlor'1S (e.g..
• PROFIBUS DP (S)
PC-Based Control. HMls. or redundant systems}.
• PROFIBUS FMS
Note: H = HARDNET PC odopler: S = SOFTNET PC adopter: PROFIBUS DP (M ) = DP-mosler; DP
(SJ = DP-slave. S5 Communication is v ia PROFIBUS FOL services, using Send/Receive tn lerface
(Doto exchange via standardized services provided os C-Functlons).

358
Working with Simolic NET Networks

PROFIBUS Software for PC and PG/ PC Stations


Software d rivers needed to operate PROFtBUS com munications services on PCs a nd
programming stations are available on the SIMATIC NET CD. This CD contains drivers for the
different Windows operating systems, for both HARDNET and SOFTNET PC communicatio ns
processors (i.e.. network interface cords). As shown in the table below, DP-5613, FMS-56 13.
and S7-5613. ore driver p ac kages for both the CP 5613 and C P 56 14 modules. SOFTNET-S7
and SOFTNET-DP ore for SOFTNET adopters CP 55 11 and CP 561 l. Drivers for PG/OP services,
needed by operator panels (OPs) and programming systems o n PROFIBUS ore conta ined in
eoch o r lhe listed driver packages shown with on asterisk. The some is lrue for PROFIBUS FDL
d rivers, which ore required for S7-to-S5 compatible communica tion on PROFIBUS.

Tobie 7- 12. PROFIBUS Communica tions Drivers for PC and Proa rammina IPG/PCI Stations.
Software Used with Description
DP-5613 CP 5613/5614 Software drivers for DP master/slave functionality. •

FMS-5613 CP 5613/561 4 Sottwore drivers for PROFIBUS FMS tunclionolity•


S7-5613 CP 5613/5614 Software d riv ers for S7 Functions•

SOFTNET-S7 CP 5511/5611 SOFTNET drivers for S7 Functions •


CP55l1/561I SOFTNET drivers fo r DP master/DP slave runctionolily.
SOFTNET-DP

SOFTNET-DP (SJ CP 5511/5611 SOFTNET d rivers for DP slave functionality.
All PROFIBUS Contained in each package as interface to OPC
OPC Server
CPs capable Windows applications fe.g .. Office. HMls)
Notes: • Drivers for PG/OP and PROFIBUS FDL services ore contained in this sortwore package.
PG/OP and FDL d rivers are installed when the HARDNET adapters CP 5613/561 4 ore installed.

Ethernet Communlcatlons Processors


In the SIMATIC NET world of communications, o PLC or PC node is connected a nd
established on the network using a comm unications processor [CP). You will determine what
CP is required, based primarily o n the required communications services. We reviewed
Ethernet communications services in the previous discussion. Here, we will first look a t the
commu nications processors used lo connect the S7-300 and S7-400 PLCs lo Ethernet;
following this, we will look at the CPs required lo connect PC stations lo Etherne t.

Ethernet CPs for S7-300 and S7-400 Stations


The CPs in lhe Fo llowing !able allow you to establish the S7-300 or S7-400os o station on on
Ethernet subnet. As Industrial Ethernet nodes, all S7-300 or S7-400 CPs will support re mote
programming, S7-to-S7 communica tion, a nd communication with S5 PLCs (CP 14301, via the
ISO or TCP services. Given these standard services. available on all Ethernet CPs. you must
select o CP according to the specific protocols and communic a tion services needed in your
applicolion (e.g .. rou ting via gateways or IT services). The main feoh.Jres of o specific CP are
highlighted when the part is selected in the STEP 7 Hardware Configurofion catalog.

359
STEP 7 in 7 Steps

Ethernet C Ps ro r lhe S7-300 include the CP 343-1. and the CP 343- 1 IT; and for the 57-400. the
CP 4-43-1 and the CP 443-1 IT. Each short name liste d In the CP Module column actually
represents several CPs - each of whose full port number con ta ins the numeric port of the
short name (e.g .. 343- 1), These short names ore used os CP folder names in the catalog or
the Hardware Configuration Tool, The CPs found in a folder are of the san, e type and basic
feature set. For example . the CPs in the CP 343-1 ll folder all support internet capability and
incorporale the same basic communic a tions services. The different port numbers in a CP
folder may reflect the CP at different revisions, resulting from different firmware. Feature
enhancemen ts ore briefly described when you select the port in the catalog.

Tobie 7-13. Overview of Ethernet Communications Processors (CPs) for S7-300/S7-400 PLCs.
CP Module Brief Applcatlon Descrlpllon Comm. Services
This CP attaches the S7-300 to Industria l Ethernet, w ith - PG/OP Comm.
standard copobililies including remote programming - S7 Comm.
CP 343-1 between networks. Services or this CP a lso supports S7-300 - S5 Comm.
communication with other devices (e.g.. S7, S5, HMls. - ISO Transport
PCs), via ISO and TCP/IP transport connections. - TCP/IP Transport

This CP attaches the S7-300 to Industrial E1hemel, w ith • PG/OP Comm.


standard and internet capabilities (e.g., Web browser -S7 Comm.
CP 343-1 IT access to data, Event E-mail). Services of this CP a lso - SS Comm.
supports S7-300 communication w ith other devices (e.g.. - ISO lronsport
S7. SS, HMls, a nd PCs), via TCP/IP transport connections. - TCP/IP Transport
This CP attaches the S7-400 to Industrial Etherne t, w ith - PG/OP Comm.
sta ndard capabilities including remote p rogramming -S7 Comm.
CP 443-1 between networks. Services of this CP a lso supports S7-400 - S5 Comm.
communication with other devices (e.g.. S7. SS, HMls, • ISO Transport
PCs), via ISO and TCP/IP transport connections. - TCP/IP Transport
This CP attaches the S7-400 lo Industrial Ethernet, w ith • PG/OP Comm.
standard and internet capabilities (e.g., Web browser -S7 Comm.
CP 443-1 IT access to data. Event E-mail). Services of this CP a lso - S5 Comm.
supports S7-400 communication w ith other devices (e.g.• - ISO Transport
S7, S5, HMls. and PCs). via TCP/IP transport connections. - TCP/IP Transport
Note : S7-to-S5 communication is via the Send/Receive interfa ce, using ISO transport, /S0-on-
TCP, TCP/IP transport. or UDP connection servic es.

Ethernet CPs for PC and PG/ PC Stations


SIMATIC NET c lassifies communications processors for PCs, as either o HARDNET CP or SOFTNET
CP. The HARDNET CP desig n incorporates a dedicated microprocessor, w hich makes ii
suitable in applica tio ns with more stringent performance require ments. HARDNET CPs
supports loadable firmware, and allow s autonomous handling of multiple p ro tocols onboord.
SOFTNET C Ps, do not incorporate a microprocessor and must rely on the resources of the PC
for implementing lhe prolocol software. Tiley support single-protocol opera tion and ore
suited to less stri ngent requirements.

HARDN ET CPs like the CP 1613, are recommended in cases where use of PC resources must
be minimized. Example uses include redundan t S7-H systems. where several CPs ore needed
in one PC. in high performance HMI applications (e.g., WlnCC). and large (more lhon five S7-
PLCs) supervisory/data acquisition systems. SOFTNET CPs. like the CP 1512 and the CP 1612.
ore typically used for STEP 7 programming systems, and in small supervisory/data acquisition
system s (e.g., less than live S7-PLCs) . These modules ore round under the SIMATIC PC Sta/ion
in lhe CP Industrial Ethernet folder of the hardware catalog. Software drivers for operating
PCs on Etherne t are described later in Ethernet Communications SeNices and Software.

360
Working with Simolic NET Networks

Tobie 7-14. Ethernet Communicatio ns Processors for PC and Proorammin< /PG/PC\ Sta tions.
CP Module H/S Brief Description Services
This PC network card is certified for use with all - PG/OP Comm.
Industria l Etherne t SOFTNET drivers. The CP 1512 - S7 Functions
CF' I 512
(PCMCIA)
s supports both ISO and TCP/IP protocols. and is - SS Comm.
intended for use fn non-criticol/non-stringen t - ISO and TCP/IP
applica tions (e.g., PG/PC, small HMI system).

This PC network cord is certified for use with 011 • PG/OP Comm.
Industrial Ethernet SOFTNET drivers. The CP 1612 - S7 Functions
CP 1612
{PCI)
s supports both ISO and TCP/ IP protocols, and is -S5 Comm.
intended for use in non-crilicol/non-sfringen1 • ISO and TCP /IP
opplicotlo ns (e.g., PG/PC, small HMI system).

This PC nelwork cord is compa tible wilh all CP • PG/OP Comm.


1413 protocol software. The CP 1613 supporls -S7 Comm.
CP 1613
H ISO and TCP/ IP protocols and is oble lo handle • SS Comm.
(PCI)
high-speed protocol processing for o large - ISO and TCP/IP
number o f connections. • TF Protocol
Note: H = HARDNET PC network odoplers: S = SOFTNET PC network adopters. S5 compatible
commu nication is via ISO, TCP/IP, or UDP connections, using the Send/Receive interface.

Ethernet Software for PC and PG/ PC Stations


Software drivers needed to operate Ethernet communications services on PCs and
programming stations ore available on lhe SIMATIC NET CD. This CD conloins drivers for lhe
various Windows operating systems, for both HARDNET and SOFTNET PC communications
processors. As shown in the following loble, 57-1 6 13. TF- 1613, and S7-Redconnect. ore d river
packages for the CP 1613. SOFTNET-S7 and SOFTNET-PG packages ore used in conjunction
with SOFTNET adapters CP 1512 and CP 1612.

PC drivers that support PG/OP services for programming sys tems on Industrial Ethernet o re
conta ined in each of the listed software drivers shown with on asterisk. The some is true for S5
compatible communications d rivers, required for S7-to-SS communica tion on ISO, ISO-on-
TCP. TCP, and UDP connecllons.

Tobie 7-15. Ethernet Communicatio ns Drivers for PC and Proarommina (PG/PC) Stations.
Software CPs Used With Desafpllon
S7-1613 CP 16 13 Software for S7 Functions.•

S7-Redconnec t CP 1613 Software for S7 FunctiOns on rectvnc1on~Ethernet •

CP 16 13 Softwore for Technological Functions/Monufac turing


TF-1613
Message Specificatio ns [TF/MMS services).•

PG-1613 CP 1613 Software for PG/OP Functions only,

SOFTNETPG CP 1512/CP 1612 SOFTNET drivers for PG/OP Functions only.

SOFTNET-S7 CP1512/CP 1612 SOFTNET drivers for S7 Functions. •

OPC Server All Ethernet CPs Interface to OPC capable Wind ows applications
Notes:• Drivers for PG/OP and SS compatible communication (i.e., ISO, ISO-on-TCP. TCP. and
UDP) ore contained In these software packages; corresponding OPC server Is also included.

361
STEP 7 in 7 Steps

The Network Configuration Tool


In STEP 7. c reating a network configuration is to create a software model or the actual
networked sta tions or an S7 project. The configuration includes the graphic arrangement or
one or more subne ts with their connected stations. PROFIBUS DP subnets will include both
master and slave devices. where stove stations are shown connected to a maser station. and
may be displayed or hidden from view. Configuration also involves module addressing and
the setting or module parame ters.

Configuring the Network


Creolion of lhe network configuration requires lhe Network Configurafion Toof. which may be
storied from the SIMA TIC Manager or the Hardware Configuration tool. Aller a station is
created. the configura tion lool ls launched by opening the Slolion folder and then double-
clicking on the hardware object. W1th the hardware configuration tool. on object model of
your actual hardware arrangement is developed, with each component of your hardware
installation having a matching object in the hardware configuration. Once developed. a
network configuration may be copied to other STEP 7 projects, modifying it as required.

The completed conriguration can be checked ror errors using a consistency check,
compiled and then saved. The configuration is saved to the System Doto object, which is
placed in the offline Blocks folder. The System Dato object may then be downloaded to the
CPU. !hereby providing the CPU wllh complete lnrormalion of the network configuration. The
CPU in turn transfers configuration parameters to the appropriate programmable modules.

Menu and Toolbor


Menu headings of the Network Configuration tool include Ne/work. Edit, /nserl, PLC, View,
Options, Window. and Help, Network operations allow you to create. open. save. compile.
and c heck the configuration for errors. Standard Edit operations inc luding Cu t. Copy, Delete,
and Paste allow subnet and sta tion objects to be edited as required. Standard online
operations such as configuration upload and download, monitoring and diagnostic tools ore
supported by PLC operations. View and Window operations allow components of the
configuration window to be displayed, hidden. or arranged lo your convenience. The
toolbor bu Hons, listed below, represent some of the most freq uently used menu operations.

Ta ble 7- 16• NETPRO Ne tw0 rk C on f'1auro I'10n T00lbor Bu Hons.


Icon Toolbar func:tton lc:on Toolbar Function

~ Open Station Olfline Window ii] Download Network Configuration

IE Open Station Online Window ii] Upload Network Conligurotion

[!] Save Configuration [ffi] View Ne tworl< Catalog

l~nl Save ond Compile Configurollon


~ Netwo~k Configurdtion Help

[i] Prin t Network Configuration


~ Insert New Connection

[§1 Copy Selected Object @] Change Connection Partner

[§] Paste Object from Clipboard


-

362
Working with Simalic NET Networks

Network Components Catalog Window


The network components catalog contains the various component objects used to c reole a
configuration of your networking solution. When the configuration tool is opened, the
catalog. which may be hidden from view. con be d isplayed by selec ting View ► Catalog
lrom the menu. If the window is docked, you may double-click above the words ''Selection
o l lhe Network" lo cause It to undock. If it is already un-docked, you may double-c lick on
the title bar lo c a use it to dock. When undocl:ed, you may resize or move the window to suit
your convenience. You may a lso re-dock the catalog by dragging and dropping it onto the
lef1-edge or th e right-edge of the configuration window.

The major object containers of the ca talog, PROF/BUS DP, PROF/BUS PA, Stations, and
Subnets, ore presented in o tree struc ture. PROFIBUS-DP and PROFIBUS-PA containers include
objec ts for representrng DP or PA slave devices. The Station containers contain objects ror
StMATIC 300, SIMATIC 400, SIMA TIC PC. SIMATIC SS. SIMATIC S7-400-H statio ns. PG/PC, and
Other Stations {Non-Siemens stations). The Subnets lolder contains objec ts for MPt. PROFIBUS.
Industrial Ethernet, and Point-lo-Point Subnets. Once you place a subnet is in the
configuration, then compatible nodes may be placed in the w indow.

Selection of the network


PROFIBUS OP Selection of the ~wale

.~
PROFlBUS.PA
e D statio,,, ftJ PAOFlBUS DP
Other Station If PROFlBUS -PA

t ·§ PG/PC
Iii] SIMATIC 300
J-liil SIMATIC 400
j- g_ SIMATIC PC St&lion
8

I
0 Statioos
I ,....._! Othei Station
I ..,.,§
I
PG/PC
· !iii SIMATIC :m

~ SIMATICS5 [U SIMATIC 400


ill Sl~lATIC 57-400-H , ····Ji!. SIMATIC PC Slation
8 Cl Subneu I: '·-~
'-·li'lJI
SIMATIC S5
Y lncbtJial Ethernet £:J CJ
SIMATIC S7-400-H
SJJbnets
- .YMPt
\'I PROFIBUS Y lnduruiol Etheinct
YPTP
·. \g MPI
L.~ PAORBU S
:..~ PTP

SIMATIC 57-:DJ, M7-:nl -t!i SIMATICS7-300, M7-300


and C7 modiks (rential rack)
'lil
and C7 modt.1let (ctntiol reek)

Reedy Ready

Figure 7-4. (a) Network Catalog Left-Docking. (b) Network Catalog Un-Docked window.

363
STEP 7 in 7 Steps

Configuration Window - Network Layout


As you develop your network configuration, the upper pane or the window will contain th e
subnets and sto tions tha t you define. If you have attached the nodes lo a subnet interface,
then they will appear attached too specific subnel. Each connected S7 PLC s1otion will
conta in on object for the programmable modules installed in the sta tion (e.g .. CPU, CP. or
FM). Stations connec ted lo MPI are attached via the MPI interlace of o CPU module. Stations
on PROFIBUS or Industrial Eth erne t o re attached too communica tions p rocessor object (e.g.•
CP 443-5, o r CP 343-1 ). You can access and modify the properties of a subnet or any
programmable module (e.g.. statio n address). by double-clicking on th e object.

During configuration. PLC station objects lor the S7-300, S7-400, S7-400 H. may be dragged lo
the window. If the station's hardware is not yet configured. you can open the station in the
hardware configuration tool by double clicking on the station name. You con return to the
network configura tion using the toolbar icon for Configuring Networks. PC workstolions,
PG/PC programming sta tions. and SIMATIC SS stations may also be dragged a nd dropped
into the station window. With these stations, you simply need to create and assign an
app ropriate network interface lo the station object in order to a ttach ii lo a subnet.

PROFIBUS DP slaves ore also shown as objec ts, based on the type ol drop (e.g., modular,
compact) . As the config uration is developed, you con either hide or d isplay the connection
between each DP master and its associated DP slaves, from the View menu.

Configuration Window - Connection Table


When on S7-300/S7-400 CPU is selected in any of the sta tions of the upper pone o r the
network layout window, a list of its configured connections are displayed in a connection
table in the lower pane of the configuration window. A new connection is added from the
menu, by se lec ting Insert ► New Connection. For o g iven connec tion, fhe table columns list o
connectio n ID in the local station, l oco/ ID; a Portner ID. lor the local station; the name of the
remo te partner, Portner; the c onnec tion Type, and the Subnel name. The Active
Connection column indicates whe ther the local station is the Active Connection Portner in
establishing the connection. Yes, indicates that the local node establishes the connection;
'No' indicates that the connection partner establishes the connection.

1\1 Pli 1
Pl
.,_,ROfl0.1$, l
0 ROFIBLl5

ltrr'ffll lM
II
$ 74~0.Voew_l _O"
,.... ~ 153-1 mlii 153-1

•"'
'=
■~-,

-

m .' .•• ..
,.
11

e
:■

-•
57300_3_1ier_Exp•nsion
"'-.z:,. , :· '"''

,
g S740D_Mu~ lo_CPI.Js
.. ,.,

• )
.,,


\1
..
>,; ,,. . . .. .
4... ,..,_1 t i&.4 I+.: :

•••ll U
, .,.,

:
'r
. ... ..... 1; ,


•~


I -4~ ~ ~'! lilt ~-psruJ.:r1 ~a,J J1&..2 I Sl c ~ a~ 1vee FRa'DJS( l) (FRCf'BJS)
001AJ:00 cooiNtYJ S1»i., _Te1.bmn,ionl<ruJ1e,2 , ~ com-• • ·,1101"aJS<•i<!'AC11lOS)

Figure 7-5. Ne twork Configuration with stations shown connected to MPI. PROFIBUS. and
Industrial Ethernet. PROFIBUS DP Moster and associa ted modular DP Slaves highlighted.

364
Working with Simolic NET Networks

Comments on Working with SIMATIC NET Networks


Network configuration tasks ore accomplished using both the Hardware Configuration tool
and lhe NetPro network configura tion tool. Generally, at this stage, you will hove configured
each station's hardware (I.e., S7-300/S7-400 rocks and modules) using the hardware
conf1gurolion tool. You may or may not have inserted the various network communications
processors in each stalion, assigned unique addresses, and attached the CPs to a subnet. If
you did, however. you have already done much of the work and may only need to
configure connections between communications partners.

This final chapter considers building the network configuration graphically from the lop-
down. using the NetPro Configuration Tool. As you may hove already determined, lhe
network is b uilt from the bottom-up, as you install and configure the communications
processors using the Hardware Configuro1ion Tool. You may hove already token this
approach. In either case. the network configuration is completed in lhe Network
configuration tool, where you will need lo configure connecti ons be tween partners and
download the results.

As a whole. establishing stations on a network con be accomplished in jusl a few short tasks.
These tasks. some of which you may hove already performed. ore outlined below. Step-by-
step examples of con figuring MPI. PROFIBUS. and Industrial Eth ernet networks ore p rovided in
the following pages.

Checklist: Working with SIMATIC NET Networks


• Verify that "NCM for Ind ustrial Ethernet'' a nd "NCM for PROFIBUS" are installed
{these packages ore typically lns toJ/ed w//h the in/I/of STEP 7 instollolion}.

• tnslo/1 the required protocol drivers in PC stations/programming systems.

• Insert the subnets (e.g., MPI, PROFJBUS, or Industrial Elhemel} required in your
project. and configure the operating parameters- of each subnet.

■ Insert /he required communicoJ1ons processor {e.g., Industrial Ethernet, or


PROF/BUS} In each Sl-300/Sl-400 station; configure the address a nd op erating
porometers of th e CP. and attach It to on existing subnet.

• Insert the required commvnicolions processor (e.g., Mf'J. PROF/BUS. or


Industrial Ethernet) in each PC host or programming station; configure its
address a nd opero ling porome ters, ond attach it to a n existing subnet.

• Define required connections for S7 communica tions partners that will


exchange data via configured connections /e.g., S7, FDL. ISO, /SO-on-TCP,
TCP. or UDP}.

■ If g lobal doto transfers ore required. then configure the Global Dolo table- for
/he participa ting CPUs, which reside on on MP/ s-ub ne/.

• Save and compile the network configuration ofter making changes, a nd


perform consistency chec~ for con figural/on errors prior to downloading.

• Download /he nefworl: configuration lo network slo/ions.

• Use the Setting the PG/PC Interface ut/rity. to select the appropriate ONLINE
interface In your programming sys/em (PG/PC),

365
STEP 7 in 7 Steps

Building a Network Configuration Using NetPro


Basic Concept
The NetPro Configurotion tool allows you to build ond configure your MPI, PROFISUS, ond
Industrial Et·h emet networks in a graphical editor. Although it is possib le lo stor1 crea ting the
statio ns of your network using the SIMA TIC Monoger o nd the Hardware Configuration tool.
more complex networks may be simpler lo build by storting with NetPro. With Nef Pro. you
may define the network stations and layout. and then finish up with the Hardware
Configura tion too t as you configure th e rocks and modules of each station.

Essential Elements
NelPro is similar to the Hardware Configura tion tool in that It provides o component object
catalog from which you may drag ond drop network objects Into the Network configuration
window. In this fa shion, you may b uild the framework of your network from the top, starting
with the subnets (I.e.. MPI. PROFISUS. and Industrial Ethernet). After you have inserted one or
more subne ts. you may then insert the required network stations. Network sta tions include the
S7-300. S7-400, S7-400 H. SIMA TI C ss, PG/PC. PROFISUS DP PA stations.

After you define the graphic layout of the network, you may then proceed to configure
each sta tion (i.e.. insert modules and define parameters). When you double-c lick on a
statio n. the statio n is opened in the Hardware configuratio n toot. where you moy configure
the cen tral rock with power supply. CPU. and the required communications processor (CP).
With the CP installed. you may then config ure its opera ting parameters. its address. and
finally attach the station lo the subnet. As you attach each CP, the next available address is
suggested.

Application Tips
As you insert and configure each communications processor. remember tha t eoch station
must have a unique address. In addition. you will also wan t to manage the assignment of a
unique MPI address to each CP installed in o rock a nd in the total subnet. Recall that in the
S7-300. STEP 7 automa tically assig ns on MPI address to each FM or CP. by incrementing each
a ddress by one starting with the a d d ress assigned to the CPU.

;11 MPI_ProJ (Network) -


H:H *======----------=·
='=□:!.I::::~x
C.:\ Patrlck\ 57 _Protccts\ MPl_Prof ,_

-----
1

riiiD SltvlAllC 300(1)


fill iiifl
SIMATIC 300(2)
CPU CP
315 343-t liiii)
SIMATIC 300(3)
CfU
314
ISO

• 3

5
■ ■
7

ElhernE<r(1)
lndustnal [ U1i>:ne1


Figure 7-6. Ne tPro Graphic connec tion o f S7-300 Stations o n MPI and Industrial Ethernet.

366
Working with Simolic NET Networks

Quick Steps: Bulldlng a Network Configuration Using NetPro

ACTION

1 Open on existing project or create a new project if necessary.

2 Wilh the project window open. from the right pone. double click on the MPI subnet
object o r press the Configure Network icon, lo open the NetPro configuration tool.

3 If th e network objec ts catalog is not open in the window. select View ► Catalog.

4 From the ca talog, expand the object folder for both the Stations and Subnets.

5 From the fist or Subnets, double click on the desired subne t type (e.g .. PROF/BUS.
MP/, or Indus/riot Elhemel) to inserl. Once the subnet objec t is inserted in the
window, you may drag the object up or down to o new position, as desired.

6 To configure the operating properties of a subnet (e.g .. Transmission Role. Highest


Address, and subnet Profile in the case of PROFIBUS), d ouble click on the subnet
object and select the Network Se/lings lob. The subnet ID and Name, ore on the
General lob. and may be modified: the subnet ID is generally unchanged.

7 From lhe Station folder. you may inser1 stations in the configuration window wllh a
double click on the station type (e.g., SIMATIC 300, SIMATIC 400) or by dragging the
object on to the screen. You may insert as many stations as requ ired and may drag
a station to any new position you choose.

8 Double click on o station object (e.g.. on the Station name) to cause the station to
open in the Hardware ConFiguro tion tool. Then. creole a central rock. by inserting
the required Roel< . CPU, Power Supply, and the Communications Processor.

9 When you insert o CP /e.g .. PROF/BUS. Ethernet) . the p roper1ies dialog will appear:
attach lhe CP to the subnet. by selec ting the subnet name - the next available
address is ou tomoticolly entered in lhe field. You may accept or oller the address.

10 Save the central rack configuration in order to hove the results appear in the
network configuration when you return to Ne1Pro.

11 From the Network Configuration, you may al ter any network address. For MPL
double-click on the CPU object; for PROFIBUS or Industrial Ethernet stations, double
click on the a ssociated communications processor (CP) object.

12 You con configure each sta tion using the procedures o f Step 8 through Step 10.

13 When all of the stations ore completed, select Network ► Save and Compile to
perform a consistency check. and to save th e configuration to the System Doto.

367
STEP 7 in 7 Steps

Downloading a Network Configuration Using NetPro


Basic Concept
Once you hove completed your network configurotion. you must then proceed to d ownload
to the ind ividual sta tions. Like a station's hardwa re configuration. the network configuration is
sa ved in system d ata b lo cks (SDBs/. which a re d ownloaded to the CPU of each station.
whic h in turn transfers appropria te data lo the communicatio ns processors. lhe SDBs
associated w ith the network co nfiguration Include subne t properties. sta tion a ddresses.
c onfigured co nnections, inpul/outpu1 a ddresses. and module pa ram eters.

Essential Elements
Yo u c on d ownload the network c o nfigura tion for a stolion. using the PLC ► Download
command. either from the Simotic Manager. or rrom the Hard ware Configuration toot when
c o nfiguring sta tion hardwore. By downloading the c o nfiguration from the Ne twork
Configura tion Toot. you may d ownlo ad the entire configuration s1alio n b y sta tion lo a ll
sta tio ns on o subnet. Yo u m ay also choose to download the network co nfiguration of
selec ted statio ns only. In add ition. you con selectively d ownloa d specific sta tions a long with
the associa ted connections a nd config urations for communicatio ns p artners.

Application Tips
As you p rep are lo download 1he network configuration. consider that white ii is possible lo
d ownload the configura tio n ove r o subnet. tha t a ll sta tions must hove been previously
a ssigned uniq ue station addre5,5es. In add ition. you will o lso wo nt lo ensure the assignm en t of
a uniq ue MPI a ddress lo eac h CPU, CP. a nd FM installe d in o rack and in the tota l subnet.
Recall that in the S7 -300. STEP 7 automatically assigns o n MPt address to each FM or CP. by
incrementing each a ddress by o ne starting wi th the address assigned to the CPU.

Ii•• Clhr _JOO (Networl:) •· C:\Palritk\S7 _Proic<ls\ Ul,r_3 w


C.ll,dr,<IA( 4
Industri al Etherne•

rvF'II 1)
l\1PI

SIMATIC 300(1) . SIMATIC 300(2) SIMATIC 300(3)

• -·
liiiD ,,.
~
·• •
CP CPU CP CPU CP
liiiil 30)-1 liiiII :143-1

2
• • 6

LC>C81D Pot1ne110 P"'1ner Type s. - i


OOJI
.
A020. iOO?I A_D20 4~IMATIC ~ ) .IC~U 3!~- IS<? -pm.J'..omed!!' Yes Bht!~Mj1 tf;IE)
WJ2A020 111QOI AD'!J SIJATICJQCl(3)1CPU316 ~ ltOMPciri cqmcclion Ve: flheme!(_1) (le)
0003 A02II Jooo2 AO~ 1SIMA TICW0(2)1 CPU 316 TCPcennecuon Yes Bl>t1net( I ) (ii:)
0004A020 i 0002 A020 ~ t.V,ll:300(3) 1 CP(!_316 !_SO t,onspciri comcctlon No If11l<;1ncl(~ ) ~)

Figure 7-7. Ne tPro Graphic connection o f S7-300 StoHons o n tnduslrial Ethernet.

368
Working with Simolic NET Networks

Quick Steps: Downloading a Network Configuration Using NetPro

ACTION

1 When you ore done with configuring your network. you must ensure lhol you hove
assigned unique addresses lo each station (including sta tions whose addresses ore
set using switches.

2 Network connections must be completed for all stations tho! are communications
partners in configured connec tions (e.g .• S7. FDL, FMS, ISO. ISO-on-TCP. TCP/IP, etc.).

3 When all of the stations ore completed. select Network ► Save and Compile All lo
perform a consistency check, and to save 1he configuration to the System Doto.

4 When downloading for the first time. you must use a direct connection lo each
station's MPI port. Later a f1er each CPU is a ssigned o unique MPI address. the
configuration may be downloaded via lhe MPI subnet. Aller the initial download. ii
is also possible to download via PROFIBUS or Ethernet is subnets if they ore in place.

5o Download Stations on Subnet

From the menu. select PLC ► Download ► Stallons on Subnet to transfer the network
configuration to all stations on the subnet - one-by-one. Connections. s1o tion
addresses, 1/0 addresses. subnet p roperties. and module porome1ers ore
downloaded.

5b Download Selected Stations

From the menu. select PLC ► Download ► Selected Stations to transfer lhe network
configuration o f only the selec ted stations. Connections. 1/0 addresses. station
addresses. subnet properties. and module parameters ore all downloaded.

5c Download Selected and Portner Stations

From the menu. select PLC ► Download ► Selected and Partner Stallons to transfer
the network configuration of only the selected stations and its configured
communications partners. Connections. 1/0 addresses. station addresses. subnet
p roperties. and module parameters ore all downloaded.

5d Download Selected Connections

From the menu. selec t PLC ► Download ► Selected Connections to download the
selected connections of a station and to the partners involved in two-way
communica tion. Only the selected connections ore downloaded.

Download Connections and Gateways

From the menu, select PLC ► Download ► Connections and Gateways to transfer
the configured connections to the selected module and its partner stations.
Connec tions and gatewa y inFormotion ore downloaded (in RUN -P or STOP modes).

369
STEP 7 in 7 Steps

Adding and Configuring an MPI Subnet


Basic Conc ept
An MPI subnet is automa tically inserted into each newly c reated project - however.
additional MPI subnets may be added as required to reflect each of the physical MPI
subnets of your project. Once inserted. the operating parameters of the subnet must be
configured as required. using the NetPro configuratio n tool.

Essential Elements
You may insert a new MPI subnet from the SIMATIC Manager or the network configuration
tool. Once you insert the subnel. you must configure ils General and Network Se/lings
properties (See figure below). The General properties inc lude a subnet Name and Subne t ID.
Modifying lhe subnel ID is unnecessary. slnce this automatically derived ID {STEP 7 derived
project number - subne t number) will always b€1 unique. The Network Settings allow you to
define the transm issio n ra te, and the highest statio n a ddress ( HSA). The standard tran smission
ra te for MPI subnels is 187 .5 Kbs. b ut this can be set to a maximum of I 2Mbs to support the
CPU 318-2 and the S7-400. The transmission ro le, however, musl be sel ror the slowest station.

Application Tips
The highest MPI address selling should be set to a value equal lo or greater than the highest
o c tuol station address. A hig hest station address of 3 I (HSA =31) is wha t is recommended in
order to optimize the polling of network stations during normal. diagnostic, programming. or
other network operations.

Properties - MPI 1

I
Generl!I J Netwoik Setting$

Name: jMP1(2)
S7 t\lb net ID: 10020 I • looss
Ptoject~ j\Waehouse_l\MP1(2)
Sl01age location
of the p,ojed: IC:\P...t,ick \57_Pro',ecu\\1/aehous
~ ,: fC.T.Jone~
Dote c,e.,ted- 21 09..200~ 14:58·39
Lau modfaed. 21.09.2004- 14:58:39
Colm'lert

OK
I Cancel I Help l
Figure 7-8. MPI Properties: General settings dialog.

370
Working with Simolic NET Networks

Prnrertie., - MPT _

General Netwo,k Settings I


Highe,,t MP1 addres:s: P' Change

Trensrmsion Rate; 187 5 kbil/~


1.5 MbiVs
3 Mbil/s
6 Mbit/s
12 Mbit/s

OK
I Cancel j __H_elp_....,
Figure 7.9_ MPI Propenies: Network Se11ings dialog.

Quick Steps: Adding and Configuring an MPI Subnet

ACTION

I Open the SIMA TIC Manager and 1he project where the MPI subnet is to be added.

2 Select the project folder, and then from the menu. setecf Insert ► Subnet ;.. MPI. This
step is only required ir you ore adding on additional MPI subnel.

3 In the right pone of the project INindow, double c lick on any subnet object or press
the Configure Network toolbor bu tton to open the network configuration tool.

4 With the configuration tool open. setect the MPI subnet object. double click on the
subnet or right-click, and select Object Properties lo open the properties dialog.

5 From the General tab, you may choose to keep the default Name of the MPI subnet
[e.g., MPI (1 )). or you may modify the name to renecl 1he subnet' s func tion.

6 The S7 Subnet ID, represented by a projec t number separated by a subne t number.


is oulomolicolly derived by STEP 7. You may modify the subne1ID. but lhis is
unnecessary. since it w ill always be unique.

7 On the General tab. you may enter o deportment name in lhe Author field. or
perhaps your name ii you ore defining the subnet p roperties; you may enter or
modify the Comment tines to describe the subnet's function in the projec t.

8 From the Network Settings lob. oclivole the Change check box in order lo modify
the Highest MPI Address. For best performance set the ac tual highest address.

9 From the listed options. choose the Transmission Rate to use for the entire MP!
subnet. This setting must not be higher than what Is supported by the slowest stolion.

10 Select the OK b utton to accep t 1he seltings for 1he MPI subnet operoling properties.

371
STEP 7 in 7 Steps

Building an MPI Network with Peer S7-300/ S7-400 Stations


Basic Concept
The MPI port on each MPl-compatible device. though normally used for direct programming.
con a lso be connected to rorm a low-performance network configuration. Communica tion
services of the MP! network support local/remote programming functions for S7-300/400
CPUs, operator panels !OPs), observatio n sla lio ns (OS). and PCs. Dato transmission services
a lso support !he oulomofic transfer o f process variables be tween S7 CPUs a nd operolor
panels (OPs).
Essential Elements
Each S7 CPU hos on integra ted multipoint interroce (MPI) port. Since !he interface is
integrated. no o ther cords are required. MPI stations a re connected to the subnet in the
same manner as PROFIBUS stations, and use th e sam e m edia an d attachment components.
The c ho ice of connection options. however, will depend on whether a copp er or fiber optic
(FO) media is used. Each S7 CPU will iniliolly hove o default MPI address o f "2," but you will
have to assign a unique MPI address to eoch station prior to con nec ting it to th e subnet.
Application Tips
Whe n assigning MPI station addresses. rem e mber !hot on MPI subne t supports 32 stations,
with addresses O -lo- 31. In the S7-300. consider lhol CPs and FMs In eac t) station ore given
addresses based on the C PU address. Each MPI d evice type hos a foc loiy default add ress.
whic h you must modify it multiple devices of that type o re to be connected. For o PG/PC
programming station, "O" is the d efoull address: the default address for on opera tor pone!
(OP) , is "I"; a nd "2" is the default address of S7-300 and S?-400 H CPUs.

~ SIMATIC Manager - MPI_Prj fl~ EJ


File Edit Insert PLC View Options Window Help

~ ] MPI_Prj -- 0:\ 57 _ Projects \ MPI_ Prj l!ll!J £t


SIMATIC 400[1)
SIMATIC 300[1]
SIMATIC 300(2)
"""' MPl(1)

Press F 1 to get Help. [Filtered


Rgure 7-1 0. S7 Project wi th S7·300/S7-400 Slo lions. and on MPI subne t.

l!IGJE'J
·": ' MPI_Prj (Network) •· D:\ S7_Pr ojert~\ Ml'l _rrj

· 1' I 1} 1 .
lf-'I

SIMAllC 300(1) SIMAllC 300(2) SIMAllC -400(1)


iiiil CP U
) I& liiiil CPU
)ta II] CPO
◄ I S• 1


3
•4
• 5

◄ ~
Fig ure 7-11. NelPro config uro lio n tool. showing connection of S7-300/57-400 statio ns on MPI.

372
Working with Simolic NET Networks

Quick Steps: Building an MPI Network with Peer S7-300/ S7 -400 Stations

ACTION

1 Open lhe SIMA TI C Manager to an existing project or crea te o new projec t using the
New command.

2 With the project folder open in the SIMATIC Manager, from the menu select Insert ►
Station ► SIMATIC 300 Station. Insert ol leosl two additional S7-300 or S7-400 sta tions.

3 Wilh the project folder selected. note in lhe right pone that STEP 7 hos already
generated a n MPI subnet (created by default wiih each new p rojec t).

4 Double c rick on the subnet. or press the Configure Ne twork loolbor button to open
the Network Configura tion tool. Your MPI network should appear, along w ith objects
that represent the MPI subnet and the S7-300/S7-400 sta tions you crea ted.

5 Double cllck on the MPI subnel objec t. lo configure the subnet operoling properties
(e.g., Transmission Rate, Highest MPI Address) on the Network Settings tab. The
subnet Nome con be modified on the General tab (See the previous task, "Adding
and Configuring on MPI Subnet").

Double click on th e first station object (e.g., on the Slotion name) to open the
sta tion in th e Hardware Configuration tool. Configure a central rock. inserting the
required Rock. a Power Supply. and CPU.

7 Double click on the CPU object and when the dialog opens, press lhe properties
button in the MPI Interface box.

8 When the MPI parameters dialog appears; olloch /he CPU to the MP/ subnet, by
selecting lhe correc t subnet from lhe list; the next available address is ou tama tic olty
assigned when you selec t the subnet; you ma y also en ter any valid a ddress.

9 Save the central rock configura tion and press the Configure Network. icon on the
toolbor lo return to the network configura tion. The sta tion will appear connected to
the MPI subne t when you reh.1rn to the network configuration.

10 Repeat Step 6 through Step 9 to configure each re maining station.

11 When you are done wi th all stations. select Network ► Save and Compile to perform
o consistency check for errors and to save the configuration to the System Doto.

373
STEP 7 in 7 Steps

Configuring a Programming Station (PG/ PC) on MPI


Basic Concept
II you will need to gain remote a c cess to the S7 PLCs. connec ted lo on MPI network, then
you will ha ve to configure and a ttach a PG/PC station to the subnet. As with o ther S7
statio ns, the PG/PC requires physical connection to the networl< and the logical
configuration and attachment. in o rder lo be known and recognized on lhe network.

Essential Elements
To establish a PC as a programming station on MPI, on MPl-compatib le network interface
cord (e.g., CP 5511/CP 5611. or CP54 12 A2)musl be installed in the PC. and configured in
Windows. If you hove a , PG programming d evice (e.g.. PG 720. PG 740). then it will alrea dy
be equipped with the MPI networ1<. The d river software for programming runclions (PG/OP)
over MPI is installed during the initia l installation of STEP 7. With the physical connection in
place, you only need to configure a logical interface connection for the PG/PC.

To configure your programming device. you must first insert a PG/ PC object in the Simatic
Manager or in lhe Network Configuration tool. and then configure and assign it o n interface.
An interface defines the subne t. and node address. When you assign the interface lo one ot
the ac tua l network cards on the PG/PC. then ii will be adap ted to the configured sellings of
the interface, including the operating properties of the subnet to which it is attached. If you
modiFy the configured settings (e.g.. the network tronsmi$Sion rate). the interface on your
PG/PC is automatically adapted to match the new settings.

Application Tips
Since o nly one configured p rogramming d evice (PG/PC) is allov,ed in a project, by c reating
several interfaces, w hich con be assigned lo the PG/PC. you con conveniently switch
interfaces. Severa l interfaces may be assigned lo a PG/PC. however only one can be
activated as the S70NLINE interface at a given time. Witho ut this function. you would have
to coll up the "Setting the PG/PC Interface" progra m and ma nually adopt the interface
settings of your PG/PC to the configured se ttings.

Properties -PG/ PC :.El


Gerteral I lhteifaces Assq1ment j
N04Aujgned- -
Configured Irmlaces:
14~ T,Y~ ..§_ubnet
Ethernet interlace(1 l lnduwial Etherne1 ... not netw01ke ..
PROFIBU S iilerface(l I PROFlBUS ··· not netw01ke...
M?! inte1fac,;{1} MPI MPll1 )

lrtetface Pai!flleler Assgimentsinthe PG/PC:


PC Ma ie~MPI .. . .
PCAdapte~PROFIBUSJ
Assign
I
I
bxerface 11 Paiarnetl!f ~ S\Jlnel _j $70...-.e .
S70NLINEAccen:
~ r M,ve
OK I Cancel He_lP~ '
, __

Figure 7-12. PG/PC Properties d ia log: Interlace Assignment lob.

374
Working with Simolic NET Networks

rii1
}jMPI_PrJ (,etwork) -- C:\ Palrick\ S7 _ProJech \ MPI_Pr i - IOI XI
F ~ .,

ii
0 2
1¥1P!{ 1)
l,1PI
.
SIMATIC 300(1) SIMATIC 300(2) SIMATIC 400( 1)
liiill C PU
316


m CPU
)10


II CPU
.;10-1


3 4 5

• ~
Figure 7-13. Ne!Pro Graphic configuration of PG/PC assigned to a specific MPI interface.

Quick Steps: Configuring a Programming Station (PG/ PC) on MPI

II 1
ACTION

Open the SIMA TIC Manager, lo the project where you wish to establish the PG/PC as
a sta tion on on MPI Subnet.

2 If the PG/ PC object is not a lready installed. selec t l he project folder, rig ht click. and
select Insert New Object ► PG/ PC. Skip this step if lhe PG/PC is already installed.

3 With the project folder selected, from lhe right pane, double click on lhe MPI subnet
object to open the NetPro graphical network configura tion tool.

Wllh lhe network configuration open. selec t the PG/PC object. right-click and selec t
Objec t Properties; or double c iick on th e PG/ PC object lo open the properties dialog.

5 From the General lob, you may modify the defa ult name PG/PC {I ). too na me you
choose. You may also modify o r enter a new Author o f the interface parameters, ond
modify or enter o Comment describing the use of the programming system.

6 Select lhe Interface lob, lo display existing Interfaces or c reate a new MPI interfac e to
which you wish to assign lo the PG/PC.

7 Select lhe Assig nment lob, to d isplay the configured MPI interfaces a nd interface
parameter se ts (I.e .. physically insta lled interfaces) previously denned in lhe PG/ PC.

8 From the Not Assigned b lock, selec t the logica l MPI interfa ce you wish to assign lo the
physical interface in lhe PG/PC: the n from the Interface Parameter Assignm ent
window, selec t the physical interface or the PG/PC;

Press the Assign button. The "Assign" but1on will b e g rayed out unless the config ured
interface you choose is networked a nd the selected interface parameter assignment
matches the configured interface.

9 With a log ical interface assigned to a physical MPI Interface, you may then activate
the S70NLJNE check box if you wish to activa te !his interface a s the c urrent means for
establishing and the online connection to STEP 7.

375
STEP 7 in 7 Steps

Configuring Global Data Communications on MPI


Basic Concept
Global doto /GD) communications is o simple cyclic dolo transfer service. integrated in all
57-300 and 57-400 CPUs. With this service. S7 PLCs may exch ange input (1). output (Q), b it
memory (M) , and dolo b lock (DB) memory areas between CPUs on on MPI subnet (and via
the S7-400 backplane). Global data transfer requires no p rogramming since configured data
is automalically transferred cyclically a t the end of each CPU scan similar lo the 1/0 update.
The response lime of globa l data exchange is therefore dependent on the CPU cycle of o ny
two partners involved.

Essential Elements
For GD communica tion. you must conFigure a global doto table. in the Ne/Pro Configuration
Tool. This table \viii define the CPUs Involved. the memory a reas sent. and the memory areas
in which dolo a re received. In the GD table, you may d efine up lo fifteen C PUs. where each
CPU is assigned to o column. As you define each CPU, the CPU and station identi fier appear
in the column header. In each row. in the cells beneath each CPU you will specify an
address for the CPU lo send or in w hich lo receive dolo. A CPU is identified os the sender if
the send address is preceded by the send character "► ". In a given row. a blank cell
indicates the CPU In this column is not par1icipaling in lhe data exchange.

Application Tips
You may use Input (I) addresses as global data receive a reas in the S7-300 and S7-400, If a
corresponding module is no t insta lled. In S7-400, you may handle g lobal data transfer from
you program, using SFCs. When the GD table is completed and compiled, each so-called
globa l d o ta row (GD row) receives a unique GO identifier (GD ID). You may use the GO ID as
o parameter inpul to sys1em functions (SFC). in th e S7-400, when exchanging global dolo
using SFC 60 (GO_SND) a nd SFC 61 (GD_RC V).

ltrt\ GO - [MPI( 1) ( Global data) - MPI_Prj) Riel £,t


~ GD Table Edll: Insert PLC View Window Help

SI:Mlt'l'IC ,:TJQTXC SDOWIC


GD D 310(1>\ 300(2)\ 400(1>\
CPU 3 16 CPU 3:16 CPV 4:16 - 1

1 GD .l. l . l
2 CD .l. 1. 2
1----i '• M, ...

3 Gl> .l. l . 3

.
CD 2 .1. 3
'
1==---1·· ...
'1 r.n
l·· -... . _ .._
4

Figure 7-14. Globa l Da to Table, for configufing address for global data exchange.

376
Working with Simolic NET Ne tworks

Quick Steps: Configuring Global Data Communications on MPI

ACTION

1 Open lhe SIMA TIC Manager and project w here you wish to creole a g lobal data
table.

2 From the menu select, Options ► Configure Network, or simply press the NetPra icon
to open the NetPro network configurolion tool.

3 When lhe networ1c configuration window opens, select lhe MPI subnet objec t.

4 Verify that all stations that will pa rti c ipa te in the g lo ba l data ta ble ore atta c hed to
lhe MPI subne t. Use the following step to o ltoch ony stolions not a lready a llached.

S Select the C PU o bject o f the station. right c lick. select Object Properties: press the
Properties button und er the Interface box lo open the MPI Interface d ialog. A tta c h
the station by selecling the subnet. sel the address if required. a nd confirm with OK.

6 Select the MPI subnel, right-click and select Define Global Data.

7 Select the first column. right o f the GD ID column, righ t-click a nd selec t CPU . .. to
define the first column ror o CPU that will porlicipole in the g lobal data excha nge.
When the project d ia log opens, d isplaying the project. expand the station objects
to display and select a CPU. Select a CPU a nd confirm the selection by pressing OK.

8 Repeat the procedure of defining a column for each CPU that will participate in the
g lo ba l d a ta exchange.

9 Starting with the first GD row and first CPU, specify o n address from which the CPU
will send d ata, or in w hich ii will receive dolo. To identify o send address, right-c lick
and select Sender: oil other addresses o re marked Receiver by default.

10 When done, from the menu select GD Table ► Save to save the GD table.

11 From the menu, select GD Table ;.. Compfle to generate a g lo ba l data Identifier (GD
ID) for each set of global data (GD Row) and to compile the d ownload data .

377
STEP 7 in 7 Steps

Adding and Configuring a PROFIBUS Subnet


Basic Concept
Connection of PROFIBUS stations on o common medium. comprised o f one PROFIBUS
segment or of several segments connected via rep eaters, is considered a subne t. In a la rge
plant or project, the complete PROFIBUS network may require multiple PROFIBUS subnets. In
STEP 7, you will need to create a subnet object for each of your p hysical PROFIBUS subnets.

Essential Elements
You may insert a new PROFIBUS subnet from i he SIMATIC Manager or lhe network
conngurolion tool. Once you insert the subneL you must configure ils General and Network
Settings properties (See fig ure below}. The General p roperties include b asic d ocumentation
suc h os Nome and Subnet ID. Modifying the subnet ID is unnecessary. since this oulomotically
d erived ID (STEP 7 d erived project number - subnet number} will a lways be uniq ue. Tne
Network Settings a llow you lo define PROFIBUS operating characteristics, including !he
transmission role. the highest station address (HSA). and lhe bus parameters.

PROFIBUS bus parameters ore actually the timing values for the token bus. You may define
the bus parameters. but since these values must be consistent for the entire network ii is not
recommend ed. Instead. STEP 7 o ffers predefined "Profiles." ea c h o f whic h optimizes lhe
p arameters for the makeup of a typical network. You can select a p rofile bosed on the
makeup o f your specific network.

Application Tips
II possible. you should creole and configure nodes that you wont to connect in a network in
the same project. By placing fh e stations in lhe same project, STEP 7 is able lo c heck your
en tries (e.g .• oddres.ses. connections. etc.) for consistency. In o large p lan t with several
statio ns. ii may be necessary to creo le a number of subnets. While you may manage these
subnets in a single project, you may decide lo handle the subnets in multiple projects. If
stations in d ifferent projects need to be connected. you may assign the station to more than
one subne t [i.e .• in d ifferent projects).

Propertie~ - PROFlllUS

Name: IPROFlBUS(31
S7 soonel ID. Joo20 - loll'56 ·
Project ~lh, I\Werehouul_ 1\PAOFlBUSP)
Stor~ e loeecio,i
ol the.pr,oiect lc:\Patrick\S7J'rojeds\\liaehous

At.4hor. jc.~_.Jo~,= =
Date created :?1 .09.2004 15:10:42
IAst modiied 21.09.2004 15:10;42
Comment _;]
I .:.l
OK
I Help I
Figure 7-1 5. PROFIBUS subnet Properties: General settings dialog.

378
Working with Simalic NET Networks

Properties - PROABU5 2S.l


General Netw~ SetH'9~ I
OplJons,..
Hlg-ie$l PAOFlBUS
Adrlress: 8 ~ Chenge

Tu,n1mi~1ion Rate: 45.45 (31 251 Kb?$


9175 Kbps
..
187.5 Kbp:
SOOK s

Proli~

Univertal(DP/ FMSJ
Use,-Oerl'led
Bus Paameter& .. j

I Cancel j __He_~__,
Figure 7-16. PROFIBUS subnet Properties: Network Sellings dialog.

Quick Steps: Adding and Configuring a PROFIBUS Subnet

ACTION

1 With the SIMATIC Manager open to the project of the new PROFIBUS subnet. select
the project folder. and then from the menu. select Insert ► Subnet ► PROFIBUS.

2 In the righl pone of lhe project window. double c lick on any subnet object or press
the Configure Ne/work loolbar bu tto n lo open the Network Configuration tool.

3 In the network conliguro1ion view. double click on lhe PROFIBUS subnel objec t or
right-click o n the objecl and select Object Properties to open the properties d ialog.

4 From lhe General lob. you may keep or modify the deloull Name of fhe subnel.
and fhe S7 Subnet ID (this STEP 7 derived ID number will a lways be uniq ue).

5 Also on the General tab, you may enter a deportment name in the Author field, or
perhaps your name if you ore defining the subnet p roperties; you may enter or
modify the Comment lines to describe the subnet's fu nction in the p roject.

6 Select the Network Se/lings lob. and a c tivate the Change c hec k box to modify the
Highest PROFIBUS Address. For best performance se t the actual highest address.

7 Use the Options button, to specify further. the physical characteristics of the subnet;
this will allow STEP 7 lo determine the catculo ted bus parameters more accura te ly.

8 From listed options. choose the Transmission Rate for lhe en tire PROFtBUS subne t. This
setting must not be higher than what is supported by the slowest node.

9 From lhe listed options. selecl a Profile of lhe ne lwor1<: configuratio n to delermine
p redefined bus liming parameters based on network makeup. To set the bus-
passing parameters manually, select the User-Defined profile. then the press Bus
Parameters bulfon.

10 Select OK lo accept the settings for the PROFIBUS subnet operating p roperti es.

379
STEP 7 in 7 Steps

Installing, Configuring, and Attaching an S7-300 PROFIBUS CP


Basic Concept
Alloching on S7-300 too PROFIBUS subne t requires the use o f o PROFIBUS communications
processor (CP) selec ted according to application requirements. The communications
processor must be p hysically inserted into a rock, included in the hardware configura tion,
and its inlerface parameters must be defined. Finally, ollachmenl of the CP to one of lhe
project 's PROFIBUS subnets completes lhe connec lion or lhe station to the nelwork.

Essential Elements
PROFfBUS networking options for the S7·300 include CPs that support lhe DP pro tocol (CP 342·
5, CP 342-5 FOi, or Iha ! support the FMS protocol (CP 343-5). CPs that support PROFIBUS DP
may support both the DP-mosle< and DP-sla ve func tionality. This capability allows the S7-300
to act as a DP-master or as DP-slave. Newer PROFIBUS CPs may a lso support routing fea tures,
which allows communication between networks (e.g.• Ethemel-lo-PROFIBUS).

Ikl·i·t§ iii 4444•11141tiHii9i dB13IUIJf;l•Ui-il

~lame·
Projed paltc
Stc.a,;,elocl!lion
ol the project lC:\Patrick\S7.Pioiecis\Prill.300

Aulho1 le.T.Jone~
D•!•cr....ted. 21.09,2004 16:20·55
LMI modirlf>d'. 21.09.2004 16·20.55
Convne~
.d
I'~ - - - - - - - - - - - .z.J
I OK I Cancel Jielp

Figure 7- 17. General Properties lab: CP 343-5 PROFIBUS Interface.

i4t·l·IPIJl4W44·lii-lf~iffli9;diiiidlJi;t•Jt\lf -
Gene,al Pa,em!llelf I
Adoess: JG .:)
Highest addle..s-. 126
T,-miuion ,ate: 1.S t,tbl:,~
Slb\el:
New...
I
f'Joperties,..
I
Delete
I

I OK
I Canca Help

Figure 7-18. Parameters la b: CP 343-5 PROFlBUS Interfac e .

380
Working with Simalic NET Networks

i~i;Prof_JOO (Network) · 0:\ 57._Projects\ Prol_JOO l!!J~EJ


' 11-J~ I 1
,1' 'I
t'R,)Fi8U5( I)
P.ROFIBUS

-
SlMATIC 300(1) SIMAT!C 300(2) SIMATIC 300(3)
fiiiii1 CPU CPU CP CPU er
!MWJ ltfJ [iiil] 316 343,6 liml 318 W,S

• 3
••
5 5
•• 7 6

Figure 7- 19. PROFIBUS Station addresses 4. S. a nd 6, shown attracted to the subnet in Ne!Pro.

Quick Steps: Installing, Configuring, and Attaching an S7-300 PROFIBUS CP

■ ACTION

I Open lhe SIMATIC Manager and project where the PROF!BUS CP will be inserted.
configured, and attached. If necessary, odd and configure a PROFIBUS subnet as
described in the p revious task, "Adding and Configuring a PROF/BUS Subne t."

2 With the project folder expanded, select the station where you will install the C P,
then From the right pone double click on the station hardware object lo open the
hardware configura tion tool.

3 Open the SIMATIC 300 catalog object to view the S7-300 component fo lders.

4 Open the CP-300 folder. then under the PROFIBUS sublolder open the appropriate
CP sublolder (CP-342-5. CP-342-5 FO, CP-343-5/. to selec t a DP. DP over fiber, or FMS
module. Select the desired CP and drag if to slot-4 or hig her in the S7-300 rock.

5 If th e interface properties dialog of the new CP does not open automatica lly, when
inserted. then selec t the CP, right-click and select Object Properties: lhen press the
Properties button to open the interface d ialog.

6 From the General tab, you may modify the default name o r the CP. You may a lso
enter a new Author of the CP configuration. and enter a Comment on the CPU use.

7 From the Parameters lob, set the Address tor this CP. as desired. or perform the next
step fo hove the next available PROFIBUS address (1 - 126) a utomatically assigned.

8 From the Subnet list box. select th e correc t subnet to which this communications
processor should be attached. Press the OK bu tton to confirm your selections.

9 From the menu, select Slatton ► Consistency Check to check fo r errors.

10 From lhe menu bar. select Station ► Save to save the configuration. Use Save ►
Compile to generate the System Doto object that you will download lo the CPU.

381
STEP 7 in 7 Steps

Building a Project with S7-300 Peer PROFIBUS Stations


Basic Concept
A PROFIBUS network of peer S7-300s is one in whic h multiple S7-JOO stolions o re on the some
subnet, have identical or similar characteristics. and hove equal a ccess la the network.

Essential Elements
Selecting a nd installing t11e appropriate PROFtBUS communications processor (CP) is olt that is
required to establish o n S7--300 station os o nelwork sta tio n. In this task. o n of the slalions will
use the same communications processor; however. the exac t module optio n will depend on
whether a copper or fiber (FO) media is used, and what communica tions p ro tocols must be
supported in your application.

Application Tips
In coses where the cenlrol rock for lhe S7-300 stolions will be identical or very simflor, you
should complete one stolio n lo include the rock. power supply. interface modules (IMs). o nd
sig nal modules (SMs) that will be identical in o il stations. ond then use the Cut ond Pas te lo
duplicate the station. You migh t c hoose to d uplica te th e orig inal sta tion prior lo inserting the
communications processor. When you manually insert the CP in each station, STEP 7 will
assign a unique address lo each. Otherwise. you will hove to modify each station address.

~ SIMATIC Manager - Prof_300 l!!lliJ£i


File Edit Insert PLC ','J ew Options Window Help

.~ 11 < No Fi
',;J! Prof_300 -- 0:\ 57 _Projects\ Prof_300 l!!lliJ £i
Prof_300 SIMATIC 300{1)
SIMATIC 300{2)
SIMA TIC 300(3)
MPl(1)
J-lr-", PROFIBUS(l }

Press Fl to get Help. l


Figure 7-20. Project w ith S7-300 Peer stations. MPI and PROFIBUS subnets.

-~ii Prof_300 ( ~etwork) -- D:\ S I _1>ro1ect.\ Prof _JOO 1!1I!J EJ


1
fl.1r ~ I
rv!PI
l<rJFIBll S( 1)
Pf OFIBUS
T . T ~
T
SIMATIC 300(1) SIMATIC 300{2) SIMATIC 300(3)
llllffl
liUW
c,v
) 15 lllD c,u t P
>1& )4)~ iilD CPU
) 16
,~
) '°'6

• 3
••
5 5
•• T 6


Figure 7-21. NetPro Graphic configuration of S7-300 Peer Stations o n PROFIBUS.

382
Working with Simolic NET Networks

Quick Steps: Building a Project with S7-300 Peer PROFIBUS Stations

ACTION

1 Start· the SIMATIC Manager and Cre a te o new Project using the New command.

2 When lhe New Project dialog oppeors, type in o p rojecl name in the Name field.
Verify that the Storage Location Pa th is where you wish the project to be stored.

3 With the project folder open in the SIMATIC Manager, from the menu select Insert ►
Station ► SIMATIC 300 Station. Insert at least two or more S7-300 stations.

4 Wi th the project folder selected. from the menu select Insert ► Subnet ► PROFIBUS.
The PROFIBUS subne t objecl will be inserled in lhe right pone of the project window.

S Double click on lhe subnet or on the toolbor p ress the Configure Network button lo
open the Network Configuration tool. The network configuration window will open
wilh objects Iha! represen l lhe PROFIBUS subnet. and lhe S7-300 stations you
creeled.

6 Double click on the PROFIBUS subnel object lo define the subnel operoling
properties (e.g .. Highest PROFIBUS, Address, Transmission Rote, and bus Profile) as
described in the p revious task "Adding and Configuring o PROF/BUS Subnet.")

7 Double click on the first station object (e.g., on the Station name) to open the
station in the Hardware Configuration lool. Configure a central rock by inserting the
required Rock. Power Supply. CPU. and PROFIBUS communications processor (See
Slep BJ.

8 When the CP is inserted. lhe properties dialog will open oulomotically; configure the
properties (including o unique address) and allach lhe C P lo the subnel as
described in lhe previous task " lnslol/ing, Configuring. and Al/aching a CP."

9 Save the central rock configuration and press the Configure Network. loolbar icon
to return to the network configuration. The slo tion will appear connected to the
PROFIBUS subnel when you return to the network configuro lion.

10 Repeal Slep 7 through Step 9 lo configure the remaining stations.

11 From lhe menu, select Network ~ Check Consistenc y to perform a check for errors.

12 From lhe menu bar. selecl Network ► Save .lo sove lhe network configuration. Use
Save and Compile to generate the System Doto lha l you will download to lhe CPU.

383
STEP 7 in 7 Steps

Installing, Configuring, and Attaching an S7-400 PROFIBUS CP


Basic Concept
Attaching on S7-400 too PROFIBUS subne t requires the use o f o PROFIBUS communic ations
processor (CP). sefecled according lo application requirements. You must insert lhe
commu nications processor into o rock. include ii In the hardware configuration, and define
its interface param e ters. Finally. ottochment of the CP to one of the project's PROFIBUS
subnets completes the connection of the stolion to the network.

Essential Elements
PROFIBUS networking options for the S7·400 include CPs lhot support the DP prolocol (CP 443·
5 Ext.). or that support the FMS p rotocol (CP 443-5 Basic). Newer PROFtBUS CPs moy a lso
support routing features. which a llows communicatio n between networks (e.g .. Ethemet-to-
PROFIBUSJ. PROFIBUS CPs must be installed in a rock tho! hos the communications b us (C-
Bus) , (e.g .• central roc k [CR). or universal rock (UR)).

lkl·l1t§litil?;i•iil;t';itbf§ldiii;itfli·dhtlf,J•ttJ1J
G~n(lta\ I Pnrameteit l

Name;
P1oject p!Jlh:
StOfage looalion
of !he project
Aulhor le. T. J ones
Dai:e cieoteit 21 09-2004 16·40:«
Lail rnodfied 21 OS 2004 16·40:«
Comrnehl:

I OK I
Figure 7-22. Ge neral lob: CP 443-5 Basic PROFIBUS Interface.

iPi!litilitiil4;hlild!®J916idliilihii;60tli1ItMfl

Addreu : 13 .:]
Higl¥.>st addre:s: 126
l ron,mi:sionrots: l ,5 Mbp,:
Slbnel:
-- not nelworl,.ed - · N'ew...
I
P10pertiea ,
I
Delete
I

I OK
I
Figure 7-23. Parameters lob: CP 443·5 Basic PROFIBUS Interface.

384
Working with Simolic NET Networks

.iffi
~~P,·of_400 (Network) •· C:\ Patrick\57_Projccts\Prof_4

.U....,.t-:1--
tvlf'I
- 1

PPOF,BUS( ·1)
PROFlSUS

SIMATIC 400( 1) SIMATIC 400(2) SUvlATIC 400(3)

II • ■ ■
CPU CPU CP CPU CP
416-1 41 &- I 44:).., 4l&-1 44'.l·S
llailc Da>io
■ ■ ■ ■
3 5 5 7 1

• ~
Figure 7•24. PROFIBUS Stollon addresses 3. 5. and 7. shown o ttrocled to the subnet in NetPro.

Quick Steps: Installing, Configuring, and Attaching an S7-400 PRO FIBUS CP

ACTION

1 Open the SIMA TIC Manager and project where the PROFIBUS CP will be inserted,
configured, and anached . If necessary, a dd and configure a PROFIBUS subnet as
described in lhe previous task. "Adding and Configuring a PROF/BUS Subnet."

2 With the project !older expanded, selecl the station where you will install I he CP.
then from the right pone double click on the sla tion hardware objec t to open the
hardware configura tion tool.

3 Open the SIMATIC 400 catalog object lo view the S7-300 component folders.

4 Open the CP-400 folder. then under the PROFIBUS subfolder open the approp ria te
CP subfolder (CP-443•5 Basic. CP-443-5 Extended). to selec l from the FMS or DP
modules. Select the desired C P and drag i1 to slot-4 or higher in the S7-400 rock.

5 II th e interface properties dialog of lhe new CP does not open automalically, when
inserted, then selec t the CP, right-clic k and select Object Properties: then press the
Properties button to open the interface dialog.

6 From the General tab. you may modify the default name of the CP. You may also
enter a new Author of the CP configuration, and enter a Comment on the CPU use.

7 From the Parameters tab. set the Address for this CP. as desired. or perform the next
step to have lhe next available PROFIBUS address (l-126) automatically assigned.

8 From lhe Subnet list box. select the correct subnet to which this communications
p rocessor should be attached. Press the OK bul1on lo confirm your seleclions.

9 From the menu. select Station ► Consistency Check to check for errors.

10 From the menu bar. select Station ► Save to save the configuration. Use Save ►
Compile lo generate lhe Sys te m Dalo object lha l you will download to the CPU.

385
STEP 7 in 7 Steps

Building a Project with S7-400 Peer PROFIBUS Stations


Basic Concept
A PROFIBUS network of peer S7--400s is one in which multiple S7-400 stolions ore on the some
subnet, have identical or similar characteristics. and hove equal access la the network.

Essential Elements
Selecting and installing t11e appropriate PROFtBUS communications processor (CP) is olt that is
required to establish o n S7-400 station os o nelwork station. In this task. on of the slalions will
use the same communications processor; however. the exac t module optio n will depend on
whether a copper or fiber (FO) media is used, and what communica tions pro tocols must be
supported in your application.

Application Tips
In coses where the cenlrol rock for lhe S7-400 stolions will be identical or very simflor, you
should complete one stolio n lo include the rock. power supply. interface modules (IMs). ond
sig nal modules (SMs) that will be identical in o il stations. ond then use the Cut ond Pas te lo
duplicate the station. You migh t choose to duplicate th e original station prior lo inserting the
communications processor. When you manually insert the CP in each station, STEP 7 will
assign a unique address lo each. Otherwise. you will hove to modify each station address.

~SIMATIC Manager - Prof_400 1!!!1@£1


File Edit Insert PLC \llew Options Window Help

~ , 1< No Fi

~~Prof_400 -- D:\ 57 _Projects\ Pror_400 l!!!I~ EJ


" .
Prol_400 SIMATIC 400(1)
SIMATIC 400(2)
SIMATIC 400(3)
MPl(1 }
PROFIBUS(1)

Press F 1 to get Help.


Figure 7-25. S7 Project with S7-400 sta tions. MPI and PROF1BUS subnets.

HH
,!i Pror_ 400 {Ndwu,k) - C:\Pdtritk\ S7 _Projf!Ch\ Prr,I_4 LL

PROFIBUS( I)
PROFIBUS

SIMAnc 400(1) SIMATIC 400(2) SIMATIC 400(3)

Ill • ill CPU CP


<1 18· 1 413.5
a.... II •CPU CP
4 111-1 +13-6
e....

3
••5 5 7
• 7

Figure 7-26. Net Pro Graphic configuration of S7-400 Peer Slotions on PROFIBUS.

386
Working with Simolic NET Networks

Quick Steps: Building a Project with S7-400 Peer PROFIBUS Stations

ACTION

1 Start· the SIMATIC Manager and Crea te o new Project using the New command.

2 When lhe New Project dialog oppeors, type in o p rojecl name in the Name field.
Verify that the Storage Location Pa th is w here you wish the project to be stored.

3 With the project folder open in the SIMATIC Manager, from the menu select Insert ►
Station ► SIMATIC 400 Station. Insert at least two or more S7-400 stations.

4 With the project folder selected. from the menu select Insert ► Subnet ► PROFIBUS.
The PROFIBUS subne t objecl will be inserled in lhe righl pone of the p rojecl window.

S Double click on lhe subnet or on the toolbor p ress the Configure Network b ulton lo
open the Network Configuration tool. The network configuration wind ow will open
wilh objects Iha! represen t lhe PROFIBUS subnel. and lhe S7-400 stations you
creeled.

6 Double click on th e PROFIBUS subnel object lo define the subnel operoling


p roperties (e.g .. Highest PROFIBUS, Address, Transmission Rote, and bus Profile) as
described in the previous task "Adding and Configuring o PROF/BUS Subnet.")

7 Double click on the first station object (e.g., on the Slotion name) to open the
station in the Hardware Configuration. Configure a central rack by inserting the
required Rock. Power Supply. CPU. and PROFIBUS commvnicotfons p rocessor (See
Slep BJ.

8 When the CP is inserted. lhe properties dialog will open aulomatically; configure the
properties (including o unique address) and altach lhe CP lo the subnel a s
described in lhe p re vious ta sk "lnslol/ing, Configuring. and Al/aching a CP."

9 Save the central rock configuration and press the Configure Network. loolbar icon
to return lo the network configuration. The sla lion will appear connected lo lhe
PROFIBUS subnel when you return to the network configuro lion.

10 Repeal Slep 7 through Step 9 lo configure the remaining stations.

11 From lhe menu, select Network ~ Check Consistenc y lo perform a check for errors.

12 From lhe menu bar. setecl Network ► Save . lo save lhe network configuration. Use
Save and Compile to generate the System Doto lho l you will d ownload to lhe CPU.

387
STEP 7 in 7 Steps

Configuring a Programming Station (PG/ PC) on PROFIBUS


Basic Concept
II you will need to gain remote access to the S7 PLCs. connec ted loo PROFIBUS network.
then you will have lo configure and allach a PG/PC station lo the subnet As w ith o ther S7
stalions, the PG/PC requires physical connection to the networl< and lhe logical
configuration and attachment. in o rder lo be known and recognized on lhe network.

Essential Elements
To establish a PC os o programming station on PROFIBUS, a PROFIBUS network cord (e.g., CP
5511 /CP 5611 or C P5412 A2) must be inslo lled and configured in Windows, and the
app ropriole SOFTNET or HARDNET driver must be inslalled. II you have a, PG programming
device (e.g., PG 720, PG 740). then ii will already be equipped with the MPI network. The
driver software for programming functions (PG/OP) over PROFIBUS is installed d uring the initial
installation of STEP 7. With the physical connection in place, you only need lo configure a
logical interface connec tion for the PG/PC.

To configure your programming device, you must first insert a PG/PC object in the Simatic
Manager or in the Network Configuration toot, and then configure and assign it an interface.
An Interlace defines lhe subne t. and node address. When you assign the interlace to one o f
the actual nelwork cards on the PG/PC. then ii will be adapled to the configured settings of
the interlace. including the operating properties of the subne t to which it is a ttached. If you
modify the configured setlings (e.g ., the network transmission rate). the interface on your
PG/PC is automatically adopted to match the new settings.

Application Tips
Since o nly one configured p rogramming device (PG/PC) Is allowed in a project. by c reating
several interfaces, w hich can be assigned to the PG/PC. you can conveniently switch
interfaces. Severa l interfaces may be assigned to a PG/P C, however only o ne con be
activated as the S70NLJNE interface at o given lime. Without this function. you would ha ve
to call up the "Setting the PG/PC Interface·• program and manually adapt the interface
settings of your PG/PC lo the configured settings.

Properties · l'G/ l'C


Gene1alJ Interfaces Atsignment ]
r Not Auigned
I Configured lntedaces:
I Type I Subnet
PROFIBUS ir-~rf .:);;c 1l PROFIBU S PROFtB US 11

lnte1foce Parameter Anignment, i, \he PG/PC


PC Adapter(MPll
PC Adap1e1[PROF rBUc-J

Anigned:

S70NUNE Ac011n:
..!J r Acwi:,

OK I Cancel Help I
Figure 7-27. PROFIBUS Interface Properties: Interface Parame ters dialog.

388
Working with Simolic NET Networks

rid
.};P<of_300 (...,twork) -- C,\P•lrlck\57_Prot~ct.\PM>f_30 .• lc l_~J

PROFIBUS( I J
PROFIBIJ':
lo

IIIiD
---
) 10
'
SIMATIC 300( 1)
CPU CP
3Cl¢ liiIII CPU CP
310
'
SIMATIC 300(2)
343·6 m
'
SIMATIC 300(3)
CPU CP
) 18 ~-6

•3 • 4
•5 •5 • •6
7

Figure 7-28. NetPro Graphic configuration of PG/PC and Peer S7-300 Sta tions on PROFIBUS.

Quick Steps: Configuring a Programming Station (PG/ PC) on PROFIBUS


'
ACTION

1 Open the SIMATIC Manager. to the p rojec t where you wish to establish lhe PG/PC as
o stolion on o PROFIBUS Subnel.

2 If th e PG/PC object is not already installed. selec t the project folder, right click, and
select Insert New Object ► PG/ PC. Skip this step if the PG/PC is already installed.

3 With the project folder selected. from the right pone. double click on the PROFIBUS
subnet object to open the NetPro graphical network configura tion tool.

4 With the network configuration open, select the PG/PC object. right-click and select
Object Properties: or double click on the PG/PC object to open the properties
dialog.

5 From the General lob. you moy modify the default nome PG/PC (I ). too nome you
choose. You may also modify or enter a new Author of the interlace porometers. and
modify or enter o Comment describing the use of the programming system.

6 Select the Interlace lob, to display existing interfaces or create a new MPI interface
to which you wish lo assign lo the PG/PC.

7 Select the Assignmen/ lob. to display the configured PROFIBUS interfaces ond
interface parameter sets [i.e.• physically installed interfaces) previously defined in the
PG/PC.

8 From the Not Assigned block. selec t the logical PROFIBUS interface you w ish to assign
to the physical interface In the PG/PC; then from the Interface Parameter Assignment
window, selecl lhe physical PRO FIBUS inlerfoce found in the PG/PC;

9 Press the Assign button. The "Assign" button will be grayed out unless the configured
interface you choose Is networxed and the selected interface parameter assignment
(i.e., PROFIBUS Network card) matches the configured interface.

With o logical interface assigned too physical PROFIBUS interface. you moy then
activa te the S70NLINE check box if you wish to activate this interface as the current
means for establishing and the online connection lo STEP 7.

389
STEP 7 in 7 Steps

Configuring PROFIBUS Communications Connections


Basic Conc ept
A connection is o logical channel established be tween two communication partners. for the
purpose of dolo exchange using a specific communication service. Before a sl otlo n co n
commu nicate over PROFIBUS using FOL, FMS, or S7 Functions, you must first configure a
connection of that type between the station and one or more remote partners. In a given
CPU. depending on compatibility. you may c reate connections of di fferent types and to
different por1 ners. Connections for a CPU ore created using the Network Configuration Tool.
and o re contained in who1 is referred lo as the CPU connection table.

Essential Elements
On PROFIBUS. you may configure connections that facilitate FDL. FMS. or S7 communicatio n
services. FOL communication is possible between S7 PLCs, S7 and SS PLCs. or between S7
PLCs and o ther FOL compatible devices (e.g.. PC stations). FMS communica tion is possible
between S7 PLCs. between S7 a nd SS PLCs, and between S7 and other FMS compatible
d evices je.g .. PC stations). Anally. S7 communica tion is possible between S7 PLCs. operator
statio ns. and PCs. tr you configure on S7 connec tion to a station in ano ther project. you will
ho ve to specify a connection name. The connectio n name is used to link partners across
project boundaries. Alier the connection Is rinked. you canno t edil the connection name.

Application Tips
To c reole connections for a station, you must hove connected the intended porln er sta tions
lo lhe subnet. using a communications processor !hat supports lhe connection types you
intend to creole. After defining the required connection table for the CPUs in your p roject,
you should print lhe connections report as a reference tool for writing the communications
functions in you program. Each S7 connection will genera te a connection ID, which for some
you will need as o block input parameter when programming the com m unication function.

~ n Partner - - - - - - - - - - - - - ~
EHo) In the c1Xrent project
i l:l l!!.D Prol_301l
I
'

1
; -§ PG/PC(1J
~-Wl SIM4TIC 30~ )
i -··-II CPU 316
I IB· !Iii SIMATIC30~ )
!· ·; - .. (U n$J!e cili111d)
,-, - .. , All broadcast statioos
- -- All flllllticast staliont
/!!D In Lilknown l)loje-i:t

f roiect: jProf_300
f tot.ion· jSIMATIC 300[2)
M~e: jCPU 316

Comecoon-· - - - - - - - - - - - - - - - ~
lYP6: I
Fl,tS connection 3
,-,, . E-mai comection
1'" Q,s~ PfO FOL conneolion
.FM S connect ,on
ISO tr1inl'l)01t connection
OK. I
1S0-oo-TCP connection
--- - - ·- Point~o- • connection

Figure 7-29. Dialog for new communicatio ns connections.

390
Working with Simalic NET Networks

r,I d
,
MFI
PROF'l3US{ I)
PROl=13US

--.- - -
SIMAnc 300( 1) SIMATIC 300(2) SIMATIC 300(3)
[EJ' PG/PC(1} c,v c.,
fiiii) c•
)4U 2\IJ l4J.cl m e,.u c,
310 3,C.1-cl

2 0
J
•4
• •
5 5

7

8


0001 0100 '0001 0 100 ISlM llC XO(:!) I Cl'U 3 16 r!AS eomococn l"ft0f8US(I) (l'R(\AlUS)
... - .
00020100
- -~· ·-
~0001 0 100
~
s;MllC300(3)/(PU~6 - n i i s ~

-• •fMftlUS(I) ~ )
OCOJ0100 PQ.l'C(1) FMS eomcdlon ~8US(I) (rR(IRlUS)


Figure 7-30. Network configuration tool. w ith connection table displayed for selec ted CPU.

Quick Steps: Configuring PROFIBUS Communications Connections

ACTION

l Open the required projec t and double click on any subnet object to op en the
network conligurotion tool in order to create new communications connections.

2 With the network configuration in view, selec t the CPU module for which you wish lo
creole connections. When lhe CPU is selec ted. its connec tion table is displayed.

3 With !he desired CPU selec1ed. you may double click on on empty row. or simply
right click on on empty row and select Insert New Connection.

4 The New Connec tion dialog will d isplay a p roject tree listing the stations of the
p rojec t, other th an 1he sta tion you hove selected. that you may d efine as the
connection partner. You may click on o specific 57-300 or 57-400 partner. or in the
case of FDL. and FMS connections, you may also setec1 All Broadcas t Sia /ions. FDL
connections also suppor1 communication lo All Multicast Sta tions .

5 Be fore selecting a connection type. activate lhe checkbox "Display properties


before Inserting," ii you wish lo view or modify the derived connection parameters
before the connection is inserted. De-activa te the checkbox ii you do not wish lo
view the assigned connection parameters before you save your entries.

6 Then, from the Type drop list. choose lhe connection type you wish to creole (e.g.,
FOL. FMS, or S7 connection); and then press the OK button to enter the connection
and view the connection properties.

7 Although the connec lion properties will vary depending on th e connec1ion type.
you may gel assistance from the online help on modifying the defoull p arameters.

8 Confirm each connection entry w ith 1he OK button and STEP 7 will list the Local ID
and Partner ID for the connec tion. the connection type. and whether the local
station is Active or Passive in establishing !he connection.

9 From the menu bar. selec t Network ► Save. to save the network configuration. Use
Save ► Compile lo generate the System Doto that you will download to !he CPU.

391
STEP 7 in 7 Steps

Adding and Configuring an Ethernet Subnet


Basic Concept
Connection of Ethernet nodes on o common medium. comprised of one or of several
Ethernet segments connected via repeaters. is considered a subnet. In a large plant or
project, the complete network may require several Ethernet subnets. In STEP 7. you will need
to c reate a subnet object for each of your physical Ethernet subnets.

Essential Elements
You may insert a new Ethernet subnet from the SIMA TIC Manager or the network
configuration tool. Once you insert lhe subnel. you may configure ils General properties (See
figure betowl. The General properties include basic documentation such as Name a nd
Subnet ID. STEP 7 derives the subne l name. but you change lhe name if necessary. STEP 7
also derives the subnet ID (p rojec t number - subne t number), which you may modify. This is
unnecessary since this ID w ill a lways be unique. You do not need lo set any opera ting
parameters for on Ethernet subnet.

Application Tips
If possible, you should crea te and configure nodes that you wont to connect in a network in
the some project. By p lacing the stations in the some project, STEP 7 is able lo check your
entries (e.g., addresses, connections, e tc.) for consistency. In a la rge p lant with several
statio ns, it may be necessary to creole o number of subnets. While you moy manage these
subnets in o single project, you may decide to handle the subnets in multiple projects. If
stations in d ifferent projects need to be connected, you moy assign the station to more than
one subne t (i.e .. in d ifferent projects).

I II

Genorol I
Name: 1Elhemet(2)_

57 iubnet 1D: 10020 . ,.005


-_ 7_

Project pall !\Warehouse_1\Ethernet(2l


5 torage location
of the project jC;\Patrick \S7_Projects\W arehous

Author le.T.Jones
Date created: 21.09.2004 15:28:46
Last modJied: 21.09.2004 15:28:46
Commeri:

.:::J
DK I Cancel
I
Figure 7-31. Industrial Ethern e t subnet Properties: General settings dialog.

392
Working with Simalic NET Networks

Iii
~- Ethr_400 (Network) -

c:r ru
In justn al Ethernet

C:\ Patrlck\ S7_Pro}ects\ Ethr_400

MPl(1)
MPI

Figure 7-32. Newly inserted Elhernet Subnet. graphically shown in the Net Pro.

Quick Steps: Adding and Configuring an Ethernet Subnet

ACTION

1 Start a nd open the SIMA TIC Manager to the project of the new Ethernet subnet.
select the project folder, and then from the menu. select Insert ► Subnet ► Industrial
Ethernet.

2 In the right pone of lhe project window, double c lick on any subnet object or press
the Configure Network !oolbar bu tton to open the Network Configuration tool.

3 In the nelwork configuration window, double c lick on the Ethemet subnet object or
right-click on the object and select Object Properties lo open the p roperties d ialog.

From the General tab, you may keep or modity the default Name of the subnet.
and the S7 Subnet ID (this STEP 7 derived ID number will a lways be uniq ue).

5 Also on the General tab. you may enter o department name in the Author field, or
perhaps your name if you ore defining the subnet p roperties; you may enter or
modify lhe Comment lines to describe lhe subnel's fu nction in the project.

6 Select OK lo accept the new Ethernet properties.

393
STEP 7 in 7 Steps

Installing, Configuring, and Attaching an S7-300 Ethernet CP


Basic Concept
Attaching on S7-300 to on Ethernet subnet requires the use of on Ethernet communications
processor (CP) selec ted according to the appticolion req uirements. Th e CP must be
physically inserted into a rock, included in the statio n's hardware configuration. and its
interface para meters must be defined. Finally. you must attach the CP to one of the projec t's
Ethernet subnets to comple te the connec tion of the station to the network.

Essential Elements
Ethernet networking options for the S7-300 include CPs tha t support ISO transport connections
only (CP 343-1 ISOJ; those that supp ort TCP transport connections only (CP 343- 1 TCP); CPs
lhot support both ISO and TCP (CP 343-1 ); and CPS that support inlernet capabilities (CP-343-
1 IT). o r these CP groups, newer CPs will atso support routing features. w hich allows
communication between networks (e.g., Ethemet-to-PROFIBUS).

IPi!UMlit4W4tHUIH41MiMiiiGl#llll;i•JLJJJ

jce.OO.lliOl.00 00 II a 11bnet it selected.


the m,tt avalable ;,ddce•• is. « wasted

G&'.ew4y
(: r,c n J ,~,~
j::ss2ss oo
(" J~c:e,

I Addrm:- J1!R 00 (11

EU,omet[l )

j
OK I C4!lcs

Figure 7-33. Parameters lab: CP 343-1 Ethernet Interface.

IPl+tJlitMP,Bl,Bit,ii§IEBi•ilGIIID·tiiit

MACoddrc>s: jc:&OIJ.ffi-OHJl-03 II o l<.Cnel is telecl~


11,e neJ<t av-lii6ble addr~ i; :ygoe;~

"' ijelewa,- - - - - - - - - - ,
IP oddress:
I" Do~ U1>el°"'el
Slbnel mask: 1255.ao,o
r Use 1owc
Addle~ i ,o O1

Propedie1..

C4ncel. I
Figure 7-34. CP 343-1 Ethern et Interface activated for IP protocol use.

394
Working with Simalic NET Ne tworks

Quick Steps: Installing, Configuring, and Attaching an S7-300 Ethernet CP

ACTION

1 Open lhe SIMATIC Manager and project w here the Ethernet CP will be inserted,
configured, and o lloched. If necessary, odd and configure on Ethernel subnel os
described in the p revious task, "Adding and Configuring on Ethernet Subnet."

2 With lhe project folder expanded, select the station where you will install the CP.
then from the right pone doub le click on the sta tion hardware object to open the
hardware configuration tool.

3 Open the SIMATIC 300 catalog object lo view the S7-300 component folders.

4 Open the CP-300 folder, and then under the tndustrlal Ethernet subfolder open the
ap propriate CP sub folder {e.g.. CP-343-l , CP-343-1 ISO, C P-34 l · l TCP, C P-443-1 IT, or
C P-341-PN). Select the desired CP and drag ii lo slot-4 or higher in the S7-300 roc k.

5 If th e interface properties dialog of the new CP does not open oufomo ticolly, when
inserted. then selec l the CP. right-click and select Object Properties: lhen press the
Properties b utton to open the interface dialog.

From the General tab, you may modify the default name of the CP. You moy also
enter o new Author of the C P configuration, and enter o Comment on the CPU use.

7 From the Parameters fob, set the Ethernet MAC Address for this CP. or perform Step
8 lo hove the next available address outomoticolly assigned. If no other sta tions ore
already connected, the default MAC address of 08.00.06.01.00.00 is displayed.

8 From the Subnet list box, selec t the correc l subnet to w hich this communications
processor should be a ttached. Press the OK bu tton to confirm your selections.

9 If th e CP supports the IP Protocol and TCP/IP will be used in this application, then
activa te the c heckbox labeled IP Protocol ls being Used; in the IP Address and
Subnet Mask fields, enter the IP and subnet mo sk address provided for the CP. then
occepl your enlries wilh the OK bullon.

10 From the menu, select Statlon ► Consistency to perform o check for errors.

11 From the menu bar. select Station ► Save, to save the configuration. Use Save ►
Compile to generate the System Doto that will be downloaded to the CPU.

395
STEP 7 in 7 Steps

Building a Project with S7-300 Peer Ethernet Stations


Basic Concept
An Ethernet network of peer S7-300s is one in which mulliple S7-300 stations ore on lhe some
subnet, have identical or similar characteristics. a nd have equal access la lhe network.
Essential Elements
Selecting and installing the appropriate Ethernet communications processor (CP) is all th at is
required ta estoblish o n S7-300 sta tion as o network sta tion. In this losk. on of the stations will
use lhe some communicolions processor; however. the exac t module option will depend on
whether a copper or fiber (FO) media is used, and what communications p rotocols must be
supported in your application.
Application Tips
In coses where the cenlrol rock for the S7-300 slofions will be identical or very similar. you
sho uld complete one statio n lo includ e the rac k, power supply, interface modules (IMsl, and
signal modules (SMs) that will be identical in all stations. and then use the Cut and Pas te to
d uplicate the station. You might c hoose to dupllco le the original station prior to inserting lhe
communications processor. When you manually insert the CP in each station. STEP 7 will
assign o unique address to each. Otherwise. you wilt hove lo modify each station address.

~ SIMATIC Manager - Ethr _300 fl(il EJ


File Edit Insert PLC View Options Window Help
n
-
-'< I)
...
•·
•- J < No Fi

'~1 Ethr_300 -- D:\ 57 _Projects\ Ethr _300


. . . .
- - - - - --
!!l(il EJ
a -{:] Ethr_300 SIMATIC 300(1)
IB·11l) SIMATIC 300(1 1 SIMATIC 300(2)
ffi.. lii] SIMATIC 300(21 SIMATIC 300(3)
f±J· Iii] SIMATIC 300(3) MPl{1)
Etneme~1)

Press Fl to get Help.


Figure 7-35. Project wi th S7-300 Peer stations, MPI and Industrial Ethernet subnets.

t~Eth,r _300 (Netwotlc) -- D:\S7_Projccts\Ethr _300 l!!ll!J £J


Ethernet( 1)
Industrial Ethernet

1,IP'( 1i
MPI

!iml 3!8
Sltv1ATIC 300( 1)
CPU CP
34:J.l !lill]
SIMATlC 300(2)
CPU CP
116 )"3. 1 11ml na
_,
SIMAllC 300(3)
CPU CP

•• 2
• •
4
••
6

-1 ~
Figure 7-36. Ne!Pro Graphic configuration of Peer S7-300 Stations on Industrial Ethern et.

396
Working with Simolic NET Ne tworks

Quick Steps: Building a Project with S7-300 Peer Ethernet Stations

ACTION
I

1 Start· the SIMATIC Manager and Crea te o new Project using the New command.

2 When lhe New Project dialog oppeors. type in o p rojecl name in the Name field.
Verify that the Storage Location Pa th is w here you wish the project to be stored.

3 With the project folder open in the SIMATIC Manager, from the menu select Insert ►
Station ► SIMATIC 300 Station. Insert at least two or more S7-300 stations.

4 With the project folder selected. from the menu select Insert ► Subnet ► Industrial
Ethernet. The subne l object will be inserted in the right pone of fhe p rojecl window.

S Double c lick on the subnet, or press the Configure Ne twork toolbor button to open
the Network Configura tion tool. The network configuratio n window will open with
objects that represent lhe Ethernet subnet. and the S7-300 slolfons you crea ted.

6 Double c lick on the first station o bject (e.g., on the Station name) to open the
slotion in lhe Hard ware Configuration tool. Configure a central rock b y inserting the
required Rack. Power Supply. CPU. and the Ethernet Communications Processor.

7 When lhe CP i.s inserted. lhe properties d ia log will open outomotically; configure lhe
properties (including o unique address) and attach the C P to the subnel as
described in the p revious task "Instolling, Configuring, a nd Altaching a C P."

8 Save the central rock configuration and press the Configure Nelworf< toolbor icon lo
relurn to lhe network configura tion. The sta tion will appear connected lo the
Industrial Ethernet subnet when you relurn to the network conflg uroHon.

9 Repeal Step 6 through Step 8 lo config ure the remaining slollons.

10 From lhe menu, selec t Network ► Check Consistency to p erfo rm a check for errors.

11 From the menu bar. select Network ► Save. to save !he network configuration. Use
Save and Compile to generate the Syslem Da ta tha l you will download to lhe CPU.

397
STEP 7 in 7 Steps

Installing, Configuring, and Attaching an S7-400 Ethernet CP


Basic Concept
Attaching on S7-400 to on Ethernet subnet requires the use of on Ethernet communications
processor (CP) selec ted according to the application requirements. Th e CP must be
physically inserted into a rock, included in the station's hardware configuration. and its
interface parameters must be defined. Finally. you must attach the CP to one of the projec t's
Ethernet subnets to comple te the connection of the station to the network.

Essential Elements
Ethernet networking options for the S7-400 Ethernet includes CPs that support ISO lronsport
connections /CP 443- 1 ISO); that support TCP transport connections (CP 443- 1 TCP); CPs that
support both ISO and TCP connections (CP 443- t ): and CPs that that support internet
capabilities (CP-443-1 IT). Of these CP groups. newer CPs will also support rou ting features,
which allows communication between networks /e.g .• Ethemet-to-PROFIBUS).

IPNII91i1Niltiil,i41Mli6tii,iiiiktUaMil

If aatlr'te! i,,celacled.
raaoo 06 0 100 00 the nol<t .W$l!ll>le ~ - ",uggeated.
r IP Pllllocd ls berg wed
Gae,;~
IPaddte~ 114 10 1
t:" Uo t,ul uic •OU1t'
Subnbi-1<. 1.£ :l5(l0
r u ~,,,,,.,,,
Ad(te,t, I141 IIJ (i I
New•.

OK I Coned I Help

Figure 7-37. Parameters tab: CP 443-lEthernet Interface.

iAl JHYti!¥iHINl,t§ifiii§idBl•iCiiiitllttit
1

MAC odd-au; 1(18.00 06-01 -4)0,03 If • ...tr.ot be ,elected.


lhc riei« ovolltib\:, oddo'en it W!)Qettcd.

- Ga!e,w,y•- - - - - - - - ~
1140.en o1 r- Do not u,e rout,c
)255255.0.0
r u•• ,oui.,
Adctcn: (1 ◄r 00 0 I
Subnet
- not netwaked •· tlow ..

OK J Canul I Help I
Figure 7-38. CP 443-1Ethernet Interface ac tivated for IP protocol use.

398
Working with Simalic NET Ne tworks

Quick Steps: Installing, Configuring, and Attaching an S7-400 Ethernet CP

ACTION
I

1 Open lhe SIMATIC Manager and project w here the Ethernet CP will be inserted,
configured, and o lloched. If necessary, odd and configure on Ethernel subnel os
described in the p revious task, "Adding and Configuring on Ethernet Subnet."

2 With lhe project folder expanded, select the station where you will install the CP.
then from the right pone doub le click on the sta tion hardware object lo open the
hardware config uration tool.

3 Open the SIMATIC 400 catalog object lo view the S7-300 component fo lders.

4 Open the CP-400 folder, and then under the tndustrlal Ethernet subfolder open the
a p propriate CP sub folder (e.g.. CP-443-1 , CP-443-1 ISO, C P-443-1 TCP, C P-443-1 IT, or
C P-443· 1PN). Select the desired C P and d rag it to slot-4 or higher in the S7-400 rock.

5 If th e interface properties dialog of the new CP does not open outomo ticolly, when
inserted. then selec t the CP. right-click and select Object Properties: lhen press the
Properties b utton lo open the Interface d ia log.

From the General lob, you may modify the defa ult name of the CP. You may also
enter o new Author of the C P configuration, and enter o Comment on the CPU use.

7 From the Parameters lob, set the Ethernet MAC Address for this CP. or perform Step
8 to hove the next available address outomotically assigned. If no other sta tions ore
a lready connected, the default MAC address of 08.00.06.01.00.00 is displayed.

8 From the Subnet lisl box, selec t the correc l subnet to w hich this communications
processor should be a ttached. Press the OK bu tto n to confirm your selections.

9 If th e CP supports the IP Protocol and TCP/IP will be used in this application, then
activa te the c heckbox labeled IP Protocol ls being Used; in the IP Address and
Subnet Mask fields, enter the IP and subnet ma sk address provided for the CP. then
accepl your enlries wilh the OK button.

10 From the menu, select Statlon ► Consistency to perform o check for errors.

11 From the menu bar. select Station ► Save, to save the configuratio n. Use Save and
Compile lo generate the System Doto that you will download to the CPU.

399
STEP 7 in 7 Steps

Building a Project with S7-400 Peer Ethernet Stations


Basic Concept
An Ethernet network of peer S7-400s is one in which mulliple S7-400 stations ore on lhe some
subnet, have identical or similar characterislics. and have equal access la lhe network.

Essential Elements
Selecting and installing the appropriale Ethernet communications processor (CPI is all that is
required to establish on S7-400 station as a network station. In this task. all of the slotions will
use the same communications processor; however. the exac t module option will depend on
whether o copper or fiber (FO) media is used. and what communicolions pro tocols must be
supported in your application.

Application Tips
In coses where the central rack for the S7-400 stations will be identical or very simflar, you
should complete one station to include the rack. power supply. interface modules (IMs). and
signal modules (SMs) that will be identical in all stations. and then use the Cut and Pas te lo
duplicate the station. You migh t choose to duplicate lhe original stafion prior lo inserting the
communications processor. When you manually insert the CP in each station, STEP 7 will
assign a unique address to each. Otherwise. you will hove to modify each station address .

• w -

File Edit lnsert PLC View Options Window Help


0
- .!l. ..
•·•·

l,;1] Ethr _ 400 -- C:\Patrick\ 57_Projects\ Ethr_ 400

SIMATIC 400(1)
SIMATIC 400(2)
SIMATIC 400(3)
MPl(1)
Ether nel(1)

Press Fl to get Help. l


Figure 7-39. Project with S7•400 Peer stations. MPI and Industrial Ethernet subnets.

":!-~ fthr_ 40CI (Netw ork) - • 0:\ 5 ·1_l"roJects\fth r _ 400 l!I@ Ei

Ethernet( 1)
Industrial Ethernet
''Pl( I)
Pl
_ t _ _I
SIMATlC 400(1) SIMA TIC 400(2) SIMATIC 400(3)
CPU CP
4 1~ 1 443- t

■ •
CPU CP
41~1 ~ I

■ •
II CPU
<10·1 ~-I


CP


3 5 1

Figure 7-40. NelPro Graphic configuration of Peer Sl-400 Stations on Industrial Ethernet.

400
Working with Simolic NET Ne tworks

Quick Steps: Building a Project with S7-400 Peer Ethernet Stations

ACTION

1 Start· the SIMATIC Manager and Crea te o new Project using the New command.

2 When lhe New Project dialog oppeors. type in o p rojecl name in the Name field.
Verify that the Storage Location Pa th is w here you wish the project to be stored.

3 With the project folder open in the SIMATIC Manager, from the menu select Insert ►
Station ► SIMATIC 400 Station. Insert at least two or more S7-400 stations.

4 With the project folder selected. from the menu select Insert ► Subnet ► Industrial
Ethernet. The subne l object will be inserted in the right pone of fhe p rojecl window.

S Double c lick on the subnet, or press the Configure Ne twork toolbor button to open
the Network Configura tion tool. The network configuratio n window will open with
objects that represent lhe Ethernet subnet. and the S7-300 slolfons you crea ted.

6 Double c lick on the first station o bject (e.g., on the Station name) to open the
slotion in lhe Hard ware Configuration tool. Configure a central rock b y inserting the
required Rack. Power Supply. CPU. and the Ethernet Communications Processor.

7 When lhe CP is inserted. lhe properties d ia log will open outomotically; configure lhe
properties (including o unique address) and attach the C P to the subnel as
described in the p revious task "Instolling, Configuring, a nd Altaching a C P."

8 Save the central rack configuration and press the Configure Nelworf< toolbar icon
to return lo the network conligura1ion. The slo tion will appear connected lo lhe
Industrial Ethernet subnet when you relurn to the network config uroHon.

9 Repeal Step 6 through Step 8 to config ure the remaining slollons.

10 From lhe menu, selec t Network ► Check Consistency to p erfo rm a check for errors.

11 From the menu bar. select Network ► Save. lo save the network configuration. Use
Save and Compile to generate the Syslem Da ta tha l you will download to lhe CPU.

401
STEP 7 in 7 Steps

Configuring a Programming Station (PG/ PC) on Ethernet


Basic Concept
II you will need to gain remote access lo the S7 PLCs. connec ted lo on Etherne t subnet. lhen
you will have to configure and logically attach a PG/PC station to the network. As with other
hardware sta tions in the subnet. there is the physical connection of lhe PG/PC lo the network
and the logical configuration using the STEP 7 Hordwore Configuration Tool.

Essential Elements
To establish o PG/PC as a programming station on Industrial Ethernet. on Elhernet-
cornpolible network interface card must be installed in the PC. the appropriate SOFTNET. or
HARDNET d river must be installed o n th e PC, a nd the network interface cord must be
configured in Windows. With the physical connectio n in p lace. you need only to complete
the logical connec tio n of the PG/PC programming statio n.

Application Tips
As o rule. you should insloll lhe required Eth ernet d river first. and Ihen physically insloll lhe
required Elhernel network interface cord in to your PC. In this way, lhe appropriate SOFTNET
or HARDNET driver is in place w he n you attempt to insta ll the network interface card in
Windows. Recall. lhol the software drivers. for th e programming services (PG/OP) over
Ethernet. ore installed as p ort of each Etherne t driver package.

~ SIMA TIC Manager - Ethr _ 400 .


F~e Edit Insert PLC View Options Window Help

I <N_o Filter >


SIMATIC 400(1)
SIMATIC 400(2)
SIMATIC 400(3)
PG/PC(1)
MPl(l)

----------------------~---_-_-_-_-_-_-_------
Press F1 to get Help. I
Fig ure 7-4 1. 57 Projec t with Peer S7-400 Statio ns, PG/PC stalian, M PI. and Ethernet subnets.

402
Working with Simalic NET Networks

0Ethr _400 (Network)-- r.:\Patrick\S7_Pro1e~t~\Rh1·_-100


1

PG/PC(1)

Ethernet( I) •
lndustn::;I Etherne:
f"1Pl( I)
t\llPI

SIMATIC .::100( 1) SIMATIC 400(2) SIMATIC 400(3)

■• • II II
CPU CP CPU CP CPU CP
410-1 443-1 410.1 440- 1 41~-I 443-1

3

5
• •• 7
.=.I
• 2..1
Figure 7-42. NelPro Graphic configura tion of PG/PC and Peer S7-400 Stations on Ethernet.

Quick Steps: Configuring a Programming Station (PG/ PC) on Ethernet

ACTION

I Open the SIMATIC Manager, lo the proj ec t where you wish to establish the PG/ PC as
a stolion on on Ethernet Subnet.

2 If th e PG/PC object is not already installed. selec l the project folder, right click. and
select Insert New Object ► PG/ PC. Skip this step if the PG/PC is already installed.

3 With the project folder selected. from the right pane, double click on the Ethernet
subnet object lo open the NetPro graphical network configura tion tool.

4 With the network configuration open. select the PG/PC object. right-click and selec t
Object Properties: or double click on the PG/PC object lo open the properties
dialog.

5 From the General tab. you may modify the default name PG/PC / t ). too name you
choose. You may also modify or enter a new Author of the interface parameters, and
modify or enter a Comment describing the use of the programming sys1em.

6 Select the Interface tab. to display existing interfaces or create a new Ethernet
interface lo which you wish to assign to the PG/PC.

7 Select the Assignmen t lob. lo display the configured Elhernel interroces and
interface parameter sets [i.e.. physically installed interfaces) previously defined in the
PG/PC.

8 From the Not Assigned block, selec t the logical Ethernet interface you wish to assign
to the physical interface In the PG/PC; then from the Interface Parameter Assignment
window, selecl !he physical Elhern el interface round in lhe PG/PC;

9 Press the Assign button. The "Assign" button will b e grayed out unless the configured
interface you choose Is networked and the selected interface parameter assignment
/i.e .. Ethernet cord) matches the configured interface.

403
STEP 7 in 7 Steps

Configuring Ethernet Communications Connections


Basic Concept
A connecfion Is a logical channel established be tween two communication partners. lor the
purpose of data exchange using a specific communication service. Before a stalion can
communicate over Ethernet using ISO, ISO-on-TCP. TCP/IP, UDP, or S7 communications
services, you must first configure o connection of that type between the station and one or
more partn ers. In a given CPU. depending on compatibility, you may create connec tions or
different types a nd to d ifferent partners. Connections for a CPU ore created in the Network
Configuration Tool, a nd ore contained in w ha t is relerred to as the CPU connection table.
Essential Elements
On Ethernet. you may configure connections to lacili tate ISO, ISO-on-TC P, TCP/ IP. UDP. E-
Moil, or S7 services. ISO. ISO-on-TCP, TCP/IP. and UDP communications services are possible
between S7 PLCs. S7 and SS PLCs, or b etween S7 PLCs and PC stations with compatible ISO or
TCP/IP protocols. Finally. S7 communication is possible between S7 PLCs. operator stations.
and PCs. If you configure on S7 connection to a station in another p roject. you will hove to
specify a connection name. This reference is used to link partners across project boundaries.
Arter the connection is linked. you cannot edit the connection name.
Application Tips
To creole connections for a sta tion, you must hove connected the intended partner sta tions
to the subnet, using a communications processor that supports the connection types you
intend to create. Aller defining the required connection table for the CPUs in your projec l,
you should print the connections report as a reference tool for writing the communications
functions in you program. Each S7 connection will generate a connection ID tha t. for some,
you w ill need as a block input parameter when programming the communication function .

ll,ti§il-44~13·1,i,i§iit·1, _ _ _______

,- Connection Pa,tner
0 In the cuuent proiecl

Il
El ·~ Eth1_ 400
sj PG/PC(1 ]
Hi (D SIMATIC 41:W)
$-Iii) SIMATIC 4~3)
; - iJ CPU 416-1
i - - [Unspecified)
- All b1oadc~ stations
- All multice1t ilali¢ns
~ In unknown project

Project: jEtl'ir.:_400
Station: ls1MAT1c 400131
Module: jcPU 416-1
Connec.tfon
T_ype: IISO tr<llnspo,t conneclion .:1
w Displa}' Pf ISO-on-TCP connection
- -•Point·to-point comection
, - - - - - - - 157 connection
DK J S7 connection faul-tolerant .,. elp
.__ _ _.._ TCP connection

Figure 7-43. Dialog for new communications connec tions.

404
Working with Simalic NET Networks

FIi I I
lrtJu,tn,:' ElhE>rm, I
'I'
• J
I I

SIMATIC 400(2)
.
l
SMA11C400(3)
PG/PC(4),
liiiiffl
u
■• •
ctu .,;p1 Ct'tJ t i'
4 U), l I 41~1 "'4).t

• 5 ]


i.o..t ID Por111er O Por1nm TYJ)C Aaflo oonr.odlon l""tr<r Sb><!

:i~6 t:l~--
0002
0001 A020
~
t~{~=::~~~:-
/
-~·•:~iZ.~tti<n1~*·
,IJl20 ~W.l ie ◄00(3) CPI).41 6-1 TCP comedlon , Yet
-~:}~~
e t ~) (II:)
..:J
Figure 7-44. Network configuration tool, w ith connection table displayed for selected CPU.

Quick Steps: Configuring Ethernet Communications Connections

ACTION

1 Open the required projec t and double click on any subnet object to open the
network configuration tool in order to create new communications connections.

2 With the network configuration in view, select the C PU module for which you wish to
create connections. When the CPU is selected. its connec tion table is displayed.

3 With the desired CPU selec ted. you may double click on on empty row, or simply
right click on an empty row and select Insert New Connection.

4 The New Connec tion dialog will display o p rojec t tree listing the stations of the
projec t, other lhon the sta tion you hove selected. that you may define as lhe
connection partner. You may click on o specific S7 -300 or S7-400 partner, or in the
case of UDP connections. you may also selec t A ll Broadcas t Stations.

5 Before selecting a connection type, a ctiva te the checlc:box "Display properties


before inserting." ii you wish lo view or modify the derived connection parameters
before the connection is inserted. De-activate the checkbox if you do not wish to
view the assigned connection parameters before you save your entries.

6 Then, from the Type drop list, choose the connec tion type you wish to create (e.g.,
ISO, ISO-on-TCP. TCP. UDP. E-Mail, or S7 Connec tion); and then press the OK button
to enter the connec tion and view the connection properties.

7 Although the connec tion properties will vary depending on the connec tion type,
you moy get assistance from the online help on modifying lhe d efault parameters.

8 Con firm each connection en try with the OK button ond STEP 7 will list the Local ID
and Partner ID for th e connec tion. the connection type. and whether the local
station is Active or Passive in establishing the connection.

9 From the menu bar. select Network ► Save, to save the network configuration. Use
Save ► Compile lo generate the Sys1em Data that you will download lo the CPU.

405
STEP 7 in 7 Steps

406
Appendices

Contents

Standard Library: Organization Blocks

Standard Library: System Blocks (SFCs, SFBs)

ASCII Charts

Examples of f-orcing/1\i\odifying 1/0 and


Memory Variables

Condition Codes CCO & CC 1 as Resulls Bits

F Analog Input/Output Digital


Representaiion

Common Abbreviations and Acronyms


Appendices

APPENDIX A: Standard Library - Organization Blocks


As described earlier in this book, you •;viii be required to write the code for any Organization
Blocks (OBs) you decide to include in your program. All of the OBs, however. ore included in
the Standard Library. provided w ith the STEP 7 Basic package. They ore only provided in
order to give you o template for the dectorotion area or each or the OBs. To include on OB
in your program you must inser11he block as you would with any o ther b lock. Remember, not
oil OBs ore ovoilobte in oll CPUs - you must open Module Information for your CPU to
determine whic h 08s ore ovoiloble with the CPU you ore using.

Tobie A-1. Organization Blocks IOBsl list. Provided in STEP 7 Standard Librorv.
OB Default Priority Description

Cyclcal Processing
0B1 1 Main Program Block

nma-of-Day Interrupt Processing

OB 10 2 Time-ol-Doy Interrupt - 0
OB 11 2 Time-of-Doy Interrupt - 1
0B12 2 Time-of-Doy Interrupt • 2
...
OB 13 2 Time-of-Day Interrupt - 3
0814 2 Time-of-Doy Interrupt • 4
0B15 2 Time-of-Doy Interrupt• 5

.. 08 16 2 Time-of-Doy Interrupt • 6

. OB 17 2 Time-of-Doy Interrupt - 7

nma-Delay lntanupt Processing

0820 3 Time-Delay Interru pt - 0

OB 21 4 Time-Deloy Interrupt - 1
0B22 5 Time-Delay Interrupt - 2

0823 6 Time-Deloy Interrupt - 3


'"
Cycle Interval (Watchdog) Interrupt Processing
Cyclic Interval Interrupt O - Default Interval = 5 sec
.....0830 7
0B31 8 Cyclic lntervol tnlerrupt 1 - Default Interval =2 sec
0832 9 Cyclic Interval Interrupt 2 - De fault Interval = 1 sec
0B33 10 Cyclic Interval Interrupt 3 - Deroull lntervol = 500 msec.
0834 Il Cyclic Interval Interrupt 4 - De fault Interval = 200 msec.
f-

0835 12 Cyclic Interval Interrupt S - De fault Interval= 100 msec.


0836 13 Cyclic Interval Interru pt 6 • Delault lnlervol = 50 msec.
0837 14 Cyclic Interval Interrupt 7 - Default Interval = 20 msec.
0838 15 Cyclic Interval Interrupt 8 • De foull lntervol = 10 msec.

408
Appendices

APPENDIX A: Standard Library - Organization Blocks (Cont.)


Tobie A-2. Oraonizotio n blocks (OBs) list (continued!.
OB Defa ult Priority Description
Hardware lntem,pt Processing

OB40 16 Hardware Interrupt 0


--- OB 41 17 Hardware lnterrupl 1

0842 18 Hardware Interrupt 2

0843 19 Hardware Interrupt 3

0844 20 Hardwa re Interrupt 4

OB45 21 Hardware Interrupt 5

OB46 22 Ho.rdwore Interrupt 6

OB 47 23 Hardware Interrupt 7

MulH-CompuHng Interrupt Processing

OB60 25 Multi-Computing Interru pt

Asynchronous Error Processing

0880 26. 28 Timing Error

OB 81 26. 28 Power Supply Fault


-
OB82 26. 28 Diagnoslic lnlerrupl

0883 26, 28 Insert/Remove Module Interrupt


OB84 26, 28 CPU Hardware Faull

OB85 26. 28 Priority Closs &ror

OB86 26.28 DP Error

OB87 26, 28 Communlcalions Error



Background Processing

OB90 29 Background Processing

Start-up Processing

08 100 27 Worm Resta rt
OB IOI 27 Hot Restart [S7 400 only)

OB 102 27 Cold Restart



Synchronous Error Processing

08 121 27 Programming Error

OB 122 27 1/0 Access Error

409
Appendices

APPENDIX B: Standard Library - System Bloc ks (SFBs and SFCs)


System b locks. are a nother resource available to the STEP 7 program developer. lllese blocks
which ore integra ted in l he S7 operati ng system, may be coiled in your program. As part o f
the CPU. th e ac tual code for these blocks is buill into the operating system and do no t use
any of the user memory. However. to coll l hese b locks as you develop your program. you will
need the colling interface o.ssocioled with each SFC or SFB. These inlerfoces ore provided in
the Slondord Library supplied wi lh STEP 7. under the p rogram name "Sys tem Function Blocks."
llle block will appear in lhe 8/ocl<s folder o f your program once used.

Calling an SFB o r SFC in your p rogram is the some os it would be for user-c reated FB or FC.
Simply insert a new network or open on existing network and coll !he system b lock as
required. If the block requires that actual parameters be supplied. you will need p roper
documentation th a t defines each parameter and the correct operand requirements .
Remember. tho I SFBs ore slill FBs. and require on inslonce dole block as ils memory. You musl
c reole a nd download the required DB as port of the program.

Ta b le A-3 . Sys t em bl ocks . .incIu d'1no SFBson d SFC s. Prov1


'd e d .1n STEP 7 Stan d or d L'b
1 rory.

SFB/ SFC Abbreviation Description

IEC Counten and nmen

SFB 0 CTU UP Counter

SFB I CTD Down Counter

SFB 2 CTUD UP/Down Counter

SFB 3 TP Pulse limer

SFB 4 TON on Deloy limer

SFB 5 TOF Ott Deloy Timer

S7 Communlcallons via Configured S7 Connections

.. SFB 8 USEND Uncoordina ted Send

SFB 9 URCV Uncoordinated Receive


...
SFB 12 BSEND Block-Oriented Send

SFB 13 BRCV Block-Oriented Receive

SfB 14 GET Read (Fe lch) Dalo from Porlner

SFB 15 PUT Write Dato to Portner

SFB 16 PRINT Write Do to to Printer

SFB 19 START Initiate Com plete Restart in Communications Portner

SFB 20 STOP lnitiole STOP in Set Communica tions Portner

,_ SFB 21 RESUME Initiate Restart in the Communlcotfons Portner

SFB 22 STATUS Check Status of Communications Portner

SFB 23 USTATUS Receive Status of Communications Portner

SfC 62 CONTROL Check Communications status

410
Appendices

APPENDIX B: Standard Library - System Blocks (SFBs and SFCs)


Tobie A-4. System blocks. includina SFBs and SFCs (continued).
SFB/ SFC
-
Abbreviation Description
Handling Integrated 1/ 0 Functions (for CPUs with Integrated 1/ 0)
SFB 29 HS_COUNT High-Speed Counter

SFB 30 FREQ_MES Frequency Meter

SFB 38 HSC_A_B Control "Coun ter A/B" {On CPU)

SFB 39 POS Control "Positioning" (On CPU)

SFB 41 CONT_C Continuous-Action C losed-Loop Control (On CPU)

SFB 42 CONT_S Step-Action Closed-loop Control (On CPU)


SFB 43 PULSEGEN Genera te Pulse (On CPU)

SFC 63 • AB_CALL Coll Assembler Code Block

Drum Sequencer

SFB 32 DRUM Drum
Generaflng Block-Related Messages

SFB 33 ALARM Messages with Acknowledgement Display

SFB 34 ALARM_8 Messages without Emb€dded Values

SFB 35 ALARM_8P Messages with Embedded Values

SFB 36 NOTIFY Messages withoul Acknowledgement Display

SFB 37 AR_SEND Send Archive Dal o


Enable Messages (Block-Related. Symbol-Related. Group
SFC 9 EN_MSG
Status)
Disable Messages {Blool<-Relaled. Symbol-Related. Group
SFC 10 DIS_MSG
Status}

SFC 17 ALARM_SQ Genera te Block-Rela ted Message wi th ACK

SFC 18 ALARM_S Genera te Block-Rela ted Message with Permanent ACK


-
SFC 19 ALARM_SC Check ACK Status of Last ALARM_SQ Entering Stal e Message

CPU Clock/Run-Time Meler Operations


SFC 0 SET_CLK Set System Clock

SFC 1 READ_CLK Read System Clock

SFC 2 SET_RTM Set Run-Time Meter


- SFC3 CTRL_RTM Control Run-Time Meter Start/Slop

SFC 4 READ_RTM Read Run-Time Meter

SFC 48 SNC_RTCB Synchronize Slave Clocks

.. SFC 64 TIME_TCK Read System Time

H-System Operations
SFC 90 H_CTRL Control Operation in H Systems

4 11
Appendices

APPENDIX B: Standard Library - System Blocks (SFBs and SFCs)


Tobie A-4. System blocks. includina SFBs and SFCs (continued).
SFB/ SFC
-
Abbreviation Description
Copy Data Area/ Block OperaHons
SFC 20 BLKMOV Copy Variables
SFC 2 1 FILL Initialize o Memory Area

SFC 22 CREAT_DB Creole o Doto Block

SFC 23 DEL_DB Delete o Doto Block

SFC 24 TEST_DB Test o Doto Block


SFC 25 COMPRESS Compress User Memory in CPU
SFC 44 REPL_VAL Tra nsfer Substi tute Value to Accumulator l

SFC 8 1 UBLKMOV Un-lntell\Jplible Block Move



Program Cohtrol Operations
SfC 43 RE_TRIGR Retrigger CPU Cycle Time Monitoring

SFC 46 STP Switch the CPU to STOP Mode

WAIT Deloy User Program Execution


.. SFC 47
Handing Interrupt Events

SFC28 SET_TINT Set a Time-of-Day Interrupt

SFC 29 CAN_TINT Cancel a Time-of-Doy Interrupt

ACT_TINT Activate a Time-or-Doy Interrupt


.. SFC 30
SFC 3 1 QRY_TINT Query o Time-of-Doy Interrupt

SFC 32 SRT_DINT Start a Time-Delay Interrupt

SFC 33 CAN_DINT Cancel a Time-Delay lntem.Jpl

SFC 34 QRY_DINT Q uery a Time-Delay Interrupt

SFC 35 MP_ALM Trigger a Multiprocessor Interrupt

SFC 36 MSK_FLT Mask Synchronous Foulls

SFC 37 DMSK_FLT Unmask Synchronous Faults

SFC38 READ_ERR Read Error Register

SFC 39 DIS_IRT Disable New Interrupts and Asynchronous Errors

SFC 40 EN_IRT Enable New Interrupts and Asynchronous Errors

SFC 4 1 D1S_AIRT Disable Higher Priority Interrupts and Asynchronous Errors

SFC 42 EN_AIRT Enable Higher Priority Interrup ts and Asynchronous Errors



System Diagnostic OperaHons
SFC 6 RD_SINFO Read Start Information of on OB

SFC 5 1 RDSYSST Read System Stalvs List/Porllol Usi

SFC52 WR_USMSG Write User-Defined Diagnostic Event to Diagnostic Buller

412
Appendices

APPENDIX B: Standard Library - System Blocks (SFBs and SFCs)


Tobie A-6. System blocks. includina SFBs and SFCs (continued).
SFB/ SFC
-
Abbreviation Description
Distributed 1/ 0 Operations
SFC 7 DP_PRAL Trigger DP•mosl er Hardware Interrupt
SFC 11 DPSYC_FR Synchronize DP-slave Groups

SFC 12 D_ACT_DP Deoclivole/Aclivo l e DP-slaves

SFC 13 DPNRM_DG Read DP-slave Diagnostic Doto

SFC 14 DPRD_OAT Read DP-sta ve Consistent Doto

SFC 15 DPWR_DAT Write DP-slave Consistent Doto


Process Image Update Operations
SFC 26 UPDAT_PI Update Process Image o f Inputs

SFC 27 UPDAT_PO Update Process Image or Outpu1s

SFC 79 SET Set o Range of Outputs

SFC80 RSET Resel o Range of Ou~puts


Address/ Access Module Operations
SFC 5 GAOR_LGC Get Logical Address o l o Cha nnel

SFC 49 LGC_GADR Check Module Slot of a Specific Logical Address


...
SFC 50 RD_LGADR Check Module Logical Addresses
Data Record Transfer
SFC 54 RD_PARM Read Defined Poromelers

...SFC 55 WR_PARM Write Dynamic Parameters

SFC 56 WR_DPARM Write De fault Parame ters

SFCS7 PARM_MOD Ass.i gn Parameters to a Module


-
SFCS8 WR_REC Wri te o Do to Record

SFCS9 RD_REC Read a Doki Record


S7 Global Data CommunlcaHons
SFC 60 GD_SND Send a Global Doto

SFC 61 GD_RCV Accept Received Global Doto


S7 Communications via Un-Configured Connections
SFC 65 X_SEND Send Doto lo External Portner

SFC 66 X_RCV Receive Doto from Ext. Portner


e
SFC 67 X_GET Read Doto from External Portner

SFC 68 X_PUT Wri te Doto to External Portner

SFC 69 X_ABO RT Abort Connectio n to Ext. Portner

SFC 72 I_GET Read Doto from tntemol Portner

SFC 73 I_PUT Wri te Doto to Internal Portner

SFC 74 I_ABORT Abort Connection lo Int. Portner

4 13
Appendices

APPENDIX C : ASCII Character Chart

.

Tobie A-7. ASCII Characters 0-63. wiH1 Decimal ' 1norv. 0 c t a I, ondHex E:O UIVO
. Ien ts.
CHAR DEC BINARY OCT HEX CHAR DEC BINARY I OCT HEX
NUL 0 00000000 000 00 space 32 00100000 040 20
SOH I 00000001 001 01 I 33 00100001 041 21
STX 2 000000 10 002 02 .. 34 00 100010 042 22
me 3 00000011 003 03 I 35 0010001 l 043 23
EOT 4 00000100 004 04 s 36 00 100100 044 24
ENQ s 00000101 005 OS % 37 00100101 045 25

ACK 6 000001 10 006 06 & 38 00100110 046 26
BEL 7 00000111 007 07 ' 39 0010011 1 047 27
BS 8 00001000 010 08 ( 40 001 01000 050 . 28 .
HT 9 00001001 011 09 ) 41
-00101001 '-
051
- 29
LF 10 000010 10 012 OA • 42 00 101010 052 2A
VT 11 0000101I 013 06 + 43 0010101 1 053 26
FF 12 00001100
.... 014 oc 44 00101100 054 2C
CR 13 00001101 015 OD

. 45
--
00101101 055 20
so 14 00001110 016 OE • 46 00 101110 056 2E
SI 15 ()0001111 017 Of I 47 0010111 1 057 2F
OLE 16 00010000 020 10 0 48 00 11 0000 060 30
DC1 17 00010001 021 11 1 49 00110001 061 31
DC2 18 000100 10 022 12 2 50 00 110010 062 32
OC3 19 000100 11 023 13 3 51 0011001 1 063 33
DC4 20 00010100 024 14 4 52 00 11 0100 064 34
NAK 21 00010101 025 IS 5 53 0011 0101 065 35
SYNC 22 000101 10 026 16 6 54 00 110110 066 36
ETB 23 000101 11 027 17 7 55 0011011 1 067 37
CAN 24 00011000 030 18 8 56 00111000 070 38
EM 25 0001 1001 031 19 9 57 00111001 071 39
SUB 26 000110 10 032 IA •• 58 00 11 1010 072 3A
ESC 27 0001 1011 033 16 .• 59 0011101 1 073 38
FS 28 00011100 034 IC < 60 00 111100 074 3C
GS 29 0001 1101 035 10 .. 61 00111101 075 30
RS 30 00011110 036 IE > 62 0011 1110 076 3E
us 31 00011111 037 IF ? 63 0011111 1 077 3F

414
Appendices

APPENDIX C : ASCII Character Chart (Continued)


Tobie A-8. ASCII Characters 64-127, w ith Decim a l, Binorv, Octal, and Hex Ea uivo lents Icon!.}.
,
CHAR DEC BINARY OCT HEX CHAR I DEC BINARY OCT HEX
@ 0 1000000 40 • 96 01100000 140
64 100 60
A 65 01000001 IOI 41 a 97 01100001 14 I 61
B 66 010000 10 102 42 b 98 01100010 142 62
C 67 01000011 103 43 C 99 01100011 143 63
D 68 01000100 104 44 d 100 01100100 144 64
E 69 01000101 105 45 e 101 01100101 145 65
F 70 010001 10 106 46 I 102 01100110 146 66
'
G 71 010001 11 107 47 g 103 01100111 147 67
H 72 01001000 11 0 48 h 104 0110 1000 150 68
I 73 01001001 11 1 49 I 105 01101001 151 69
J 74 010010 10 I 12 4A j 106 01101010 152 6A
K 75 010010 1I 113 48 k 107 01101011 153 68
l 76 0 1001100 11 4 4C I 108 0110 11 00 154 6C
M 77 01001101 115 40 m 109 01101101 155 60
N 78 01001110 I 16 4E n 110 0110 1110 156 6E
0 79 01001111 117 4f 0 1J 1 0110 11 11 157 6F
p 80 01010000 120 so p 112 01110000 160 70
Q 81 01010001 121 51 q 113 01110001 161 71
R 82 010100 10 122 52 r 114 01110010 162 72
s 83 010100 11 123 53 s 115 01110011 163 73
T 84 01010100 124 54 I I 16 01110100 164 74
u 85 01010101 125 55 u 117 01110101 165 75
V 86 010101 10 126 56 V 118 01110110 166 76
w 87 010101 11 12-7 57 w 119 01110111 167 77
X 88 01011000 130 58 X 120 01111000 170 78
y 89 0101 1001 131 59 y 121 01111001 171 79
z 90 01011 0 10 132 SA I 122 0111 1010 172 7A

I 91 01011011 133 58 { 123 0111 1011 173 78

\ 92 0101 1100 134 SC I 124 0111 11 00 174 7C


I 93 0101 1101 135 5D } 125 01111 101 175 7D
I\ 94 01011110 136 SE - 126 01111 110 176 7E

- 95 0101 1111 137 SF PEL 127 Ollll111 177 7F

4 15
Appendices

APPENDIX D: Examples of Modifying/ Forcing 1/ 0 and Memory Variables


icol 1/0 and Memo Addresses with Valid Force/Modi

Adclreu force/ Modft/ Value Desalpllon

14,5 false BOOL 1(0f10ble; FAlSE also vofid

M4.2 true BOOL variable: TRUE otso volld

Q l 1.6 0 Bit "orioble wlthoul binary identifier

085.DBXl .0 1 Bit variable without binary identiRer

14,4 2111 Binary vorioble with binary identifier

MS.5 2#0 Binary vonoble with binary identifier

Possible Byte Addresses (tB. QB, MB. PQB, OBn.OBBn)

Address force/ Modly Value Desalpllon

IB 10 21111011001 BYTE variable os blnory constant wtth bi11ory identifier

M822 bl/161/Ff BYTE variable os hex constant with hex identifier

MB24 Ff BYTE variable os he1. constant without he1.identifi8f

QB 10 'y' BYTE variable os CHAR constant

08,S.DBB 2 10 BYTE: variable os positive INT constant

PQ84 -12 BYTE variable os negative INT constant

Posslble Word Addresses (IW, QW. MW. PQW , OBn.DBWn)

Address Fotce/ Modft/ Value Desalpllon

IW3 21100001 111000011 11 WORD variable as binary cons1ant with b inary Identifier
-
MW42 w# l 6#ABYN WORD variable os hex constant with hex identifier

MW44 ABYN WORD "Oiioble os hex constant without hex Identifier

QW 12 bl/(20.44) WORD variable as 2-byte unsigned decimal v alues

DB5.DBW2 ·yn' WORD variable OS CHAR constant

PQW6 -10500 WORD variable os negative INTconstant (-32.768. to 32.767 1

MW2 10500 WORD "oiioble os positive INT constant (-32.768. lo 32,767)

MW4 SST#10m30s WORD variable as SSTIME value with SSTIME identifier

MWS c#l75 WORD variable as COUNT value with Count identifier

MWIO d#2005-07-0-4 WORD variable as DATE value without DATE identifier

4 16
Appendices

APPENDIX D: Examples of Modifying/ Forcing 1/ 0 and Memory Variables


• • ... . I • • •• • • • Ad d resses with Valid Force/Modi • ~ ·a1~1a111w· •
Possible Double Word Addresses {ID, QD, MD. PQD, DBn.DBDn)

Addreu FOJCe/Modlly Value Desc:rfpllon

ID4 000110001 1100 10101 11010111010 111 DWORD 11orioble os binary con11on1 without
blnory ldenJilier

M02 10 E3 DWORD variable os REAL constant

MD6 9 DWORD variable os hex value withoul Identifier

QD20 DW#l6#obcdefl0 DWORD vorioble os hex value with identifier

QD24 ABCDEF IO DWORO variable os hex value wlfhovt identifier


085.DBD 6 Bit I12.34,56.78) DWO RD varia ble as 4-unsigned decimal numbers

PQD4 'abed' DWORD vorioble as STRING consta nt

M020 l# .1 2 DWORD variable OS DINT 11oluo wilh identifier

M024 L#l2 DWORD vorioble OS DINT value wilh identifier

MD28 - 123456789 OWORD vorioble os DINl value without identifier

M032 123456789 DWORO vorioble as DINT value wilhoul identifier

M036 TII 12s345ms DWORD variable os TIME value

M040 TOD# I :'2:34.567 DWORD variable os Time-or-Doy valve

MD44 p#eO.O DWORD vorioble os POINTER value

Timer Memory Addresses (Tn)

-Addreu
T 10
Force/Modly Value

0
Desc:t1pffon
Conversion lo mUnseconds jmsl

T11 20 Conversion lo ms

Tl2 12345 Conversion to ms

T13 SSTIME/1 1Om30s Timer votue with SSTIME (or SST) identifier

Counter Memory Addresses (Cn)


Addreu FOJCe/Moday Value DelCflpllon
CIS 0 WORD voriobte as COUNT value wllhoul Iden filler

C 16 35 WORD voriabfe OS COUNT value without identifier

C 17 c# 150 WORD variable os COUNT value with Identifier


-

4 17
Appendices

APPENDIX E: Condition Codes CCO and CCl as Result Bits


Ta b leA- 11 . o·10 1·1a I 0 >oero rions Resu IIson dEvo Iuo r,on us1na ResuIts s·t
I E . Iens.
·au,vo I
Integer Operations CCO I
I
CC1 I
ov OS ' ResuHs llt Equivalent
'
Result< -32,768 for (ADD_I. and SUB_IJ 0 l I 1 >O and OV and OS

Result< -32,768 for (MUL. I) l 0 l l < 0 and ov and OS

Result = -327 68 to - 1 1 0 0 . <O


Result= 0 0 0 0 - =O
Result = + I to +32.767 0 I 0 - >O
Result > +32.767 for (ADD_l. and SUB_I) I 0 I I < Oand OV and OS

Result> +32,767 for (MUL_I) 0 I I 1 > O and ov and OS


Result= 32.768 for (DIV Jl 0 I I I >O and ov and OS
Division by zero I 1 I 1
• .
Real Operations cco CC1 OV ' OS ,' 1te1uHs llt Equlvalent
+ Normalized 0 I 0 - >O
± De-normalized 0 0 l l =O a nd OV and OS
±Zero 0 0 0 - --o
--
- Normalized 1 0 0 - <Oond NOTOV

+ infinite Result (Div by zero) 0 1 I 1 > 0 and OV and OS


- infinite Result (Div by zero) I 0 l 1 < 0 and OV and OS
IN l or IN2 is Invalid REAL l 1 I l uo

Compare Operaflons i cco CC1 ov OS ResuHs llt Equlvalent
Result IN2 = IN l 0 0 0 - ==O
Result IN2 < IN l 1 0 0 - <O
Result lN2 > IN l 0 I 0 - >O
IN I or IN2 is Invalid REAL I 1 l I uo
Conversion Operations (NEG_I/ NEG_D) cco CC1 ov OS Results llt Equivalent

Result in Normal Positive Range 0 I 0 - >0

Result· Equal Zero 0 0 0 - 0


Result In Normal Negative Range I 0 0 - <O
Result al Extreme Negative Range I 0 1 l <0 and OVand OS
Word Logic Operations cco CCl ov OS ResuHs llt Equlvalent
Result OUT Equal Zero 0 0 0 - --o
--
Result OUT Nol Equal Zero 0 1 0 . >O,or<>O
• " •
Shift Operations cco CCl ov OS I ResuHs llt Equlvalent

,. Bit Shifted Out = 0 0 0 0 - --o


--
Bit Shifted Out = 1 0 1 0 - >O
Nole: The Condition Code Bits CCO/CC I ore the some for DINT operations except that the
number ronge is -2 147483648 lo +2.147,483,647.

418
Appendices

APPENDIX F: Analog Input/ Output Digital Representation


T bl A 12 A • • 1/0 t • IR • I f' f • M IR •
Range :t 500 mV :tlV :t 2.5 V :t 5 V :t 10 V :t 20 mA

+ 32.767 ~ 587.96 ~ 1, 1760 ~2.93911 ~ 5.11796 ~ 11.759 ~23.5160 OVERFLOW

+ 32,511 + 587.94 + 1. 1750 + 2.9397 ♦ 5.8794 11.7589 23.5150


• . • . • ' OVER-RANGE
• . • • • • •

- + 27,649

+ 27,648
+500.02

+ 500.00 mV
+ 1.0004

1.0000 V
+ 2.5001

+2.5000 I/
+ 5.0002

5.000 V
10.0004

+ 10.00 V
20.0007

+20.00 mA

+ 24.192 +437.50 +0,8750 +2.1875 +4.375 +8.75 + 17.50

+- 20,736 +375.00 -+-0.7500 -+-1.8750 +3.750 +7.50 +-15.00

+ 17,280 +312.50 +0.6250 +1.5625 +3.125 +6.25 +- 2.50

+ 13.824 +250.00 +0.5000 + 1.2500 +2.500 +5,00 + 10.00

+ 10.368 + 187.50 -0.3750 +0.9375 + 1.875 +3,75 +7.50

+6,912 + 125.00 +0.2500 +0.6250 +1.250 +2.50 +5.00

+ 3,456 +62.50 +0.1250 +0.3125 +0.625 +1.25 +2.50

0 0.00 0.0000 0.0000 0.000 0.00 0.00 NORMAL

-3.456 -62.50 -0.1250 -0.3125 -0.625 - L25 -2.50

• 6,912 -125.00 -0.2500 ·0.6250 - l.250 -2.50 •5.00

• 10,368 - 187.50 -0.3750 -0.9375 - 1.875 .3.75 -7.50

• 13.824 -250.00 -0.5000 -1.2500 -2.500 -5.00 - 10.00

· 17.280 -312.50 -0.6250 -1.5625 -3.125 -<>.25 -12 .50

- 20,736 -375.00 -0.7500 - 1.8750 •3.750 -7.50 -15.00

- 24.192 •437.50 -0.8750 •2.1875 -4.375 -8.75 -17.50

· 27.6-4$ -500.00 V -1.000 V -2.5000 I/ -S.00 V -10.00 V -20.00 mA

-27.649 -500,02 -1.0004 -2.5001 -5.0002 -10.0004 -'20.0007


. . . . . . OVER-RANGE
. . ' . . .

• 32.768

-587.96

S-51111.91
- 1.1750

s-1.116
-2.9398
S •2.935
-5.8796
S -5.IIIIO
-1 1.7590

S-11.76
-23.5160

S•:13.517
-
UNDERFLOW

419
Appendices

APPENDIX G: Common Abbreviations and Acronyms


Tobie A-13. Common Abbreviations and Acron ms.

Al Analog Input
AO Analog Outpu t
CFC Continuous Function Chart
~-

-- CP
CPU
DB
-➔·
Communications Processor Module
Central Processing Unit Module
Doto Block
DI Digitol lnpul
DO Digital Output
DP Distributed Periphery (or Distributed 1/0)
EN Enable Input Line
ENO Enable Output line
EPROM Erasable Pragrarnmable Read Only Memor,
FB Function Block
FBD Function Block Diagram language
1---
FC Functio n
FEPROM Flash Erasable Programmable Read Only Memory
FM Function Module
IM Interface Module
LAD Ladder Diogrom Language
MPI Multi-Po int Interface
OB Organization Block
OP Opera tor Panel
1---
PG/ PC Programming Device/PC Programming Device
PII Process Image or Inputs
PIQ Process Image of Ou1puts
RAM Random Access Memory
RLO Result of Logic Opera tion
SCL Structured Control Language
SOB System Da lo Block
SFB
1---
SFC
---- System Function Block
System Function
.SM Signal Module
STL Statement List Language
UDT User Defined Type
VAT Variable Tobie

420
address: 1) A reference number tho I
identi fies a unique memory b it, byte,
word, or double word location. 2) An
identi fying number designating a unique
system entity or object.

address Identifier: A single or double


fetter designation that precedes o n
address and indicates the specific
memory area and size of the memory unit
being referenced. The first letter indicates
lhe area and a lways obit if only one
letter is present. A second letter 'B' will
indicate byte, ·w· a word. and 'D' a
double word.
Glossary AS-Interface (AS-I): A network inte nded
to connect binary sensors and ac tuators
at lhe lowest part of the field level of lhe
plant networking hierarchy. The S7 300
connects lo AS-I via Hie CP 342-2
communications processor.

asynchronous error 08s: The group of


organization blocks called when one of
-A- lhe asynchronous errors occur.

asynchronous errors: Run-time errors that


absolute address: A direct re ference to a ore not OS$OCioted with or resul tant from
memory location, represented by a any particular aspect of the user program
charac ter identifier and a number. The (e.g ., power supp ly error, module
term "Q 6.7'' and "M 44.3" are absolute inserted/removedl. See asynchronous
addresses. See symbolic address. errorOBs.
absolute addressing: Use of the direct authorization: A right o f use for the STEP 7
references of memory locations like I 5.6, Basic and optional programming
instead of substitute or name references packages. stored on an authoriza tion
suc h a s "STOP_PB'' to reference memory diskette. You mus-t install required
locoiions. See absolute address. authorization lo your hard drive before
STEP 7 software or optional packages can
accessible nodes: A utility of the Simotic
run without interrupti on.
Manager that. when activated.
determines what sta tions ore configured
os MPI nodes and con be accessed by
the programming sys tem. - B-
accumulator (ACCU): Memory registers in
the CPU that serves as b uffers lor load B stock: Bloc k Stack. A n S7 m emory area
and transfer operations, as well as for (stock) that con be viewed to determine
comparisons, moth, and conversion all non-terminated b locks called and the
operations. order in which they were called up to the
actual parameter: The address or value block that erred and caused the CPU l o
that rep laces a formal parameter when a stop. Also. see I stack.
function b lock {FB) or functio n {FC) is
called. For example, the formal
parameter "STOP" may be replaced by
the actual parame ter "I 60.2." Also see
block parameters; formal poramefer.
background processing: A method of CCl status bit: Condition code stalus bit
processing non-critical code (in 0B90) in of the CPU status word.
the slice of time tha t starts w ith the end of
C-bus: Abbreviation for Co mmunication
lhe actual CPU scan lime and continues
Bus. Port of the backp lane bu s of lhe
until the expiration of the most recent
SIMATIC S7-300/M 7-300 and S7-400/M7•
minimum CPU scan. If the aclual
400 p rogrammable con tro llers. A
execution cycle lime is less than the user-
separa te communication bus increases
specified minimum cycle time (S7 400).
data transfer rotes between the CPU and
0690 is processed for the remaining
programmable modules. as well as n1oke
duratio n of the minimum cycle lime.
progra mming access possible lo all
Then, th e OB 1 cycle is re-started .
programmable modules (e.g ., FMs, CPs).
bilateral communication: Refers lo S7 via a PG/PC connected to the C PU.
co mmunication between partners, in
central rack (CR): For lhe S7300, the term
whic h !here is o SFB on both the local and
refers lo the main 1/0 rail (rock for S7400)
remote partner (e.g .. "USEND" AND
that holds the CPU. The central rock may
URCV"). See unilo terol communication.
a lso contain signal modules, function
bit memory: The area of the system modules. and communications
m emory containing what may be processors. All o ther roils {or rocks),
referred lo as the CPU"s internal storage connected to the cen tral rack using
b its o r software co ntro l relays. The le tter interrace modules. o re rererred lo as
'M' precedes each b it memory address expansion rocks.
(e.g., M l 0.0 is a b it, MB l O is a byte, MW
CFC: Abbreviation for Continuous
10 is a word, and MD 10 a double word.
Fune lion Charts, an optio na l STEP 7
block header: Each bloc k has a header programming language used to link
that contains attrib utes of the b lock, such complex functions graphically. CFC links
as Nome, Family, Versio n, and Author. The existing functions, many of which ore
block header may be modified by available in standard functions libraries.
opening the block properties. Select the C FC tune lion libraries include logic, moth.
block and lhen right click to select object control, and data processing Junctions.
properties. Charts created in CFC o re stored in the
"Charts·· Folder. beneath the S7 program.
bloc ks: Blocks make up the STEP 7 user
b efore they ore compiled to form the S7
program. and are d istinguishable by
blocks of the user program.
function. slruclure. or purpose. STEP 7
blocks may be grouped as logic code CFC charts: A specia l graphic source file,
blocks of types (FB, FC, OB, SFB, and SFC); created using the Con tinuous Functio n
dofo blocks or types (DB. SDB) and user- Charts programming language. See
defined data types (UDTJ. charts container.

block stack (8 -stack): See B-s fac l< charts container: A fold er or container
used to store CFC "Cha rts" beneath the S7
block parameters: Re fers to the named
program. See CFC charts.
input/output c hannels tha t allow data to
be passed into (input parameters) or clock memory: A system me mory area
ou lp ut from (oulput parameters ) a block comprised o f individual bits that generate
function. clock p ulses that a rc usable in the control
program by simply refere ncing the bit
address. E1ght clock memory bits a re
available, each representing a unique
-C- frequency from 0.5 hertz to l O hertz.

CCO status bit: Condition code status bit


of the CPU status word.

422
Glossary

code block: S7 program resource that conslstency check: A utility that checks
allows program construction in modular lo see if the hardware configuration
sections of code. These sections ore (Hordwore Configura tion) or if the
referred to as blocks. Logic block: types network configuration (Ne/Pro) is free of
include Organiza tion blocks (OBs), errors.
Function b locks (FBsJ. ond Functions fFCs).
controt loglc: I) The combination of
System Functions (SFCs) ond System
conditions that must be satisfied to
Function Blocks fSFBs). ore code blocks
control a particular device or perform a
tha t ore port of the CPU operating
particular function. 2) Refers to the en tire
system.
program logic or relay logic that will
cold restart: An S7 start-up mode in which control a given machine or process.
the orgonlzolion block: OB I02 is
controller rack (CR): A main S7 300 or 57
processed if loaded; the process image
400 system component used lo install !he
(Pit. PIQ), oil timers. counters. and bit
C PU. The controller rock may also
memory are all reset. Furthermore. Doto
contain signal modules, function
Blocks generated by system functions ore
modules, and communications
deleted from work memory.
processors.
communication bus (C-bus): See C-bus.
counter memory (C): The area or lhe
communications processor (CP): A class system memory containing locations
of 57 communications modules that used for software counters. Each counter
include both those that provide network word, when set, contains the user-defined
interfacing and point-to-point serial links preset value as a BCD value. The Jetter
between S7 PLCs or to o th er devices. 'C' precedes each 57 counter address
(e.g .. CO, CI , C2, and C3 each is a
communications, bllateral: See bi/oteroJ
unique coun ter.
communicolion.
counter. down: An S7 software counter
communication, unnateral: See unilolerol
instruction tha t decrements its count
communication.
value by one for each off.to-on transition
compressing memory: See memory of its count-down input.
compression.
counter, up: S7 software counter
configuration tables: The oulput or the instruction tha t increments its count value
STEP 7 hardware configuration tool. which by one for ea ch off-to-on transition o f its
hos each 1/0 rail of on S7 300 or rock of count-up input.
an S7 400, and the modules installed in
counter, up-down: An 57 software
each slo t. represented in the form of a
counter instruction that combines the
table. The table includes rows for the
actions of both the up-counter and
module contained in each slot. and
down-counter.
information associated with each module
in columns. cyclic Interrupt: S7 300 and 57 400 system.s
provide cyclic interrupt OBs lo support
configured connection: A
periodic processing of certain portions of
communication link be tween S7 partners.
the user program. independent of the
in which the connection properties
normal cyclic processing time of the CPU.
between 1Wo partners ore preconfigured
Cyclic interrupt ore available at inteNols
and fixed in o connection table.
of 10 milliseconds to 5 seconds.
Connection types include: FOL. FMS, ISO,
ISO-on-TCP. point-to-point. 57, and UDP. cycfic Interrupt OBs: OB 30 to OB 38 ore
provided for servicing cyclic interrupts.
connection table: A STEP 7 object that
Cyclic interrupt OSs ovoiloble to a
contains the preconfigured connections
program. is CPU dependent.
between the communications partners of
a projec t.

423
diagnostic buffer: A memory area of the
-D- CPU in which all diagnostic events are
stored the order o f occurrence. STEP 7 is
Doto Block (DB): A STEP 7 b lock that used to view the contents of the buffer.
allows users to store data associated wilh diagnostic entry: A single event entered
the program and the process. There ore into the S7 CPUs diagnostic b uffer.
lwa lypes of data b locks: the shored
doto block whose data is accessib le by diagnostic Interrupt: An interrupt used by
oil logic code b locks. and the instance o module .,.,;th diagnostic copobilily. to
data block, whose data is associated report occurrence of o module fault lo
with a specific function b lock {FB). the CPU.

Dalo Block, Instance: See data bloc!<. diagnostic message: A message lhot
consists of a processed diagnostic event,
Doto Block, shored: See data block.
which is then sent from the CPU to the
data type: Stipulates the characteristics of display unit.
program data. with respect lo ils direct addressing: A method of
representation and the permissible range addressing in which the memory location
of values. Some example data types lo be accessed or operated upon, is the
include BOOL INTeger. REAL SS_TIME, address referenced by the ins1ruction. The
ARRAY. and STRING. In STEP 7. lhere ore address can be absolute {e.g .. 14.71 or
two categories of doto - elemen tary. or symbolic (e.g .. E·STOP).
complex.
direct 1/ 0 read: An instruc !ion operation
data type. complex: Category of data
that uses th e peripheral input (Pl) address
types lho1 reserve memory for variables area to access on input module's data
that ore comprised of two or more doto directly from the module or 1/0 bus, as
element of elementary data lype. opposed to normal reading from the
Complex data types include DATE-AND- process image of inputs (PU).
TIME. STRING, ARRAY. STRUCT. and UDT.
direct 1/ 0 write: An instruction operation
data type, elementary: Category of data that uses th e peripheral output (PQ)
types that reserve o single bit. by!e. word. address area lo access on output
or double word of memory. Elementary module' s data directly via the module or
data types Include 800L, BYTE. WORD. 1/0 bus. as opposed lo normal writing to
DWORD, INT. DINT. REAL. DATE, TIME, the process image of outpu ts (PIQ).
SSTIME, TIME-OF-DAY. and CHAR.
distributed 1/ 0 : Slave d evices that ore
data ty pe, user defined: A user-defined
connected via a PROFIBUS-DP master.
structure of any combination of Also referred to as distrib uted perip hery.
elen1entary or complex data types. to be
used as o template for creating data DP- ma ster: An Intelligent device that
blocks of the some data structure or for behaves in accordance to the Profibus
decla ri ng o frequently used struclure as a DP standard EN 50170. A DP-master is
data type. able to send data lo and request data
from its slave devices.
declaration section: The area of a STEP 7
code b lock or data b lack. in whic h DP-slave: A device tha t behoves in
variables may be defined. accordance to the Profibus DP standard
EN 50170. A DP-master is able to send
diagnostic address: An address that is data lo and requesl data from its slave
assigned lo a module's configuration in devices.
order to receive diagnostic informa tion
data. The diagnostic data con be dynamic connection: A connection that
checked from the user program using or ls set up a t runtime when the octJVe
from the STEP 7 monitor/modify data partner initiates th e connec tion by calling
utility. lhe appropriate communications system
function (SFCJ.

424
Glossary

dynamic parameter. An S7 module formal parameter: A placeholder for on


parameter tho! con be set or modified actual poromefer, used when creating a
vio the STEP 7 progrom using o system logic b lock that con be passed
b lock: contrasted to slollc parameters poromelers. In FBs and FCs. formal
that are only set using STEP 7 parameters ore defined by the user; in
configuration sottwore. SFBs and SFCs. formal parameters ore
predefined. Also, see ocluol parameter.
Function (FC): According lo fhe IEC 1131 -
- E- 3 standard. functions are logic b locks that
do not reference on instance doto block,
meaning they do nol hove o ·memory'. A
error. asynchronous: Run-time errors that function allows passing of parameters In
ore associated with or resulting from the user program. making it suitable for
some aspec t of the user p rogram (e.g., programming complex functions !hot ore
addressing error, 1/0 module access)_ required frequently (e.g., calcula tions).
Note: As there is no memory available,
error, synchronous: Run-lime errors that
lhe colcuio ted values must be processed
are not associated w ith or resulting from
th e user program (e.g., power supply immediately following the FC coll.
toul1}. Function Block (FB): According to the !EC
error OBs: Organization blocks !hot allow
1131 -3 standard. f\Jnclion blocks are logic
b locks that reference on instance data
user; to write code to respond to system-
related (asynchronous) or program- b lock. meaning they hove slotic data. A
function b lock allows passing of
related (synchronous) errors. There Is on
associated OB for each error type. If the poromelers in the user program. making it
OB is loaded in the CPU OS port of lhe suitable for programming complex
reusable fu nctions. Since FBs hove a
user p rogram. II will be coiled by the
operating system if the associated error 'memory' in the form of the o.ssociofed
occurs. instance data block. its parameters ore
accessib le ol ony time and ony point in
expansion rack (ER}: An 1/0 rock used to lhe user program.
extend the S7 1/0 system by holding
Function Block Diagram (FBD): See FBD .
addilionol modules. An expansion rock is
connecled lo th e central controller rack function module (FM): Any of the so-
via on interface module placed in the coiled intelligent 1/0 modules used to
centra l rack and in 1he expansion rock. perform complex or lime-critical tasks
independent of the S7 300 or S7 400 CPU.
extended pulse timer: See Pulse Timer
E)(fended.

-G -
- F-
GD circle: The CPUs that participate in on
exchange of global data pockets form a
FBD: Abbreviation for Function Block
Diagram. one of the three language circle. If there ore other CPUs exchanging
representations of the basic STEP 7 global data pockets in a mul1ipoin!
programming package. Control logic interface network. these CPUs lorm a
can be created using box instructions second circle. A c ircle may be two-sided
involving two CPUs. each of which con
represented in Boolean goto logic
format. The opera tions AND, OR, and bolh send ond receive o GD pocket: it
NOT ore combined with other box may be one-sided in which a single CPU
sends a GD pocket to several o ther CPUs.
operations to construct simple and
See GD pocke ts.
complex control logic. Also. see LAD: srr..

425
GD communication: See gfobol doto hardware configuration: Definition of rock
communication. arrangement. modules, module slo ts.
addressing. a nd initial operating
GD packets: In global data
parame ters of the hardware componenrs
c ommunication. th e small blocks of dolo
of o project. See hord ware configuration
transferred in global dolo
utilily.
communication: dolo !hot have the
some receiver and sender ore combined hardware configuration utility: A STEP 7
in a global data packet. The global data software configuration ulitity used to
pocke t is sent in a frame. A global d ata define rack arrangement. modules.
pocket is identified by a global data module slots. addressing, and initial
pocke t number. If the maximum leng th of operating parame ters o f the hardware
o send global data pocket is exceeded. components of a project. This tool atso
o new global data circle is used. provides online hardware diagnostic
capability of the ac tual componen ts.
global data: Information, such a s input
ou tp ut. bit memory. and data block hardware interrupt: A signal ability of
memory areas. which may be some S7 modules lo trigger and alert to
exchanged be tween C PUs porlicipoting the CPU when some process or module
in global dolo cammunicotion. event occurs.

global data communication: A d olo HIGraph: An oplional STEP 7 language,


exchange method used by CPUs in an also called S7-Higraph. designed for
MPI network to exc hange small amounts implemen ting machines or processes that
of data . See g lobal data. ore considered "stole machines." In such
machines. only one sto le is possib le o t
global symbol: A symbolic oddres,; known
any given time. HiGraph allows
to the entire user program (i.e.. oll blocks).
programming of the blocks o f your
as opposed to a local symbol, defined in
program os slate graphs. This segmen ts
o b lock. ond w hich is known only to U1e
the p lant into individual functional units
specific block. See symbolic address.
that moy each toke on different sta tes.
GRAPH: A STEP 7 optional programming Also, see SCL; CFC; G raph.
package. Gra ph, also called S7-Graph, is
hot restart: An S7-400 star1-up mode in
a graphic language designed to
w hich the organiza tion block OB 101 is
implement sequential controls. Th e
processed if loaded; o ho t start-up occurs
programming process includ es crea ting a
folloY-ling the return o f power after o
series of steps, defining the contents of
power loss while in the RUN mode; the S7-
each step. and defining the 1ransi1ions
400 CPU resumes program execution o f
from one step to the next. Also, see
the point ot which it was interrupted. Bo th
HiGraph; CFC; SCL.
o mo nuot and oulomotic hot restart is
group error: An LED indica tor found on possible if the user program was not
the fro nt face-pla te or some S7 300 modified in any wa y w hile in STOP mode.
modules, to indic ate any inlernol or
H-stalion: A fault- tolerant S7 PLC station.
external error on the module.
consisting of at least two CPUs. one
configured os mosler and one os
standby.
-H-

hardware catalog: A component of the


STEP 7 Hordw ore Configuration tool, that
con tains Simotlc objects (e.g., S7 rocks.
and modules) used lo create a sof1ware
configuration that represents the various
ports of the acluol hardware
configura tion of o project.

426
Glossary

interface module (IM): Module


- I- components available in both the S7 300
and S7 400 systems, used to expand the
I-stack: Interrupt Stock. An S7 memory t/0 syslem by allowing connection of
orea (stock) that con be viewed to show additional 1/0 expansion rocks.
the conten t of the CPU registers Interrupt: An efficient method of
(occumulo lors, address register, dalo reques1ing the immedia te attention of o
block register, and status word) at the central processor to gain some type of
point of interruption and o1 the exact service. Interrupts ore usually classified as
error thal caused the CPU to slop. Also, hardware (e.g., process signal, 1/0
see B-stock. module wilh interrup l lines) or software
Image table: See process imoge. (e.g .. timed Interrupts).

Indirect addressing: An addressing Interrupt stack: See I-slack..


method In which the desired absolute 1/ 0 image table: See process image.
address is not used directly in an
instruction operation. instead the address 1/ 0 rack: The mounting unit in whic h 1/0
is contained in another memory location. modules ore installed. In the S7-300
used as a pointer to the actual address. system. the rack is o standard DIN roil.

Industrial Ethernet: The Simatic NET


network intended to connec t S7 300, S7
400 and other systems a t the - K-
management and cell levels or the plonl
networking hierarchy. Defined b y the
IEEE 802.3 standard, the network was K-bus: Some as C-bus: The backp lane
form erly designated as SINEC HI. communications bus of S7-300/S7400
PLCs.
Input Image table: See input memory.
Know_How_Protect: A STEP 7 keyword that
Input (I) memory: Memory area thol allows o user-written code block to be
stores snapshot status of connected compiled ond tocked from view. A b lock
digital inputs. Each connected input hos that has been protected may not be
o b it in the input memory that viewed, printed, or modified. Only the
corresponds to the configured byte b lock header and declaration area \viii
address for the module. The address be d isplayed.
identifier "I' indicates on input memory
address, when used in the program (e.g .,
110.0 is a bit. 1B 10 is a byte, IW !Ois a
word, and ID 10 o double word. Also, see - L-
process image inputs.

instance: An '1nstance" is the coll of a LAO: Abbreviation for Ladder, one of the
funcllon block. If o Function is coiled four three language representa tions of the
limes in o STEP 7 program, then there ore basic STEP 7 programming package.
four instances. An ins1once data block is Control logic con be created using reloy-
assigned to each call. See do/a block. tike instructions may be combined with
box Instructions to perform simple to
instance Data Block: See dofo block.
complex con trol operations. Also, see
intelligent DP-slave: A DP-slave involving FBD: STL.
on intelligent device such os on S7-300
ladder logic (LAO): See LAD
connected as o slave via its integrated
DP port, or via a communications ladder network: See ladder rung.
processor (CP). installed in on $7-300.
which con serve os o DP-slave.

427
ladder rung: A single Ladder d iagram local stock: Temporary memory loca tions
network, p ort of o complete program or made available by the CPU to each
block, that performs the desired control code b lock a s it is coiled. The so-coiled
logic in po11 01 in whole ror o single L-stock, is released when o b lock
device or function. terminates, and is ovoiloble for use by the
next called bloc k. The block header
library: A STEP 7 object used for storing
reserves the L-stack length however the
reusable p rograms or program
maximum length is CPU dependent.
components {i.e., block lo lde1, source
folder. C FC c horl [o lder. symbol table). local symbol: A name assigned too
Users may create libraries from the b lock variable and known only to the
Simotic Manager. a nd certain slondard b lock in which it is defined. as opposed to
libraries ore supplied with STEP 7 basic global symbols assigned in the Symbol
and optiona l packages editor, and that ore known to the entire
user program (i.e.. o ll blocks). See
library, standard: A STEP 7 library that is
symbolic address.
provided with !he basic package.

linear program: Refers to a STEP 7 user


program designed such that the entire
main program is coded In organization - M-
block 1 (OB 1). See partitioned program;
structured program. memory card: A p lug-In RAM or Fl ash
load memory: S7 men1ory that holds the EPROM memory expansion cord.
en tire user program or objec ts that ore memory compression: An S7 memory
downloadable to the CPU (e.g., code reclamation operation tha t reclaims
blocks. data blocks, and system me mo ry by eliminating gops in the C PU's
configuratio n data ). In some CPUs, load work memory and in the RAM load
memo,y may a lso contain symbol. memory. Suc h gaps o re the result of
comments. See work memory. multip le b lock dele tions and reloading.
local data: Temporary doto stored in the message block: A system function b lock
local (LI stock a nd accessed exclusively (SFB) or system function (SFC)
by the executing block. The local data incorporated in the S7 program in order
area is reserv ed in the block header of a to generate messages.
block. when temporo,y (TEMP) variables
ore defined. Also, see loco/ stock. message table: Table Iha! defines the
lex! lor messages ond tha t a ssig ns these
local data stack: See local stock. messages lo specific events.
local 1/ 0 : Input/output rock restric ted to message number: A unique number
a short d istance from the CPU connected assig ned too message for identificollon
using loco! 1/0 interfa c e modules (!Ms); and use p urposes.
contrasted to remote 1/0, which may be
located long distances from the CPU. minimum scan cycle time: A CPU
parame ter tha t allows setting of o
local data: Temporary data stored in the minimum time for processing the main
local (L) stacl< momory and used program. If the actual proc essing lime o f
exclusively by the executing block for lhe main p rogram (OBI ) to kes less time
temporary results. The local variables ton the minimum specifiod limo, then the
defined in the b lock header determine C PU will wait until the specified minimum
the size requ irements of the local doto. cycle time expires before starting the next
See tocot stock. cycle o t OB 1.
local memory (L): See local slack.

428
Glossary

module parame ter: A value that con be NETPRO: A STEP 7 u lility used to configure
set on on S7 module, which will a ffect the networks or paint-to-point links for S7
module's behavior. Some modules hove projects. using graphic objects. The tool
several parame ters. some or which con allows for adding o f new subnels or point-
be set via the control program. to-point links, attachment of new stations
(SS. S7. PG/PC, Ops. e tc.). network and
module catalog: See hardware catalog.
module p roperties to be set. and for
MPI address: In on MPI network. every configuration of communications
programmable module (e.g.. CPUs. CPs. connections.
and FMs) must hove its own unique MPI
network: 1) A number of nodes linked
address assigned.
together by connecting cables ror the
MPI network: A Multi-Point lnlerfoce purpose o f communication. 2) Divides
nelwork or up lo 3 1 nodes, vsed 10 Ladder Logic (LAD) and Function Block
provide a programm ing network for S7 Diogrom (FBD) blocks into logic rungs or
300 and S7 400 CPUs, function modules Statement List code into smaller
(FMsJ. communications processors (CPS), segments.
!ext d isplays and opera tor panels. The
network configuration: Creation or
network also focilita tes global dato
modification of point-lo-point links or
communications among CPUs.
networks. for S7 projects. Slotions may be
multi-computtng: An S7 400 feo lure thal added to the nelwork configuration alter
supports up to four CPUs Installed in one or before they ore created in the STEP 7
rock. The total control task con be project. See NETPRO.
divided among the C PUs, each or which
has its own program, govern its own 1/0
and con communicate with th e o th er
CPUs.
-0 -
mulll-computtng intenupt: An S7 400
fealure that allows any of four possible OB 1: Organization Block 1: the main
CPUs operating in o multiple processor cod e block ol o STEP 7 program. Once
configuration, to generate an interrupt to downloaded to the CPU. O B1 p rocesses
a ll of the other porticlpanls such that o cyclically. All other blocks ore called
synchronized response is possible. See directly or indlrec I ly from OB 1 or from
mu/Ii-computing interrupt OB: m ulli- another organization b lock.
computing. object: Refers lo on item in o STEP 7
multl-compuffng Interrupt OB: OB 60 is folder. which con b e opened and edited.
provided in S7 400, for servicing user- automalicolly s1orting the appropria te
configured multiprocessing. see application in the software. for example.
multiprocessing interrupt; multiprocessing. b lock.. source me. or station.

off-delay timer (S_OffDT): A limerwhose


oulput is activa te d when the enabling
signoI goes TRUE. ond starts liming when
-N- the enable goes FALSE. After the
programmed timed delay expires. lhe
nesting d epth: Refers to the number of timer coil de-energizes.
block calls tho! can be mode in a
off-Hne bloc ks: Blocks contained in the
horizontal direction, slorling for example
offline b locks folder of a CPU program;
from the moin organize tion block (OB 1).
the b locks stored in the project on your
Nesting -depth is CPU-depend ent. The first
hard drive. Also, see online blocks .
OB represents nesting depth or one.
hence six more b lock calls in a horizontal
direction would be a nesting depth of
seven.

429
on-delay timer (S_ODT}: A timer that storls parameter: I ) A variable input to or
liming when the enable signal goes TRUE output from on S7 code block. 2) A
ond continues to time unless the enable variable tho! con be set on on S7 module
goes false or the limer is reset. The output lo determine one or mo,e aspec ts of the
is oclivoled o tter the preset lime hos module's b ehavior. Also see dynamic
elapsed. ond stays energized until the poromeler: stofic parameter.
enable signal goes FALSE or the lirner is
partitioned program: A STEP 7 user
rese t.
program that in essence is o linear
on-llne blocks: Sloclc:s contained in the program. however the program is
CPU; th e blocks listed in !he ontine b locks subdivided info blocks of code. The
folder. Also. see off/ine blocks. blocks are then called in sequence. See
linear program: structured program.
operating mode: The various continuous
or tronsilionot states of opera tion of on S7 Peripheral bus (P-bus}: See P-bus.
CPU. Operating modes may be selec ted
Peripheral inputs (Pl}: An address area
from the PG/PC or lrom !he mode
that allows direc t rea d a ccess lo the
selec tor switch on the CPU front plate
dolo of on input module via the 1/0 b us.
(e.g .. RUN, RUN-P. STOP, HOLD, ond
In o th er words, addressing a module
STARTUP).
using Its Pl address allows a direct or
Organization Block (OB}: A special immediate input read. See direc t t/0
category o f STEP 7 code b lock tho! read.
provides the user program with on
peripheral outputs (PQ): An address oreo
interface to the CPU's operating system.
lhot allows direct w ri te access lo lhe
Organization blocks allow p rocessing of
data oreo of on output module 11io the
the main user program as well as
1/0 bus. In other words. addressing o
organized p rogram response lo various
module using its PQ address allows a
categories of system related conditions.
direct or immediate output write. See
Whal 08s ore ovoiloble is CPU
direct 1/0 write.
dependent.
PG: A Simotic designation for
output image table: See output memory.
programming device. The SIMATIC PG is a
Output (Q) memory: System memory personal computer with a rugged
oreo for storing the status of connected compact design. suitable for industrial
digital outputs. Each connected output conditions. The Simatic PG is completely
hos o b it in the output memory tho! equipped for programming the SIMA TIC
corresponds exac tly to the terminal to programmable logic controllers.
which the outpu t is connected. Toe letter
PG/ PC: An abbreviation thot refers to
'Q' p recedes eoch output memory
Simolic programming system (PG) or o PC
address. w hen used in the program (e.g ..
(personal computer) programming
QIO.O is obit. QB 10 is a byte. Q'N 10 is o
system.
word, ond OD 10 o double word. Also.
see process image outputs. point-to-point link: Refers to the type of
communication link used lo connec t
devices with a serial interface. such as
b or codo roo dors, printers, or onothor
-p- controller, to on S7 300 or S7 400. The S7
300 uses the CP 340 ror this type of link. S7
P-bus: Abbreviation for Peripheral Bus: the 400 uses the CP 441- 1 or -2.
S7 1/0 doto bus. Also. see C-bus.

430
Glossary

priority: A melhod of assigning the order pulse timer (S_PULSE): A timer lhat starts to
in which p ortions of code ore execu te d lime when the trigger input (RLOJ goes
based on level of importance. A from low to high, and continues to time
program o f higher priority c on lnterrupl ror the programmed duroHon. or until lhe
one of lower p riority. Since oil b locks ore trigger signal goes from high lo low. Th e
called either directty or indirectly from on timer is reset when the reset inpu t goes
OB, priority is assigned to S7 OBs. high while the timer is liming.
priority class: A p rogram hierarchy level pulse timer exiended (S_PEXT): An S7
into which o STEP 7 orgo nizolion b lock limer tho t starts to lime when lhe trigger
c on b e placed. There ore 28 groupings inpuf transitions from low lo high, and
or p riority c la sses lo which OBs are continues to time until lhe programmed
assigned. Priority c lasses determine how duration exp[res: regardless o f any
OBs may interrup t o ther OBs. OBs change a t the trigger input before the
assigned the same priorlly class do no t timer times oul.
interrup t one another but ore processed
in sequence. See p riority.

process Image: In the S7 world. the area - R-


of sys tem memory that contains a snap-
sho t image or th e sta tus of diglfal inp uts
and digital outputs that is updated on real-time clock: A c lock !hot indica tes
each CPU scan. Also, see process image the p assage of actual lime. in contrast to
inputs: process Image ovlpuls. a non-real-lime set up by a compu ter
program.
process Image Inputs (PII): The system
memory area that c ontains a snap-shot remote 1/ 0 : Input/output rocks located ol
image o f the inp ut sto fus b its (ON = 1, OFF long distances from lhe CPU using remole
= 0) as read from th e connected digital 1/0 interfa ce modules (IMs).
input modules. ot the beginning of each restart, complete: See worm reslarl.
CPU cycle.
restart. cold: See cold res tart.
process image outputs (PIQ): The system
memory area tha t contains on image of restart, hot: See hot restart.
the oulpu t status bits as se t by the control
restart, warm: See warm restorl .
logic (ON = 1, OFF = 01 and ore
transferred to the connected digital result of logic operation (RLO): The c urrent
out p ut modules at the end of each CPU result of a series of Iogic operations in the
cycle. user program. whic h Is then used lo
further p rocess signals digitally. Certa in
PROFIBUS: Acronym for PROcess Fleld BUS.
instructions ore either executed or not.
Profibus is on internationally accepted
d epending on the lost RLO.
network stand ard defi ned by DIN 19245,
for the net-...•orking of field level devices. retentive bit memory: Port of the bi!
memory area designa ted to retain its
proJect: The main STEP 7 object; !he
contents or signal states even under off-
projecf allow. users lo develop, organize,
circuit conditions. Re ten tive b it memory
and store all programs and dota
by deloult starts o f byte Oof the (MJ area
o ssocio tcd w ith on outomotion lo sk. A
and ends a c c ording to user designation.
project contains one or more PLC stations
and programs, hardware configura tions.
and ne twork configura tions.

43 1
retentive on-delay timer (ODTS): A timer SCL: An optional STEP 7 programming
tha t starts timing when the e nable signal package called "Structured Control
goes TRUE and continues to time even if Language." SCL is a text-based
the enable goes false. If the enable signot language. w hose definition conforms
c hanges bock lo ' I' before the timer generally to the IEC 1131 ·3 standard.
expires, the timer -wilt restart. The output is PASCAL-like. SCL simplifies programming
activated after the preset lime hos of loops and conditional branches.
elapsed. and remains activated until the making it quite sui1oble for formula
timer is reset. calculations. complex algorithms. and
extensive data monagement. Also. see
rewiring function: A STEP 7 u tility tha t
HiGroph: CFC; Graph.
allows the replacement of the addresses
used In one or more b locks or o f the segmented rack: A feature o f the $7 400
en tire program. w ith another set of a llowing two CPUs with o shared power
addresses. For example. the inputs I 10.0 supply to be lndependenl of one
to I 10.7 may be replaced by I 20.0 lo I another. The two CPUs may interchange
20.7. Addresses of inpuis. o utputs, timers. data via the C- bus yet each hos tts own
counters. b it memory, os well os Functions P-buss for 1/0 data.
(FC) and Function blocks (FBs) may be
signal module (SM): Any of the digital o r
re-wired.
analog 1/0 modules used to interface
rising edge: The rising edge ol a signal d igital and analog signals to S7 300 or S7
(i.e., the OFF-to-ON or 0-to- ltransition). 400 systems.

rung : See network. Slmatlc Manager: The main software


developmenl fool running under the STEP
RUN mode: An S7 CPU operating mode in
7 package; sometimes referred to as the
which the user program is processed and
Project Manager.
the proces.s image of inputs a nd outputs
ore updated cyclically. Slmatlc NET: The product designation or
brand name for Siemens nehvorks and
RUN•P mode: An S7 CPU operating made
network components. formerly called
in which the user program is processed
SINEC.
and the p rocess image is updated
cyc lically, and restricted access to the source file: Port of o prog ram. which is
program is allowed (e.g.. via the PG/PC). c reated with a graphic or !ext-oriented
editor a nd is comp~ed into an
run-time meter: A CPU function that
executable block as port of the S7 user
counts hours. Run-lime meters are used
program. S7 source files ore stored in 1he
for tasks such os determining total CPU
folder ''Source files" beneath the S7
run-time or the running time of certain
program.
devices connec ted to the CPU.
source file container: See source file.

standard blocks: Turnkey S7 blocks


-s - provided as part o f o library. Standard
blocks o re delivered in o library as part of
the STEP 7 basic or optional software. on
S7 GRAPH: See Graph. CDs or other storage mediums.
S7-HIGraph: Soe HiGraph.

S7-SCL: See SCL.

432
Glossary

start Information: Every organization block status bits: Binary indicator flogs used by
reserves 20-byfes o f local dola tha f the the CPU during b inary op erations {e.g ..
operating system supplies as start AND/OR logic ), ond set by the CPU
inlormotion when the OB is slorted. The during digita l operations (e.g .. compare.
start information specifies the start event arithmetic). Status bits are available as bit
o r the OB. the dote and time the 06 instructions !hot may be combined with
starts. errors tho! ho ve occurred. and o ther logic op erations.
diagnoslic events. For example, 0 B40. a
STL: Abbrev ia tion for Statement Lisi. one
hardware interrupt OB. contains the
of three language representa tions o f the
address of the module thal generated
basic STEP 7 programming software, is o
the interrupt in il5 start information.
line oriented language with assembler-
Start-up Mode: A CPU operational mode like Instruc tions. Also, see LAD: FBD.
just p rior to starting cyclical program
STOP M ode: A CPU operolionol mode in
execution. S7 slortups ore triggered by: 1)
which the user p rogram is not scanned
switching ON the main p ower supply. 2)
and the modules ore set to the default
switching the CPU mode selector from
ini1ial stales specified in the CPU. The
STOP to RUN or RUN-P. or 3) o
STOP mode is caused by: I) switching the
communication START request issued from
CPU mode selec tor lo STOP: 21 executing
the PG/PC or from another CPU.
SFC 46 STP function; 3) on unrecoverab le
Start-up 08s: Organization Blocks that ore error during p rogram execu1ion: or 4} o
called on one of the three types of S7 communication STP request from the
start-up modes: worm restart (OB 100); programming unit or another CPU.
hot restart (OB l 01 ): and cold restart (OB
struc ture: A composite grouping of
102). Start-up OBs ore called during just
variables with different data typ es. An
prior to starting the cyclical program
example where a structure may be
(OB l I.
required is o recipe. using data types
Statement list (STL}: See STL. (e.g .. REAL. INT. TIME. and DATE) . It could
also contain on array.
static conne<:lion: A connection in whic h
the properties tha t establish the logical structured program: Refers 1o o STEP 7
relationship between the partners is user program designed to toke
configured in a CPU connection table. odvontoge or STEP 7 resources that allow
and is b uilt-up at the start-up o f the CPU programming of modular b lock functions
and remains even w hen lhe CPU is lhot con be reuse d lhroughou l the
switched to STOP. p rogram to minimize code writing and
redundant code development.
static parameter: An S7 module
parameter that can only be set or subnet: A subnet comprises all nod es in a
modilied using the STEP 7 software, network. which ore connected togelher
contrasted to dynamic parameters th at without g a teways. A repea ler ma y be
may be set via the STEP 7 user program. inc luded within o subnet.
An example static Is the inpul delay on a
symbol: See symbolic a ddress. Also. see
digital inp ut mo dule.
global symbol. local symbol.
static variable: One ol lhe variable typ es
symbolic address: A substitu1o reference
tha t con be d efined in an S7 function
to on absolute address or memory
block (FB). Static variables are variables
location. represented by o name. The
thol must be moin1olned from one coll or
term "STOP_PB'' could be a symbolic
the FB to the next. These variables are
address for lhe absolute address I 6.7".
saved in the associated instance doto
See absolute address.
block w hen 1he FB is terminated.

433
symbolic addressing: Use of substitute or
name references like "STOP _PB" to
- T-
reference memory locations. instead of
absolute addresses. like I 6.7''. See temporary local data: Variables defined
absolute address. using the (temp) designation in 1he
symbols table: A STEP 7 program
declaration table of o block. Variables
component that allows users to define designated os such ore only available lo
symbols l o represent absolute addresses. the local b lock and only while lhe block is
Symbol definition involves specifying lhe being processed. See local stack.
name (symbol). absolu te address, data time base: A unit of time generated by
lype, and on associated comment. the system clock and used by software
Symbols defined here are considered timer instructions. Normal time bases are
global. See global symbol. 0.01, 0. 1, and 1.0 second.
synchronous error OBs: Th e group of lime-delay Interrupt. An S7 Interrupt
organization blocks c alled when one of capability that causes on interrupt to the
the synchronous errors occur. CPU o fter a specific amount of time hos
synchronous errors: Run-time errors lhot e)(pired (e.g .. every 100 ms.) S7 300 and
ore associated wrth or resultant from a S7 400 systems provide time-deloy-
particular aspect of the user program interrupt OBs to allow crea tion of service
(e.g., addressing error, error accessing 1/0 routines to respond to user-configured
module). See synchronous error OBs. time-delay interrupts. See time delay
interrupt 08s.
system blocks: S7 blocks that ore actually
time-delay Interrupt 08s: OB 20 to OB 23
components of the operating system.
Such blocks include system functions ore provided for servicing time-delay
(SFCs). syslem function blocks {SFBs), and interrupts configured by the user. The
system data b locks (SDBs). code blocks called lrom these OBs will
support timed regulated processing of
system data object: The compiled certain portions of the user program.
configuration doto that is loaded to the lime-delay interrupt OBs available to o
CPU. The data con1oins configured program, is CPU dependent. See Ume-
hardware and network configuration and deloy interrupt.
connection informa tion.
time-of-day Interrupt: S7 300 and S7 400
System Function (SFC): An S7 Function, systems provide time-of-day interrupts to
integrated in the operating system of on support processing of certain portions of
S7 CPU. SFCs ore called from the user the user program a t o specific time of
program just as any o ther Function. What day either once only or periodically (e.g.,
SFCs are usable, is CPU-dependent. hourly. doily, weekly. monthly. yearly. or
every minute). See lime-of-doy interrupt
System Function Block (SFB): An S7
OBS.
Function Block. integrated in the
operating system of on S7 CPU. SFBs ore time-of-day Interrupt OBs: OB 10 to OB 17
called from the user program just as any ore provided for servicing user-configured
o ther Function Block. What SFBs are time-of-day interrupts. Time-of-day
usable. is CPU-dependent. interrupt OBs ovollobte to a program. is
CPU dependent. See lime-of-day
in terrupt.

434
Glossary

timer memory (T): The area of the system un-conllgured connection: A togicot
memory containing locations used for communication link between S7 p artners.
software timers. Each timer word. when in which the connec tion is established
se t, contains the timer preset value in dynamically al runtime when the active
BCD, and the user-defined time-base of partner in the link initiates the service.
the time,. The le tter 'T' precedes each S7 instead of being defined expliciHy os w ith
timer address (e.g .. TO. Tl, T2. and T3 each configured connections.
is a unique timer.).
unilateral communication: Refers to S7
timer preset value: A programmed value communication between partners, in
that determines the number of time-base whic h there is o communica tions system
intervals to be counted in a software function b lock (SFBJ only on the local
timer and. subsequently. the partner (e.g .. "GET" SFBJ. See bilateror
programmed time duration. communication.

tralllng edge: The falling edge of a signal User Defined Type (UOT): See UDT.
(i.e .. the ON-to-OFF or t -to-0 transition).
User Memory: S7 memory tho! holds the
tree structure: A graphical report showing control program and dota. In S7 300/S7
how blocks are called in a given 400 systems, the user program is in two
program. areas. load memory and work memory.
See lood memory; work memory.
trigger frequency: When using the
Monitor/Modify variable utlllty. setting the
trigger freque ncy enables you to
determine whether selected variables are -V-
monitored or modified once or every
time the trigger point is reached.
variable: A factor thot can be altered.
trigger point: A setting in the measured. or controlled: quantity tho!
Monitor/Modify variable utility, that con c honge in value.
defines o point in th e active user program
(e.g .• start o f cycle. end of cycle. on RUN· variable declaration: The ac t of defining
to-STOP transition). that will determine a variable for use in the user program.
when selected variables ore to be Declorotion requires noming the vorioble,
monitored or modified. defining its data type (e.g., BOOL INT,
etc.).

variable declaralfon table: The pali o f a


-u- b lock in w hich its local variables ore
defined. In the case of code blocks.
depending on the block type. these ore
UOT: A composite of user-defined the b lock parameters os well a s th e
elements of arbitrary data types, that temporary or static doto. tn the case of
may be used to declare local variables data blocks, the declared variab les ore
of o b lock. specific vofiobles ol o doto the dote addresses.
block. or the variables of on entire data
variable table (VAT}: User created tobte
b lock. In essence. a UDT is a struc ture. Up
containing a group of variab les to be
to 65.535 UDTs from UDT 1 to UDT 65.535
displayed. monitored and perhaps
may be defined. A UDT is global. and
modified or forced. Up to 255 variable
once defined may be reused repeatedly
tables from VAT 1 to VAT 255 may be
where the same data struc ture is
created os resources for monitoring and
required. See slrucfvre.
debugging the control program.

VAT: See variob/e tob/e.

435
-W -

warm restart: The new name for the


complete reslorf mode of earlier STEP 7
versions. This restart mode is triggered
whenever the CPU mode selector switc h
Is moved from STOP 1o RUN, or upon
power up (provided the CPU hos battery
bock.up). Ono warm restart, the CPU
and oil modules ore reset to their initial
stoles: non-retentive doto is erased; OB
I00 is called: the process image of inputs
(PIIJ is read; and the main program (OBI J
is called for processing.

work memory: High-speed S7 CPU RAM.


that contains lhe relevanl portions of the
user program; these ore essentially the
program c ode blocks and the user data
lhot lhe CPU calls when processing the
user p rogram. See load memory.

436
'
Archiving a project
library SQ
projec t SD.
Array, data type 206,2Ql..23Q
Asynchronous error OBs ill, 1..6.L
Asynchronous errors 12.4.
Authorization l 2-15
AuthorsW 11, 1.1. 1.6

- B-
Index
BRCV 352,:i.5.6
BSEND 352,:i.5.6
B-stock 326,327.342
Binary result 213. 222
Bit logic inslrvctions 212
-A- programming 252..2.58. 260
Bil memory l.Q6. l..'22. 1.26.. l2Z
AG_LRECV .3.i3.3.5.i.356 Blocks 36
AG_LSEND m 3.55..356 documenting
downloading 296, 3 14-315
23.8

AG_RECV 353,355.356 editing and saving 236


folder 33..;ffl.~
AG_SEND 353,355.~
generating 232
Accessible nodes utility ~330 header 228.232
parameters 206,20.8
Accessible node window 2M.~32Z
stack 326, 32L 342
Actual paramelers 120.. 121. 228. ~ 2M types 188, !1Q. ill. 1.22
uploading 226. 316-312
Address, absolute window 2lJ
Address. symbolic
BOOL, data type 200.246.254
Addresses BYTE, data type 200
analog 1/0 134, 135, I 80, l.8J
digilol 1/0 I26. l 27. 172. 12.l
Address identifier 22
-C-
Address overview 60,6B.69

Analog input C-bus 56.57, !38.384


addressing ~ us.. Uill. l.8J
module p roperties 128.. 129. 174. lL2 CFC z
signal parameters L3Q. 1.3.L !Tu. lZZ Central rock configuration
Anolog output SZ-300 78, 79
addressing 1.:H. I 35, 180, l.8J 57-400 136. l3Z
module properties 1.32. m 11a. 112 Central processing unit
Index

CHAR. data type 2115 Connection table ~ 3.51. 364,390.391


Charts z Connection types 3£Q,_ 4Qf

Clock memory lili.. ill2. J.jQ. l.5J Continuous function c hart Z


Code block I.& Conversion instructions 216-2) Z
documen1ing Zill programming 264-262
editing and saving 236
Counter inslrucHons 2.L1
generating 232
programming 262-263
Cold restart 101.1§..305
Counter memory 198, 21 4, 417
Communicolions bus ~~38§.
Counter. down 214,262, 410
Communications processors 2. ~ 157-36
Counter. up 2li.. 262, 268, 410
Ethern et 359-361
Profibus 357-358 Counter, up-down lli
Compac t DP slave CPU properties 1.00
configuring and attaching 88:82 access protec tion 112, 158, 297. 304
cycle ond c lock memory l (M. JSO
Compare instructions 22Q
cyclic interrupts ~ 1M, 1.82
programming 268-269
diagnostics and clock l 10. 156
Comparing programs general 100
online/offline 296.318 interrupt 111. 160
path I /palh2 297, 32Q local memory l 08, I ~
performance dala 3D2
Compressing memory 3.12 retentive memory l..02. L5.2
Configura tion tables 62. 70. 12A. 1.32 slartup JQ2. 148
lime-of-da y interrupts !.!.A. l1i2
Configuring Compact DP Slaves

Configuring
Compact DP Slaves 88
Elhemet Connections 4Qf
- D-
Profibus Connections 320.
GD Communication 3Z6 Doto Block l filh I 22
Hardware Stations zo accessing dolo elements ] ~?BB
Intelligent DP Slaves 90-99 creeling 228
Modular DP Slaves 86 editing 230
Modules for Multi-computing l.82 instance 1.22
Multi-compu ling Operation 1..38. shored 1.22
S7-300 OS DP-Mosler 8.4.
S7-300 Cenlral Rock 78 Dote lype 200
S7-300 Local Expansion an complex 2Q6

S7-400 OS DP-Mo sler L40 elementary 200


S7-400 Central Rock l.3.6 user defined 208
S7-400 Local Expansion L42 parameter 20.8
S7-400 Remote Expansion ill DATE, dolo type 20A
Simotic Workspace 1.8
Subnets m1~392 DATE_AND_TIME, dclo type 2QZ

CP 342-5 OS O DP Slave 22 Decloro1ion section 1.90.. L2.l


CPU ,1J 5::2 DP as DP Slave 9Q
SM 147/CPU os o DP Slave 2:1 Diagnostic buffer 11M. I ill. 130. l iQ. 298.
Connections 3.5.Q.3£Q,_,10.4 Diagnostic inlerrup t l 2kl~J30.l.68..126
configured 350. 351 ,3,53, 355, 356
un-configured 351, 413

438
Index

Digital input
addressing 126, 122
- F-
module properties l.2Q, 1..66

Digital output FB lfili. 120


addressing ~112 FBD ~202.202.~
module properties 124, 1ZQ
FC 188.. w
DINT, data type 203
FOL 35:l
Direct connection ~ru
FOL connection 3.53
Direct 1/0 read 197,286
Floa ting-point 204,218,272
Direct 1/0 write 197,286
FMS 353, 3.5.6
Double integer 203
FMS connection 353.3.5.6
Downloading
blocks 296 3 14 Formal poramelers 1.20. w
network configuration m3.68. Function w
DP-master colling 12.L 242.. 2.4.6
S7-300 M coll with formal parameters 2.4.6
S7-400 l..:10 coll without formal parameters 2.12
programming ~2.4.4
DP-slave
compact 88. Function Block 1.20.
intelligent w. 22. ~ calling 190,250.25!1
modular 8.6 coll with formal parameters 25!1
57-3 1x-DP as intelligent 20. coll without formal parameters 250
CP-342-5 as intelligent 22 programming 248, 252
BM 147 /CPU OS intelligent 2A Function Block Diagram ,2. 212. 234
DWORD, data type 2Q2 Function modules 52
Dynamic connection .:ill

-G-
- E-
GD communication 354.
ET-200 86 GD table lli
ET-200 B 88 Global d a ta communication 354.
ET-200 M configuring lli

ET-200 S 8.6 Global dalo. receive lli

edge evaluation operations Global doto. send lli


p rogramming 26Q
Global symbol 2.U
Error OBs 1.82

Expansion rock ~1.42


- H-
Ex1ended pulse timer 2l!i

Hardware catalog 61. 64


Hardware configurolio,, 6.Q. 6fJ.. ZO

Hardware interrup ts 111. 122. l !ill, 168

439
Index

HiGraph l.Q
- L-
Hot restart 1Q2.. 118.. 305

LAD 5.
LAD/FBD/STL Editor 20£
- I- Navigating 23!1
Library 33
IM 360/IM 361 SZ.80..82 archiving SQ

IM 365 57.82 S7 standard 3.4.


IM460 SZ. 142, i l l Load memory m.30.6
IM 460/IM 461 5Z,_ L12 Local 1/0 expansion
57-300 fill
IM 46 1 5Z,_ I42. i l l S7-300 Single-Tier 82
IM 463 SL i l l 57-400 1.42

I-stack 326. 327.342 Local memory 100. lSA

Industrial Ethernet 342 Local stock JOO. ISA


Input b it LU Local symbol 2.26
Local variab les !.2Q. ~
Input byte ~ l.22
Input double word 1.22
Input image 172. 196. l.22 -M-
Input memory 112.t 172. LUi
Input word ~ !JID. ~ 1.22 Memory
addressing l.26
INT, data type 2m areas l..Ui
Instance l.2Q bi! l.2Z
byte 1.2.L 1.2.2
Installing authorizations g compressing 312
Instance Doto Block 190, 1£2 double word 197, 1.2.2
word !iZ. 1.22
Intelligent DP slave
S7-3lx-2 DP O S 20 Minimum scan cycle time !fil. 1.50
CN4N os il Modular DP slave
BM 147/CPU as 2.4. configuring and attaching 86
Interface module sz. Monitor/modify variables 33.!I.
Integer 203 Move instruc tions m
Integer arithmetic instructions 218 programming 286-287
programming 270-271 MPI 59,3.48
Interrupt )94-195 MPI address
OBs I.B2
hardware !li LID MPI network

Interrupt input p roperties 122. 1.68 Multi-computing


configuring 1/0 modules 182
Interrupt stack :HZ interrupt OB I.B2
ISO transport service 3.5.4. S7-400 Central rock 1.3a

ISO-on-TCP service 355 Multi-point inte, race 52. 3.48

440
Index

PG/PC system 2. 12. 26. m. .388. rn


-N-
Parameter data type 208
Nesting level 108. 1M Password Protection 112.1 58
NETPRO 362,366.368 Partitioned p rogram 1.86

Network 3illl Perip heral inpu t 196, ill

Network configuration J62. 364, 36.6 Perip heral inpu t byte l.£Z
New Project Wizard AA Peripheral inpu t word ~ 1.00.. ill
Peripheral memory 180, ill
Peripheral outpu t 196, ill
-0 -
Peripheral output byte Lil

OB I 189, 1..2.!1 Peripheral output word ~ 00 ill


programming 29) -292 Power supply 2. 58
Object 33.38 Priority 114.. l.& )94-)95
Object prop erlies 32 Priority class 100.. 154, I 94-195
Off-delay limer 215 Process image inputs 1.26
Off-line blocks 236 Process image outputs 1.26
011-llne window 36 PROFIBUS ~

On-delay timer 215. 264 Profib us DP 3M


On-line blocks 236 Program flow control inst ructions 22J
On-line w indow 36 programming 276-279

Opera ting modes 2!ZiL. 298, 304. Project 32,38

Optional tools 2., 12 1.6 Project window 32,38

Organiza tion Blocks 146, L6Q. !!ill. 1/rl, 1..2.!1 Pulse timer 215

Other Sta tion 48, 365 Pulse timer extended 21.5

Output bit 1.26


Output b yte !1.2. 1.22 - R-
Output double word 1..22
Output image 112 l.9b.. 1..22 Rock 2.~'2L80
Output memory 126. 172, ~ REAL arithmetic instruc tions 218::212
programming 272-275
Output word 1.J4. 180, 196, 1.22
REAL, data type ~ 20.6
Receiver in lertoce modules sz.
- p- Remote 1/0 expansion
SZ:40Q w
P-bus 56. 57 Removing authorizations I.A
PC adapter 26 28 Resetting CPU memory 306-307
PC Sta rion 358-359, 36()-36)

44 1
Index

Restart Setting lhe PG/PC interface 28


cold J.Q2, 1~305
hot 102, I 18.. 305
Shift-Rotate instrvctions m
worm 1.02. I 18.. 305
programming 282-283
Signal modvles 52
Result of logic operation ~25Z
Re ten tive bit m emory ~152
Simotic Monoger 32. 35. 38. i!O
Simo tic NET 3Aa
Re ten live on-delay timer 2.1.S
RLO 2 12. 2 13. ~ 260
Simatic PC-Station 61. 358. 360

RUN mode 304-305


Simotic Station 33
Single-user environment 18
RUN -P mode 304,305
Source !older 33
Standard library 3.1
-s - Start-up OSs 189. 1..£4

Sta te m ent List 5.234


SSTIME, doto type 2.05
Stolic connection 3.5.1
S7 300
os DP-master M Static variable llil. 1.22
as intelligent DP-slave 20 Station .ll. ~ ~ ~ 70:74
basic con1ponents .56-52
central rock configuration 78-79 Sta tion conflgvrotion zo
local expansion 80-83 downloading u
up lo ading 24
S7 400
viewing 68
as DP-masler l..4Q
basic components 56:59 Sta tion window 62
central roc k configuration 136-)37
Sta tus bit instructions 222
local expansion I 42- 143
mvlti-com p uting configvrotion I 38-1 39
programming 284-285
remote expansion 144- 145 Sta lus bits 222. 2fu1.
S7 connection 3.i) , ~ 356 STEP ZAvlhorizalion u.
S7CFC z STL 5.234
57 Functions 352 STOP Mode 30A,306.31 2. 3JA.326. 342
S7-GRAPH a STRING, dola type 2Q6

S7-HiGraph LO STRUCT, data type 2QZ

S7 Online Connection 26 Struc!\Jre 2QZ

57-Progrom 33 Subnet ~

S7-SCL
Industrial Ethern et 3.42..322
2
MPI 348 ,3ZQ
SFB 188 Profibvs 3.42. 3.28
SFC 188 Subnet ID 3ZQ-3Z I . 378-379. 392-393
Sample projects 42-43 5J Symbol 226. 215.
Segmented rack 51 Symbolic addresses !96.226
assigning to 1/0 modules Z6
Set-Reset operations 2.1.3 viewing and editing 226
programming 258-252

442
Index

Symbols table 226 UDT. doto type 208

Synchrono us error OBs 1..82 Un-configu red connection 35..l


Sync hronous error interrupts W2.W Unlversol ro ck 56. 57
System blocks l.BB. Uploading
b locks 3.1.6
System doto blocks l.88
S7 p rogram 3.16
System data object 60 s-totion configuration l.4
System Function 35.J user blocks l.BB.
System Function Block 352 User Defined Type 208

- T- -V -

TCP/ IP se,vice 355 VAT 3.32


Temporary local d a ta )90:)9) Variable 192. 200-208
TIME. data type ~ Variable declara tion table )90..)9)

TIME_OF_DAY. d a ta 1ype ~ Variable table 3.32


Time-delay in terrupts J )4.160,l84. l94
Tim e-delay interrupt OBs lli. 160,189.194
-w-
Tim e-of-day interrupts l !A. I 62. I 94
Tim e-o f-day interrupt OBs l }Q..162, l89,194 Worm restart 102,1 48,305
Timer instructio ns 21.'i Watchdog interrupt 118. Jful
programming 264-265
Watchdog intorrupt 08s J18. JM
Timer memory 1.98.
WORD. dolo typ e 200-20 )
Word logic instructions 223
- u- programming 280-28)
Work memory 303, 306

UDP service

443
Notes

Notes:

444
Notes

Notes:

445
Notes

Notes:

446
Notes

Notes:

447
Notes

Notes:

448
-

I I I

P-roclicol
• task-oriented

P.resented in a steP.·by-steP. t .. .
...

ore surelx alreodx done!

Started

Actual
P.resented

ISBN 1-889101-03-6
90000>

9 781889 101033

You might also like