Professional Documents
Culture Documents
LAD FBD HansBarger
LAD FBD HansBarger
Automating
with STEP 7 in
LAD and FBD
51MATIC 57300/400
Programmable Controllers
SIEMENS
HansBerger
Contents
Automating with
STEP7 in LAD and FBD
Programmable Controllers
51MATIC 57-300/ 40 0
by Hans Berger
Th" Jl<OiJ1Imming .,.ample. oO<1OO11lnll" on dc",,";bing III<: L"-O .ne! FBD fUDctioll1 and prO~id'"lI SJM,,-TlC 57
_ ... with progr.mming tip. for wiving speclfio ta.k. with this contron.r.
Tho programming example. gi vell 1ft the book do I",t prot.n<! to be complete w lut;"", or to be "ne u,.hle on
fulu", STEP 7 rolea.." or S7-300/400 ver.;onl. AddilioNll .Ir. mu>t b. talen in order 10 comp ly with 11>0 ",I_
""ani safely "'liIu l"i"" .
,hi.
The luthOO" and pub'is"'" ha vo taken ~at e,,", wi:h an I~x\l and illU>tnltioos in
book. ".".<thel". orrl>t'll
""n """.r be comple'ely avoided. Th" publisher lfId tho author
no [jability. ""anll... oflepl booi fo<
any damap ",.ulling from the use of the pmlil'V".rrunll .xamples.
""".-pi
The aulhor at>d publi.her are ah.",YJ valefu! 10 bear your "'SJIODSO> 10 th~ conlen'" of me book.
PubHcij CorporolC PubliMrina:
P.O. IJ.ox 32<1
0 _91030 Eriangen
E_mail ' publ io;hin g -bools@publioi . de
Inl.""", www.p ub lici .delbooh
ISBN 978-3-89578-297-8
4th edItion. 2008
Ed itOr. Si.m .... "-klkngcselbchaft. Berlin and \h"llch
l'ubli,h..-: I'ubIkil COIJl'O'"'lle Publi.hiog, Erla/li""
C 2008 by Publici. KommunihtionsAIClIturGmbll. OWA. ErI""lIen
Thi. publiclloon and all parts tlterwf an: plttl"'" by copyrillht. All rights ..,..,."ed
Any ux of;1 outoide the striet prm.-;.ions of the copyrigbtl.'" without th., consetll oftht publisher is forbtddon
and ..m incur pt;nallia. This &pplil!1 pankularly 10 ",prot.!l,ICIion. ..... <1!I&tKm. mkmfilmillj or otbcrproc:ouin3.
and 10 6t""'Je or proces.injl: in electlttoic. 1}'1ttm. It al", oppli 10 tho use of ex"""'", from til<: text.
Prinled in Gcmuny
Preface
Preface
Overview of the
S 7-300/400 progmnunable
logic controller
Introdncdoll
1 SlJ\L\TIC S7-3IJGI4Q(l
C"",,.,,Uor
I'LC functions
comparahle to a comactor
control sy,tem
Ba.k fun<."I1"ns
Digita l fUllctioUJ
9 Cump.ri..,n Function.
Comporjwn Accordu'i 10
Da'" Types INT, DiNT and
Pru~rammabtc
N""ting t'uru:lions
Memory Ar"",~
Distributed [10
(PROFIfIUS QP):
5 Memory Functio ns
Cooununiu><ioDs (Sutm.t.),
Midlme o.,lp"a;
M.-.Juie Addru8C.;
bdge e,-.Iua"oo:
Add,."..,., A,,,,,,
I:.~.tnple
of a Cooveyor Bolt
Control SY"t<m
2 ST EP 7
SGR... r.
~:
3 SI:\-tl\TIC S7
Pm~m
7 'f!moro
Start SIMATIC Timon with
F ive Diffe",nt Ch.,-aotrn.tic.,
Re ~tting and Scannmg;
lEC Timer Function.
.-u.nct1on.
FunctiOn>;
~u.ring_ Square_root
hlr3<lion, Exponerrtiatioo,
U:>garitlull5
t3 Shift fun<tion.
8 Counto ...
Mot~.m.lIcat
Program I'mce"ing;
Blocl{TyJ>e' :
11
12 Com'oT5ign fUDotlon.
Arc functi<m.;
6 Mow FUDction'
Tri~omctric
P",&rammID~
Ilditiog Projects;
~,
SIMATJC Counter->;
Count up. Count down, SCI,
Reset.nd Sc"" Count""';
IEC CountIT Function,
14 Word Lo~i<
l'r<:>o;:e;sin&
AND, OR and &d""i,'. OR
Worrl Logi<: Operation
The: pre5CIlt book provides many figureS repre~t iDg the use ofl/lc LAD aod reo J'!TOiI1UIIming languages. All programmini examples
can be downloaded from the publisller', website _w.publicis.deIbooks. There are NoD Iibruiet LAD_ lJ.ook Md FOD_Book.
The libraries LAD_Book and FBD_Book contain dght programs that are ...entillly illustration, of the graphi~al rcprestntation. Two extens;,c cxamples oIIow the propamming of
funcrion$, function blocks and local instances
(Con'cyor Example) and the handling of data
(Message Frame Example). All the uamplcs
contain symbols and comments.
,
~ 8
fa
103
106
FB 101
fB lOS
Fe 4-t
To uy the programs out. set up a project corresponding 10 your hardware configuration and
then copy the program. incl uding the symbol
table from the library 10 the project. Now you
can call the example programs, adapt them for
your own purposes aud tcstthem onlin e.
DUI1)'pu
EXlmples of Definition and Applieatillll
fB
FB
FB
FB
Basic FunctiOn!
FUD Reprcs<:nlOlion Examples
Conwyor Enml'l e
Examples ufBasic Functions and Locallnstanc~
Fa
FB
Fa
FB
FB
Fe 11
FC 12
FB 20
Fa 21
1().1
105
106
107
108
Chapttr5:
Chapler6:
Chapter7:
ChapterS:
Memory Fl1IIC1ion<
Mo,. Functi<Kl.'i
Timer Functions
CO\If\ter Functions
FB 22
Belt Control
Counter Control
F=<
Con"eyor Belt
Paru Counter
Digltl l FunctIons
fBD Reprnenllotion Examples
FB 109
fa]10
FR 111
FB 112
Fa 113
Fa 11 4
Chapter 9:
Chapter 10:
Ch.lpter H:
Chapter 12:
ClLapterl3:
Chapter 14:
}'ro~r.m
FBD
Compari:!Oll flmCliOll$
Arithm~tic func(ions
Math FunctiolU
Conversion F"""ions
Shift Func(ions
Word Logic
Flow ContrOl
Examples
Re~sentalion
FB 115
FB 116
Fa 117
FB 118
Fa 119
FC 41
FC 42
FC 43
FC ~
R.ange MoniUlr
Limit Value Dc~linn
Compound Intere,t CIJculalion
Doubleword"",i'le Edge E,.. lualion
- .
..".
......." ,'
O~"'''ting
=w-
i"",7~
'"
Use pmject
ass istant
a nd CPU)
~"
Creat.. Pruj..ct
contain",
CD
, ,,
tnunstaUOrt
1-
-,
Open Hardware
cbj&e1
"~I
.'
proje ct
~",.
Sa~ e
insert
a ootMr ttatiot1
is ""I up
COOfogUf6
000111 .... s tation
CD
Project structu re
and canpi le
Compiled configuration
data ere located In 11>8
object
Sy~
DB/a
'"
...
...
:::~~
u"
:f
Slart netwo<l< conffguration
Insert miss;""
objects
commun ica~o ns
Incr~~nt81
"
'::;'~
J
Define data structur..
program structure
Se leCllllodule with
"connection capability"
and conllgure connections
with t~" connection table
Program
1
I
I
Single slep
,=1
!
, ,
08~
J p il6
program
source fi les
I,
.-
(j)
Creato
program
source ~ Ies
De~n"
M'
SOU'C<Ioriemed pro-
.!
P",ameterlze CP modu les
ro lovam
Isof(v;.....
fJJ
Switch onl;ne
Gan era!"
rnf...-&nco d ata
~
.
COfTact e'rors , updata
offlin .. database
j Test n,,~t
;
(j)
"
Cont<111<1
Contents
:Jnmidvctl(ln . . .
S IMATIC S7-31111/41111
1.1
Stru~IUn.:
1. 1.1
1. 1.2
1.1 .3
1.1.4
I.I.S
1.1.6
"
......
rro~nmm"ble Controll~r.
of the Programmable
ContruU.,. . .
Componenu.
S7-300Station.
S7..400 Stati"".
fault-tolerant SThfAllC.
Safely-n:Ltted SIMATTC.
CPU M~mory Arcas.
Distributed 110 .
'"
20
2.2.1
2.2 .2
"
28
2.2.3
1 .2 .4
Creating Projecu .
Managing. Reorgan;~ing and
Ar-chiving .
l>roj ect Versions
C!"""in g and editing tnullipr()je~t~
28
31
2.3
!J. I
1.3.2
Introduction _
J5
31
1.3.4
Scn~Ce'i.
Madule Add1X'<;scs.
"
1 4.1
1.4 .2
1.4.3
\.4.4
1.4.S
1.4.6
Sigual Path . . . .
Slo\ Addre~ ..
Logical Add!""s .
ModuJ~ Slart Addu,," .
Diagr>oStie~ Address . .
Acidre!lK'5 for nus Node;;
I.S
Address
\.S.I
I.S.2
J .5.3
!.S .4
Art:a~
2.1.3
14
J5
Communications
Connections .
I Illllallation
Automation Liern~e Manager
SL"-t.'\TIC Marutgcr .
Proj ects and Libraric~
Multiproja"1s .
""
"
Jl
SubllCt~
2.1 . 1
2.1.2
Editing I"rojects.
Communication .
..
50fh, a re
2.2
L3
2.1
Pr(lgrammjn~
Ocline ITdp . . . .
Gateways
PR QF""mTO
STEP 7
2. IA
2.1 S
2.1.6
20
20
1.2.1
1.2.2
1.2.3
1.2.4
\.3.3
PROFUIUS l)P
"
.,
"
"
""
""
"
"
"
"
"'"
Ar",nging Mooule ..
2.3.2 Addr.-ssing Module.
2.3.3 ParnrneterU.ing Module.~
2.3 .4 .!'-etworking Modules ...ilh MPI
2 .3.S Monitoring and Modifying
Modules. . . .
1.3 .1
49
""
"
50
53
""
"
"
""
"
'"
60
60
""
'621
2.4.1
2. 4.2
C(lnfi~uring
62
2. 4.3
2.4.4
2.4.5
2.4.6
2.5
2.5.1
2.5.2
2.5.3
2.5.4
Introduction.
Symbol Table .
Pro);I"3ffi Editor.
Rewiring
Addre. s I'riOOty
Refel"l:!l<:c Data .
l.no:uage Setting .
2.S.5
2 .5.6
2.5.7
""
'"
68
'"
70
70
71
"
"
76
77
79
Contents
2.'
Online
2.6.1
2.6.2
2.6.3
2.6.4
2.6.5
Connecting a PLC
Prote<:ting the User Program
CPU Information .
Loading the User Program into
the CPU
Block Handling
2.7
2.7.1
27.2
27.3
2.7.4
2.7.5
2.7.6
2.7.7
2.7.8
Mo d~
3'
31.1
3.1.2
3. \.3
3.2.1
3.2 .2
3.2 .3
3.24
Block Types
Block Structu!"<'.
Block Propenies .
Block Interface.
"'
"'82
"
"
86
'.2
"'
.. ..
3.3
3.3. !
3.3.2
3.3.3
3.3.4
3.3.5
3.3.6
3.3.7
3A
3.4.1
3.4 .2
3.4.3
80
"
3.5.1
3.5.2
3.5.3
3.5.4
3.5.5
3.5.6
3.5.7
" 6
'16
'"
'"
'"
,n
120
>28
86
87
88
90
90
90
"
"
"
Basic F llnctions . . . . . .
D'
'"
'"
,.,
4.1.1
4 .1 .2
4 .1.3
4.1. 4
4.1.5
.. . .
94
95
4.2
4.2 .1
"98
4.2.2
99
'"
4.2.3
4.3
'"' ,
""
'" ,.,
'"
'"
5. I I
.08
5.1.2
'08
5.1.3
.09
'"
112
'"
'"
'"
'"
,.,
'"
D2
D2
U3
'"
'"
03 '
038
' 39
'"
'"
'"
'42
'"
,44
'"
'"
' 48
5.2.1
5.2.2
5.2.3
Assign ..
Set and Reset Box .
Memory Box
' .3
Midline Outputs.
' 50
5.3. 1
5 3.2
' 50
"8
'"
U
Contents
'A
Edge Evaluation . . . . . . . .
S.4.1
S.4.2
5.4.3
"
5.5.1
Binary Sealer
..
5.5.2
Solution in LAD.
So luti(>Il in FilD .
'6
Mo\"t
6
6. '
6.'
General
6.2 .1
6.2.2
6.2.3
6.3
Fun~tlons.
MOVE !)ox
7
7. '
Thnrn . . . . . . .
7.1.1
Gclk."T1IllleprescnllUion of
a Timer. . .
Staning a Timer .
Specifying the Duration of Time
RCS<:ltinll A Timet. .
Cheding a Timer .
Sequence of Timer Operations
Timer Box in a Rung (LAO)
Timer IJ.m< in B Logic Cin.:uiT
7.1.2
7.1.3
7.1.4
7.U
7.1 .6
1.1.7
7. 1.8
Programming a TlITler .
"
IS2
'"
m
lECTnners ..
.. . . .
180
7.7.1
7.7.2
7.7.3
'80
'80
'80
Counters .. . . .
18'
'"'' 85
CounTing
IS'
Checking a Counler.
'"
'" ".. ,
'"
'"
'"
16'
16'
'62
'62
163
R.2
8.3
8A
186
8S1 Up Counter SFO 0 cru
187
8.5.2 Down Counter SfB I CTD.
'"7
8.5.3 Upldown Counter SF8 2 eni D . 187
Part;; Counter Eltampl\! .
'.6
18.
8.'
IEC Counl<TS . . . .
'64
'65
'65
166
166
166
168
168
17'
170
'"
Comparlsoo
"
'93
!J.2
'93
Arlt hmetir
' 97
"
10.1
Pnxe~.iog
f unction
Fn n~ltons
19'
Fu n~tl on
an AriThmetic
.....
.. . .
"7
'"
10.2
170
10.3
'71
10.4
'"
'"
173
II
Mathern.lleul Funcll(mt
11.1
'00
'"
Pul., Timer .
'"
'"
'"
m
'76
,\liscdlaneollli Matbmlatlcal
functions . . .
On-Delay Tim.....
177
''''
207
'78
'"
Procrssing a COO"ersiOD
function
. 207
(FU D) ..
7.'
7.3
7.'
7.5
7.6
'"
7.7
11.2
Trigonometric Functions .
11.3
Arc
11.4
"
12. \
FUIIClioDs. . . . . . . .
20'
21)'
''''
Contents
209
12.3
2 10
12.4
210
12.5
Miscellaneous Conversion
Functions ..
Shift Funcdons
'"
m
m
13 .2
Shift
2 15
13.3
Rotate
2 16
"
Word Logic
12.2
. .. ... .
14. I
14.2
'"
'"
m
220
18. I
I 8. I I
18.1.2
18.1.3
IS. I .4
IS .l.5
18 .1.1;
DO
DO
238
18.2
2"
18.2. I
18.2.2
18.2.3
18.2 .4
18.3
Status Bits . . .
15.1
'" "
15.2
222
15.3
224
15.4
225
225
15.4. I Scuing !ne Binary Result BR
15.4.2 Main Rung, EN/EKO Mecbanism 225
15.4.3 ENO in the Case of User_wriuen
Blocks .
226
"
Jump F unction .
16.1
m
m
16.2
Unconditional Jump
228
16.3
JumpifRLO - I".
229
16.4
229
"
Ma.ter Control
17. 1
MeR Dependency .
17.2
MCR Area
17 .3
MCR Zone.
'"
17.4
233
R~la y
m
m
232
239
2<0
241
'"
'"'"
2"
"
221
'"
m
"
\ 9.1
249
2>0
'"'"
m
m
m
m
Block P a rameters .
B lock Parameters in General
253
Paramelcrs
Formal Parameters
'"
'"
19.3
Actual Parameters .
2S3
19.4
260
19.5
F~amplcs
260
260
26'
262
Program Processing .
.269
Main Program.
'"
23O
"
20.
Program Organization.
270
'"
"
20.2
272
20.7
272
176
276
20.7.1 f~ndan1entals.
20.7.2 1\>.o-Way Data Exchange .
20,i.3 Onc-W.yD"tanchange.
20.7,.1 Tnmsfcning Print Dahl.
20.7.S Control f unttiollll. . .
20.7.6 _\Ionitoring runctions .
20.3
Program f unctioos
20.8
20.3.1
20.3.2
20.3.3
20.304
20 .3.S
20.3.6
20.3.7
Tillie or dsy .
Read Sy'tem Cl"",k
Run-Time Metcr , .
Compressing CPU Memory ,
Waiting and Stapping . . .
Multiprocessing MOlle . . . .
Determinin& the Oil Program
Runtime. .. . . . . . . .
Ct.angin8 program protK1ion .
27K
20.8,1 Basks , . . .
20.8.2 Estah lishing and cleari ~ s
down Co""ect ion~. . . , ,
20.8.3 nata transfcr with TCP "flliv~ or
IS(}...-,n-TCI'
.... ,'
20.8 .4 Dato. transfer with UDP.
20.3.~
2004
20.S
27S
2RO
no
282
2K2
2M2
283
286
287
287
292
'"
3"
300
1/0 .
314
320
20 .5.1 Furtdamemalll . . . . . .
20 .S.2 Configuring G O communication
20 .5.3 Syslcm Functions for
GO Communicotion.
20.6
274
S7
l:J"si~
Commuuicatioll .
320
322
324
324
"
20.9
S7 Communication . . .
IE communie,uion ..
DO
DO
332
m
335
335
3"
339
no
341
343
345
20.9 .1 fundsmCfltals.
20.9.2 ASCll driver and 3964(R)
pro<edure
20.9,) RKSI2 ~omputer coupling.
347
. 349
20 .1 0 Config'Jration in RUN . . .
352
'"
352
353
3S3
3S4
354
354
21
Inlcrru pt H a n dlln K
356
21.1
General Remarks .
356
21 .2
Time-of-Day Inttmtpts .
Timc-Delay inteTTUpt~
360
C()nt~nts
2 1.4
Wakhdog
Int~ITl,pts
363
Hardware InteITllpts
365
365
306
2 16
DPVllnterrupts
367
21.7
Multiprocessor Interrupt .
369
21 .8
370
367
21
~. l
21.9
372
"
Starr_up
Char~cteri"tks
12.S
Parameterizing Module"
22 .5.1
393
23.1
Synchronous Errors.
;93
23 .2
395
'"
23 .3
AsynehrotlOl1< Errors
398
23.4
SY"em Diagnos!ics.
'00
376
377
377
377
22.2
378
Remarks
Power_Up
22 .2. I STOP
Mod~
Appendl~
no
24.1
Block Protection
22.2.4 Retentivity
22.2.5 Restan Parameterizati<m
24.2
Illdirect Addressing.
of R~'tHn
22 .3 1 START-UP Mode
22.32 Cold Re<ran
12.3 .3 Warm Restan.
22.3.4 Hot Re8{art.
22.4
383
243
380
380
380
Supplemen{S to Graphk
Progrllmmin1:
378
Typ~,
397
;oJ
;97
400
400
401
403
22 .3
;oJ
Web Server
23.5. 1 Activating
378
379
390
'Error Handling
23.5
G~neml
'88
23
'"
376
22.1
3R6
24.2.1
24. 2.2
24.2,.1
24 .2.4
BrieflJescription of the
-MessHge Frame Example" .
..
4U(i:
.97
'"
"8
'"'
.08
408
"0
410
'"
ConteDts
......
'"
"
m
fun ctio n
16. 1
Bask functions.
26.2
Digital Functions
426
'"
26.3
'28
25.4
'"
420
25.5
421
25.6
2S.7
27 .1
Basic Functions.
'"
Communication BI<xh .
27 .2
Digital Functions.
258
'"
'"
m
"
27 .3
25 .9
SIMATIC_NET_CP .
423
Bhxk Librari es . ..
"
25 .1
Organization BI<xks.
25.2
25.3
'"
'"
~t
LAD.
'"
",
429
<3,
m
Indu .. . . . .
433
Abb re,'lations.
'"
IntTOd uction
Introduction
STEP 7 is the programming wftwarc for S7300/400 and the automation tool is the
31,\tATfC Manager. The SIMATlC M an"gcr is
an application for the Winnov." op"rating systcnts from Microsoft and contains all fLInetion,
need<;"d to set up a project. 'Vhen neces,ary. the
SIMATIC Manager ,tan, add itional tool, . for
example to configun.: , talion" initia liz~ moduks. and 10 write and tcS! pro gra,,,s,
1.1
Controller
1.1.1
Compo nen t.
> Racks
AcootnlllOdate the modules and oonnect
them to each other
~
1.1.2
Centnllzcd configuration
I>
worb
(.ubnCI~)
> Subnna
Connecl programmable conlroller5 to eacb
other or to other dcviccJ
A programmable controller (or station) may
com;stofseveral racks. whkh are linked toone
another via bm cable,. The pOwer sU;lply. CPU
and VO modules (5\-1,. FMs a&d CPs) are
pluaac:d into me central rack. If th= is not
enough room in the cenlnl! rack for the LO
modul"" Of if you ,,"ant some or 111 1,0 mod.lIes
to be 5CJHIrate from the ccnlTlll reck. expansion
rach are .... ailable which Ire Connecl<:d 10 the
centro l rack via interface module!< (Figure l.l).
20
t>
t>
57300 Statlnn
I>
,\
Modular configuration
Four-tier contigural;on
wilh 1M 3()ti ""d [~j 361
of aD S7-300 Stati"n
Two-t i. , ,,,,,f'gur.non
WI'" l.\t 3M
w_
1.\1 %()'l
1.\1 <60-<
1:-.< .{,ll
Loc. l "'1llI"
up'u 5m
witt""" ~ V
tr:.rwniMiOIl
(l\t46 j-{))
R omot<; ",ng<
"PlO 100m
witboul 5 V
.... ''<In;'';on
(1M 461 ])
Romot< rang.
up (oWO m
""I00U' ~ V
R
"""". rangefur
up
10 WO tll
S5 oxpan>ion uni"
(IM 314)
F ; ~u",
Loco! r><Li<
","'l.lrn~ i th
5V
"""""',>Coo
(N 46\ 1)
The now dis<:omin ued CPU ) 18 can be replaced by the CPU, 3 17 and 319,
Cl'U5
SIPLUS S7_300
Compllet CPU.
I>
In\cgral liOs
Digital and analofl inputs/outputS
Integral technoi<JiY function,
CP Us
1.\ .3
Ctnrrallzed eonlieunli()n
The conlrOiler me\( for the S7-400 i$ available
in the \... Rl (18 slots), U R2 (9 stol~) aod CR3 (4
sh)ts) vcrnions. UR I and UR2 can al.o be used
as expansion r~cb_ The power supply and the
CPU a lo;O occupy slots in !he rack<. possihly
evm tWo or more per module. If necess.ary. the
number of slots available CM ~ inc",ascd
usina e~J'ans;on "",ks: L"'R I and cR I ha"e 18
s\o!$ each, UR2 and ER2 have 9 ta.eh.
The 1M 460-1 and 1M 461-1 in!erf.cc modules
m~e it pmsible 10 haveonc exPMlion rack ptr
a.
A maximum of21 expansion racks can be con nected to II central ra~k. To distinguish bem'een
racks. you set th~ number of the rack On the
coding switch of the receiving 1M.
The backplane bus consists of II para1lel P bus
and a serial K bus. Expansion racb ERI and
ERl arc de,'igncd for ",imple'" signal modu les
which generate no hardware interrupts. do not
have to be supplied with 24 V voltage via the P
bus, require no back-up voltage. and have no K
bus connection. The K bus is in racks URI.
UR2 and CRl either when these rackS are used
as central racks or expansion rach with the
numbers I to 6.
Segmented rack
A s!",cial feature is the segtn""ted rack CR2.
The rack can accommodate m'o CPU, with a
sh"",d power supply while keeping them functionally separate . The t",o CPUs ~an =change
data with one another v ia the K bus. but have
completely separate P buses for their own signal modules.
1\1ultiproccssor mode
1.1..1
Fault_tolerant SnlATIC
l.l .S
Safely-related SIMATIC
F_CPUs cUlTently available arc the CPUs 315F2DP and 3 17f-2D P for S7-300, the CP U 41 1iF2 for S7-4OO, and the basic muduk IMI5 1- FI
CPU for ET2ooS. The Fmodul e. and f-sub
modules are connected to S7-400 u.ing PROI'!
B US DP with the safety_relevant profile
PROFlSafe . U,e o f F- modules in the controller
rack is additionally possible w ith S7-300.
STEP 7 w ith th e optional S7 Distributed Safety
package is necessary fo r configuration and progranuning of the failsafe system . The safetyrelevam scction of the program is programmed
u,ing F_LAD or F-PBD with a limited operation set and fewer data types oomparcd to the
basi c lan guages. If a fault is dete<:tcd in the
""fety program, the F-CPU eme", the operating
,tate STOP.
The option package also contain , a block
library fo r the safety program with failsafe
blocks and templatc .
S7 F/FH Systems
S7 Fff H Systems is a failsafe automation sys
tem ba.ed on S7_400 with main applications in
th . process industry.
S7 F/FH Systems is based on the S7_400 automation system . The F-modules and F-submodu les arcc conne<;ted to S 7400 using PROI'TBUS
DP and the safety- relevant profile PROFISate.
With S7-400F, a failsafe uWr program can be
i n~orporated into the standard Uscr program . Tn
addition to failsate ty. tl><: S7-400FH also provides increas.d availabil ity. If a Mtected f"ui(
results in " STOP of the master CPU, a switch
is made w ith(mt feedback to the CPU running
\tl hot standby mode (""c ].1.4 " Fault-to ler",,!
SIMATlC").
Con fLguration is carried out using the standard
applications of STEP 7, V5 .1 and later. The
option package 'S7 F Systems" is required for
paramctcrL,ation of the failsafe signal modules
and for programming o f the ""fetyrelevant
program components, p lus Ih <: option package
"eFC", VS.O SP3 and later. thc option package
. $7 -SCL" V 5.0 and later and - for the fa ult-tolemnt funclion, the option package "S7 H System," V5 .1 and later.
Spc~ial
library
f unction blocks from the supplied Fbe called and interconnected using
~<Ul
T he cpe s have a slot for a plug-in ",,,mory .,"b"wdu/e. The load memory, or pans thereof. is
"ailsafc 110
1b~ fai lsate signal modul es (F-modules) are
require<! for ,afe'y <)p<..--ration in lhe failsafe ,ystem,. Fail safery i. achieved with the ;t\legral
",fely fu,,"tioru and appropriate wiring of th"
serums and acl\ill.ton;.
\>
1.1.6
Th. 110 moduks contain memories for lhe signal state oIrhe inputs and outpu18.
card
Figure 1.2 shows the m emory area, in the programming device, the CPU and the ' ignal modu les whicl1 are important for )"our program
The programming dcviee conMins the offl;ne
data . These consist "f'hc usc' program (program code and user data), the syst~m data (e .g.
hardware, nen.,.ork and inte rconn~C1ion coniig-
.\licro
m. mo~'
card
I SIMATIC 57-3001400
-....
Hardware
Sym~
.~
P~le
Canlrolkr
System
(contlguration
dataonlinel
+ll<.
Arcnive<l
(compressed)
~data
Paru
01".,. hlgllNghred
'""
InllRUp!
momc:wy _
syslfNn
memotY~.
commotl ph.,.;c.l
memotY
1ft
.re.
In redlJClion
in tI>e
""'" """""
do'*" on
_-..d.
ptOgT1ImmIfIf/
.JIe,
I..oMd memo ry
The rntm user program. Including configuration data (system dati). is in the load memory.
The U ""," program is 11 ...ay~ Initially transferred
from the programmina device 10 the load mem_
ory. a nd from !hcre 10 Ille work mrnlory. The
backup.
From STEP 7 VS.l onwards, lind with appropriately designed CPUs. you Can save the com-
m~rn ory
Work memory is designed in the fonn of highspeed RAM fully integrated in the CPU. The
operating system of the CPU copies the pro_
gram code "relevant to execution"' and the user
data into the work memory. "Relevant"' is a
characteristic of the existing objects and does
not mean lhal a particular code block will necessarily be called and executed . The "'actual"'
control program is executed in the work mem-
NY
Depending on the product, the work memory
can be designed either as 8 corrdaled a~a or
divided according to program and data m emOries, where the laner can also be divided into
retcutive and non-retentive memories.
Whcn uploading the user program into the programming device, tbc blocks arc fetched from
the load memory, supplemented by tbe a~tual
values of thc data operands from the work memory (further infonnation can be found in Sections
2.6.4 "Loading the User Program into the CPU"
and 2.6.5 "Block Handling"').
Sy't~m
memory
Outputs (Q)
Outputs are an image ("process image") of
the digital output modules .
Bit memories (M)
Store< ofinfonnation accessible throughout
the whole program from any poinL
o Timers (T)
Timers arc locations used to implement
waiting and monitoring times.
o Counters (Z)
Counters are soJhvare-levcllocations, which
can be used for up and down counting.
Micro me
card
iC"'"'-____________--,_______-,Work m emory
Program codl>
Use< data
l oad mamory
RAM and RO M
System memory
,C,'", '--_____________________
Work. mamolY
Prog ram code
User data
Loadma mory
RAM and ROM
Sy"em memory
non-ret&ntive
Us-erdata
fele~tive
5 7-400 CPU
M&m
CI'lrd
C'"
Load memory
AAM
load memory
RAM
Load memory
FEPROM
Work memory
Program code
Work memory
Use r data
1.2.1
PROFIBUS DF
PRO FlBU S Dr provides a standardized interfaee for transferring predominantly binary pro
CO" data b etween an "interface module" in the
(c eIltral) progranunabl e conlrol!er and the field
devices. This "int"face module" is called The
DF maoter and The field devices are the Df
,h,cs.
1.2
Distrib uted VO
IlP mastu
Th~ DP master is the IOCtive node on th~ PROFlBUS n~".vorL It exchanges cyclic data with
"11'" OP slaves. A 01' master can be
c>
t>
to
or .I~H'
The OP .Ial'es are!h~ passive nodes on PROF!nus. in SL\1ATlC S7, B distinction is made
bem'c~'Il
:>
Compacl DP slaves
They behave like a sing le modtllc lowards
the pr maSlcr
Tntelligent Dr 5Ia,"("<
They contain a tnnJl'ol progr-am lhal
trois The lower_level (o",n) mndules
COfI-
c=-~., .w.
[)rlL)r
PROflBUSDP
DP"..
'I
DPRSnlC
link
DPAS-ln~
LiDk
50",,! roD1I1;""
Fillurt 1.4 Comron<n'" of 3 PROFIBUS Of' Masltt SY'l<.m III lin RS4~~ sCiln.m.
t>
10
dl" i e~
,=.
1.2.2
PROFIN ET 10
ET200M. ET200S and ET200pm. The gateways PK'PN coupler. IE/PB link and IEiAS -i
link nre 1l1so 10 d~vices.
10 su pHviSQr
10 supervisors arc dc\ ices for paramc'erization, Startup, diagnostics. and human machine
imcrfacing, e.g. progmmming devi""s or HMJ
de,ices.
10 controller
The 10 controller is the BCtive station on Ihe
PROFr'lET. It exchanges data cyclically with
'its' 10 devices. An [0 controller Can be:
IE/ PR linJ.
1.2.3
Actuator/Sensor
lnlHrac~
"
Indy,niol Etheme,
PROFmUSDP
~
- link
ASi
IE/AS-;
li"k
AS-i a<tu.""
B;""'Y actuators
a nd n<Ol'S
",';'0 ASiAS IC
AS-i .emo,
AS-i d"tributor
runhc:r AS;
do,'ioc,
Binary "motor<
000 S=or<
without ASiASIC
ASi master
Standard ASi masters can control up lD 31
standard ASi , lave, with a maximum cycle
lime 01'5 ms. In the ca, e of extended ASi mas
lers, tllC quantity structur. increases 10 a maxi.
mum of 62 AS-i slaves Wilh an extended ad
dress area Wi lh a maximum cycle time of 10
ms. Slave, with an extonded address area occupy one address in pair,; if standard slaves al"<'
operated on an extended master. they each oc
cupy one addrc>s ,
""
Standard slaves
Slav~"
slaves)
"" Analog slaves to slave profile 7.3 or 7.4
put bytes in the analog aililress area (from 128 upwards). Upto 31 standard slaves or 62 A/B slaves
CilaV"" with ~xtendcd aJdross area) Can be op,:",t
ed on the CP 343 -2. The ASi Sla'"C8 are paramc
teri<ed wi1h default valllC' stored in the CPo
In exle"ded mod~, the full range of functions in
accordance with the ASi master spc~ification
is available. If you use the Fe bl""k suppl ied,
maSter calls can he made fwm the user program
in addiTion to standard mode (transfer of parameters during operal;on, checking of 1he desired!
.~lUal configurati on, test and diagnoslics) ,
AS I slin'e.
AS; ,lave, can be bu.-enabled ,ensors and aC
mator. with ASi AS ICs, or they can he AS;
modul ~s. You ~Onnecl ,ensors and actuators
with AS; ASICs to a passive module. Convon
tional sen,ors and actuators can be connected to
an acti,'e module.
ASi ., laves ar~ available in the standard ,'~rsion
with One standard sla,'c oc~upying one of the
maximum of ) I possible addresses. The user
program handles the standard slaves lil:e h;nary
input> and outputs.
AS; slave> with eXTe nded addressing mode
(AlB slaves) ""cupy an address in pairs so that
up 10 62 slave, can be operated 00 one maSler.
L2 Distribmed I/O
1.2.4
Gateway.
Gateways allow data exdmn gc k tween device, on different subnets, and the forwarding of
configuration and parameterization in fonna_
tion beyond subnet boundaries (Figure 1.7).
Conn.-cring two PROFIBUS .ubncts
The Dl'lDP coupler (Version 2) conne<:ts m'O
PROFIB US suboets to ~ach other, allowing you
to exchange data berorecn the DP ma,ter'; , Both
"ubnel< arc i,olated and can be operated at different data tram fer rates up to a maxim,un of 12
Mbi t/s , In hath .ubnets. the DPtDP coupler is
as<igned to the relevant DP master as a DP
slave with a freely sckctable node address in
each case.
The maximum size of the transfer memory is
244 bytes of input data and 244 b;1CS of outp ut
data, divisible into a maximum of 16 areas.lnp.,l areas in one ,ubnct must correspond to output areas in another. Up to 128 bytes can be
tm,nsferred consi,lently, If the s ide w;th the input data fails, the correspond ing OUlpUt data on
lhe other side is tnaintained at its la't value
The DPIDP conpl~r is configured and parameterized with STEP 7. A GSD tile i, available for
operation on non-S iemens masters.
Connecting PROFIBUS DP
PROFIBUS PA
10
I>
PN.'?N ""uple'
TfJPB
link
Serial <oM<Clio"
FiIlU~
1.7 Gateway.
33
t>
t>
Slaves with data transfer mechanIsms in accordance with AS_i spe<: ificalion V3 .0 (DP!
AS-i Link Advanced)
1.3 Communications
1.3
Communications
Introduction
In addition. there arc communications proccssors (CPs) available that enable data e"change
at highcr throughput rates ~nd with different
protocols. You must link these modules via nct _
..... orks. ,\ network is the hardware connection
between communication nodes.
to
p.
Slaves with data mmsfer mechanisms in accordance with AS-i specification V3.0
The IE/AS-i link is configurcd and parameterized with STEP 7. A GSDML file is avajiable
for othcr configuring tools.
Data is exchanged via a conn ection in aCcordance wilh a specifi c eXe<:U1ion plan Ccommunications ,crvice) which is based, among other
things . on a specific coordination procedu:
(" protoCor). S7 connection i5 the standard
between S7 modules with communications
capability. for example .
Using an S7 connection, f igure 1.8 shows thc
objects involvcd in conunun ication between
rv.o stations. The uSCr program of the left_hand
station contains the data to be lransmined in a
data block (DB) . The conunun;cations function
in the example is a system function block
(SFB) . Assign the parameter RD with a pointer
to the data to be sent. and trigger the transmission from the program. The communications
5 1MATIC 57 station
CPU
5 1MATIC 57 station
User
program
System
memory
Received
data
Connection
ID
Communications
function
Bus interface
of the module
5ubnet
System
memory
CP
Operating
system
Connection
resources
Con'lec:.tiQD
N etwork
A network is a connection between sev eral
devices for the purpose of communication . It
36
Connection
A connection defines the communications rela-
Communicatiun~
function!
The communications functions are the u,er program's intenaee to the communications sen'ice
For SIMATIC S7 - internal communications. the
communications functions are integrated in the
operating system of the CPU and they arc
called via system blocks. Loadable blocks are
ava ilable for communication with non-Siemens
devices via communications processors
O v.. rvl" w of communications objects
Table 1.1 shows the relationships ~tween subnet', modules wil h communications capability
and communications services. In addition to the
commun ications services shown, POtOP com munications is also possible via MPL PROFlBUS and Industri al Ethern~1 subnets.
1.3.2
Sub nelS
MPI
Low_cost method of networking a few
SIMATlC devices with small data volume,.
t>
PROFTBUS
High -speed e"change of small and mid range volumes of data. used primarily with
distributed 110.
t>
t>
Industrial Ethernet
Communications between computers and
programmable controllers for high_'peed
e"change of large volumes of data, also
used with d istributed II0s (PROFC'lET 10).
Poim-to-poim (PTP)
Serial link between two communications
partners with special protocols.
l\ fP 1
37
SfC call'
"
BUS
Dr interrace
SFB/SFC call,.
.,
CP 443 - ~
- --
Industrial
~xl...,d.d
H.,.dwarc conliguflItion,
SF BiS FC call.,
FMS int'-TIace
CPU, with
PROFINET 10
(10 controller)
"
CP44.11
TCP/lP and C OP.
CP343-11T
57
cr 4431 Advanced
CP443 -1 1T
tah le,
38
1.3 Communicalioll5
access rights. A passive node <;\oxs not receive
access righls
The PROFIBUS network CRn al!l<) be physi~ally
designed a.s an electrical network, optical nelwork or wireles couplina with various trans_
mission rates. The length ofa Sejmcttt depend.
on the tranSmission ratc. ~ elcctrical network
can be configured with a linear or!reC topology.
11 uSC!! shielded. rw;,\ed two-wire cBble
(RS485 inlerfaee). The transmission rate can be
~djuS!cd in steps from 9.6 kbitlS 10 !2 Mbiti,
(31.25 kbitls with PROflBUS PAl.
The oplieal network L1ses eilher plastic. PCF or
lila" fiber-optic cables. 11 is suitable for large
distanccs, provides electtical iSOlation. and is
insen~ilive 10 electromaanetic inlerferences.
The transmission ntte can be adju<1cd in <1epS
from 9.6 kbitl. 10 12 Mbits. When using <>pli
cal link module. (OLMs), design:< arc possible
wilh linear. ring or Star topologies. An OL:vI
also provides the connection hClweC11 cltrical
and optical networb wilh a mixed design. A
co~t-opt itllized version is the design a.~ a linear
structure with integral interface and optical bus
Icnninal (OST).
lising the PROFTRU5 infrared link module
(ILM). sinille or several PROFIBUS sla,''''' or
I~gments can be provided wnh a wireless con_
nection to PROnSU5 slu,cs. The maximum
transmission rate of \.S Mb,,,s and Ihe ma.ximom rangc of IS til mean. ,hat commUniCalion
i~ possible with moving parts,
You implemcm connection of distribUlCd VO
via D PROFIBUS subnetwork; the relevant
PROHBL'S DP communic"ions service is
implicit. You can ~ eitherCPUs with integral
or plug-in DP master, or the rele~ant CPs. You
cpn also nperate station-internal 57 basic com_
munications or S7 communications via this net_
work.
You Can transfer data with PROFffiUS FMS
and PROFIBU5 FDL us ina the relevant CPs.
There are loadable blocks (F\15 interface nr
SEND/RECEIVE interface) available as the
interface 10 the user proaram).
I nduSlrlal Et hernel
Industrial E,hemet is the Jubnet for connecting
complllcrs and programmable control lers, with
"
PROFII'I,'ET
AS- I nt~rface
Point_to-poiut
eonn~eti"D
1.3.3
Communication s ServlcO/"S
J'G communication .
1'G communicalions i, used to exdlllnge data
between an engineering station and a SIMATIC
sta tion . II i. used. for example, by a programming device in online mode 10 C"Xe<:U1e the
function, "Moni tor variables" or " Read diagnostics buff~r" or to load user programs . The
~ommuni ca tions functioru required for PC;
commun ication, arC integrated in the operating
system of the SIMATIC mooules . PG communications Can be c."'e<:uted over the MPl,
PRO FIBUS and InJu,mal Ethernet subnets. By
applying S7 routing, the PG communications
'''III aho be used beyond , uhneK
1.3 Communications
OP communic ation>
OP con>m"nkations i~ us~d to ~xchallg-e data
between an operator stat ion and H S!MATIC
statim' , For example, .1 io "sed by an HMI
oe~iec for opcmtion ~n,j monitori!\g. or 10 read
and Wrile variablcs. Tbe eomml.micatio!\s functions requircd for OP commll!\;cation~ are im,,gn.tcd 'n the opcratina system of the SL\{ATIC
modules. O P communicauons can be excculcd
overthc Ml'1, PROFlB US and l ndu~tri"l F ibernel ",hocts.
S7
bY~lc
communicatIons
conlanee wi ,h RYC 793.1S0-<Jo-TCP in accor' .... nee with RFC 1006. ur UOP in accordance
WI th RfC 768 . Th~ C(Jmmunication functions
are luadablc runction h locks (fH~) containeo in
the Smmh",J Ubra'Y of STt::!' 7 under Comm,,
tliClllimr Block. The function blocks are c"lIed
in the main program and they control eO'.mC'CItOn buildup ""d c1"ardown as ",ell a, <!ala
transfer,
Glohal dara
communk,.tlon~
I'll' commun ications (poi~t.to point connection) \Tnnsfe~ data o,~r. ~crial intCTfa~e. e,g.
hem-'een a SIVIATIC slition and a printer. Thc
cummunications functionti requi red arc intcb'1'llted in th~ operating sy.tem. e.g. as system
fW'lction blocks SFB. Olla uchan.:" is prn;siblc
tHing various tJaru<fer procedurn.
S7 cn mmuuic"tion,
SS-i:(lmpatible
fF: communlcatlon
WiLh "'Optn eommuruclttion via lndu5lrial Eth,,",cl (IE communicatiOn fO'l" shon). you tJ<tmfer data b<.-tween tv."\) devices connC'Cted to the
Ethernel SlIhnel. Communication can be implemented using the protocols Tel' nativc in 8C-
~omm"nICltl ... n.
Slanda r d co mmunk,.,loM
41
Co nnections
w<>ri<..,.
1.4
1.4. 1
Module AddrcsSf.'S
Signal Pat h
1.4 Module
" HPOI . L
_SIO ( ..
,~,
.,
,,-
modulo
~'
Byten
.,
"'
.,
-,
._.
.,..
. .".
Process-image
1234 56 7
,
Byf1I
n~ I
A~
i:
----
11
-+
.,...
.""
Abso"'t"
~".
start add", . .
",,",a
U.", P
.... m (LAD)
~ s_ c "
on mo lor"
!"11m IFBDl
USII'
~ S ... ;tc:h on motor"
II
15.2
II
,,~
-:::0-:::0-
I'lgu,,' 1.9
S lo t A ddress
Every slot bas a fi xed uddress in the progra mmable controller (an S7 stalion). This slot
addreu cons;",s of the number of the mounting
rack pnd the number of the slot. A module ;s
uniquely described using the slot address
("geographical addressl.
If the module contains interface cprds. each of
these cards is also a~sii"cd a submodu1e
add ress. In this way, each binary nnd analog
1.4,3
1.4.4
Logical Addu"
Using th e hardware wnfigurm ion. you determi ne the position ortbc US<.T data addresses in
the address volumc or !he CPU by defining Ihe
modul~ "an addressc . The lowest logical
addre" is also Ihe moduk .tart address for Ihe
modules of the distributed JIO and even for the
virtual siNS in the tIlIn.fer memory of an intel _
ligent DP , lave
The modules ,tan addrcss is used in many cases
to identify a module. Other than thi', it has no
'peeial meaning ,
104.5
1.4.6
i\dd...,sscs ror
Ru~
"odes
MI'I
Module. that arc nodes on aD M l'l ne t,,"or\:
(CPUs. FMs an d CP S) also have an " '11'1
addren. This address is decish'e ror !he link 10
programming devices. human machine interface devices and for glob.al data communicalionl.
I'l~asc nOle lhat with older revision levels ofthc
57_300 CPU . !he FM and C I' modules oper.
aled in Ihe .arne Slat;on receive Hn MPI address
derived fro m the MPI addrc~s of the CPU. In
the case of newer S7-300 CPUs. the MPI
addre.sc, of FM aod CP mndulc~ in thc ,ame
sialion can he detennined independently oflhe
MPI address o f the CPU.
VKOf'lBUS DP
EliCh 01' lItation (e.g. Dr maSter. DP slave. progTanuning device) on the I'ROFIBUS also has
a node Md dre~s (station number) with which it
can be unambiguously add resS\:d on thc bu s,
I'ROFn<'ETIO
Staliom on the Industrial E.thcrnct havc a faelory-SCt MAC . dd",~, ",hich is unique world_
wide. An II' ad d l"fi~ is addillonally reqoired
for identification on the bus. and ,s configurcd
for the 10 cOlltroller. Thc II' addresses for the
10 dc"icc~ are deri ved from thc ll' addr~ss of
the 10 cOntrol ler. The 10 comrollcr (thc ,n terfdce) an d each 10 device i~ additionally
assigned a dl"'"jce na nw. The 10 device IS
addressed by the user program by m~anS of a
dC" lcc number (stalion numbcT).
I>
User Data
A~a
\\'hen modules are access~"<J. iI makes no diff""TenCe wh"ther they are in 11I~k.s with centralized
configuration o r uS<."<:I as distributed YO. All
modules occupy the ~me (logical) add~s
space.
A module's user data propcTtie! depend on the
module type. In the case o f sill nal modules.
they nrc either digital or Bnalog input/output
~igllll l s. and in th~ ~HSC offu nctio n modules and
COllununications processoN>. Ihey might. Inr
uarnple. be conlro! or Rtatus infonn ation. The
"olume of user daQl
modu lc-Hpeei fic. There
are modules tha! occopy onc. t .... o. four or more
b>,es in this ...-ea. Addressing ah'1IY. begins at
rcl~thc byte O. The address o f byte 0 iJ the
module <tan address: it i~ 5tipu lated in the coofiauration table.
'S
1.5
A ddress Areas
I;>
!>
I>
Ihe timer and eounler funclions (scc Chaplers 7 '""Timers" and 8 "Counlers"')
Pcrlpbc"aloutpuIS
You u,e the peripheral outpUT (PQ) addre,s area
whe"Jl you wriTe vnlu~s to the u'er data a~a on
an OU(plit module. Pan of the PQ add~8s area
leads TO Tbe process image. This part always
begi ns at 1/0 address 0; the le ngth of lhe area is
CPU_specific.
With a Dire<:T I/O Write operaT ion. you can
a~cess modules whose inK'Iface, do not lead to
the process outpul image (su~h as analog output
modules). 1bc sig,;al states of modules ~on'
trolled by th~ process outr\lt im:.g~ ~an also be
dir""lly aITcctcd. The signal statcs of the outpu1
bils th~n change immediately. Please nOte tha1:'
Dirc~t I/O Write operation also upd ates the sig
nal S!.a\ CS of (he ~levant modules in the process
output image! Thm. there is no di fTercnce
betwcen the rrocess OUtpUT image and the sig.
nal S!~tc~ on the output module .
additional memory area sitnilarto the bit m=OIy area. Thi, appl ies both for the process input
image and the process OUtpUT image.
Inp uts
An input is an image of thc corresponding bit
on" digiml input moduk. SC>UIJling an inp ut is
th~ same as .canning the bit on 1he module
it,clf. PriOI to program C~CCllli on in every program cycle. the CPU'~ operating sy'tem copie,
the , ignal ,tate from the module to the proce"
inpUT Image.
Th~ use of a proce.s input image has many
adv "mages:
1.5.2
Process Image
"Ib~,;e
Outputs
An outpu t is an image of the corrc'p,mding bit
on a digi tal output module. Setting an output is
the same as setting the bit on the output module
it self. The cpe's operatin g system copies the
signal state from the process output im age to
the module .
The use of a pn)l:e" output unage has many
advantages:
~
SeUin g an output is much fasler th an acc e ssing an output module (for example . you
avoid the tramiem reeove.-y time on the L10
bus. and the system memory response times
are ;;horter than the modulc response times).
The program is there fore e~eeuted that
mu~h more quickly
"
1.~ .3
Data cons istency m eans that data can be han d led ill a b lock. Transfcr ofa data block m ust
not be interrupted. and it is not perm issibl e for
the data source or target to be changed from the
other end duritlg a transmissi on e ither. For
examp lc. if you transfer four bytes ind iv idually.
the Jransmirting program can b e interrupted by
a program of h igkr prioritybctwccn each byte.
and this progr.un cuu ld change Ihe data in the
souree or target arca.
1.5.4
Bit Memories
m~m .. rics
17 1 6 1 5
j41 3 1z l tlol
I 10H~
5 Hz (fllcke<lng light)
2.5 Hz (fast ~as hi ng light)
,",
, "'
2.1
Thi s chapter describes the STEP 7 basic package, Ver;ion 5.4 SP3, Wh i!c Ihe fIrst chap ter
presented an overview o f Ihe properties of the
pTOgmmmable controller, this chapter tells you
how to sel th~se pTOpenies ,
The. basic package contains the statement list
(STL), ladder logic (LAD) and function block
d iagr4tn (FBD) programming languagc"_ Tn
addition to the basic package, optio n packages
such as S7-SCL (Structured Control Language), 57 -GRAPH (sequence p lanning) and
S7-H iGraph (>tate-trans it; on diagram) are a lso
available .
2 .1 .1
ImTaliution
STEP 7 VS.4 is a n_bit application whi ch executes with MS Windows 2000 Profe>sional
with SP4, MS Windows XI' Professional with
S1'2, MS Windows ServcT 2003 S1'2 standard
edition as workstation computer or MS Win_
2.1.2
Floating License
This liccnse is applicable for an unlimited
time. and provided for procurement yia a
network .
(>
Trial License
This license i, limitcd to 14 days. or to a certain number of days starting with ils in itial
use , It can be used for testing and val idation.
(>
Upgrade License
This li cense permits upgrading of an authorization/license key from a previous version
to the current vLTsion.
2.1.3
SII\-IATIC M.nager
III
ure2.1).
Under the SlMAT1C Manager. you work with
the objects in the STEP 7 world. These "Iogica\"' objects correspond to "rear' objects in your
plant. A proj~ct contains th.. entire plant. a sta
tion corresponds to a programmable controller.
A projed may contain sewrnl station. con nected to one another. for example. via an MPI
,ublleL A Slation contains a CPU, and the CPU
contains a program. in our case all S7 program,
Th is program. in tllID. is a "container" for other
objects, g<lch as thc object Blocks, which contains, among othcr things. the compi led blocks.
The STEP 7 object' are connected to one
another v ia a tree structure. Figure 2.2 shows
the most important parts of the tree slIUcrure
(the "main branch'". a. it were) when you are
working with the STEP 7 basic package for S7
MPI P I P PROFI8US,
Sub""'t
Industrial EthlImet
"n,.,; k software)
,~.
mooules
Con<ol"", for tI,c ,0,,",co<lo," '.bl_
. ,,~
lb. u r prugr.m
Connectloos
""'!If\IDC"'' '
Symbol table
Co"'.in~r
for tbe
.onrco.
C"",.i~ 'he S<>un;" for \he
mer program (~., for STl ailtl
SeL progra,ns)
Source programs
pJ'()~ram
User program:
OrgantzaliOrJ bfocI<s
FUl'ICtion blocks
FUl'ICliC'(ls
Data bk>cl<$
Data types
and
. o nll~nratio n
th~
System lurlctlnns
System functlons blocks
C"","i~
Variable table$
t~e
2nd modif0nlr
'0 hard,,=c
$y,te>n
Proj ~cn
Contains loadable functions for editing variables of Ihe eomple~ data types PATE_
AND_TL\l Bnd STRING
t>
Communication Blocks
Conta ins loadable functions for controllin g
CI' mo<lules
1>
'ii.celianffiUS Block<
C.IIntains block!; for time SUtmping and time
synchronization
~y~teftUl.lic
storing of
dilla and programs needed for solving an automalion task. E5Sentially, these arc
I>
I>
I>
t>
components. Librarics an.: u'lIlttlized hierarchi~all)'. They may contain STEP 7 pwgmms
which in tum may conmin a USer program (a
coolo.iner for compiled hlocks), container f.llr
source progrnms. and a symbol table_ With the
exception.llf online connecti.llns (DD debugging
plbsiblc). Ihe crealion ofa proiflUll or proiJ1lm
.celien in a library provides the same function_
alily as in an objecl.
As suppl ied, STEP 7 V5 provides the Slmidard
Library containing thc followini: prollTams:
block!; for
OrganJ~ation Block,
Contains the templatcs feT the organization
block. (es<enlially the variable declarotion
for the stan in formation)
(>
I>
2.1.5
Mult ip roject.
"arne project,
In a muitiproject. it is possible to carry out paralld processing of ind ividu al projects by vari_
ous
cmployc~s
ual projects can be pre,em in different dire<:tories in a networked environment . The croSsproj ect fu nctions, such as thc match ing of ,ub networks and connection.<, are then carn ed oUi
centrally when processing the multiptoj:t, In
the case of central SlOrage on a s erver, only th ~
operaling systems MS W indows 2000 Server
and MS Windows Server 2003 are pcnn;llcd
It is a ls o advantageous to create a muitiproject
if yo " wish to make th e individual proj ects
sm aller and clearer.
2.1.6
Online Help
Help function from any application. This contains all the bosic knowledge, If you click on
the -'Home" symbol in the menu bar (start
page), you will be provid ed with an introdu~
tion to the centra l topi~s of STEP 7: Starting
with STEP 7. Confi guring & programm irlg.
2.2
E d i ting Projects
\Vhen you sct up a project, you create "coma irl erg'" for the rcsuitirlg data, therl you generate the
data and fill these containers , .'Ionnally. you
cr~ate a project w ith the rel e vant hardware.
configuro the hardware, or at Icast the CPU, arld
receive in return containers for the user program. However, you can also PUl an S7 program d irectly into the project conmirler withom
involving any hardware at all ).jete that irlitial izing o f tho modules (address modificatiorls.
CPU settings, c on fi guring COrlnections) is po ssible only with the H ardware Configuratiorl
tool
We strongly recomm end that the entire proj ect
editing process be carried out using the
SIMATIC Manager. Creating, copying or deleting dire~\Ori es or files as well as changing
name< (') witb the Wirldows ExplOl"<'r within
th e Slmcture o f a project carl cause problems
with the SI1>tATIC M anager,
2.2. 1
C r eating P rojects
Project "izard
The STEP 7 Wizard helps you irl crcatirlg a new
projecl . You specify the CPU us ed and the w izard c reates for you a p roject with an 57 station
an d the s c1ecl ed C PU as we ll a.\ an S7 program
container, a SOurce comainer and a b lock cot)tainer w ith th e selected orgarl izatiOrl block...
CrT.Unlt a
You
~Iart
Ibe
proj~1
proj~et
"ilh th e 57 stllll"n
C....aring a "e"'proj'",,1
5d~1 F u.E ..... NEW. enter a name in the dialog
box. change the type and siorage lor;&l;on if
n~e$~pl)'.
and confinn with "OK" or
RETURN,
/nsenil'R a nrw station in II,,, project
S~ICCI
J\lanwglnll'
An:bJvlnS(
~t'()IIIYnl/.lnw
and
ma;ntain~
a list of all
progrnm ARJ.cxe is not suitable for MS Wi n00"'" Vista). You can ulso open A RJ archives
....i'h PKZip V8.6 CU.
Projecr.. and libraries cannot be edited in tbe
"",hi>'w (compressed) st~tc. You can unpack
an archiv~d object "~th Fll.E ..... RI1UEVE and
then you can edit it further. The rctrieved
objccts ~TC automatically ac<.:cplcd mto Ibe
project or libmry management ~tem.
You make the .-.cUing. fot archiving and retriev_
ing on the .. ATChi,...... tab undCO' OPTIONS -+
CL'STO~I1Zr;; e.g. setling the tarset d irectory for
archiving and rclrie .. ing or ''Generate arch ive
palh aU1omatically~ (then no addilional specificatinns are rc-quircd when archiving hceause
the DIme o f the archive file is genernted from
Ihe pmjecI name) .
Anbivlng a project in the CPU
With the "Ppro priatcly de, igned CPU . you
~"n
a project as a V2 project.
2.1..1
u.ing Fn.E -+ NIoW you can crente a new mulliproj....,t in Ibe SIMAT1C Manager in which
~Muhiproj....,f'
you <elect
"
2.3
Cunfiguring Stations
wheth~ your <:limes well' free of e lTOrs. STAllOS ..... SAVE stores t~ configuration "'bl.-.;
with all parameter lWIignm~nl data in yoor
project on the hard diu.
ch~lcl;um
obj~(.
Hi" ....
l.~
With HELP -+ PRODUCT !';VPI'OIlT u,"FORM.<.you can display infonnat;on from the
[mernet for tbe sckctcd module. You muSI fint
enllblc this function with OPTIO"S -+ CUSTOMII I and set a valid Intcrnet addre8s. Thc
selected module can be in the hardwan: catalog
Of already in the configun:d rack.
TlON
Co nn gur.tloD t.ble
The Hardware Confilllll'lllion 10Ql works with
tables that tach represent an S7 station (a
mounting r~ck), a DP stalion o r an 10 device. A
u\ c~.
2.J. I
You begin configurin g by s<; lcctinii and "holding" the rail from the module catalog. for
instanc~ under "S!MATIC 300" and "RACK
300". wit h the mouse, dragging it 10 the upper
half of the 'fation window, and dropping i1 anywhen:: in that window (drag & drop), An empty
eontigun.tion table is screened for \bf; central
rack. NCOICI, 5Clce1 the required module! !Tom
the module eafalog and, in the manner
o:k:seribed above, drag and drop them in the
appropriate ,10\5. The perrni>sih!e slolll have _
g~n background. A "No Parking" symbol
te ll s you cannot drop the sdcc\cd modu le at the
intcnded ,lot.
You can abo mark the slot to be equ ipped. and
sclt(:t IN5~Il.T -+ INSERT OBJECT. In a popup
window, !he Hardware Configuration then
shows you a ll modules penni.sihle for thi, slot.
from which you can selC'Ct otIC.
In the case of!ingle-tler S7-300 stations, slot 3
remains empty; it is reserved for the immaee
module 10 the expansion mck,
You can generate the eonfigunt.tion table for
another nck hy dragging the scle<:ted raclr:: from
the e8talo& and dropping it in the sumon ,,'indow. In S1-400 systems, a non- int~onflCeted
nick (or more precisely: the relevant rei"e
interfnce module) is assigned an interface via
the "Link" tab in the Pro!>"rt;" s window of a
Send 1M (select module and EDIT -+ OS/ECT
PROPERTlI:S).
2.J.2
AddTf'Mlne. Module.
When ammging modules. the Hardware Configuration tool automatically assips a module
~tart address. You can view this addn::ss in the
lower half of the stalion window in the object
After you have arranged and addressed the digitsl and analog modulu, you save the station
data. Then you >clect th~ module (line) and
EDIT -+ SYMBOLS. In tlte window that !hen
OpenS, you <:an assign a symbol. a data type ami
a OOmm=t to the absolute address for each
channel (bit-by-hil foc digital modules and
word-by-woo-d for analog modules).
The "Add Symbol"" button enten the absolute
addresses as symbols in piKe of the &Iolute
address" without symbols. The MApply" bu!ton trans fers the .ymools inlO the Symbol
Tablc . "OK"' also closes the dialo& box.
I'n. m ~terldnlt
Modul""
,= .
!.3.~
2.3.4
l\tudul~
"
2 STEP 1
2.4
Pro~1IlIIlinB
Software
The
NETWORK --> SAVE "''<'5 an incomplete Net""ork Configuration. You can cheek the con!isteney of a Network Configun.tion with NET
WORK --> CONSISTE..'-JCY CUECK, You c1~ the
Network Configuratioo with NETWORK -->
SA VI! A."D COMPIlE.
!'Jdwor k window
To start the Network COnfiaUrtllion, you must
have create d a project. Toa;etber with Ihe
project, the 51l\IATIC Manlger automatically
creates an MPI .subncl.
A double-click on thi5 or anyOlher subnet staru
th.e Network Configunlion. You can also reach
the Net,,'Ork Configuration ir you open the
Connectioru object in the C I' U container.
f>
c>
po
2.4.1
po
StI~cIIO I:
I>
c>
You can .lso configure global data communications wilhin the Net ....ork Configu"'tion: $Clect
the MPI liubnet and then r.ele<:t Opno:-;s ...
O~ft:-'I! Gl.olIAl DATA (see Chpter 20,j"Global Data Communication").
arran glnlllh~
VI~w
(omponentl
.,
..
.
r:=0i-:. i ;;;;;;'
'..-..
.. ...........
,-
-\""
".....
-';;' ''.1._
.. "'
"
..l _~ "
. .J _
-.
" :::11'_
"
--'''
...1<'_
-, -",,,,,,,
--
. .1 -""'''''
.
. >'0 J _
>-
is=-
......
2.4.2
PROF'IBUS OP
I-'ROHNl:T 10
I>
I>
The:
"
I>
I>
2.4.3
the communications
SI"'lATlC 57 device ,
panner
i,
not
Note: you do not require a configured connection for di",ct online conncc tion of a programming device to the MPI network for program ming Or debugging. Jf you wam to reach oth",
nodcs arranged in O!her conne<:ted subnet' w ith
the programming device, you mu~t configure
th e cotlllcction of the programming device: in
the Network Object Catalog. sdcct the PGIPC
object undcr Stations by double cl icki ng, open
PGIPC in the network window by double
clicking. and ,eleclthe intcrface and assign it 10
a .ubnet,
Conn~"t lon tabl~
[l)
Ii
j ,
,1
"""'~ I
L>o4~f"'_ ~--~~
f -
r
;C'
..
,,
""";11
TI :
I'
~ '~obI"'~~_
.r
Sont _ _ _ _
,I
,,,,,,p,,-,
l_",toI
,co< "".
~d
~~~
r,-'",-rawo;;:."
'I
I
1
1
1
- -- --
-~
~
Value
rang~
for S7 connections:
f>
.. IJ
Partne,.,.
lbis column disp lays the connection partner. If
you want to re>crvc a connection resource without naming a panncr device . ~"Ilter "nspedfied" in the dialog box u nder Station
In a on e-way connectlun. "ornmunkation can
only be initiated from one partner; ~x ,unple : S7
conmmnication. between an S7-400 and S7300 CPU. Even without S7 communications
function, 1n the S7-300-CPU, data can be
exchanged by an S7_400 CPU with SFB 14
GET and SPB 15 PUT. In the S7_300, no user
program run. for this communication but the
data c.~chan;;e is handled by th. operati ng <;ys-
"m
A one-way connection is configured in the connection table of the "active'" CPU Only the n
does STEP 7 a.;;ign a "Lo~allD . You also loa d
this c0nne~tion only in the local station.
Wi th a two_way cunn~ction, both partners Can
asS lmle communicat ion actively: e.g. two S7400 CPU s with the comnmnication,; functions
SFB 8 SE:'>ID and SFB 9 BRCV.
con n~e!ion
bu il du p
me~.a lilrs
ConnlXlion ""nne", wilh a configured twOw"Y cOMterion can exclumge operating ~Iate
messages. Iflhe local nO<ic is to send il5 operaling stal~ m~<;;ages. aClivate the ,levanl ehc:ck
bo", in me propenics wiodow oflhe cOMeclion.
In the uSCr program of me panncr C PU. Ihese
messalil"s can be receIVed wilh SFB 23 USTA-
TUS.
Con ne ctio n pa lh
As th~ connecl;on palh hc propenie~ window
ofm~
b~tween
proj e<:u
"
I>
Programmi ng devices/PC.
I>
SIMATIC S5 station,
2.4.4
G8tew.y~
<ubnet. it can reach all othcr nlxlos on this subnet. t"or example, [rom one connection poinl,
you can progmm and debug all S7 stations ~on
nectcd 10 an MJ'I ncnvork If anoth~r subncI
such as a PROFIBUS subnet is connected 10 an
S7 station, thc programm ing d~vicc can also
rea<:h thc Slations on the other subnet . The
requiremcnt fm thi, is tha t the station with the
subnct trans ition h as routing capab ility. th at is,
it will channel the transf~m.:d message frame..
When the network configuralion is compiled,
routing tables containing all the necessary
in fornmtion arc automat ically gcncrat~d for the
stations with .uhnel lransitions . Al l acc ess ih le
cOlIUllunications partner< mmt ~ configured in
a piant n~lwork wilhin an S7 rmjecl and must
~ supplied with th~ "knowledge" of wh ich .tatioru; can bcrcached via which suhnets an d subnel transilions.
1.4.5
--->
--->
GATEWAYS
In order to delete all connections of a programmahle module. load an empty connection lab le
into Ihe as<ociated module.
TI, e compiled connection data ar~ also a component part of the System d<Jla in th~ Blocks
contain~L Transfer of Ihe systcm dala and the
subsequem slartup of the CPUs clTcctively al<o
2 .4.6
~~p-
:..:l'""'""''''''
... _"""'
, "
.- ,",,-,, '""I
"' . ,......""a"
....""
'"~tAO
'"
,,", eo~
,..'" i '''---''''
c.""",,,, ,..."-"",,
L"",-, __'..M_"""
cv..... ""'~".
8'""""""""_
,I M_
~
.r-.
!fu. __
{_
"It:m:\)
tw ,,,e, Of'
3-1
1" __
...:.~.J.
__ t,
Com bining
...
~unn~~tlon .
2.S
2.5.1
C r ealing th e S 7 P rogram
IntrOdu ctin n
to
to
to
;>
"
""
""
"
""
""
""
"N
"N
0
""
"
..."""'''''1[
....,,......,
,"
'.J
' .1
"" ....,.""l
II.-
~ ..
'...- ..
,_,od
.....".<t_.'
N....... .,1 .. "
~,
~
~
~
~
.. n
72
.,,
, "
0
0
;
EOII'
"
".,
"
,
, "..,
0
0
0
"
I>
fuTlclion~
I>
Configuring-me"agc~
po
Configuring commun;ClI.ti<>TI~
NCM software
po
Control al contact ",-ith inputs aDd bit memori~s in the program ed,tOr
usin.:
for
lhe
1.5.3
r ......gnun
t~d ltor
I
~ .------------',,,,"",,,,'"""",,
'",.
Source
..
."'
O1fttne
r ----"""'''''".':)
~
InBlocI<s
the PO
programming
Ontlne
FI~ur~
L__
'~!.=~
::o:)
BlodCs
You can customi:z~ th~ prol"'nje~ or the program editor with OJ'nONS --> CUSTOMl7F.. On
th ~ "&ii,or" lah. >!CicCI thc prupcnies with
which a new block is 10 be g~neratl and di ....
played. ~...,h liS the ~"T<:ation langullge. pres<:lcction for commeots, aod symbols.
. . ,..
'"''
'
.--
_-
.... __..
.- ~....,..
~
Ft~urc
I: error
ConUIlm; the errol'S foun<l in the bloclt:bylhe
pmgram c<litor, e.g. fol1owilli <;olnpilmioll.
With OPTIONS - I (''uSTOMI7.1l in tbe
"Sources" tab you can SCI whethe r warning.
arc also \0 be displayed.
- .-........-. -- ._.-.~.,
2: Info
Contains information on the currently
.~electcd ad<lress.
3: Cross-references
Contains the references ofaddresscs present
in the current network (see Chapter 1.~6
~Refcratce Data").
4: Address info
Contams the symbol mfonnation of the
!Oddresses present in the current network
(see Chap.er 1.~.2 "Symbol Table"). You
can edit e"istinl! symbols hcre. an d nC\'.
ones, and oh<erve the addre status.
I>
5: Modify
Conlains an empty table of variables in
"'hich you can enterlheaddrcssc5 10 be: con1r01led (sec Chapter 2.7.3 "Moniloring and
Modifying Variables'').
po
6: Diaanoslies
Cnntain~" list with lite exis''''iI moni.orinil
functions for process dialilnOSlics using .he
S7-?O[A G option , package.
po
7: Comparison
Contains the re.ults of a previously implemenn:d block comparison (sec Chapler
"Comparing blocks").
76
and. after compilation. you end up with a proiI'lII with. for example. different inputs and
outputs. This allows you 10 adapl the program
10 a diffeI'O'nt hardware configuralion. For this
purpo;;e, it is best to "lore tbcse JOUI"CC files
(which are independent of the hardware
addressing) in II library, for example.
C ompMrlng hlock s
The block comparison cnables you to find the
differences between twO blocks. -[be block$ c an
be pr<:~cnt in different projects. in different target systems (CPUs). or in one pffljcci and One
I&!el .ystem.
Use Ihe program editor to compar<: the OJ>CIled
block witb the same block in the CPU or in tile
project by using OPTIONS -+ COMPAKB ON-I
OFFUl'.'E 1'A1lTNER. The resolt is displayed in the
detail ar<:3 of the editor window in the tab "..,:
Comparison".
Mark tMe Blocks object in the SIMATIC Man _
ager. or only the b locks to be compared. and
selecl OPTIONS -+ COMPARF. flLOCKS , The
comparison is carried out either between the
online and omine data managcment (ONUNFJ
omine) Or hetv,-een two proj~-.;:ts (Path I/ Path2).
\Vhen comparing the complele prog",m .... hicb can also includc tables of variable!! and
user dala types (UDTs) - you can inoorponlle
the system data. Wh-en using "ExC'Cute oodc
comparison ~, tbe prog ...m code of the bloc"," is
~ompll1ed in addition. even orblock~ wilh dif.
fercm generation language!!,
The ~omparison includes all dala of ~ block.
\lven its time stamp for progmm code and imerface. If you wish to know whcth~r the progT'Jrn
code is identical independem of the block prop
cnies, eomp ar<: lh~ ehcrksurn of the block. To
do this. select the "Details" button in the re5UllS
window ofthc b luck comparison.
2.5.4
Rewiring
I>
lflh,m: is a pmgntm source file with symbolic addre.~siog. you change the absolute
addresses in the symbol mble. F"'llowing the
compilation. you get aD "unwired" program.
2.~.~
Addrc~.
Priority
I 1.D
'Limit_switCh_down"
1. 1
"Limit_ awitch_down"
"
2.5.6
Reference
0.,.
Cross referencc~
po Assignment (Tnpul. Oulput, Bit Memory.
Timers, Counle~)
po Program structure
po Unused symbol.
I> AddresSd without symbols
po
C r oss r t fc ....'IIce.
The cross-reference list shows the Uj.C of the
ad~. and blocks in Ihe user program. II
inclU<k, lhe absolute addR"Ss, Ihe symbol (if
any). the block in .....hich the addn-ss was used,
how it wu used (read or write) and th~ posi_
tions of usc of the addre.s. Click On a ~ol umn
header 10 sort the table by ~olumn comenl~.
---- ..
"
. tru ct ur~
This li,t shows all addresses which have symbol table allocations but wc.,-e not used in the
lan gua;;:e
7 langu 3\:c
'fable 2.2
titl
itt
2.6
O nline Mnde
2.6.1
C onn.,.,tinga FI.C
2.6.2
I'rottctl 0l:
th~ (;.~r
P rogra m
1\";t~ prol~tlloD
f'1"tK~ elion
p r ntettiun
'Ulled.
C P U inform a l ;"n
PLC -+ DlA(j"uSTIC/S~lTl!<.Q
--jo H..... RDWARE DlAo:.;orncs
(Ott Chapter 2 .7 . 1 "l)iagnOlling the Hard_
WII!"C"')
--jo
-+ OrEIl.ATI:'G MODE
of the eUlTl:D1 operallng mode (foc
instance RUt>. o C STOP). mooific;aTion of
the oP='ting mode
[), ~play
-+ CLf.ARlRES ET
Rcs.clting oflhe CPU in STOP mode
-+
S ~r
Tn'lE Of DAY
:>
-+
2.6.4
When you U"lIn,fer your user progrnm (compiled blocks IUld configuralion dUla) to the
CPU. il is loaded into the CPU'S load 111<':1110ry.
r hy"i<,:alLy, load memory Can be I memory inTeinlled in the CPU. a memory card. or a micro
memory card (set' Cbapler 1.1.6 "CPU M ~mo'Y
1"rllMfcrrhl K bl".,k.
Area~ ).
b locks olTIineiulIllnc
""we
IMiaI value
When dnwnk"dWjj; '"
lh~
rpu.
!l_d . .
""""Dry.
mory
bluc~ _
...-.r h....,
UNlJ"Kl:.D zrrrib"",.
!he ...... vahle is .....~ '"
If ''''' do..
~
rl
I
'1 ' ' ' ;
I
-~
WW;O',".C~;;;;'m'o;;;;.;------- / '
"aj"" ;.
""""
'.
,.".,ao:rUaJ
rbo: ""'"
Initial vaIu ..
~[t..;.. .... ,
:"~2l"~~..:'~~
... ilEAl) DRr _
WRIT .DDL
i1
Adua/ ~ a lu"
in the
pro~m editor 10 the oftline data management using FILE ---} SAVE. TIK: nameS of lhe
vari~bles and !.he data tyPCs sa~ed in the offline
dala manaijcment are 'hen rers ined. If yo"
upload Ibe onl ine dma b lock in the SIMATI C
Manager n.ing I' LC ---} UPI .OAD TO PO or by
dragging Ihe d~la block from Ihe online win.
dow to the omine ""i ndow in the offline dalD
onanagemem. 'he descriptiotl of Ihc addresoes.
such as c.g. the Mme of the variables or the dala
Iypc, i. 1000t .
SIT 5<
..
Ihe.e blocks
been ~rcalcd.
oftlin~
2_7
Testing th e P rogram
2. 7_2
D ctcnninlnR t h e Ca u se of a STOP
If the cause
2. 7.1
D iagn os ing
t h~
H a rdwa "e
In the event of a r""It , yo" ean fetch the diagnostics informalinn nf th c fanlty modu les with
ofth~
2.7 TOI-tinathePrognm
path ()f ..U n()n_t~nnillated blocks up to the
block contain in g t~e interrupt point. U.e th,, ']
~ I ack' button to 8creClI the interrupt stack,
which ~how. you the COntentS of the CPU regist~T!l (accumulators. address r.:ais:er. data
block "'ii'ler, stalUs word) at thc in'"Tnlpt
point at the inst.ant the error occurred. Tbc L
s\.IIck (local data stack) shows
block's temporary local data. which YOII sclC<.'t in the 11
slack by clic king with the molls.:.
me
2.7.3
,\lonllorinl: and
/ll o d lf~ ln l:
VarIab le.
One exceUc[}\ resource fordebugging user prc>i, the monitoring and modif)"ing ofvari_
Bble~ with VAT ~"ariable table". Sigm" Slates or
values of "ariabl~ of dementllI)" data types can
be displayed. !fyou have aeees. to the uscrprc>pm. you can also modify variables, i.c.
cllilnge the .igllal state or usign new values .
gr.tm~
YO LI Can ~ t">ee i fy the va riahl"" with e ith er nbsoIm e or symbolic addresse s and cl,,><>se tbe dUTU
type (di~play lonnal) wilh which a varigbl~ is 10
be disp lltyed and mod ifi ed (wilh ViI::" .....
Sr:L[CT DlSnAY FORMAT or by clicking the
ri,hl muu~ bUlion dircclly on the Disp lay fl'rmat").
Usc COmnlenl lines 10 b";\,C specIfic sce,ion~ l'f
the table _ header. You may also stipula'e which
columns are to be displayed.. You can c hange
variable ordi~pby rommt or add or ddele line~
al any tilllC. You ~\'e Ihe variable table in Ihe
HIOl"b object con"'iner wilh TAB!..!; ..... SI\V.
E~tllbU5 hl nlt
,l:.
In Ihe variable table .elect V... IUAlILE ..... TlI.Klou to " tthe Trigg:~r point and the tri;:;:cr CODd1tiQn~ $Cpamlciy for mon itoring and modify_
in g. The trigger point is the poiot "t which the
CP U rends vu lLles from th e system memory or
wri lC$ values II) Inc system memory. You 'P""'if)' w h ethcr read ing and writing is to lake plnce
ODCC or pt:riodically.
2 .7.4
Forci ng VwrlllbJ u
Lm:,;:c .
t>
t>
,''''';phernl inputs PI
[57-400]
t>
Peripheral outputs PQ
[S7-400)
:>
Memory hi t ~ M
)S7-400]
addrcs!<eS.
While the foree function u. aclive, the foUo,," ina
"""liel:
t>
"so-
89
RUN.
2.7.5
Itl STOP mode, the oUlpm modllks are normally disabled by the 00 s ignal; Wi lh th e
Enable peripheral oUlputs [unct ion . you can
d~act;vate the on signal 00 lhat you can modify
the outpm module. ev." at CPU STOP. Modi_
fying i. earried am via a variable mhle. Only
the peripheral ompms ass ign ed to a CPU are
modified. Pos,ihle apr>lic3Iion : wiring test of
the oUlr>m lit STOP and without US~r program.
2 .7.6
The rceording Df the program ,tarns infmmation re quircs additional cxecmion time in the
proo:r.un cycle. For this reason, you can choose
two opcrating modes for debugging purposes:
tes[ mode and process mode . In test ",odi!, all
dchugging functions can be uscd Wilhout nostricllOll. You wo"ld selcct thi" for examp le, 10
deblJll blocks w ithout conn~ction to the system,
b~~ao,e this can s ignificantly increase the cy_
clic cxe~ution time . 1n pmces.< mode, care is
tak~n 10 keep the inercase in eycle time 10 a
minimum and th i< usults in debugging re'tric_
lion" e.g. Ihe starns display with progranlloops
i, aborted at the return po int. n~bul':;:ing :,nd
,tep-by-~{ep program execmiC>ll cannot be per_
fonned in process operat ion.
Test mode is set in lh~ factory on the 57-300
C PUs . You can sct lest or p race .. mooe 0"
these CPU s with thc Hardware Connguration
on the "I'rotcction"tah . Following thi . the configurlltion mu,t be compiled again and downl()aded to the C P U.
The process mode is set in the factory on the
S7-400 CPu s. You ean change the operating
mode online w ith th e "Pwb'l'anl E-ditor. DEBUG
-.> OPERATION .. displays the set operating
modc and offers the facil ity of changing this on line.
You can ,witch the fun~tion off agai{l by "clceting VARlAlILt: -.> NAilLE PERIPHERAL O UTPUTS again, or by pressing the ESC key. The
00 "ignal is then active again. the modu le ou tputs au set to "0" ,md the substitute v al"" Or Ihe
foree value i, re,c!.
If STOP is exited while "enah le peripheral outputs' is 5till active , all p"ripheral inputs arc
deleted, the 00 signal is activllled at ilie transi-
2.7.7
LADfFBO Progrum
St atu~
E . . .
.........
.........
.........
,...... .
"
" --"
" --"
"--'
..-......
.-......
. -- ~.
".--0'
....
.j
.,
>
." . ..
'..
..
0
"._......
.,
.,.,'
l\ l odl~'[ng
addressfi
~onta~1
2.7.11
I)~ t.
92
_Mo=R.
VICW
-'.-
--"'-
,-
..----
---.
-.,...
----- . -
......... v_.
,.,..
,III
'-
"
3 SlMATIC S1 Program
SIMATIC S7 Program
3.1
Program Processin!::
3.1. 1
P rollr am
l'roc.~ssj n lll\ftlhods
The o.1.'ieT pTUgram may be comj>Of;Cd of 1'1"0gram sections which Ih~ CI'U processt'S in
dCpol'ndet1ce OIl cmain e""TIts. Such an event
might be the Starl of the .ulomal;on sys1em, an
tnlerrupl, ot detection ofa program errot (Figure 3.\). Thc programs .\located to the e venu
arc divi ded into priority clllllses. which determine the program p~iDg ortkr (mulUIII
inlerrupubility) ",hCll ""venl.l "',.. nI5 oc"ur.
Tbe !owc<I_priority prognun is the main pm~ which is proce~~cd cyclicall y hy the
CPU. All other event, can interrupt Ihe main
program al any I""mion. the CP U then execute,
tl:e as",ciatcd interrupt .~rvi~e routine or errnr
-.
Pow. on
L /
I C,..
SI~nup
""""m
~
~
M al ...
<lnletTUpt>-
'""""'"
<Faull>
in(ellupl
OperaUng
I
Error ha ndllnq
g,am
~-
p ro_
I
IntorrupturoAee
routine
)
,
.~"'m
I!~ncrated
\)eCltU:IC a module
~ynchronou.
gram pnxcssin g, such as acceuing a non"")I;sI~nl address or a data type: eonversioll error. The
rype ami number of r<:rorded evcms and the
asscx:;alo:-<i o'llanizalion blocks are CPU-specific; nol every C PU clUl handle all possib le
STEP 7 ,,"enl'!.
asynchronou. errors.
An asynchronous error is an error which ,g
independent of the p rognun ..,an, for eKamplc
J. I .2
P r] " r lly
Cla.~lfl
Table 3.1Ii.l. Ihe availab le SIMAT IC S 7 organization blocks, cach wilh il~ priority. In Solne
3 SIMATIC S7 Program
3.1.3
Geneml
Name of CPU, plant identifier, location 10.
scllings for MPI interface (if the interface is
not combined with DP). comment
f>
Startup
Speci!ies the type o f <lartup (cold restart .
96
Memory
max . nwnber of lemporary local data in the
priority dasses (organ ization blocks): max
size Oflhe L stack and numberofconununi cations jobs
f>
Interrupts
Specification of the priOrily for bardwarc
interrupts. time-delay interrupts. a.<yn chronous errors and D?VI interrupts; assignment ofpanial process images with process
and time dclay interrupts
f>
f>
Cyclic Interrupts
Specification of the priority, tlte lime cycle
and the phase offset: assignment of pania]
process images
I>
Synehl"(lnoi.l~
cycle interrupl<
Specification of the priority: a.signmcnt of
DP maSler system and partial process
images
c>
Diagnostics/Clock
Spec ification of the system diagnost ics;
type and interval for clock synchronization,
correction factor
The relevant organizalion blocks must be programmed for all priority classes used; otherwisc the CPU will invoke OB 85 "Program Proce,sing Error" or go to STOP.
For each priority class sclcrled, temporary local
data (L stack) must be available in sumcient
volumcs (sec Chapler 18.1 .5 ""Temporary Local
Data" for more details).
Cycle/Clock ~femory
Enable/disable cyclic updating of the process image: spec ification of the cycle monitoring time and minimum cycle time :
amount of cycle lime, in percent, for communication: numbt."f of the clock memory
byte: size ofthc process images
(>
(>
Prolection
Spec ification of the protection level; defining a pa<sword; setting o f process or debug
mode
MU]licomputing
Specification o f the CPU number
3.\ PmgramProcessing
T~bl~ 3.1
SJMATJC S7
O,gan i z.tiOI~',"'~
:::"''-------------T---';;;;;;;;'--Modifiable .
,
,
,.
0"
modulos
16 to 2J
PROFlBVS DrY I
"
,or mOOe
tech no1_
"Co,. ' ~ I
OB
~5
OB
~8
:~~c c. c
2 to 26
2 to 28
2 to 26
"'"
1n th e C05e
ORRI
"
"
26 2)
2 5 2)
25 )
'
Sloer",' .
failure,
No
2 <026
24 to 26
No
'"
N"
"
the em::>'"
t>
integrate<! function
Ac tivation and parameterization of the imegrated functions
t>
Communication,
Definition of ~o"nection reSourceS
Proll:rllm
"" Web
Activation of the Wcb 8crYer, language se_
lection
len ~.'th,
3 SL\IATIC 57 Program
MOdule ill
M ODUll
I-" fOK."t~
"\05.
The c1l<:cksu m oflhe uscr prugnun is genemlcd
from the program code and Ih'" default and ini.
lial vai u"'5 of the data blocks. The writing of
dotta add",.,"" in the won memory ("ct~al \ 111ues) does not ch....nge the checksum. Th~ checksum i ~ only adapted when the data blocl.<. are
uploaded to the "mine data management, when
the actual va lues become the ini tial values. Th;~
al90 81'(llies to the data blocks aeneratcd by a
~ySlem function.
If a data block gcnerRled by S}'Slem functions i~
"'"tlen or d eleled. Ihe "'hecksum ;s nol
changed. The checksum is adapted i f a pro
&mmm~-d (loaded) diIla block i. deleted. or if
Ihe inilial values in the loud memory me modi
'"
S ~'C
84 \'lR1T_
Innov.I~...J
3.2
Blocks
3.2 Aloc ks
3.2.1
Rlo ck TYI'es
[>
I>
Uoer blocks
Bloch conta ining user program a nd u ser
data
Sy,tem block<
Rlnch containi ng system program and sys tem data
Standard blocks
Turnk ey, off-the-melfblocks, such a, driv_
ers for FMs and CPS
Us~r
bloc k s
FunCiion.I' (Fe's)
Functions nre used w program freque ntl y recurring o r comp lex automati on functio"". They
can be param~lcrizcd. and rctum a val"c (cal led
the funct io n ,alue) to the calli n g blu"'::. Th e
function value is optional, in addi tion to th e
function value , f"nct ,ons m"y a lso have o ther
output parameters . Functions do not store intor
mation, and have no a ssig n ed data block.
Da ra blocks (DBs)
These blocks contain your program's data. Fly
programming the data b locks. you dctennine in
whic h form ~he data w ill be savcd (;n which
bl oc k. in what ortl~T, and in whm data type ).
There are two way" ofu,i"g data block s: as global data bl o~ks and as instance d"ta blocks . A
globa l data b lock is, so to sp~a k . a " frcc" data
block in the user program. and is nO! allocated
10 a "ode block. An instance data block , how_
e,"er. is a,s igned to a func tion hlock. a nd ,tores
part of that fun Clion block's local data .
Sy.tem h loeks
3 SI"tATlC S7 Program
Table 3.2 Numher range, lOr sy" e m dat> bl,)(,k,
, overwrite.
ti
II
coofig-
"
"
"
,
rOT HIf and
3.2.2
Block Structun.
;>
t>
Standard blocks
""
1>
1>
The dedaration ,ecliotl cOlllains the dcfilli(ions of the block-local va ri ables, in this
case lhc data addrcsse, Wilh data type specifi cation
3.2 Block!;.
;"",,,,,,-,,,,o,,:,,.,,",,,..,,m,.,"", , OO~..~"".,m,m""',",,___~
...
Blockfleader
PrOfJrlIm
BEGIN
Program
END_Block Type
Block I>c"dcr
S TRUCT
Decl6relion
Address
INama
J
-,-
''''
In itia l value
"!!me , Data
name: Data
t ype:~
tyP": ~
...
InrualizBtiQn:
Initialization;
END STRUCT
..
.~
Fi ~n ,..,
l>
DATA_BLOCK Aadress
BJock h9lJder
BEG IN
name
END_DATA_BLOCK
.~
Initializa tion;
II
i
II:
3 .2 .3
Block Properties
w,
3 SIMATIC S7 Program
,-....-~
(RIO<
ji5;-'
Ifij .~ ..... _ ,"_. f~ ""' _"""
G"' od ~ '-""'
,,-p,",
,-
~O_
"'""-"""
"'.... w_
_ _ ~ "" ....c
rr 0____
' ~ ~"'"_
r
'"
3.2 Blocks
A block occupies InOI"I: space in the load memory 8ince the data 001 rc:levant 10 processing arc:
oaved here in ~ddition.
is
UNL~KED.
"Calls" la b
This tab shows a list orall blocks called in this
block with tbc lime stamp$ for the c;ode and the
interfaee. With in.lance dala hloch, the basic
function hloc k is shown here togeth~r wilb Ihe
.0)
3 Sl\lATlC S7
Jl'ro&nm
~ Atlrlb .. u.~
tab
po
po
3,1.4
Block In tufacc
I>
<.II~
""
Ch~cldng
hloek consistency
earli~r
I' lca,c note that after check ing the b lock ~on8is"
t~n cy, the instance data bloch and thc dam
bloch g~nemted from the UDT are assigned
t he initial value, aga in in the compiled pro"
""m,
Thc dependencies in th~ case o f call ~d or referenced blo~b are displayed in the fonn ofa tree
d i"gram (t'igure 3. 4) , You can choo, c bctw~en
the following two representations:
'"",,''''L
..'001 [ot
"""I
' [DO ~l
.
."
~,
"0"""""
~o
'
_",",,' [M ' _J
..... . "oj' [:0""'1
(0'
"'I
'(~[""
,'
."
",
'i'
0 0.,
'" Q '"""
:;c.
..
," [C<'-I
~'-I
:eo &t~ ]
0 ""
COl'
a """ _1....""' .. _
-I
o CO!
0 "'"
.p". . . '
'w[RO)
.F"......'
~o..o'r_'''''''''[MO)
_
( "' ~ l
Fi~Dr~
3.4 Exomplc of!h< Repr< oon"'tic" of the 'Check Block Consistency" [kp<ndcnde,
]1)5
aa1 ...
The dependency tree view di,'plays the depcndcn<:: ics starting from all called or rderencffi
blnc b. Thcy arc located in the left_lIftrnl tol umn. and the calling blocks arc ilStffi 10 tne
ri&ht or thi5. bample: FE 22 stores its data in
instance DB 201FB 20 that is tallffi in 08 L It
alo;o has its own DB 29 and it iscal1ffi a, a local
inStancc in FB 20.
The dC lcnnincd infonnation is displayed in
compact form by symbols. An e~chllnation
marl:, for example. indicates thaI the obj~"Ct
cllused a time Slamp conflict. A whue cross on
a red background Ind,cates that the ~SlXiated
block must be recompiled.
If you select a block in the tree diagram orin the
..,utpot window. you can edit it witn eDTT -+
O PEN oBJ!cr, e.g, COJ1"C'Ct an incorreCI call.
J,J
Chapler 2.5 "Creating Ihe S7 Program" contains an introduClion lO program creation and I<>
operating the program editor.
3.J.l
ap.,nln g Blocks
Irroo open. compilffi block in the Rlocks contai...,.., e.g. by doubledocking. it i$ open for
incremental programming. This is the case borh
with omine and ol1line progmmming.
'f lhe ~Iock doc~ 110! yet exist. you can grnerale
it ;11 the following ways:
t>
'06
t>
nom".
TO\fl7'F.
3.3.2
m oc k Windo"
'jo"
..
,~"
,....
,-,.
,-,
,~
-......_.,.....
..... ,. ._.
.w._._... h.' _
....--.0_,
,_.
"... .
_ _ _ _ _ ... _
___
. ~_.
M __
., ... _ . }
~- - " ......""
t ]litu ....
3.~
:3
In the program window,)'Qu will see uepcnding on thc Ednor'. dcfauh Serling' the fields
for Ihe block li lk and the block commen! anu,
ors
O~d.rarion S.~llO"
Vatl""l. Type
Input pat:amete",
OutP"t peramet"'"'
OUT
J.1'. _O UT
STAT
In-aw parameters
Temporary local da ..
Fune<ion ~ alue
"
"""
RETUR..'1
K
K
K
08
,e
,e
,.,.
,.
,.
,.
'"'
3 SL\tATIC S1 Pr<)f'l'II
th~ fi~lds
block. you control the di'l'lay of comand ~ymbo ls with the tllffi ....-ommunds
VI !!W ~ DISPLAY WrIll. You call chan~e the
~ ; ze of the display w ith \IJ.Iow ..... ZOO'l I);,
V IEW - ) ZOOM on ,md VJ..Io'1 ~ ZOO\! r ",C-
..
ment~
'"'
O"frvl~"
JJ.3
The
ov~rvie\\'
clement
Window
~PtIllO
r J)(iR.\ M U.ME"oiS .
Tllc o~'cr\';ewlI arc p~senlcd in a S..-pal1lle window which you can ""dock- at the Mil" of the
.-..I ilor window and also relea,., .eain (doubledick in nch c85e on the title bar of lhe oHTview window) .
n~N..ori<
JJ.4
Pro~rammln~
l\"crn'orkt
You can divide a LAOIFBO pmgram intO networks which each repres~nt a eurnnl p~th or s
logie oporul ion . The Editor numbers the nct-
'""
eml"ly
FI"u ~ 3.~
3.3.5
A ddres . ing
Absolut e
J'\etwork templates
JuS\ as you store blocks in a library to reuse
~~ dr","inl:
""
'>DolATIC 57 l'roi""m
1'' _
3.3.6
.... ;tIt
Con tac lS
Binary arldIe-sse, ""eh as inputS are scanned
u.ioa comacts . The scanned silPla l statcs at"<:
combined a, ~ording to th~ ~rmngemem of Ihc
comacts in a serial or paral1e11ayoUI.
"Current flo,,';;'" through I n",,",,,,Jlly open conif the scanned binary address ha. siiDDl
mte '"I"' (the contact is activated) "C"Urrent
1at:1
Colt,
Si:nJ>1< coil
C~:I
_.......
"'11b "'I'P1clr.tWy
IItfICh<ttl (~.II. set, use<. ~II<'
--jNOTj--
S PULSE
: ''" ,
Flilun ). 7
'"
" 1=
'CD
e-
I:>c~mpl tj;
Block bo~ ..
(~ ... I"w1ctiI>It block ""U.)
D'm
.,
.,
in3
eo"
'"0
an
. .,
~ ...
"
~.rt.
pa,u
r.~ay
h~v ..
to ' Oy.
, . . ~he<l tn .. or."
- ... u ..
{p -
.....
<>f
o~
u.<> .... l .
p.
i."'~ .~.
'Mhultl
Colis
Coils an: ,,-~ed to control binary addresses_ ruch
as Outputs. A .imple coil Sels the binary
add,....SCI when Cu.tn:nl flows in Ihe coil, and
rCIICIS it when power no lonaer 110wo.
There ace coils with addit ionnllBbels, such a,
Sct and RC8Cl coi),. which serve a special fune__
lion. You can aIm use coils to control limeTS
and counters, cal! blocb witlioul paramelers.
execule j umps in the program. and so on_
Bole.
rc-prcsenl LAD elements with complex
functiono. STEP 7 provides standard boxcs
of two difkrenl types, w,thm.1l ENIENO mech_
anism (.uch as memory functions, limer and
COllmer functions. comparison boxes). and ,"'i lh
ENIENO (such as MOVE, arithmelic and malh
functions. data type con'crsions). When you
call code blocks (FCs. FB s. SfC. and SFBs).
LAD allO rcpr-esen15 Ihc tailS as boxes wilh
EJ>;IF.NO. LAD al.., provides an "CII1p1y box
in wbicb you can CntCr Ihc desircd funClion
when programming,
Bo~<:lI
Layout
re~t dctions
'Vhen LL.ina
'"
po
bo,,~
po
po
:>
With Ihe arrangemenl of the boxes, you evaluale the signal slates oflhe ENO outputs: if you
'"
3 5lMATIC 57 Program
3 .3 . 7
Editin;:; HJD
Pr<>gramminl.: in gener al
T he program consists of indivi dnal progrllDl
elem ent. that ar~ connected togcther via th~
b ina ry sign al fl ow to form logic operation, or
ncm-'ork s_ You begin programming a lo gI c
opcl"ation by sel ecting the programm ing elements on the !eEl of the logic operat ion
!>
OpCra!lOn .
b"xe~
A NI) B ox) or
Th~re
)ah~L
Binary fu nction.
}\;jd ftu-",'i<m.
.: ORfuo"ion.
l!~:,l o.<i".--O R
fu,Id;OO
Nega'io>~ or""'D
o.nd ,..,sul, of
lli~ logic
"1" ""-'''''''
are simpk
box~,
V tEW ~ OVERVIEWS) .
fUll ction s
Sim ple
!>
Hin~ [ )'
U~menn
"
.\!lost program clements must be as< igned mem ory iocation, (nriables). The eas iest way 10 do
thi s is 10 first ammge all program clem en ts,
th~n lahelthcrn .
Slmp!e bo x..
L
L
mR
L
>.,
~."""
8 inary operand
fl..ct;
--l
='=c-<l!~
","'=ti""
Counter o p-eraoo
tltr.... ..00
Ju"'<r t'>noli"""
(;('.<\1",1
--1
CO
ju,,:p !"n~'w=.
,,,,,,,,or =!to] ",loy, <le_
Complu box
S ~Qdan:I bo,~whh<>u' l'I\! n~O
""_'">
SuotI.,.,r
wilt EN_'EXO
(t.:,: mtbm<.-ti<> f!(...clioo>}
fll<d. "OXO,
(~ IO.
Time"- ad<:lress
DB.m
S PU LSE
, eo
S 1'\1
81
BCD
Q
"
=
-
in '
in2
out,
oul2
,"0
f-
~ o. ~
' E>'
R.,.o"."
". "
1-
"
",
"B u ie u" _
"/II{a u ltl"
fl~ur e
-0
"
L.
Comple" boxes
~,
!>
!>
!>
restri~d o n.
3.4
3 SI).IATIC S7 Prugnun
3.4.1
t>
t>
I>
3.4.3
You Cln till out the h~adcr of:> block as you ereIte it or you can add the block propcnk! .t II
laler point. You proJOllUIllater addition [0 [he
block header in the editor by selecting FILE ...
PROPIlRTTfS while the block is opI:D.
3.4.2
The propam editor pmvide:; t"" vic,," for programming (cresling) dMa blocks:
u.
'"
".
Eacb ' -.e" presents a table conlPining the abso1u1~ data add.... se. in sequence. tM n8Jt>C' and
clara 1)-ptS. the initial values aDd corruncnts (Fig_
~ 3.11). The data >->cw eODtatnS an additional
column with the actual 'aluc.
If you oprn a data block from Ihe omine data
management, you arc provided with Ih~ oftline
" '11"10,,, "'nh "hieh you cao edit Ihe d~IH in the
pmgrammin g device. !fyou open a data block
F j~U T~
Offlin e w indow
You I,"C the dec laration view for input;; w ith
global data b locks You dcdare th~ data
addr~sses in th is view; you definc lh~ s~"uencc
of data add[\;\S~s. assign a na me and data type
to each data address . and Can "dditional1y em er
a conuuem. Each data add .. e<s lS ass igned a
deb.ult va lu e . This i, Z<'ro. the smallC8l value or
empty d~pcnding on the data type . You ca n
modify the ddau lt v~ luc in the initia l v alu e col-
"=.
The data "dtlrc>se, "nd the d~fauh values are
already dcfincd for data blocks which [\f~
derived from a user dam type or from a fundion
hlock. They are obtained from the declaration
d~cI "r~tion
of
3.12).
The possibility wh ich exim for assigning indi vidual default value. to ea ch data block is parti cularl y im portant for the data b locks derived
fmm a Ll..ier data typ<: or from a function b lock.
t'or example, if you generatc severnl instance
data blo<.:ks o f a function block, all dala b locks
have th~ defau lt value sct in the function b lock .
In the data view, you can m>w iT1 dividllally
as sign other values to various dam addresses for
each in.tan ce .
115
3 SIMATIC S7 Program
view
..
':~
Initial
~alu"
I'
- lr-~,c,c,C,"C,~.~"C'"~.-'J .. _:I;;:~ACO~'C"'.~'C"~.C'"-"
Load memory
Wo rk m"mory
Online w indow
You usually usc the on line window to view the
actual dam valu~s ;1) \he Ll'er m emory. H(lw_
ever, you C"n also u,e ;t to generate d ata hloch.
The initial value column;n the dec laration ,~ew
show. \b e init; a l va lu e from the oftlin e data
m anagement or thc ini\ia l ,'alue from the load
memory if tb~ omine project a'.,oc iated with
the CPU program is n ot av ailable _ The acnml
value column ;n the dma view d is plays the
a~tual value from thc work memory. W ith E VIl'
---> I N TTIAUZE DATA BLOCK you
requ~s t the
~d Ltor to re place a ll actual value, hy the in itial
values agai n.
'''ill
'"
3.5
Data Types
3.5.1
compon~nt
,, ~Iues
il).
Constants a~ used to pres et variable> to a fIxed
value . Th ~ constant is given " spe~ifi~ prefIx
depcnding On the data type .
opcr"nd,'
Variablcs. whkh you decl are within a b lock. are
to a. (block-) loca l variables _ These
include the block paramel<:rs. the static and
temp orary loc"1 dam . even the dara addresses in
global dara b locks . When th ese var i abl e~ are of
an e lementary data typc, they cau also be
a cces.ed as operan d., (for instane~ s tat i~ lo~a1
data as UJ op~rands, temporary local data as L
opcratlds. and data in g loba l da:a b locks as DB
operands).
r~ferrcd
Local variahl~<, h owcv~r, ~an "Iso ~ ot complex data typ<> (such as stnlC111res or arrays).
Variables wit~ th~,e data type, reqllire m On!
than 32 b its . s(' thal \h~y can no longer, for
example, be loaded int0 the accumula tor. And
for t h~ ,arne reason, they cannot h(: addrC"S,ed
with "normal" ' STL <ta\cm~n" . T he!"e are special functions for handling (hese variab les, w ch
as the IEC fun~tions, wh ich are pJ"<'widcd "-~ "standard library with STEP 7 (you can generate
vari ables of com plex data type in block parametcrs orthe <am~ data type).
or
If variables
complex data type contain com
pon,,'ms of e lementary data type, the<e componems can be treat ~d as (hough they were separate variables (for example, \lOll ~an load a
01"".
A v>0a..u;, """sis"
""d",u and ,1>8 da,~ 'J'P"Hi J~.><>d 'y""'xJ;Cd#y,
Va_ia ble
3 .5.2
Address;n!,: Va riables
Wh~n
[>
Abso lute
addre" ing
uses
numcri~al
addresses beginning with zero for c,,,,h
addre,s area.
Symbolic addre,sing u.;;es alphanumeric
natllCS, which you yourself dcfmc in the
symbo l table for gtobal addr~.'es or in the
declaration
section
for
block-loe,,1
addr~sses .
Ana/"K .l'iKna/s
Address klenHfier
Fl~ ur.
..
Memof")' location
J S(/>'tAflC 57 Program
mfonnation can control an indicalOr via an analog output module, where the infomlaaou is
cun ,'~ned into an analog value (such as a cur_
rent),
T he information width of a signal also c~
sponds to the infonnation width of the "ariabl~
in whieh the signal is slOred and processed . The
infonnal ion width ~nd the inlcrprclation (lflb~
informat ion (fo r ;n;;tanc~ the positionsl
weight), taken tog~t her. produce the data typo
of the variable, Binary signals an: store d in
variable, "f data type BOOL analog signals in
vaTiable, of data type L'\T.
The only determining factor fo' the addres.>ing
of variables i~ the information w idth. In STEP
7, th~-re are four w idth" which can be acce".d
wilh absolute addressing'
t>
1 bit
t>
8 bit,
t>
t>
16bit s
DatatYP<'WORDoranothndata
32 bits
Input word no . 4 :
cOnla;"'; bytes 4 and 5
QD
Q 16.4
OW, 26
QW24
,
"I
os
.. 1
07 ."
.. ,07 ..
25
OS26
CB27
2~
DB lODBX 2.0
Data bit 2,0 in dnta block DB 10
DB II.DBB 14
D~la byle \ 4 in data bloc\:: DB 11
DB 20 .DBW 20
Data word 20 in dala block DB 20
DB n.DBD 10
Dam doubleword 10 in data block DB 22
Addi'ional in fonnati'", on addressing ' he data
area call be fOllnd in ChapIe. 18.2.2 "Acces>ing
QD, 2"
QW2S
F11:IlN 3.1.t
Byte Co ntent! in Woru.; and Double" ",,<is
''"
OB 24
ID g
I 1.0
ill 2
0= Openmds"
Symbolic addrc"in g of variables
SymooJic addressing uscs a name (called a
symbol) in place o f an absolute address, You
you,selr choose mi.> name. Sueh a name millt
begin with a letter aud may comprise up to 24
3. ~
leading 'if'. Whcn tb c Edito r cannot distinguish a local symbol from an address, you In ..... t
p rece,j(; the symbol wilh a .. #" eharncte r during
inpnL
Local symbols are available onl y in the pro--gramrning device database (in thc omin e con_
tainer Blocks). Iflhis infonnation is missing on
dccmnp ilatin", the Edit"r in~crt.~ a s"bslimtc
symbol.
Udnll symhol names
G lobal symbo!.
You may assi!{T\ names in the symbol tabl e to
Ihe fo llowing objccts:
r>
r>
r>
r>
r>
Variable tables
mputs
and
A g looaJ symbol may also include spaces . special characters and counIty_sp~citk charaelers
such a" thc umja,,(. Exceptions to this rule are
the characters OOh~-' and Ft'ho' and th~ quotation
mark ("). \vllen using symbols contaiJ,ing special ch aractt-rs, you mu.<t put the symbo ls in
quotation marks in thc program, In comp iled
blocks. th~ STL Ed itnr a lways shows global
symbols in quotation mark>.
You can us c g lobal symbols throughout the p rogram; each such "ymbo l m1.lS l be uniq ue within
a program ,
EditinK imponing and nportinB of glohal
symbols ar~ d~scrib~d in Chapter 2 .5 .2 Symbol Table",
Btock_local symbols
T hc names tbr the local da'a a rc spec ified in the
dec laration seelion of th e relevant b lock. These
names m ay contain only le n ers, digi's and the
unde rline character (no umlauts').
Local "ymbols are valid only within a block.
The 8ame symbol (Ihe 83me variab le name)
may b e used in " differ.-nt context in another
bl ock. The Edil-Or shows local symbols with a
'"
3 SIMATIC S7 Program
Table 3.4 Divi,ion oftht 0... T)Ipc.
J.!.J
(n bits)
O,tni.w o rD llal)'ptl
3.S,4
~~~~i&..~~~\.J...\\~~~~
"~";he-;;;;;e"1:llI'"i;:P;:,.
dallllypu
typeS
data type.
:> Parameter types
I>
a word or a doubleword.
Tlble 3.6 mow,; the elementary data type. _For
m~IlY data type,. there are tWO con,(8nt r~pr.
sentutions tnal you can use equally (e.g. Tuv\ Elf
or Til). The lable contains \1M: minimum value
for a dalll type in the upper line and the maximum value in Ih~ lower hne.
lj5Cf
Dalalpn
f...u.~<u"~~"'<:&.~~(..'"~'"I:t.'\....,,~
I11o---....."'['<~tttenmry
EI~mtntary
""
Table 3.~ shows some elUlmplcs urthe declara(ion of v8riable. of elementary dala ~s.
TabJ~
tJata 1)l'"
( Widlh)
Dc,s cription
"OOC
( 1 bit)
Bit
FALSE
BYTE
(8 b its)
TRUE
8-bit
b~xade<'imal
CHAR
(8 bits)
WO=
(16 bits)
()'w
number
ch ara,tcr (A Se!!)
16-bithexaJe<lllla.l
tlum bcr
WII16'1oooo,INiOOOll
W~l61ifffF, J6!iFFFF
2"OOOO_ooooJII)()(}_ OOOO
""llr l 1111 111 1 Illl
Count ,alue.
3 ,let'.de. BCD
DWOIW
(32 h its)
B II(O,O)
32-bit he~adecjm. l
number
UII(255,25~)
2'iOOOO_0000_ .,_0000_0000
l ll llll 11 11
(16bilS)
111 1 l ill
LI#(O,O,O,O)
dedmal numbers
BiI(255.255.H5,2~5)
Fixed.point numocr
32768
~32
767
(32 b il.)
Fixed.point numbt'f
(32 b i!
float;ng-poim "umbe"<'
a, de<:iII1al cumbcr
SSTJME
(16 bits)
TIME
(32 biLS)
nme value in
S L~lAl'lC format
Time
"alu~
in lEe fo. -
mat
;4),,,,
SST
SST!MEif2 h46m30.
TiP'-24d20h.l 1m23.64 7m.
n",lEN24d20b,llm23.&47m.
T#--24 .855D4d
nMEII 24g~5 i34d
DI" I ~JO.(JI-O 1
DATf-'1'2168- 12-3 1
TIME 01' DAY
(32 bits)
Time of day
TODJoOO:OO :OO
1L\-lE OF DAY~23 : 5~:59.999
1) "Lit" may be "mtlled ,[the numocc 1> outsld~ tho L"l number rang.
I)
>C'C
text
3 SIMATIC S7 Program
CHAR
A , -arinble wnh data Iype CHAR (character)
Yon can us .. any printable cbaractcr in apo,troph .. , . Some spec ial characters rcquireuse or the
notat ion ~hown in Tabl .. 3.7. Example : 'SS'
represcnl. a dollar 'ign in ASCI! code.
Tabl. 3.7 Sp<X'ial ChaIl!.ct<,.. fur CHAR
CHAR
H~
n...,ription
",
4
2 """
Doll.r sign
Apostrophe
"00
L in~
Sl or $1
17h....,.
fel {lf)
SP or Sp
BCV n~mlx,r,'
BC!) numb<:rs hs'-e no ,pecial identifier. Sim ply enter a BCD number "ith the data typ .. 16#
(hexadecimal) and use only digit> 0 to 9.
OC
SII. or Sr
mJ~.
S'T '" $t
09."
'hb,,]alo[
T"T
BCD number, 3
.".
dee~d
0 \
,
ASCI! Cod.
S;gl1
28127
Bytem+2
Byte m+1
24 123
"
Bytn m+3
20 [ HI
Sign
15 14 ...
Om type INT
D~'" typ"
OINT
3130 ...
1S 1
D~UI
2302
"'.
11> 15 _
d ;;
..2'"12'" ..
Iyp" REAL
3130 .
... 0 '"
... 2322
15 14
D~"'ty""DATE
1514 .
... 0
,, 'n !)
'I','"c,'".',''''.-,------------,~;'-""~~I
,
3130...
I5I2302",...
':: '
'~"I~",
.'
"
... 6 "
" .
3130
, 0
Sign
3 SIMAnc S1 ProJ!I3:n
~J.
REA L
A variable ofdaU-type REAL represents. fra~
'0'
n 'e S 7-300 CPLis Cannol ca!cula.e wi.h denarllIali:tffl float ing_point numben. Th e bit pnttern
of a denOlmali zed numlxr is in1el"Jlll'tcd ~~ a
1.ero.lfa rcsuh falls w;thin .his ranilc, it is rep
resented a. zero. and ,tatu. bit. OV Bnd OS arc
~et (l\crflow).
A \"ariahle of data type REAL consists .nler_
nallyoftrnee components. namely the s'iln. tbe
S-bit c~poncru to base 2 0Uld the 23-bit man
tina. The sign ma~ assume the '"lItue -0.' (posili,e) 01" , (oe!!a.i,e). Beron" the exponen. i~
stored. I constant value (bias. -I 27) is added 10
it SO that it sbows a "~Iue ... nse of from 0 10
255. Tbe mantissa repre"""IS .he fnoctional portion of tl>.- number. The inteaer ponion or the
manti,sa i, ,,01 sa' cd. as it is either always I (in
the ca~ ofnonna lized floating-point numbers)
o. alway' 0 (in the ea,e of d~'I1<mnal i 7.cd no~t
ingpoint tmm~rs). Table 3.8 shows the int er_
IIBI ranl;c ofa domiog- poinl number.
SHL\l
A \"ariablewith dara I)'pt: S5TIME is used in the
bB~IC iani'Ja!!C"S STL, LAD and FBD to ~et tbe
Slil.1ATIC timers. It n::ser.o:.I one l6-bit word
with I + ] decades.
The lime i, spcciJied in bours. minuteii. sccond.$
'"
i
0
0
0
0
'"
F.... ponent
Mano.>:I
Dc..::ripuotl
'"
'"
Not equal to 0
0
0
0
0
I ... 2S4
'"
'"
..
. 2~4
""'-
0
1'01 equal In 0
Arb",..f")'
Not equ.al to (I
,=
II'"'pli"" dcDomIahzed floatm&-poinl number
1\'pri'" nonnati2ed fioaUJIa-point Dumber
infinite
1'q)1l'$C11-
S5TIMEII'500ms
S5T#2h46m 30.
3.5.5
(- 005 0t,eJ
(- 3999 h<.J
DATE
A va,iable with data (ypc DATE is stored in a
word as an un< igned
d_po int n um~r. The
~ont~'T1t' of th .. variabl.. correspond to tae num ber of days since 0 I .0 1 ,1990 . I ts repres~lHnti o n
shows the year, month and day, separated from
on~ another by a hyphen. Example"
t"". .
DATE#1990-D 1_0 1
0 #2168-12 -31
(- OODOj,e, )
( = FF62 tcx)
Tll\lE
(- OOOO_OOOOt,.,,,l
E ~ample"
D~ta
Types
DATE
A~ D
TlM r
t>
STRING
Lnaraeter string with up to 254
Chaf3Cl~TS
> ARRAY
A rray variab le (combination of variables of
the sam e type)
t>
STRUC T
Stnleture variable (~ombit1atioll of variables
of d i{ferct1l types)
125
3 SIMATlC S7
Tabl~ 3 .~
PrO~'Tam
STRll'OG
The dat. type STR Ih"G represents a character
~haracten;. Yo"
.pecify the maximum p<.:rmissib lc numlx.'T of
character< in square bmckcts foHo"ing the keyword STRING
.tring consisting of up to 25 4
Th ig speci fication ~"n abo be omitte<:l; the Edi(or th~n uses" kngm of 2$4 byICs. In (he ca:;c
of function , FCs. th ~ Ed itor doe, not permit
specification of the !cnh'lh or it demand:; me
standard length of 254. 1\ variabk of d"T~ type
S TRI NG oc~upks I\l/() byt~s more of memory
than th~ d,.,darcd maximum I~ngtb..
Prc-ass;gnm~nt i, ~aniod OUt wilh ASCllcoded characters be(ween single invcflcd com_
mas or w im a prdixed dollar , ign in th~ ca<~ of
cenain characters (see data typ~ CHAR)
pos~i blc
,p~ cify
brack~l'
in; (i~!
o.ta format DT
Yur
o bi$ 99
B),".e
Byte n+1
Month
1 bis 12
8 y"" n+1
AC".llall.. ""th
Byte ..,.2
0"
1 bi$31
By:e n+2
tstcltua01e-
Hc ur
O bis 23
Byte n+3
2r..d ::I>ar;ocer
Minute
Ob is 59
Byte ...
..
Second
Obis 59
Byte n.m+1
mrn <;haracte r
"'
Obis 999
8;'('~
..
Byte n+3
I"e,~~
n+4
Byte 0+5
~yte n+6
j3YteI1+7
I Wee kday
'"
Maxlmurl l<>nglh
...
',m"
Maximum
leflgllT
Nam.
MOA". v.1.
WO
Re~h
Typo
Inilla l V.lu<
ARRAY[l .24 )
RIOAL
ARRAY]-I0,.101
TIlI.fE OF_DAY
ARRAY(1. 14.1. 4)
0.4. I~. II
0.6. 3.0)
Comrnoms
21 (TODII01UO:OO)
%(1...-0)
2 (...).1 (-b")
OW
"'"'.
ARRAY fl .V.AI
CHAR
equal 10 the final value on the righl. BOlh indiC<;~ are TNT numbers in the NI"lIc - 32.7i>R to
+32.767. A field can lIa'., up !O 6 dimensions
.,ach of " ,IIO!!e I imi1S are separated by D= 1 .
Th., datD Iype of the individual field componems i. located in the line under the da,a l}-peARRAY. All dDta Iype. c~CCpt ARRAY are per
mi . sible: it can also be a use r data Iype,
PNt_as,<lgnment
AI IIIe declanttion SUllie, yOll can pre_a"' gn
values 10 ;ndi\-id'-'3.1 field components (nol as 1
block pIIr.rnle-ter in rollClioD. as an i",ool
pantmeler in a fun<:tion bl""k or as _ lemporary
variable). The d ata Iype of the pre.assignment
value must match the dala Iype O!"lhc !ic!d.
You do not require to preassign ull field com
ponenls: if Ihe nlImher of preassianment VIII
ues is less than the number offield components,
onl), Ihe fi.,;1 componen1~ liN pn."-".sil!l1ed. The
number of preassignment vMlu<:s musl 1>01 he
~atcr than !he number of fie ld COmpoD~nlS.
The p,.., .... ssignment values are each Separaled
by a eomma. Multiple pre-assignme!l1 with Ihe
SlIme vlIlue, is specified wilhin round brockelS
w;lh a preceding rcp<: lilion faCtOf.
If lhe indi ~id'-'3.1 ficld compom:lIls ..,.., of elemenlary data types. you can process them ""~th
"norma\"' LAD or fBD functions.
A field componenl is IIcresscd will> lhe field
name ami an index in square bracke ls. The
ind ~l( is a tiJ<ed value in LAD!ll1d FBD and ~an
DOl be moditied al rumim~ (no variable index.
ins ponible).
or the variables
Application
3 SIMATlC $7 Pn>gnun
Ta bl .. J.1I hJ.ampl .. ofD""lariul! .
Name
MotC",u
""
Off
0.1.)'
maxSpu<I
T,~
1,,111. 1V.lut
'''U~
"'''''
'00'
SSTI\IJ:
,,~
END_ST RUCT
FALSE
TI<U,
S5TL\IE ~ Ss
"'00
STR UCT
Th~ d~ta ~
C,mmnl
Simple ,lnI<:tun: ,~able with 4 componmb
Vto:iAbk :-ll>ICont.Dn oftyl'< BOOL
Van.ble Mo,cont.Dff of typ: BOOL
Van.ble )o.lo.co ~'- Delay of type SSnM E
V"".bk :\lo!Cont_ m,,~SP<'e<l of type lNT
nlted by dOL
3. 5.6
Application
You can apply a comple,e variable at block
parameters ofd.ta type STRUCTwith the same
Sln lctull' or 8t a block parameter of data Iype
ANY. For example, you can copy the contents
ofa STR Ucr variable with the syst ~m function
SFC 20 RLKMOY. Yo" can a lso speetly an
indIVidual smlCture component at a block
parameter if the block parameter is of the nme
data Iype., Ihe componem.
If the individual stru= eomponeDts Ire of
elementary data type':!l. you can Pf'X~ lbem
witb -normal" LAO or- FBD functions.
A JtnJCtUre oomponmt IS accessed ,,~th the
nrw:tUfC name and the component name separaIl:<! by. dot .
Pa rameter T~l'"
A uscr data type (UDn corresponds to. S\nICnne (cOl::lb:rwion of COmpoo~'1l1ll of IIDY data
,ype) "ith global "wdity. You can U$C a USC1'
data type ifa data
occun fteuenlly in
your prop;un or you WIlDt \0 ISStgn I name to _
data stntcture.
OnTvi~w
of P.""n.,., Typo,
addrc ssed symbolically; you as,ign the absolute address in the symhol tab le, The data type
of'a UDT (in the symbol table) is identical w ith
the absolute address.
If you want to give a varia ble the data ,(rucrnrc
ddincd in the UDT assign the 001' to il at declaration like a ''normal'' data typc , Thc 001'
can be abso lu\ely addre,sed (UDT 0 to UDT
65,535) or symbolically addressed.
You can also define a UDT for an entire claw
type. When progrmnmins the dala block. you
",sign this UDT to the block as a dala ,tNeN,."
The example "Mes:lag~ l'rame Data" in Chapter 24, 3 "'Bricf Description of the "Message
Frame E:<ample'''' ,hows yon how 10 work wilh
user data types ,
Creating (lOTs
You can create a user data type usi"g th~
SIl\1AflC Manag~r or also the program edifor:
to>
L>
Bas~Functio",
Basic Functions
Thi, OIeClion of the book describe. !bose functions of the LAD and FBD proi"'TDIDinS lang uages which r~fl'sent a ~~rtlIin '"basic functionality", The,e funclion~ s ilo'" you to pro
gr.lln a PLC on the basis of contactor or relay
~ontrols.
''0
,,'"
,
,
M~mory ru nelions
LAD coil!;; FBD hollOt'; midline outpuu;
edge (\"iuauOl1; cOII~eyor bel! example
"IOH funellons
1'>IO VE box, system !'unctions for IDO\ ing
do.
Tim ~n
S1.artmg 5 different kinds of timer. resetnng and s.eannini I timer. IEC liIn.ers
Counton
Setlwg a coumer, up md down counlin&;
resetting and .scannmg a counter, lEe
cOunters; fud eXlllnpic
4.1
t>
t>
t>
to>
I>
I>
bils
,,0 <on'.ct
r~-
4.L.1
'-';C contao.
- I I If-Binary opeI';md
-I.1f--
'"
,I
"
"
~H-r~
Figure
~ .I
,I
SM''''
octivat.d
'0'
--
"
'"
' 0'
"
oc Wa'~d
"
'0'
" '
'"
' 0
4.1.2
Series Circuit'
Tn series circuits , two or more contact, are connected in series , Power n(J"s through a series
circuit when all C<lnlacts are closed.
Figure 4.2 shows a typical ,erie, circuit. In netwMk I, the seri es circuit bas ,hr.econtac,,; any
binary ()per~nd, can be scanned. All c(}mllcts
are N O conIac\>, If the aswc iatNi operand, all
have signal Slate "I " (that is. if the '\10 COntaCtS
are activated), p<)\\er flows through the rung to
the coil. The operand controlled by the coil is
-l .1.3
Parallel Cireui"
SerI....ntctlop
NlICWOl1< 1
tact1
""".~
II
"""~,
II
( }--I
C.",.,,,
Coo_",
I
I
Contaclt5
f1
C."
( }--I
Contact4
ContactS
COO,
~,
,....n.,.on._
No...,.'
C.-,
"""_
""")
Contact3
Colt3
N,twork ..
Contact4
J~t5
I I
CO"
( }--I
Contact4
ContaC1S
co.
I
I
I
I
I
I
Coo.",
Contact3
I
Cl
Coltl
Nelwork 2
tllC14
"""~,
CoO'
I
I
I
I
I
I
I
I
4. 1.4
Instead of (ontacts. you can also amonie parallel dftuits in series. figw-e 4.3 shows twO
examplle"5. In net\\OTk 7. power flows into the
coil if dther ComClctl or Con/CleO and eilher
Confaef] or Comact4 ..re closed. To ollow
power to flow in the lower e.umple (network
8), COlI/aefS. ContCIctO and either COlllact6 or
COli/aeO must be clostd.
t""'
I
."".on
I
~h.r leo
"""'"'"
~r- I
-~.
"""""'
""""'"
I
"""-
"""n.."Io
"""""'
I
CO.
( )-----1
"'")-----1
,
II""'
Con~r4 I
-_.
fl'" I ~: I Ii"
N_....k7
Co-_
4. 1.5
,"
CoO'
( )-----1
CcWIO
( )-----1
4.2
:>
I>
I>
I>
bil~
re"ult~)
E,ttY binary operand Can be addressed absoIUI~ly o. symbolically_ Wh~n <canning a binary
(n.~ a t<
N"twotil 9
Co~taC!1
Contact1
Co<tIi>ct2
r-nf--~II
Coil9
INOTrl---<(
)--I
Coil9
N"twori( 10
-<
Coill0
Contact4
FI~ u c"
Contact4
Contact3
Co~1 0
4.2.1
..
1.
,,!
I
I
Contact2
.I
thc scan.ned operand is negated prior to exec lltion of the logic operation (see below).
OR
fu~ct!on
~XOR
Exo!m;w_OR
fUDe';""
I"
Cb k for
';~D .. I.!a!.
"0"
----1~
----1L_
4 Binary
Logi~
()p<:ratiuns
,, -\1
" "
"'
11 .0
Function box
fI~~""
4.5
S c ~nniDg
,I
s.n."..
-~
~,..l
" '
11.0
"
.....,,, -\1
&.01.01
..clN.",d
" .,'
'"
'"-,-
!t.1
"
Function box
Function bo"
uo
,I
8.
I
I
{:Jc:}-----["~'E"":J
ir.put ---j
A.",' n fu nction
Netwllrl< 1
Inputl
Inputl
Input3
Outp<Jtl
l"l'ut3
Inp<J 14
InputS
==d , ~ OutPUt2
',I
"
,
Input4
Input5
Outpul2
InpUl l
I
I
I
I
OR fu"<tlon
I Network 3
Input l
~""
OI.ltpul3
InpuO
Inputl
Outp"O
Network 4
I nput4 ~
> I
l"put5
Input4
OU\j)IJt4
I
I
Input2
In;:>ut2 -
E ~du. i, . _O R
Outpotl
Network 2
-' 1 ..
Irwu t2
Input2 -
.....
,<
I
I
I
I
I
""""
,,
Outpul4
I\tncr1on
,
Netwllrk 5
Inp"tl
Inpull
Network 6
Input4
Inp ul5
I'i~ur.
,~
~o...lPUt5
Input t
Input4
I
I
,I
, 1 ','
Input5
Outpu\15
Input2
Outpu l5
mi
137
Eadu.lve OR fu nction
~.2 . 2
--I ~.
Combin~tlo nl
lnpout1
,""'"
Inpout3
'OR
OU:pu\8
,..,...,
.., I
Inpu!7
~,~
of Sinn)" Lo"k
O p~r"llon l
N. twork 7
Input!
~ """"
'""'"
r.l><1lo.
..,
N. I _ 8
Input4
Inpul6
I
I
I
I
rqIOl'1cd.
oft h ~
to
""'~W -,
4.2.3
I
I
0''''''''
Input5
"""",W
'-"
Input5
Input6
Input3
I
I
Input2
Input2
NOR
InpY I1
branch .
Figurt 4_ 8 shows a NAN D fun cti oll (an AND
function witb negated out put) and a NOR function (an OR function with neaated output) , The
RLO of a NAND func=tion is ''0'' only when all
inpulS have a signal state ofMI", A N OR fu nelion ~tums an RLO of"l " o nly wlKcD oonc o f
Ihe ;nput5 has a signal state of "I",
4.3
Ta kin g A cco un l of th e
S enso r Type
,
, , ;'
"''',,,''ed
,
,- t )
->
" "
0
So1/) Ufl;o",
~5j
-., , . lr
" .,." 0
,
."" "".,.
-7
.,.
0
Con"'ctor
"
~-jllu" 4.~ T~kjng
oontact~
arc
plcl<8 up
"
.,.
"
Conr. ctor
pict. up
"
a~aiJablc
The example in Fig ure 4 .10 shows sensor typede p"ndent programmint:. In the first C"SC, two
1"0 COma<:l, are e01lllect<XIIO the programmable controller, and in the <econd ea,e one 1'0
contact and one NC contact. In b<)1h en_Ie " a
C(lntaClOr eonne<:t~d to an outpnt i, to pi ck up if
hoth " '''wrs ar~ a<:ti" ated_ If an 1'-'0 contact is
aClivated. (he signa! St at e at Ihe inpnt is " I ", and
this is scanned directly so that the scan resu lt is
" 1'" "hen the sensor i< ac li "al~d . If bolb NO
contacl.'S an; acti\cated, and Al\'i) condition i.
fuJfill<XI and the colllaclOr picb up.
Ifan l'C contact is act iva(cd, !.he signal Slate a(
th~ input is '"0--. In order (0 obtain a , can rcsuJ(
,,[ "I" , the inpnt mUSI be negated Wh~fl
seanned. In the second case, you n~~d an AND
func!ion with on.... direct and 0"<: negated ;"I',n
in order for the e'-'nt:<~lO r to pi ck up w hen both
sensors are acrivaled
----
E-s~
,I
'"
"
"0"
~I
E-s~
7)
H
"'
I
1.~
"--J
&
Q
"
4 .~
...
" "'"
"
&
0 4.2
'"
"'
,- T
E-s~
"".~
"
->
'to
"0"
...
" '"
"
11.5
&
0".3
"
------...,-
A
&
0 .3
"
"'
" Coo
-~
'"
Memory Functions
5.1
LAD C olis
In & l&<!der diHllrwn (LAD), the memory functioIU are u~ ;n c"njunction with s"ries and
""mllel circuits in order to influenc", the siiJIpJ
sate.< of the biImry op.....mds .... ith the aid oflbe
n:sult of the logic o!"'rntion (R LO) lIen",rated in
the C PU.
1>
1>
1>
1>
The boxes P~S and l>."EG ... ..die nalua lions of opC'l'ilnds
cdg~
c,calwl\ions ofllle
~ di~_
5.1.2
m~mory
bus.
TI,,~
5.1.1
Slnll'eCotl
'"
through Ihem.
Binary QPerand
i')
Binary operand
(.)
If pow.... fio",s in til", sel COIL the operv.nd O'CT
the coil is set to signal '!lllt . I' If J'IOV.CT flo"'$
in the /"eSC"< coil the oJm"llnd o'er the Coil is
!\:..cl to signal state 0'. If thcre is 00 power in
the SCt or l ese, coil, tbe binary operand remains
unaffectc<! (l-igu,.., 5.1, Networks ~ I1lld 6).
5.1 LAOCo",s
SIll> J. coli
,..rwork ,
laCn
Ii I
I I~I
I
"'"
1 )--I
Contact1
Coil1
CoII2
Contact1
N_ork2
INOTI
1 )--I
Col 12
I
I
n
n
I
I
-,
I C
N_twork 3
~_:~tet2
Coo"'"
{",)--I CoO,
N_rwork"
l lil
~
H
Coo<od.
II
Ulet '
"""
~ "'.
1')--1
,teet2
I
N_lwork 1
""""'"
H """
I
I
CO"
"-11I.U~
Coil1
c.".",
.,..,..,
I
""'"
oj
I """""
CO.
c~li10
$)--1
Co'19
Coil11
CoillO
Coi l11
I
I
ConlaCl1
"'"
'J
I,
c.,,~,
(0)--1 CoO,
)--I
Coo"""
CoilS
CO"
CoO<
N_orkll
n
n
Coll3
I
--,
I
I
I
teri~tics).
'"
5 Memo,), Functions
)V"oup the set and reset coils affecting an oprrand together in puin;, and to u,c them only once
in each ca,e. You should aho a void additionally
controlling tM"Se opera"ds with a s ing le "oi l.
A, with the . ingle coil. you can also arrange
contact, after the bran~h and before a sel Jnd
reset coil.
5.1.3
;\-tcmor y Box
P1eas~ nole that the operand u8cd with a memo ry fuu"ti,m at startup (complete restsrt) i. usu a lly reset. In special cuse,. the signal 'tate ofa
m emory box is retain ed . Th is depen ds on the
'tatnlp mode (for example warn, re.tart). on Ihe
operand used (for example "alic local data),
nnd on Ihe s~t1 i ngs in th~ CP U (for instance
retentive char~Cleris tic.,,) .
S R memory fu n rtlon
The functions of the s~t and ,.."et eoil are 'urnmarized in the box of a memory fun ct ion. The
common binary opcI1lIld is localed m'e< the
box. Input S of the box corresponds here 10 the
sel coil, input It to thc rcsut "oil. The s ignal
state of the binary opC1"and as,igned 10 the
memory function is at o(jtput Q urthe memory
function.
There are two version, of the memory fiUlclion:
As Sit box (res~1 pnority) and ItS box (set priority). Apart from tbe labeling, the boxes "Iso
di m .... from each other in the arrnngGmc"T] t of the
Sand R inputs .
Binary oparand
R S ho ("
,"
,
"",
"
m~."...ory op~rand
'"
Ne twork a
Contactl
Conlactl
D
i
Contact2
Memory1
Ne twork 9
Cont"ct3
C<m~'
Memory2
fE'
Network
'""
'"
WI
I
0
=
I
.1
r:cn
I
, ,,',
,
Coil1 2
)--I
,
,
I
N etwork
"
Coll13
..
If Network
:'[j~"
C~:14
Conlact2
Coil14
( )--I
V1
CO il:15
..
..
"
."".
Network 13
[j"""
T"
12
Coil1 5
Contact4
- - ( )--I
"
. . ... _....
'"
5 Memory Functions
r ung
th ~
memory function
is Lls~ally implem emed by latching the output
to be controlled , 1bis method can also be u,ed
when programming in ladder logic. However. it
has the d is advantage. when compared wit;" Ihe
memory box, th~t the mC1llory function is not
immediately recogn izahle .
'"
5.2
FBO Boxes
in FBD . the m emory boxes are used in conj unction with binary lo~,;e opemtions in ord~,. to
intlue nce the 5ignal states of binary Op"Tands
with the aid of the result of the logic operation
(RlO) generated in the CPU.
Available memory functions arc
:>
~U . !
A SSign
-l
A"ilIn
..
Network I
Ou!p~ t l
I I
Inputl
Network :l
OlJlpUt:l
Input1
q I
Network 3
OutputS
Input2
L>H
Ne twork 4
Input3
9,L
Outputl
O ~tput5
O~\put:l
, "" n,
Input2
r=J
Output3
CJ
OutputS
NetworkS
I~
=
r:=J
,
[7]i
Inpu!2
"
Ocotpua
.,
Output7
OutputS
Oulput9
R
OutputlO
Oulput11
Inpu\3
I ,
I
I
Input4
Outputll
"""".
OUtputtO
Output1t
Fil:u~
CJ
Inpull
Output7
Inr()12
. "'"twork 7
Input! _
Input4
Output4
- I
CJ
Input3
OUlpUt7
....
Inpvtl
CJ
,
r:l'
Oulput6
Network 5
O~tp~t4
OulputS
Inpu\4
l"Putl
'"
S Memof)' Fun~Iio~
~ . 1.2
S ~I
is
~I".
S.2.J
M em or y 8 0x
RfrC ~led_
re~et
Please note thaI the operand used with a memory function i. normally reSCI on startup (cold
1"H".AI1 oc wann restart). 10 spce:ial cases, tbe
signal 51alO of .. mCTl>O')' oox is retained. Thi~
<lepcnds OIl the ~1lUtUp mode (fOT imU'lnce hot
restlll). on the <>pennd used (for example stalic
local da! a). and "n the serungs in the CPU (such
as n:'temive charaC1erislic.).
re>ll:t
...
"etwo'" 8
In put1
Inpull
---I'
.~O
OUtputl2
InpU!3
In ....!'"
OUlpUt13
Inp(lt4
"
"
,
,
"
~,
t tjlu re
~.4
Momory
Function. (FRO)
'"
5 Memory fu ncti<>n.
OUlput lable, and th e (ex temal) output on the
relevant o utput module r~main, unaffected.
The CPU does not trans fer the process,image
output table to the output modules until the ~nd
of the program cycle.
The memory fllnc tion w ith reset priority is the
"normal" fonn o f the memory function. as the
reset state (signal stale "0") is usually the safer
or less hazardous state .
RS rncm(lry functiou
ill the RS memory box. the set inpul has prior,
ity. Set priority m e aIlS tbm the memory function
is or remains sct if the RLO is '"1'" at Ihe sCt and
5.3
M .idl io c
Ou t puts
[>
[>
[>
~.3.1
Binary ope"",.d
(. )
You can scan the binary operand Over the mid line OUtpUI al an"thcr p<lint in the program wi th
NO aod NC contacts. Several m idl ine outputs
can ~ progrnnuned in <me nmg.
You can place a midline output in a branch that
stansatthe le ft power rail . However, il must nO!
~ located directly at the power Tail. A midline
output may also foHow a T-bmnch. hut may 00(
tcrrninat~ a rung; the _ingle c"i l is availabk for
thi. purpose.
Figure 5.5 shows an example of how an in ter_
mediate re,ult is slnred in a midline output. The
!{LO from thc cirellit fOlmed by Cumaer/,
Con/actJ. ConluCl4 and Comacl5 i. stored in
}l i dUD~ outp~b
5.3.2
i\lldlin~
O u tputs in F B D
(LAD)
Midl"OOI: :'__-.:~~I3ct6
>-M--jidll~1
Ml d tln ~
CoilH
~I-ict-'~I------i(
)--I
"
"
"
Inpv~ _
,.,
Input2
Inpul3
Input4
&
Midline!
Inpul5
"
3I
I'" I
Input?
OutputH
I I
,
Oulpol16
5 Memory Function,
---4
11
I--
5.4
5.4.1
Edge Evaluation
How Edge Ev.lua tlon Works
'"
P""ili"" od~e 1~
tb. I"'''"' flo..-
--4('Jf--
l\"egaUvo edge in
th o p<lWfl" no"
--4(NJf--
I'Mirin ..I~
..lon ,,!,onll
Edge memory M
N<l:"",eodG"
ora" "p<rand
- LM-'",_ --'
operand
NEG
0 -
LAD represents the edge evaluation of an operand using a box. Above the box i, the operand
whos~ signal state change i, 10 hoe evaluak><1.
The edge memory bit !hal Slore' the "old" signal stale from the prcceding program eydc is
loe8led at input M _BIT
With the unlabeled input and the ontput Q, the
edge evalnation i. "inserted" in the rung
instead of a contact. If pow<'J n<>ws inlo the
unlabeled inp ut. output Q emil.< a pulse at an
e dge; ifno power 110w, in this input , outp ut Q
i.< a lso always ,e ,et . Yon can arrange Ihi' edge
ev~!u"tion in place of any contacl. even in "
parallel bran~h that docs not beg in at the k fl
po"cr rai l.
t 'igurc 5.9 shows the usC of an edge evalnation
of an operand in Nelwork 17. The edge ev,,]ua-
5.4.3
'"
S Memory Funclion'
or,h* RLO
N"l!oll>'. <><Ix_
..r,loe IU,()
"'" """"""
----4
p
----4
I--
Binary op&falld
<>f." .,........d
E,;g....."""'Y bn
".,.,,-~
~ M ~~G 0 ~
5.5
ror B dele<:led edge. Operands suitllble as pulse
memory bil~ are memory bi.s, daa bits in glob al data blocks, and .emp orary and s.a.ie IOCkl
d ata bit~.
An edge evalualion is nol permilted after a Tbranch,
Ed"e e... lulltl(m or . he RLO
An edge evalua.ion of the RLO is indica.ed by
a box
con.ains a P (for posili~e, ri:ii"ll
edge) or an N (or negalive, falling edje).
Above lhe IxIx is the edge memory bit, a binlUY
operand conalning Ihe ""old"" RLO from the
p rt:vioul cy<:le. An edge e"lIlualion like this
de.ccrs a c hange of lhe RLO within a logic circuit from RLO "1"10 RLO "()" and Vice versa.
.ha.
".
-I,
I
Output
5.5.1
SOIUlion In LAD
S.S
Ilin~ry
S.caler
\"'''""'::::::=~,,:-:==:::~~=::-:'':====-:=~==::-~
I EdJl' ."OI"'110~.~'i
Edll~
(I,.
7
'. ",.two", t 8
ConlaCt"l
11--1 1
I--""'-Ii~"'---"
Con!acI4
. dluallon In
Edg9 meroory bi l
(p)
Con(act!i
powor now
Me
Con:.C12
1f--1'
SR
0
.-J
.'. ,I
01-- - -1
,.
..
'"
- -'
"-'-'
( }--I
I :~F--'-~-In'~: I
""twor1< 21
f-_'_"
11L~'~___-l"'"e-C__
' r-______________Momo
~( ~
,--_M--1e~ry_2
1-'-,!""'-'i=1
n~wr'
5.5.2
Th~
IlLSk , IWO
Thc firsl solulion useS memory functions (Fiau re S.ll. Networks 16 and 17). If tbc sign.1
Siale of the operand InpllI is "1", lbe opt!1lnd
0 1<11'''/ is SC I (th e operand MemOly is slill re~t).
If th e ~i gna l ~tatc "fthe openmd Inpll/ changes
10 "0''. Memory is also set (Ompu/ is now T1.
ff Inpul is "J" the ne,,' .ime around. OlilPlil i~
rescI ag.. in (M..mOry is now 'T'). If b'pul ii
once ",am ''0'', M"",,,,)' is reset (since OUtplll
i~ now also ~set). Now Ibe basic stale Iu.5 ~
reached again after Iwo input pu[,.e5 and one
OUlput pul~.
The S<."COnd solu.ion uses an edge C'o... lualion of
the operafld Inpu! (Figl.lrC 5, I J. l'eIWon:s 18 10
20 ). Ifno edge i. detected at l"pulO. the RLO IS
"0" fol lowing edge ~",'alualion and Ihc jllmp
'"
5.6
j.~
..
Input
Me mory
,,~
,-
~'M
'R
0-
,
,
,~,
-.
....
- .',.
".'~
Network 18
:"".'
-. .::
:'.'.-
'R
OUIPUI
. ',"
'. ~ ':.1
",.,.,
..
.~
-- Mo~"
, Network 17
S y ~\C'ITI
--
-"
OUlflutO
OUl putO
-<!
&
'.::
.~.
~
fieurc
~.Il
... ",.,
...
-.-.-;.'
-- ..... .
';' I
I - I
..
.-'
,.
.....
..'
~~t
.. I
.:":'"~
Bin ary
S c al~"T
Exomple. (FBD)
t h~m.
The example is programmed wilh input', outputS, and memory b it', and may be progranUlled in any b lock at an~ location. In th is
cas." a fundion ",i'hout function value wa.~
ch()sen as block
> When Ihe bell is empty. the controller req uests mOI~ pans by ;:;suing the "ready_
load'" .ignal (ready to load)
0>
I>
Atth~ ~nd
po
Basic_ ,1
Set' the controller to the basic <late
t>
Mati on
Swit~hes lh~
ti (ln~
t>
! Stop
SIOP< the conveyor as lon g as the "0" sign,,!
'"
5 Memory functions
"z~ro
Light~bartier1
fM"fauh l
Fault signal from the belt motor (e .g. motor
protection :;witc h); designed a, "zero ac
tive'" signsl so tbat, for e,,"mple . wire
break also produces a fault signal
e.~ample
is located in a
fun~tion
Tabt.S.1
"
I .. .
,,'
it
'"
which you
iti .
Networ1< 1
L<tdP'"~
N.twork 2 PBrts
(,
to re"""1o
, "
...i,
I :'......,'...,",'.
,
.', ...,
Q
EM- Rem- ?
Remo.e
"M
(,
'o-",move
~ _Lo~_N
'~,
rud~
.- "
.....
. .' ,.
. '".
~
Basic_51
,~,';
IMfalfl!1
RemovQ
N etwor~
I:
EM_Rem_~
,~~
Continu"
(,
a""ic.J '
,
,
'00'
,
,
EM_ Loa
Ie
wload
, "
,
Q
..
...
.. .,..."
.. ....
.... .. ...':'-'!..
..
,;.;.
,
lMfauH!
:.~r.:
."
:'01".
'""
,;"~
'':1:;
..
M,
,"
" ;:c':
._.0"
.. '. ".:.'..."..
,. II:
'"
f'C 11 Com',
'Or
oonlNI .,'".",
..,
'""
light_ barrie r 1
Baslc_",
IMfaull l
Network 2
load
Lig~t_barrier1
BaSic_ 51
IMfau!tl
--<
..,
~
~
l oad
Remove
BaSic_ 51
Re~dy ~
..,
IMfau~ l
Network "
Remove
Beslc_",
load
/Mfault 1
..,
..,
..,
,
,
""""ve
oe
Reedy to load
oe
Remove
Load
Man on
ISlop
IMfau~l
,w
B,, ~
moll
6 Move Fundions
Move Functions
MOVE box
Copy orerands and vari"blos with elemen.
tary data lyres
"
SI'C 20 BLKMOV
Copy dat~ arca
SFC 21 FILL
Fill data a...,a
t>
SFC 8 1 UllLKMOV
The SFes ar<- 'yst<:m fun<:tions from the "tandard library Standard Library in lhe System
Fun~liun
6.1
[>
System memory
?wcess-I"",ge mput
~r><I output t..t>tcs
:' ait memory
General
You use the move fun<:uon;; w copy information bct"'~cn the system memory. the USer
memory. and the user dmH are" of the moollies
(l'igure 6.1) . Information is trans ferred via a
CPU_internal n:gister that fu nclion, as int.<:nncdime storage. This register is called accumulator 1. Moving informat ion from memory to
accumulator 1 is referred to as 'loading and
moving from acc"m"lat.or I t.o memory is
<:aUed lransferring" The MOVE box contains
Bloch prob'l"anl .
Wor!<. memory
and
counter..
D~ta In
data blocks
,,-
Constants. pointer~
TUllO ....
Modules
Peripherat
inputs
1
MOVE
r' Process~ma~a.t""'llt
'I
.. -.
"System memory
Fl~urc
Data in
,;"t8 btocks
st;oct<
Wotk memory
Peripheral
outputs
ModutM
'"
6 Move f unctions
6.2
6.2.1
MOVE Box
FBD representahon
Representation
In addition to I~C enable input EN and the
enable outp ut ENO . the MOVE box has an
input IN and an Qutput OUT. At the input IN
and the output OUT. you can apply all digital
operand. and digital variahks of e icmentary
data type (except BOClL). T he variables at
input TN and output OUT can have different
dala types.
The bits in the data fonnats are discn ssed in
detail in Chapter 3.5 Variables, ConStants and
Data Types' .
MOVe
'"
"
,"0
mIT
MOVE
'"
"
0", ~
," 0
InpUl lN
, ,.)
01,
(n+l )
01,
,
I"
24 123
(n+2 )
01,
(n+3)
'"
01,
(n+1 l
,.>
'"
, ,.>'"
*,
16 115
,.)
~
0[7
01Doubleword n
01
01By... n
01
,.)
~
'"
(n+l )
Word n
Bu"',
Accumulator 1
01B yte 0
01
'"
f--
z~roes.
.=
IF EN
"I" or not wired
THEN
ENO:'" 1
IF MeR e nabled
ELSE
THEN
OUT ;- 0
OUT ,-IN
ELSE
ENO := ' 0
Enmplt
The cor"en!! o f input "ord l W 0 arc mm'wto
ml:TllOl)'
word MW 60.
If~ou w~m In process the MOVE box in dcpt.'Ddence on specific conditi ons, you can program
binary logic ci",uits before Ihe F.N inpul. You
caD conutc1the ENO output wllh bi nary inputs
of olh..". u""tio"-,,; fm instance. you can arrnng~
MOVT' boxes in series, ",hcf'cby the "NO ou1put oflbe preceding bo" lew 10 Ihe EN input
of tlw; followin g boA.
'M"OO,V
7.,'1
,w 0-l'e''--'OU''"'. r- MW '"
c,V;"'"
r
FBD re-pr4I5OOtation
MOVE
EN
OUT -
MW60
6.2.2
and in paral -
M o \ing Opt"noodl
MOVl;
bn ~
In .. run," (LAD)
~ne,
IDo
IWu
IDo
'"
Muv i n~
QB"
QW"
QD"
outpun
Movinll: lin ,)UIPUI b}1 '
Moving "" OUlp~t ,,"ord
Movi ng au output doublewoHI
The peripheral o u~p"IS (PO:;) M!"C u,ed for transrers to the 110, Only those add,,,>,,,, cnn be
ac~~"""d Ihal are also OCCUPIed by IJO mooules.
Transferring to IJO moo.luJ". \hat have a procen_image OUTpuT table sImultaneously updates
tbat proce<s-image output table, so there i. no
diffuenee beTween idmlicaUy addns,ed ouT_
pu!:> and peripbe!'\ll outpUts.
1\10,lnll hit memnry
MD.
MWn
Mno
LH II
I'lD n
PIWn
Pro "
O'Q. "
PQWn
PQl) "
wading a
~ripheal
input byte
Loading a pc,;phcl'lI.l inpul word
Loading II periphen>! input
double"ord
"",
doublev.ord
Wb ..." moving in the 1'0 area you cau ao;ces~'
diifere", cqx:rand.s depending On the dinxliou
oflbe move. You 'p<.>Ct/)' LO inputs (Ph) al the
IN inPUI of the MOV!:: bo~, "",I 1 0 output~
(PQs) at The OCT output.
When moving from the I 0 to memol''' (loading). the inpul modules ate acee ..ed as p<.T1phl-ra l inputs (Ph) , Only Ihe &\"ailahle modules
may be addreued_ Plc,,!~ DOl. tlml diTC<:1 landing from the IJO modules Can mOye a diJfcrcn!
~lIlue than loading from Ih" input>; oelhe module "'ith the samc Iddrt.ss. While the .ilP'a!
StUC5 of th~ inpuTS COlTCspunds I<> th" ,alucs II
the sWl of the I'fOStanl cycle (wben the CPU
updaTed the pTOee$._ image). the value. loaded
din.."tl)" from the VO module. ITO the current
,'aluc>.
".
LWn
LD.
6.2.3
Iyp~
-1000
MO"m~
' .0
~Io'ing
SST- 2s
MO'-mil: an 55 Illner
Mo~mg a Time of day
TOO"g ,30
an I"'T ntJl'llber
a REAL DUmbcr
J\.I(lving pointu.
Pointers are a special fOlro of con<tan! used for
calculating addr<:SSCS in .tandard blocks . You
can uSC the MO VE box to ,Wr<: these pointers
in operands.
P III.O
P;'tM2. I
6 .3
Data Transfer
The lollowing system functions arc available
for data transfer
t>
SFC 20 BLKMOV
Copy data area
t>
SFC 21 FILL
F ill data area
t>
SFC 81 UBLKMOV
UnintcITUptible copying of a data area
6.3_1
t>
t>
A,'1Y I'ointer
P#MI6 .0 BYTE 8
Area of 8 byres beginning with MB 16
P#DJll !.rHIX30.0 INT 12
Area of 12 ..... ord, in DB 11 beginning
with DBB 30
SFC .
'"
"
"'
.. ._. . . .
'
Paramc',r
SRCBLK
}1FT VAL
Iliaralion
Data TlP<'
to~t""ts, I~ripti"n
INPUT
RETUR1';
ANY
~ource
~,
I)STIlU<
OUTPUT
,,~
BVAL
~m
ANY
Error inlorrnati on
Dc" ination to which data are to be copied
Source area to be C'upi<Xl
RET VAL
RETURi\'
I.'lT
liCK
OUTPUT
AN!'"
SRCIlI.K
INPU T
RETURl"
OU1T'UT
ANY
~,
VAC
DSTlJLK
on
ANY
Error informatiun
D,"ination to w~ ie~ t~. wurcc "rca is to be
copie<! (mcl"w"{I: multipk: oopie,)
S""rce orea trum whicb do'o an' to be copie<!
Error infomlati on
Do"ination to which daUl are to he copiod
'"
Mov~
Function.
Pil1l8.0 WORD I
Input "'oro IW 18
1'#11.0 BOOL 1
Inpul I
(.0
U ninterruptlbl e Copylni of
Data A rea
6.3.3
6J.2
Copy Da ta
A ~a
Any variables from the openmd areu for inpUIS (I). oulpulS (Q), bil memory (~t), IJ1d
da\.a blocks (variables from global da\.a
blocks and from instance dau blocks)
I>
I>
'"
>
Absolute_addres~d dati. areas ...... hieh reqUIre specification o fan ANY pointer
areas.
6.3 A
System fullction SFC 21 FILL copies a specified, alue (source area) to B memo\)' area (dC'Slin,li on a~a) as often as required 10 fully overwrite the de>lination area . The transfer j, made
in Ihe direction of a>cendlOg addresses (inerc-
d~' a
I ...."'r.. (LAD)
"'O
1--------1'"
PIIM 84 .0 BYTE 16 -
S FC 20
SRCSL K
R ET_VAL
f- FW 82
f---------1'"
P#M 80.0 BYTE 1 -
N. work 4.
Exa mple
rr~",r<r
f- FW 84
Bl K f- P#OB I 24.DSXI6.0 BYTE 16
eYAL
RET_VAL
(FBD)
lorSFC 20 B=',',.,o,',O,,-,;;-__,
r
"Input2" -
SFC 20
EN
SRCBL K
RE T_VAL
D STB LK
f--
""".'
FW82
E NO
-r=CC-o'o'CCo,"'-----,
"'nput3' P#M 80.0 BYTE I -
Figu re 6.3
Exompl~.
EN
BYAL
RET_VAL
BLK
f- FW84
I- Pll'DBI2"DBX18.0 BYTE 16
paramet~rs
"" Any variables from the operand areaS for inputs (I). outputs (Ql, bit memory (M), anI!
dala b locks (variables from global dato
b locks and from instance data blocks)
"" Ab.oluteaddressed data areas, requmng
,pecifi~ation of an A:'iY pointer
"" Variab les from the temporary local data of
data type Al\Y (special circum.'tances ap_
ply)
'"
16.
WorI< m .m
---- -~
-I
--'. -1 :-...::::
~
.
08 11
~-
DB 11
~~I
DB 12
\oj>
''01
"'''
""'01
'" "
",,.,,
).
0813
-,
--'
"'k
DB~
. ,
------DB 14
;-~I
'"
7 Timers
Timers
7.1
Programming a Timl'r
(>
On-delay timers
7.1.1
(>
(>
OfT_delay timers
Tlmorbn'
( i n 'h~ .x,mpl.' pulse timor)
feD
rcpwsentation;
r""", 0 1"'....00
,
='"e
S~P ULSE
Kame
,w
'-
Sta n inpu'
S5TLME
"
"BCO
" ,=,
R
" r=
Bm
a
B~'
Ro.<t input
WORD
WORD
Gcn~ral
Tim~r
:>
"
!l.c,,:t a tim<-r
""
Ch~c k
The box ior a ' imer contains the coherent repre,enta,ion of all timer vperalions in the fo rm of
funct ion inputs and func'ion vUlput, (Figure
7.1), Above the box i, the absolme 0.- ,ymbolic
a ddre of 'he timer. In the bo". as a header, is
the timer mode (S PULSE mean, "S tart pulse
limer") . Assignments f or th" S and TW inp uts
are mmullltory, ",bi le ~ssigt\mtnts [Or th e other
inputS and outputs 21X' vptional
Indhidusl program elcmenh in LAD
You can also program a timer using individual
program ckf1)~ nts (Figure 7.2). The t;mer is
,hen stmt ed via a coil. The timer mode is in the
coi l (SP - start pulse 'imer). and below the evil
i~ 'he ,,,Iuc, in SHIl'.'fE fmmm. defining the
duration. To reSe, a timer. usc \hc reset coil, and
us. an NO or NC eont " cl to check the Slams of
the t;mn. Fina lly. you ean ,,,ore the current lime
va lue . in bins,), in a word opcr~nd using tbe
"JOVE bo" ,
7.1
~inllaTi.mcr
...
"""", ,,,
----{SPri
""""""
R.... rim.,
(I ..... roil)
TImer Dl*and
--{R}---l
TImer operarld
TIme< operllrld
II
("0000'..". NC """,""")
Road lime at binory ....1""
(MOVE 1>0>:)
~l ,ure
MOVE
--'"
- 'N
'N
'NO
OUT
Digital
opet1Ind
7.1.2
TImer op&ralld
Duration
--i
--'"
TImer opII"'nd
~"P"Iand
,","-r operand
R
Reid tIn><r
(reset coil)
F I~nr.
~ TV "
=:d
Me"
0"' t- DigtIaI opet8nd
ON
'N
' NO
Ti",~""
Ib~
Rl. O
mOO,
7,1.3
ofTIID~
DU!"lItion of lOs
Dunmon of 1 miD .... 10 ms
""c-
""
"
"S],,-xr
~
\0 r.tart the-
"",or os
Pvil< ,;"""
i!l<tcndcd pul ..
"
Ot,deloy tun<r
"
R.... nti'e
OlI-dd.y \"'10'
M
S_OFFO'J
on:.!<l'
S_ODT
172
)'OIl
Timc
~~
Timcb>o~e
100m.
TIme base 10 It1$
on~
;" this
When Slan ing II timer, the CPU ,dop!!; the pro!!rammcd (ime valuc , The opernlin;:: .ystem
upd1IU Ihe timers at fi"ed irltcrvab and indepcndendy of the uscr program, thai is. il de..:remenb lhe I1me va!ue of "II active lllJ'IeB as per
the lime b",e v,'hcn 3 timer rcachc. zero. it has
run d""",. Th~ CPU then ",",s th~ timer St~lL!S
(oi1O"1I1 state "0" or"' 1~. dependiDi on the mode.
&art .!gnal
F 1:=3
PULSE
S_OOTS
I"".,
b 1----=1
I=-- '
F- r
0.0\ s
'-0.1.
2. 1
3. 10.
Flit"'.
!JUI in
oh~
DlII'Ol;OO
or "typc", of timer) and drops nn funher activilies "nhlthe limer i~ !'CStancd. If)'Qu specify:l
dunuion of zero (0 ms or W.l6aOOOO) when
Slllrting" lim ...., the limer rt'mams .ctiv~ unlil
lhc CPU has processed Ike Urn.,.,. and discov_
ered Ihat the time has elapsed.
Timers are updated Bsynchronously 10 the progrom ""an. As a rosull. it it possible thai lhe
time sta rns at the beginning of a cycle is different tllan al the end of the cycle. If you usc Ihe
timers a1 only One point in lhe program and in
the suggested order (5 ~low). \he as)'nelLIe>nous updating will prevent the O<,:~ulTCl1ce of
malfunctions.
7.1 .4
7. 1.5
C h..:king a Tlmtr
~lRtUI
( FI:I[
~'alue
is "'8ilable in binary-coded
7 TIm .....
7.1.7
You can cOnnect conta~ts in series and in parallel before the Start input and the reset input as
well as after OUtput Q.
The timer box itself may be located after a Tbranch and in a braoch that is dire<otly connected to the left pow~r rail. This branch can
also have contacts before th~ start input aod it
need not b~ the uppermost branch .
You can find further examples of the rcpr~.en
tation and a!Tangement of timers in the Ba,ic
Functions" program (FB 107) o f the LAD_
Book" library that you can download from the
publisher's W~bs;te (see page 8).
1>
1>
1>
Omit unnecessary clements when programming . If you observe Ihe order shown abc,,'e
Illld the timer is started and reset simultaneously", the timer will start but will be imme-
'"
7.1.8
7,2 Pu)""Tuner
7.2
Pulse Timer
SIArling a
puls~
timor
<D
Sigu.al.nate ~I~ al the reset input ohn ac\h'c timer resets that timer. Oulput Q is
then "0". The rime v.lue and the time
base arC alw set 10 zero. If the ,igna] stalc
81 Ihe ""el input g~s from '" ]" to ~O"
while the signal stille al !he sel input is
sllli "I ". the limer remains unaffected.
Signal Slale "I" at Ihe reset inPUI of an in.eli\'e timer has no cffect.
(J)
<D
,1
SIgnal state at
<l>
~ '-,
,I ,
I~d<n!>:>n
I
n
I
I
f lau .. '.6 &h:tvion.l Cb.ratlmllic. ",hell Slanillj and ROK1Iln8 _ Put.., Tun ...
7 Timen
7.3
Sf.rlhl&.n
l imn
The diagram in Figure 7.7 ~nbes the belLa,'ioml charnc"tC";~licl "f Ihe IUn<:T .ncr il i.
>Iartcd nnd wh en il i. re<;et. The do<;cripliun
applies if you obs<';C'o'e Ihe urder ~hown in CharI"'" 7 ,1.6 ""Sequence ofllmer ~rions" when
pr~nuning " 'ith individual clements (tllIn_
ing befon: rescuing befon; checking).
Reutt!.n .: Mn
a.
SigrwIltate
1tI.. Start Input
""" """'""
(iI"\temsl)
T imer status
(check 10< "1 -)
" -1 - -
-"
,0
I
I
I I
1 PtogrIJIr)ItMd dunIJon
no
DO
/
I
"
r- r---.
lim_
. ,
; nactiv~
er hll.~ no e ffe<:l.
p ub e l imn
0& When
u l~Dd \'d
I
I
.;-'i
0 I, 0 I,
,
IP P I
,
/
I p
, I
10
I
I
I
I~
/
,
I
7.4
On-Delay Timer
r~ m" m mg ,
St.rting a n on-delay
tim~r
The diagram in Figure 7 ,g de>cri~s the beh",'i"ral characterist ic, of th~ timer aft~r it is
slarted and Wh~D i\ i~ m;~t, Th~ d~'~Iip\ioD
applie. if Y"u oh<eF>'e the "mer sh own m Chapter 7.1.<5 "Sequence of Timer Operation," wh=
programming with indiv idual elements (starting ~fore rc;eUing be rore "h."king),
CD
(2)
Rescttinl;:: aD
OD -dcJu~'
timer
Sig na l state at
the Start in~t
Sil/nal state at
{he Reset input
-, : ..
...
TImer running
( i n l~r nal )
-. , :J'.,
Timer status
(d1eck fer ' j ' )
7 Time"
7.5
Of)
Wh~n
0
Signal stale al
Ih" Start inpul
i 'l
I
I
"
rl--j
H
o I
I
I,
,
,
ID
I
I
I
0
00 Signa l ,tat~
n
D
iI
I
In" "II
p'l
I 0
I
I
I
I
I I
0
D 0,
,
I I
Figure 7. 9 Bohavioral Characteri<tks "hen Startiog and R ~. ottinl1 an R<tenrin On-I).lay Ti mer
7.6
Off-Delay Timer
G:xl.J The
(D
Signal state at
the Start inpUt
r'I
Sig na l state al
the Resel input
Time r ru nni"l)
(intoma lj
Time r status
(check 10<
-" j
I
I
,.
h r
I I
In
I
I I
r'l
nl
P~m_d
I D I
n
I
dUr&tlOn
Figu ", 7.10 Behavioral Charaoteri" ie. when Slattin g and Reninl!" .n Off Delay T,mer
7 Timers
7.7
lEe Timers
r- SFB J TP
Pulse timer
~
SFR 4 TON
On_deby timer
SFB 5 TOT'
OfT-delay timer
7. 7.2
~.~",;~ D ooclaratioo
Ue"" ripliG1l
~''',~'.
PT
RP
ET
INPUT
INPUT
TL"ID
OUTPL'T
OUTPl'T
TlME
~harac t~Tis
TN
7.7. 1
Outp ut .10'1 supplies the durati on o f time fur outp ut Q. "fhi, duration begins at TOOs and en d, at
th~ set durati on PT, When PT has dap~cd, ET
remain' , et to the elapsed tim e until input IN
goes back to " .T. If input TN goes to "0" before
PT elapses, output ET goes to T#O. the instant
PT d ap'cs .
S,~rt
input
Pulse knl(th or
delay durat100
Timer >taWS
Elop=:i timo
th ~
paramNe!'s
TItD"
7.7.3
Th~
.__ t ___
Signa l slat.. at
the Stan inp ut IN
Tim.., status a
ol SFB3TP
Tim er statu. a
of SFB 4 TON
, hr
,
I
tl
,
,
f:
rI
Tim er statu. Q
of SFB 5 TOF
'-
- ,-
,-
t Prrx;ramm<>d duration
Fi ~ur<
,. , I
;m medi a t~ly
'"
8 Counters
Counters
CBU Tl '<C
S_CUD
=,
=,
I>
'>
Count up
FBD representation
ev
,
=
"Kar.lC
OU
'OOC
BOOC
'OOC
OD
,y
WORD
Booc
I>
Reset cOlUlter
I>
RP
I>
I>
of a counler as box
A coumerbox contains the coherent representa tion of all counting operations in the form of
function inputs and function outputs (Figure
8 .1 ). Over the box is the absolute Or symbolic
address or lhe coul\ter. In the box, as header. is
the counter type (S_CUD stands for "up_down
counter"). An assignment is mandatory for the
first input (CU in the example) is mandatory:
'"
WORD
BOOc
WORD
=
-
Counter 0 . "
SCUD
00
ey
ey 'CD
Repres~nlat[on
Oy
CV_BCD
'"
,
=
CO
00
,y
Programming II Counter
LAD ",presentation
8.1
box
Cy
CV_ BCD
Q
=
-
Up COlmt input
R<p.resentallOn
8.1
Prugr~mming aCmlll!er
CoUnteroperami
(wunt ur ooil)
---{W)--l
Counta< o...,...,.,,:L
Coo,,"'r ope"',,!,!
R<t Cco.Ultcr
(rcM:t coil)
Courrter operand
(1)<4
---{co)--l
---{~)--I
Count VlI1u.
---{R)--j
t""""" ".ru,
COLmta, """",00
Counter ope"",d
II
MOVE
( MOVE box)
CountS< op""md
Figur~
'"
"
'"0
0"'
Digital operand'
You ean also program a counter using indi vidual elemem, (figure 8.2).
Setting and counting mc then done via coik
The set eo un tc-r ooi I contains the counting operation (S C - Set Counter); below th~ coil. in
WORD formal. is the <.:ount va lue to be u,.d to
sd th~ emmler.
In the coil. for count ing. CU stands for count
up and CD stand s for count down . U<e the rCSI't
coil to reset a counter a nd an NO o rNC ooman
to ch~ck the status of" counter.
Finally. you Can tTan.f,T tlte current count, in
binary. with the MOVE box
Counter bus i.o. M run~ (LAD)
You can arrange contact> in ,.,ries and in parallel ~fore the counter inplll', the stan input and
th e reset input as well as a[kr OL/tp ut Q.
The counter box maybe 1,laced af\~r a T_branrh
ur in a branch that is directly conn~cted to the
I~f\ J>Ower rail. This branch may also havc con-
You can also program a counter u sing individual elements (Figure ~.J).
Setting and ~"unti.o.g are then done Vi3 simple
lxl_<~S. The set COu"t~T box contains the countin s operation (SC = Set Counter); at inpLlt PV i.
tlte count valu~, in WORD format, is the count
valuc to be w;ed to gct tlt c countcr.
In the boxes for countins . CU stand. fur coun t
up and CO stands for count down. Use the reset
bo.~ 10 ,""sct 3 counler and a direct or negatcd
bin ary function input to check tbe status of a
counter.
'"'
S Counle"
,
Counter ope<a nd
--1 CO ,
Counter opo;a n<!
Count up r"",tion
(cuun' up coil)
--1
C"
Coomer op9ran<i
c oum value
Re",' counter
("""" coil)
~ PV SC
Coullt..,,- operand
--1
COtlfl!", operam:!
MOVE
0 ",
'"
'"
==:d
r-
f-
Oigital operand
'"0
Connt{"r box in
I>
S~\
[>
Re>er conntcr
!>
Check count
I>
cOunter
If counting and ,etting takc place "si mu ltaneou,ly" when the operati ons are pmgranun ed
Sequence of co unt in g
'"
op ~ra tlon s
R e~ettin g
8.2
Settin g countH.
A counter is sct when the RLO changcs from
to '"1" bcfore set input S or before the .et
coi l or set box, A positive edgc is a lways
required to sci a counter,
""{l"
8.3
Coun ting
The counting freque ncy of a eount~.,. ;s determined by the execution time of your progmm!
To be able 10 count . the CPU must detect a
change in the State oflhe input puhe, that is, an
input pulse (or a space) must be present for at
least one program cycle. Thus, the loug~'" the
program execution time. the lower the counti ng
frequency.
U p c ou nti ng
C#l00
W#16#0 100
Resetti ng counte rs (L A D )
In down counting. each pos itive edge decrements the cOunt by one unit until it reaches the
lower range limit of O. Each subsequent posit;ve edge for down counting then has no further
effect. There are no negative counts,
'"'
8 Counters
pr\>"idc~
Up/down counter
Up counler
ll<:>WD countcr
These coumer be:>:e. difTeT only in Ihc Iype and
numlx,. OfCOIlnler inputs. Whereas S_CUD ha~
inputs fOT both eounl;ng directiOtU, S eu has
on'y the up COllnt mput and S_CD only the
down count input.
You mIL'! .. I w~y~ connect the 1i!'11 U:P\lI of ..
COllnter be:>:. If you do nol collllOC, the second
;lIPLlt (S CD) o n S cun, Ihi , 00:>: wi ll lah on
the same chBracleri~lics as S_CU.
"""m
8.4
Checking a Counter
Chccklnj;\ the
count~r
,talUs ( I.AD)
~IMtU1
8,5
I EC COUill t rs
SFROCTU
UpcounlCT
:>
SFB I CTD
Do"'n Cnunter
(FUrl)
program.
Ch ..ddnll'h~ fUUDI valu r (L,\J) aDd FRD)
8.5.1
8.!;'2
SFfI I
crn
11.5,3
,;
"
g Counters
8.6
8.6
rCSlan$ il. Th~ nexl positive edge to res.an th~
timer i~ generated when the light balTier signals
a !legnt iv~ edge . The timer is Ihen staned with
the time va lue DI/ralion] ("Dura2'). I f the hght
banier is now eo'ere<! for a period of .ime
eJCedi na Durul or free for a period of rime
e xceeding Dura]. thc limer TUns down and signal F,wff. The lim time II j, activaled. 'he
limer il ~tarted wilh .he lime value D"ral.
S llI n. ", sym bols
We wanl symbolic addressing. Ihat is. the operands are assigned namc~ which arc then used
for progranuning. Betore ent~.,.;"g Ihe program,
we create It symbol table (Tpb le 8.2) containin ll
the inputs, outputs, mentory bi,s, timers,
COUnters. and bloch.
!' roarl m
The prolP1'm is located in a function lhal you
caU to the CPU in 0'1l3niza.ion bl""k OB I
(tclec ted fro m the Progmm Illcmento enalog
underFe Blocks").
During programminll, the a lobal ~ymbols can
KI..o be u,ed with<>ut quotation ma"" provided
Ibey do not contain any special ChaJ1lClcrs . If a
symbol contains a special c haracler (an Umiaul
(lr a ~pace. for instance), il mu.~1 be placed in
qU(lIHli<>n marks. In Ihe C(lmpiled block, the
Edilor sho~ a ll g lobal symoo ls wilh quotalion
mllrks
Fillurc ~ . 4 lind Figure 8.S show~ the program
for the pans counter (Function Fe 12). You can
find this program in the Conveyor Example
pr<!ltf"8.m of .he "LAD_8ook and "FBD_
Book libraries , hat you can download from li>c
publishcr"s Wcbsile (sec page 8).
'"
x Counters
fR'
"'""'
S_ CD
lbarr1
Finished
CO
Quanllty -
""'"-'
N4twork2
'" "
EM_ l B_ N
"
( )---j
NOTI
~,
c' tCV_BC D
I-
,
~
""
~
MOVE
lbarrl
Du," 1
lba,,1
Dura 2
N_o,k4
'"'" '"0
'"
'"
00;
)---j
III Durali<ln
MOVE
'"0
00;
~
~
'M"
#t BOOl
""
III
D u,~ tlon
I"
c'
#I Duration
IR
Fi\:ur. 8.4
Pro~nmi""
Fe 12
e" un '~r
t on",,1
Count
Lbarrt 5..,t -
CD
cv-
QuantltY:-=t';V~...:O:V
::,'o'-9J-=_-<i':'":"M='j
Ackr>owl
R
Q
_
Network 2 Activate monitoring
Dural
Lbarrl -<j"
Dura2
Network 4
,.
-b_-''''J------~L_J-'[~~J
Monitoring circuit
Active
Figure 8.5 Prognunrning Example for a Pons Counter (FBD)
'"
Dilila] fUDctio""
Digital Functions
REAL.
Vou l.ISC lhe a rilhmNk fu nctions 10 make cal.
culations in your program. All the basic arith.
melic functions in data types INT. DINT and
REAL aU" avail ab le.
09
10
A rithmelic F unCII(lns
Basic arilhmetic functions with data types
INT. DINT and REAL
II
12
IJ
Shift Fu nc tio ns
Shifting 10 left and right, by word and
doubkword, shifting with correct sign:
roulling 10 left and right
14
Word L ogic
A}.'D. OR. exdU$i\'e OR; word and d oub1eword combinations
192
9 Comparison Fuoction.
Comparison Functions
9.1
Co,nl'Arl'OD .... ,
(," eumpl<; """,pariSO" for equo!
to C-T)
LAO 'OpAls"ntation:
CMPnl
='"''"'
CMP_al
- 'N'
'N'
compan~n
~tunds
FRD
R~presentAtiuD
LAD
,.
"
'"
\l
Comparison Functions
Uata types
~ amples
Comp~r ls on
Aording
In
1"'7
'"
Comparison
a ccor din!/; to I) I<,-'T
-Globa l_DS-.
CampYa l'
-Global_DS-.
Campllal2
MW 9 2
92 is equals to 120:
C MP --1
M99 .0
R)
'N'
'N'
~V
MW92 -
'"
....
..
'"
'N' ..
M 99.0
..
fhe van"bl~ .. CompRc<ult in dam block G lobal_DB ,s
Sct ,I vanablc
'"CmnpVal l";,; less than CompValr ot h~rwi"e it is reset,
"Global OS".
CompResull
C MP ~ D
CMP< D
"Global DS- ,
)f--I
Compv;ol1
"Glab'!!_ DS-GiobaLDS",
CompR" su lt
IN1
.. ..
'N'
IN2
If the V<ll1abl~ HActYal" greater than or equa l to the vanabk IIC"libm. #-Recah
C omparison
a ccording to Rt: A l.. i. ,et ' otherwise it is not
CM P
IIActY"l _
jj Calibra
~R
'N'
'N '
'"
CMP > R
#Recall
,)
IIActYal-
#Calib.-a
'"'
'N'
HRecali
Fun~tion,
9,2
,. IJ.
195
9 Comparison Functions
If. in the case of a REAL comparison. one Or
both input variables are invalid. the comparison
is not successful. In addition . ' tatus bits OV and
OS are set.
10 Arithmetic Functions
10 Arithmetic F unctions
tion
Represe n tatio n
A r i l h m ~t1< b o ~
AO D_t
," 0
OU'
'"
'"'
'"'
F8 0 representation:
ff-
'N,
'N'
OU,
'NO
~rs).
ADD_I
"
-=
I'u n cd on
f-
ATithmctic function
Subtraction
M ultiplication
>NT
ADD'
SUB I
MUC ,
DlVI
Addition
OINT
ADO_PI
SUO 01
MUl DI
REA'
ADD_R
SUB R
M UL_R
DIV R
'"
10 Arithmclic Functi{)ll5
tion
ELSE
THEN
OUT :. IN1
:: '0"
Enmples
Figure 10.1 shows an example for each data
Iype , An arithmelic function exCculcS a calculation in accordance with the characterisl;c spec
ified. even ifn{) data types have been declared
when using {)perand, with absolute addresses.
I>
The value in memory woro Ivl\\' 100 is divide<! by 250, rhe integer result is stored
in memory word M\\' 102.
Addition
accnrdiog In 1r..'T
DIV_ I
MW 100,~
..
'"
'"
'"
Add.tIOn
according to D1XT
'" 0
M
r-- MW 102
DIV_ I
-,"
MW1~
j IN2
:~1
250
'N
- >N,
"Gklba l OS".
AI1thV"j2
..
..
..
'"0
M
f-
"Glooal OS".
AI1IhReSult
"GIobaL DS" ,
AI1\hVall
ADD_ DI
'">N,
r-
0"'
"Global OS",
A,riIhResu ll
"Global_OS" ,
'"
Add"'on
accordinK 10 RI::AL
'"
'"
'"'
'"'
At1IhV~1 2
'"0
MUL_ R
liActVa l liFactor
MW 102
The -.alues m vanables .. AnthVall and .. Anth\'al1 arc added and the r~sult
stored in variable ,. ArithResult"". All ,'ariable, are stored in the data block.
ADD_DI
"Global_OS".
MthVall
r--
0",
'"0
'"0
OC , -
#Oispay
IS
transferred to
MUL_R
liActVal #Factor
'"'"
'"
OC, -
'"0
#Oispay
E~ O
You can find further examples oflhe represenI.IIlIon and arrangement of ~nthmelic fullCtionS
in Ihe program "'Digital Funclions" (FB I to) in
the library "H:JD_llook" Ihat you ""n download from the publisher's Website (see page 8).
INT subtrwCllon
'"
10 Arithmetic Fundio"s
T~'p",
DINT
011\, addition
'luo1i~nt
u result
dl'" !~!on
DINT multiplication
Ib~
""
~dd illon
REAL
ceo.
REAL dl\l.oloo
The function DIV_R int~rprc1.S the va illc, al
inplltS IN] and 1N2 as numbeT:! of dala type
REAL. It divides the number at input I~ I (dividend) by the number m input lN2 (dhisor) and
.tores the quotient;n OUlput OUT.
After execution of the c~lculatioD, status h i,",
ceo and ee l indicate Whe~T the quotien l i.o
nellati~'e, zero, o r posItive. Status bits ceo and
ee I tndtclue any ran ge violations.
In t he case of an illegal calculation (one of the
input values is an im'alid REAL number or you
attcmpt to divide ~ hy 00 or 0 by 0), DlV_R
rctUnlS an invalid value at output OUT and ,ets
SlatUS bits ceo, ec l. OV and OS 10 "I".
'"
11 Mathematical Functions
c>
E~ponential
function 10 base e.
naNrallogarithm
Function
The mathem:nical funcli,JO is cXCl.'uled if "I" is
pTC!<Cnt &llhe enable input or if"po",-e.' nOW!
In input E'1. Tf an error occurs in the calcula
tion, the enable input IS sellO "0"; othe ....;sc it
is SCI to "1". If CX~cullon of !he function is not
enabled (E'1 the calculation dOC$ I\Ot
take place and L'O is also ''0''.
"{n.
THeN
numhe~.
ELSE
11.1 Procening
Function
It
IF erro r occurred
Mat ht'1II0tlc!l1
ENO :" 0
ENO :- 0'
'"'"0
'"
=" ~
""
="'" '"0 ~
OU'
OU'
'"
ELSE
Rt pnsentulon
!.AD rejlreHnltllion:
THEN
!>
S in e
EN
IN
MO 110
'"
OUT
ENO
MO '04
S'ljuare
The .quare root of the value in variable ":-'hthValue l" is generutcd Hnd s10TC<l in the
~,
variable 'MilhRoo!"".
SORT
'NO
'N
OUT
"G~al_OB .
"Global_DB" .
MathValue '
Expo ne nl
'N
The
~anable
MathRoot
SORT
OUT ~ MathROOt
'N
' NO
"E><~nt.
m
/tExponfInl
t"lgu~
'N
'N
m
' NO
OCT
"'Reaull
'N
"-'
'N
'N
OCT
'NO
#R ..~".. ~
11 Mathematical Functions
"N
COS
TAN
Sine,
Cosine and
Tangent
"
Value Returned
~ogo
ACOS
ATA.."
SQR
SQRT
EXP
LN
I to + 1
- ,,12 to ""TtIl
I 10 +1
o to ~
Full range
S~e
Computing; the
~q ua re
root
Example :
,,12 to -~ ' 2
a"" also
Example:
"'"
Functioo
c - Ja' - b'
ASIN
ACOS
ATAN
Arc sine,
Arc cosin~ and
Arc tangent
,
,..-.:>ri< .. Calc u lation 01 ..actlva
~r
MUL_R
/NOItago "CUfT(lonl
'NOI- Jtt..REAL 1
'"
0"'
'N'
'N'
'NO
'N '"0"'
'N
itphl
IIC REAL2
MUL_R
'N 'NO
QU, r-#8_Powe,
'
N
'
IfLREAL2
'N'
Calculati o n of h ypota nu ll
II'I_ REAL1 -
N e twork 5
1- '0'
h~
"
"'-REALI
"'_REAL2
II'I_REALI
,
,
,
Math~matical
Function. ( LAD)
fJ-
u~ing
<l ..
!in.!!
IOlilo
b
'" '
L~tO
,os
II Mathematical Functions
cH~. pow~r
MU L_R
<'
#Voltage -
'"
OC;
ftCurrenl
'"
<'0
I- ill_ REAL!
"""
'"
'"
""OCT
liLREAL2
MU L_ R
<'0
"
"CREAL ! itLREAL2
'"
'"
O~
f-- #B_Powe,
'"0
,,-
'0'
<'
#LREAL! -
/<LREAL2
<'0
'" '0'
<'
'" '"
-
OC; -kt_REAL!
o c;
f-- #!_REA1.2
<'0
ADD_R
<'
'"
OC;
'"
<'0
I- IIC REAL3
SQRT
lfCREAL3
<'
0 0; - " c
'"
<'0
Conv~-rs;on Fun~tion,;
12
12 Conversion Functions
~'NVI
'"'"
'CD
3 d ee.
1.-/
INT
NEGI
'"
t 2.1 Prucessing
9.
Conversion
'"
0"
Function
OINT
Representation
RNO, TRUNC
FBD represontaUon,
I_BC D
eN
0"'
eNO
" , 'co
eN
'"
eN D
OU,
NEGR
0 '"
REAL
fFunction
THEN
ELSE
THE N
ELSE
END
ENO ;= 0'
w,\b Con
,"
"1"
ENO
,=0'
"'<'"ion fun<ri""
.. ""
'"'
12 Conve,..,ion Function,
Conwrtinll
INT
numb~ ...
MO 110 -
'"'"
,"0
0'"
MO 122
MO 120
..
I_ BCD
'"
'"
0'"
'"0
r-
MD 111
,
.
The \alue ,n vmable C"nl e"DlNT "lllterpreted as a DINT number and stored
Convcrung
UL\'T Dumber$ a rcal n umber in ,h~ van able "Con" ertREAL" ,
OI_ R
"GlobaL OB" .
ConvertD INT
Con-ertmg
'"
'"0
'"
0'"
"Global_ OS"
ConvertREAL
"Global_OS",
ConvertD INT
OI_R
0'"
'"
'"
r-
~~
"Global DB",
ConvertREAL
,"0
.
The absolute ~a lue "generated from 'anable
I'DlSplay.
RF;AL number.
#Display
'"'"
'" '"0
0'"
#Display
#Dlsplay
'"
'"
'"
#Display
'"0
'(on can connect contacts in series and in parallel ocf""" thc EN input and a tter the b~O oUl_
put,
You can find further c ~ amples of Ihe represenlalion and arrangement o f con version functions
in tbe program Digital Funct ion~ (FB I l l ) in
the !ihr.lr)! 'FRD_Book" that you can dOWTl load from the publisher's Website (see page 8).
12.2
..
Porameter
sion
TNT to DIl,a
, m
~,
Th'T to BCD
I BCD
~,
OUT
DINT
WORD
DrNT to BCD
DI_lICD DINT
DWORD
DlNfto REAL
D>R
REAL
DIN T
""
12 Conwn;ion Functions
r~porr
errors,
00"",
Hcn
Tabl~
""
Paramete,
BCD 10 l"'T
BCD_ l
"
HCrl_Tll O\VORTl Dm
.,~
WORD
OUT
lNT
om.
bil~,
'"'
0""
CHI.
RFAl
DINT
flOO R
D~"
ROUND
me
REAe
DINT
ial<ger
To no,-l lo",.,.
,n '''ger
To nD.. l inleg,'T
Without TOundinlj:
R ounding to the
P...-.-wxl~
TRu'lC
nc~1
higher
O~"
intq:~r
12 Convenion FunCiioru;
O nc',
cump~ment
One's complement
D!l'o'T
I"'T
Negatio n INT
The fUnchOn NEG_I interpret. the \'alue 8t
input IN as an TNT number. cbanges the SIgn
throuih two's complemenl generation. and
...Titt'S the converted .-alue to OUlput OUT.
NEG_' i5 identical to multiplication "'nk -I.
The function NEG_ I iClS italUS bilS cco. CCI.
OVandOS.
Neltllion DINT
The function NEG_D1 inlerprccts tke value at
inp ut IN ai a 0 Th.' T number, change, the .iin
through two' ~ com plcme!l1 generation. and
writes the eonvened value 10 output OUT.
13 Shift Functions
13 Shift Functions
"'~rd
lAD , epresentation
by word)
SHL_W
=,"'"
'"'
=
-
,.
F BD representation ;
'N
,
.. j
-,'.
W
N
.'
,"0
OC,
0.
IF EN == -1 " or n ot wired
THEN
ELSE
.,.
_W
oc, f--
END:
'"0
wi,!, Sf", ..
END: = "0"
T he value to be shifted is at inpu t LN. the number of plac es 10 be sh ifted is at input N. and the
",,"ult is at oulPllt OU T. The input and the Ollt
When Iho Ma<ter Control Relay (MCR) i. acti vated . output OUT is set 10 zero when thc shift
function is proce ssed (EN - "I"). Tbe MCR
does not affect OU!Pllt END.
Table 13 1
Ov~rvicw
Shift Fw>cti"IlS
Sh ift left
Shi ft right
S hift w ith silfll
\(otat. left
I{otat. right
uf Shift Function,
Word
Double"'Ofd
V~ri~bk
Variah l.
'"'
'"R
,~
.
.
SIll._ [JW
,,~
DW
SliR 01
ROC OW
ROR OW
e~plain.
how the
Ess ml'le<
Shiftin!:
",ord ..ari_bl ..
The value in memory word MW \3 0 is ' hifted 4 position, t() the left and """,d in
men'o,), word MVi D2.
SHL_ W
'"'"
- '''' "
MWl30 -
Shifting
doubleword
variabl~.
SHL_ W
'"0
0"' : - MW 132
MW 130
W11161J4
: G IoI:>..I_OB".
ShifI?os
Shifting
with sIgn
'" '"0
'" 00' r-"
"Global DB" .
Shil!Off-
"G lobaL
ShiftOn
W#16#2
MW132
SHR_ OW
". '"
"
"
00'
' "0
The , an.ble I"ActVal" shifted. wnh SIgn. 2 posmons to {he nght ancl tmn,rorred (0
the vHriabl. liDi'pla," .
SHR_ I
I>ActV,,1 -
0"'
"
Th~ value ill ymable " Sh,ftOu " lS , lufted fight by " SluftPos p'"",on.
ancl stored
in Shiftoft'
SH R_OW
"Global DB".
ShillOn-
='"'"
'"
'""
'"0
00'
='""'"
SH R_I
r-
JtDispl;>y
#Ac!VaI
W# I 6#2
00'
' "0
Jt Dlspiay
Shifl function in
rung (LAD )
You ~aTl e mlTl e<:t contJ{\S in s~fies and in parnl leI be rore input EN and after output END.
T he shift box itself DllIy be plac~d a fter a Tbranch or in a bnm ch IhHI Icads dire<.'1ly to the
le ft power rai l This branch can also rune conlaC," before input EN and it n~~d not be the
UPl"'ffilost branch .
The direct connection 10 the left pow~r rail
allow. you to connect shift boxes in parallel.
When co nne<;ting boxes in paralleL you requir~
a coil 10 tenn inatc the run g. If you have not proy id ed error cva lual;on. a.sign a dummy' ope<md 10 lhc coil. for example a teml"'rary local
dala h it
1).2 Shin
S h ift fORCll0 4 in a ru nlt ( FIlD)
ate buffen.
EN and ENO nc'Cd not be WiTN.
13.2 Shift
Sh irt
~hin number at inplll N specific. Ihe numberofbil pO.ilion. by which the COll!emS are to
be shific:ci. 11 can be a Con~t.anl or a \ariable. [f
the shin number IS O. the function is nQ! executed: ifi! is grealcr than I!, Ihe OUtput variable
conta ins ~eT"Q foltowin!! execution of the SH L_
\'1 function.
The
1~f1
dnubl~"'ord
13 Shift Functions
J 3.3 ROfale
The shift number at input N spec ifIes the numher of bit positions by which the contents are to
he shifted. It ~"n be a ~(mstant or a variable. If
the shift numb<:r is 0, the function is not executed: ifit is grual~T than 15, all bit pos itions in
the output variable comain Ihe 'ign following
e"ccution of the SHR_I fun~ tion.
'"
The ,hit[ nnmber at input N sp"cifie s the num her ofbil positions by which Ihe content, are to
be shifted. It can b<; a constan! or a variable , If
the shift number is 0, the funnion is not ~x e
cuted: if il i.' 32, the Contents of the input variable me reta ined and the status bilS are ,el , If
the shift number is .>3 , a Ihift of one position is
executed: if it is 34, a sh Jft o f two positions is
executed, autl so on (shining IS carried out
modulo 32 ).
Rotat~
14 Word Logic
14 Word Logic
Word logic combine, th .. valu es of two vanabIes bit by bit accordmg to M'D. OR. or
E"dusive OR. Th e log ic o!,<,ration may be
applied to words or doubl='ord <;. The available
word logk operations arc listed in Table 14, I.
With.
variable
ooubJewurd
v"';able
A-," D
"'iAND_ W
WAND_ DW
0'
WO' W
WXOR W
WOR - OW
Exclusive OR
w~
WXOR OW
Fun ction
Repn~~entation
LAD representation;
WAND_W
ENO
EN
IN1
OUT
'"
FBD ,"presentation;
WAND W
"
INl
OUT
lN2
ENO
ELSE
ENO:" "0-
14 Word I.ogic
Tlo bl~ 1~ . :
R~" II Funn.1OI11n
C
Word Logic Openl1u'"
ContC1lf>< ..finput TNt
gram
,
,
,
,
0
0
0
0
, ,
,
,
, ,
, ,
0
0
meme~! ~
V! ~WS
The four high.".<kr b ttl of memory word MW 140 arc .1 10 .-0"; Ihe ""u l, ;.
stored in m<;OlOrv
. w o rd :>.1W 142
WIIND_ W
ENO
MWI40-
W.,6011FFF
OR
'N
'N '
'N'
IOIl:I~
WANO_W
O~ f -
- 'N
J.tw 140 _
MW 142
..
..
..
..
Van ablcs wtoglc'\al l and \\ LoglcVal2 al'<' OR~d bu Cor bu lind tbe ",.ull
oretl in W1.Oj;ICRCi lt'.
WOR_OW
"Globio l OS".
'M..oglcVal j .
~~v~r
'"0
"
'N '
'N'
"GlObal DB".
0"' I - WLogkReall
/l'lropul tIM. .k
Hgu~
"Gk>l><!ol OS" ,
lNloglcVall "Global OS".
WLOQIeVal2
WOR_OW
"
0"' f-
'N'
'N' 'NO
"Glob31 OS"
WLOQIcRestl
The ,,due i!C11<"I'lO,e<! by comb inin.l! n riabk.,. "lnpuI &nd I/\fask with
Exclush e..()R is w ' "8riabl c ~ ~uff.,.
It c-~----1 EN
WXOR_W
ENO+-- - - - - i
"
O~
W1f16/l"FFF
INt
lN2
iIIflput ll'Masl< -
'N
IN1
IN2
OUT
ENO
I-- /ilSuIIer
Since Ihe b its that are "0 at inp~t IN2 also .et
the eorre'ponding result bits to '0" regardl e~s
o f what value thc,e bits have at input IN I , we
also refer to these bits as being "masked",
Masking i. th e primary use for the (digital)
AND operation.
OR ope r Rt lon
If you. want to have the word logic box processed in dependence on 8pccir.~ condition s.
you can arrange binary logic operat ions before
the EN input , You can connect the ENO outp ut
with binary inpms from other functions; for
example, you can arrange word log ic box., in
seri es, wbereby the ENO output of the preceding box lead, to the EN input of the .ubsequc-nt
bo" , If you want to u,e the result fmm the preceding box as input value for a .ubsequent box.
variables in the temporary local data area make
convenient intcnnediatc buffen.
You ~an fLOd further cxamples of the repre,en tation and amtngement of logic operation. in
the program " Digital Functions" (FB I I I ) in
the library "FED_ Book" that you can download from the publisher'. Web site (see page 8) ,
..
'" ]"
Since the b its that are ., I '" at input IN2 also ,..,t
the corresponding result bits to " t " regardless
of what value thcse bits have at input INI, we
also refer to these bilS as being "masked",
Masking i. the primary use for the (digital) OR
operation ,
In the result, only those bits w;th opposing signal statCS in IN I and IN2 priOT to execution of
the digital Exclusive OR operatio n will be " I ".
Locating bits wiih opposing signal states or
'"negating"' tbe . ignal states of indiv id ual bit. is
the primary use for the (digital) Exclusive OR
operauon.
I!I
SlalUS Bits
Status bits RLO, BR. CCO, CCI and overflow; setting and evaluating the stat us
bin; using the binary result; ENIENO
16
17
You ~an usc Jump function. to branch unCOnditionallyor in dependence on the RLO.
A funher method of affecting progrllm execution is provided by the Muter Cont rOl RelA Y
(MC R). Originally developed for relay comactor CQIIIrOIs, LAD and FBD offer" solW-lIre
version of this program control method.
no
=~
18
Bl ock Functions
Block type . block caU. block end; stalUS
local dalll; data block TC,ister, using data
operand.; handling data blocks
19
Block Pa rametcn
Parameter declaration; formal parameters, actual parameters; passing parameten; 10 called blocks; Examples: ConveyOr belt, pans counter and supply
15 Status Bits
Ln
A bitlogi" st~p e nds w ith a binary value assignment (e.g. of a 'ingle coil or an a-'Signme nl) or
w ith a conditional jump or a block change.
These SCI IF C - "0".
Hesu lt of the logic o p era tlon (RLOj
1 ~. 1
Slams il its
Bina ry Flags
!Fe
first Chock
RLO
Re<uit of logic
STA
Slatu,
OR
Stat u, "it OR
BR
Binary ""uit
0r><r~tion
Dlgltol F1a ~.
OS
Ston."<i o,crflow
OV
Overflow
ceo
CC I
nl
IS Stalm Ilits
Status bit OR
Status bit OR stores the re.ult of a fulfillw
series circuit o r a fulfillw AND condition and
indicates to a subsequemly pX:cs,ed paJ"llllel
circuit or OR function that the ~sult bas
already been determined. All other binary functions ,eselthe OR status bit.
1 ~.2
O verflow
Status bit OV indicates a range violation or the
use of invalid REAL numbers. The following
functions affect the OV status bit: ArithmetIC
functiollll. mathematical funclions, som e convers ion functions, REAL comparison functions.
Of the con\'ersion functions, the two'S complements affect all diaital stams bits . In addilion,
the following conversion functions set SlalUS
bils OV and OS in the event of an error (range
violation Or invalid REAL number):
Binary
I>
:>
r~SQ II
222
I..'OT calcul.tion
DIl'iT c alculotlon
ceo
< 32768
(ADD_ I. SUB I)
<
32 768(MUI.._I)
- 32 768 to
"
,
",
+110 + 32 767
>+32 767
(ADD I. SUIUJ
,. +32 767(MUL_TJ
)2 76H{OJV I)
( )65 536
Division by Uco
"
"0
,
ov
, , ,
, ,
, "
"
CCI
,
",
,
,
", ,
, ,
, ,
, ,
, ,
ceo ce. ov
-to
+ 1 to"'32 767
"
- 1 to 32767
( )32768
-1'0-2147483647
>+2 14 7483647
(ADD D J. SUB 01)
>+214748 3647
(MUL DI)
2147483648(DIV_ DI)
0;
0
0
The rult;s:
CCO
t<,
ceo cu OV
"
0;
,
"
, " , ,
:-a"c -D
CCO
-1 '0+2147483647
0
110_2147483647
( )2 147483648
,
,
Word logic
CC" CCI
OV
"ro
not zero
t"
with shift nOln be. 0
0
0
ce. ov
"
Co> CC,
" , "
0
0;
0;
,
,
, , , ,
0
0
ce. ov
Cotlnrslon
. function
Shirt
The shifted out bit io:
0'.
"
1 5 than
" "
", 0 "
, ", ,
0
, 0 , ,
, , , ,
infinite
(division by zero)
2 147483 648 10
'" denOrrn.'l1ized
~ero)
21 4 7483648
(MUL 01)
<
equal
+ infinite
(divi. ion by
147483648
(ADD OJ. SUB OJ)
, " 0;
, ,
+ DOnnalized
" zero
nonnali,ed
<
ce. ov
, , ,
, ,
,
"
,
" "
" ,
", ,
",
", , ,
, , ,
, ,
"
,
,
, ,
CC"
Comp. ri.on
JU:AL c.lculation
The ,ult i.
0;
, ,
OV
0'
223
15 SlatUll Birs
Slatu. bit. for comparison functions
-1~
> 0
-H~
--I f <0
=:-I~
<>0
--I f "0
--I f UO
--I f ov
--I f --I"f -
'R
'"
FRO
rcprewnlation
is fulfillw wben
<0
..0
<>0
S~ttjng
>
OR := OV
for the ari thmetic and mathemat;c,,1 fune_
I; on~
r~"ull
------1 SAVE I
:>
BR :- OVor"I"
for th e ~on version function s
t>
th~ ~as~
of
l'lease note that the SAVE c'o;1 does not termi11atc th~ log ic op"ation (the !FC staw s b it is not
set to "0"). Thi, means that the log ic operat;""
p receding 'h~ SAVE coil is also th~ preced ing
logic operation for lh ~ next network.
Th~
225
15 Stall>.' HilS
Is ENO switched?
NO
'"
Is EN switched ?
Is EN switched 7
v",
NO
Is EN "1"?
Is EN - - "t " ?
NO
'"
BR corr ...
SPOMS to tunc-
'R
,. "0 "
tion
Fi\:" r.
1~ .2
BR
YeO
BR ,. "t "
corre
BR not a ff9CtBd
ENO in th<'
Block.
Ca~e
of \)s~rwrittc n
,.... ,.
NO
BR :- ' 0'
NO
For examp le, I3R coul d be set to " I"> at the ,tan
of a block. It" an error lh~'!! o ccur> during pro "
ce " ing of the b lock, for ~xampl~ if a result
exceeds the tixed range "0 that further process
ing nlU,t be f'1"Cvcnted, 8et the binary result to
"0" with the SAVE ~oiLlbox and j ump to the end
of the block w h ere th~ b lock w ill be =ited (in
the event of an e rror, the condition mu,t supply
sign"l . tme "{I"), Plea,c notc lhat the RET coi li
box sets the BR to" I" i f you ~X il
block via
coiL-box ,
we
1m,
-it"'
H - - '"
~ MD"1)}.;:::'
'N1
-,. - 'NO
-.tOO-.,,
;~'.., -.I.i!~'
"
ROUND
OIV_ R
'"0
0"' f-#CREAl
#\ R EAL
'"
"
Coo Utett
'"0
OC;
---'
EN
IN
MOVE
::ioliO ~
ENO
. H l
OUT '.MO 3~;
iiLDINT
-"--
c; ~H~~--:;'
~
"
E ND
HIt"rc 15.3 Eumpl e fo, the Series Conn"" ,ion or.t;N and ENO
'"
. '.:
16 Jump Functions
16 Jump Functions
Representation
LAD
rep r esenta l lo ~
Dest
---{ J MP)------l
JumpifRLO - "O"
Dastn
---(JMPN}-----j
Entry, Jump
Jab~ 1
FBD representation
Jump
iF RLO - "0"
Fu nction
A jump is e ither always executed (absolute or
unconditional jump) or ;t is exeeutcd depending
on the re sult ofthc logic operation (RLO) (condit ional jump). In the case of a jump dependent
On the RLO , you Can de<:ide whether the jump
is to be executed if the RLO is " I" or if the RLO
is "0"
E~ample (ri gure 16. 1 and Figure 16.2): In Ne(work 3, there is an unconditional jump (0 jump
label M2 . After th is Tl ~twork has be~n proce"ed_ {h~ CPU cont inu"s program e:xecution
at j u",p labe l M2 in Network 5. A jump from
anothcrprogram location is required in order to
ptoees. Nctwork 4 .
'
:i"'~---1
I t/compVall - (N1
CMP~I
tiompval2 -1.""~''-
If RLO
Ml
~-----{JMpH
___--1
1/-" ~lAcl
f-I___________(
.,
.,
. ~!,rk
iH
3 Uncondttlona( Jump
l~:+;;~~~~~~,_~.-----------------------4(~~H
CondlUon ltlJump 11 RLO _
"O~
"
Entry- 01 "'1 2
228
16 .3
JumpifRLO ~ "I"'
16.3 JumpifRLO="I"
#CompVall
IICompVal2
~=l';IN2
N;'~
~ 1~
*~ I
__J___[jM~''e:J
JMP
----l
#AnlhVa l1 _-l~'N;',--"O~';'}r-_~'~A~
';~,"~R~'~'~____[i9M~'E:
#ArithV,,12 IN2 ENO
JM PN
Ne twork 5
Entry of M2
I
I
{=='=:}______-{O="~"~'J'
Input1 - 1
&
Network e E ntry of M3
I - I
{=='=:}______-{O="~'''~OJ
Inpu12-1
.'t~ u r.
&
"0"
!>
Please nOle thai deenergiz;ng ",ilh the "soft",.are " Master Control Relay is no SIIbslilUtejar
LAD representatkm
A.Uv.te MeR .",a
!>
FBD
r ep'a~entat i oo
t>
t>
t>
-------l MCR< I
IMCR>I
IMCRDI
17.2 MC R A rca
I>
r>
Bh><:k 1
Block 2
Block 3
MCRA
MCRA
Bloc+< call
MeRA
BlocJ(cali
MCRD
MCRD
B lock end
Block end
Bloc k en d
231
L&d
representation:
IH
I
t
/MCRzon.
I,
~1 .;
I ..
, 1.1
(MCR<H
(MCR<H :
I
I
I
---l
MeR"'!
t 1.1
---l
MCR<!
S"'i<chi"" "fMC,,,
~""Y
2J
,
0
"
(MCR z_1J
{J..teR zone
.~
! MCRA!
'I':'
.rl<
,'ifMC"!hpn"
.., "t', 2}
S-;,'l,il..
(MCR.4}-l
(MCR>H ,:
I MCR> I
(MCR~H
! MCR~ !
{MCRoJ-i
I MCRO !
otf
,.
MCRA
MCR<
IMCR
ron&
I MCRA I
[MeR zone '1
[MCR zone I I
I]
[MCR
zone 2J
BlOCk call
MCR>
MCR>
MCRD
I MC RD I
" Iluft 17.3 MCR Zone> in Ihe Cau of llIod Change
TMbk- 17.1 \1CR [kpcndcncy in Lbe ea.., of':'e.<tru MeR Zo...,. (Example)
MILO
'" I ~
''0''
7.<>r>o 1
One :l
17 MasterCODlml Relay
T~blc
D.ta Type
INPUT
OUTPtIT
~,
on
OUTPUT
POlJ'.'TER
VAC
"
""'U,
RET_VAL
OUTPUT
en
<A
OIJr ~UT
POINTER
INT
A",isnment. Oc>cription
Numh,,- of bit< to I>e .et
FITor information
Pointcr to the first bit 10 l>e set
Number ofbi" to l>e reset
Error information
PUll"''- t~ the first bit to be res<:t
You call rmd examples of the Master Comrol
Relay and of the SystCID functions SFC 79 and
SFC RD in function b lock FB 117 in the libraries
"LAD_ Book" and "FBD_Book" in the rrogram
"Program Flow Control" that you can download
from the publisher's Website (see page 8).
18 Block Fuocriom
18 Block Functions
D'.
".
- '"IN'
IN'
-- 'N
OUlI -- IN'
IN'
'NO
OU"
--
au"
nina
Callin/( an Fe M STC
with CALI. t><>.
with CALL ooil
.,
'N
ENO
C.III"iI an FB or SrB
., 1"".1 'nS\8lnce
["'ponde"t on RJ.n
IN'
OU"
IN2
OtJT2
--{ RET}----i
FBO "'prflSflntation:
with <13 ... bl""k
HI...... nd
,C.
OLn.me
,"0
mm
ComHi on Fe or SFC
CAlL OO~
o.."p<"do,,! on RLO
CALL
-IL-'c:'::.T-,
,C.
EN
OUT1
INt
OUT2
IN2
ENe
-1
'C.
18 Block Functiom
In Ihe case of incremental pn)~lullming, you
will find the CALL coillbox and !be RET coill
box in the Progrtlm Elemems Cata log (with
VtEW --J> OVEll.VIEW~ [Clrl K 1 or L'SlRT--J>
consi~t~
of Ihe call box that CO il hlins the ad~s. or the called bl"d: (here: Fe
10). the enable inPUt [;N, thc enable OIltpul
ENO, and any block puameters. Following
proc~ingoftbc ~"Il function, the CPU OOnlinues progrHm cxec\U;on in the called block. The
block is procc"ed to the end or IIm;1 a bloc k
end function is cn~oumered. The CPU the n
rerums to the calling: block (here: 013 I) arid
cominucs proccssiull this hloc~ alkr the call
A block c"U
.".
.. .
"
C_Ili_1l b .... k.
~ .I. "'11_. 1... 11,," block O BI
NetwoJ'k pIior to
~od< ca~
,,
11-- -1""
HH""
Fe 10
~ -- ~
'"0' -- - -1 '
Ii
,, ~
04.0
\"1 _0
... --,
"ro<~,sin!l. oj"blod 1"''''mOl....' CO'ro!sIJQ",h
,,, p1W~,,;n/( of Ih. ~cl""ll'/zr;abl~., durinj{ "'"""'~
'N'
C..l1ln K bk><:k.
~ .~
i'Q
ca~
--
pa~
Fe 10
;,
FiJ:;"'"" JIU Exampl. n( a Rlock Call
or ENO. You can only insert a call box in a paralld rung if it is connected directly to the le ft
po"'e r rail.
ELSE
Ca lled block
is riot processed
ELSE
ENO := "0-
18 Block Functionl
block (Ihe hlock you arC ~urrenl ly programming). The local illstancc " called by 5e1eClin g
one o f the available local ill' tances under 'Multiple Instaocel' in the Program F.le-mctU5 Catalog; it is nut D~'CC;;:;aay to ,pecit)t an instance
data block (~e also Chapl.r 18 1,6. "Slatic
Local Data'').
CalliDl:
functl"n~
Hlock
mu~l ini(ializ~
all
,n
hlock~ cx;~t
~Yl'tem.
23l'1
in
5equtn~~
(FRD)
~ ~_""C=;-=-~':-~=.:~{:-~'-;'-~..'.'.~
-..:, -:::J[==l~::-::.::. :j:;.;I -....,.. - - '- '1""-"
.. ......
-''-
.. _
H'
.. _
,- -..
........
~. -
Fl~u""
FeD
~Mntation:
--1
RET
t. ex ited
processed
BR
:c '0"
18
OI~k
fWKTions
local dlltll
I>
'"
Data Type
A .....
STNtO
ARRAY [1..201
"
LB>~~
BYTE
ARRAY [1..1fiJ
l.IYTE
"1.0
20.0
"t .O
.'tgure 18."
Example oflhe l),;..clar.... ;on otTcmporary Local Data
in an Orgonizotion Block
A \'ariab1e in the temporary local dala can although this is an exception - he declared as
data type ANY. You can use this fearnre to mooify the A;'o/Y pointer at runtime (sec Chapter
24.2.5 ..... Variable .. A.'1Y Pointer").
You dedare the start infonnation for an organization block when you program Ih at block. Tbe
infoonation is mandatory. Sample declarations
in English can be found on the Standard
Libra/")' undCT Organization Blocks. If YOll do
nOI necd the stan in formation, simply declare
the f1r5120 byte, as something else. for example
as an array (as shown in Figure 18.5).
Static local data are a function block's " memory". They retain their values umi ll hosc values
are changed by the program.just l i~c data operand, in global data blocks .
D",,\arat;on
IN
OUT
'N OUT
STAT
T~
~ll,l u. ~
Nao'e
Man on
Switd
Length
Total
Sctpoint
Difference
Buffer
'"
Data Type
Addrc"
Initial Value
ROO'
0.0
'.0
FALSE
H~'
<NT
INT
DINT
INT
REAL
'"
0.0
" .0
FALS E
0
0
1.#0
0.0
'.0
Comment
inpul parameter
Output parameter
UO paramoter
Static local data
Temporary loc,.l dala
I ~ lJlock Functions
of in~remcntal pro-
t>
t>
'"
MOVE
"Total izer
DaH!" .
Total
'N
'NO
'N
W C
MO~
"
o
'"
'NO
ou,
MWW
r- "Totalize,
Deta",
'o~
(To/an.
08 "TotaolizerD8t&"
LAO representatIOn:
AOO
ENO
'"
'"
'"
Olin onot.-
f - lITolal
~ 0;;"
L.
F8
"'"
ENOf-
liTo\a1
OS " EvaluaUonOat&"
LAO ,epresentatk>n:
'!~&j
#EM Add
I'
''V''lue~'
I ~e l ete
#EM~O'"
I'
'N
'NO
'"
MOVE
' N
1
,
,
MOV E
'NO
"'Memory
OU ,
"ResullZ"
'"
"
'NO
-"
"M,
"ValueZ" -
#EM Del
#Oelete
#M .. mory.Total -
F12ur. 1H.6
E~amr l e
, ,
II'Memory
'"
'"
'"
'N
"
'"0 l-
"
MOVE
0-
,"0
MOVE
'"
'"
' :"';'~
FBD fa <l$<Intation:
'"0
OU, f - .Memory,Total
18 Block Functi(ms
'"
fOI"
Data Blocks
!>
!>
You Can use data blocks in two version." asglobal dala blocks that are not aSiiigncd to any
code block. and as Instance dara blocks mat are
assigned to a function hlock . The data in the
global data bloc"" are "'free" dma thaI every
code block can make usc of. You yourself determine thcir volume and structure directly
through pro!,,'ramming the global data block . An
in_lance data block contains only th~ data w ilh
which the asso~imed function block works; this
function b lock then also detemtines the stru~
and storage location of me data in "i ts~
instance data block.
The numb..r and length of data blocks are cpuspecific . The numlx'ling of the data block
begins at I: the re is no dala block DB O. You
~an use ea~h data block either as a global data
block or as an instance data block.
You muiit rm;t Create (""!el up") the data bhx;kli
you use in your progr~m, either by program_
ming, such as code blocks, or at rumime using
the systcm function 5FC 22 CREAT_ DB.
R.~bt~rs
I[ is recommended that you addrelIII wua <>pl'fands symbolic.lI)' ,,henever possible. Sym
bolic addressing
~
reduces "rite errOr~ made d.u:WII programmini (the ProifWll Editor compares tlte
terms used in tbe Symbol T.. ble and in the
program; "number-switchi ng errors" such
as DaB 156 and DaB 165 that Can occur
when using absolute addresses ctinnO! occur
bere) and
0.,. Operands
Olay
0.[. wurd
111.2.2
Atcu~lng
DBSI).
\)ala Operands
rOT .ccess-
"od
:>
A~signmem
Table
Data blocks are Jobal data Ihat have un ique
addres~ within a program. In the Symbol
Table. you assign a symbol (e.g. MOlorl) to
the ab$Olute addres~ oflhe datD hlock (e.g.
1)
I ~ 1I 1oc~
Function.
In the case Df fully_addre<sed acee". YDU specify the data b lock together with the data operand. This method Df addressing can be symbolic or HbwlulC '
"M7!"OR l- . ACIVAL
IlB 51-DBW 20
'"
",
f--{ OPN}------l
FBO representation:
~~~'i3'
,
DB 13
Network: 6
~-
DB 13
I O'N I
(OPN}----1
' N
'N
DBW lQ
' NO
0"' ~1iIt_WORD
DBW 10
'N
'N
."
#CWORO .~:
~':,;,l
MOVE
OUT -
....
END
::;'[
I
Networi< 8
DB 14
I OPN I
MOVE
, iIt_ WORD
Network 9;
'"
'"
'NO
OU'
Copy with
DSW 16
Iully--ad dr~uCd
lit_WORD
'"
'"
'"0
DB 14.
OU'
DBW HI
18.2.4 Slleclal
Chuoges in
lh~
Po int~
in Data Addre"ing
c"nteD" of {he DR
'N
'N
0"'
'"0
O BW16
data operands
MOVE
DB'3,; _
DBW12
MOVE
~egi st~r"
W ilh the following funccion<, the Program Editor g~n eral~' add;t;o nal instruction, which can
alter tb~ e(ITllcn ts oflhe two DB rcgistcrs ;
0813 .
DBW12
M OV E
'"
OU ,
'N
'NO
_~B 14_
DBW 18
....
..
..
18 Block Funclion;;
"0...,,,,-"
t$l.Daw 10
~ero.
. A ~ ~Va h:.
DEl. .DEW H
SFC 12 CREAT DB
Sf C 85 CREA DB
Create data block in ,,"urk memory
:>
SFC 23 Dt::L DB
Ddete data block
SFC14 TEST_ DB
Test data block
18.3 System
Fun~tion"
=i;;i;;
rJ!
;:,;;
"
'6"~ ,
, ,
H1
~
, ..
"
,;,
, ,
I ~Y
"
BH 16l'()4
.~ ~
"
,
,
,',
"
"
,
;
block i5 initialized
"
,
,,
18 Block Functions
In the even t of an ~rror. a data block is not erealedo the pam meler DR_ NUMnER paramet ~r
i. assigned Z<.--ro, and an ~rror number i. output
byRT_ VAL
B it O = "I"
The dat<! block has Ihe Unlinked anribute .
Following transfer to the offline data m anagemenl and reloading into the C P U, the
<.lata bl ock ;s still on ly pccs~'IlI in the load
m~mo ry.
has
the
Non Rei";,,
with W#I6#80BI.
'"
19 lJJock Parameters
19 Block Parameters
deB.
d~lare
t>
how to
block parameter5,
t>
t>
t>
8lu~k
Pwramcters
Block parameterS mllke it possible to parameterile the processing instruction in a block, the
.,,,,
Fe 12
Nama : Adder
Parameter .
Pr~m
om
Ronutt
FI~ur. 1~.1
1/ Fir" oall
-Adder"
Num b_1
Resu lt
MW32- Numb_2
MW30 -
MW34
Nu mb 3
Actual parameter
II Second co11
DB 12.
DBW30
DB 12 ,
DBW34
Numb
Default values are optional and are only possible for function blocks if a block parameter is
stored as a value. This applies to all block
parameters ofdemcnt"T)" data type and to input
and output parameters of comp le x data lype. A
parameter comment can al so b e given.
r-
D812.
DBW40
ADD I
Numb_1 Numb_2
Memory -
You define the block parameters in the declaration ,eclion of the hloc\: when you program the
hlock. Figure )9.3 shows the declaration tables
of a function FC and a function block FE. In
addition to the b loc k parameter>< (IN . OUT, I:N_
OUT), you also declare the temporary local
data (TEMP). the function value (RETURN)
for fun ctions Fe, and the static local data
(STAT) for function b locks. Only the temporary
local data (TEMP) exists for organization
bloc ks OB which arc neither called in the u,er
program nor possess an instance data block.
Illock
par.meter
DB '2,
DSWn _
Numb_3 -
MW4Q
-Adder"
Num b_ '
Result
Numb_2
r-
'" 0'"
'" ADD_ I
'" 0"' -
-M~
'N'
Fum,.1
~m"m
ADD I
0"' -
MW3Q- IN1
MW32- _IN2
M emory ~,.
II Second call
DB 12.
DsW30
OS 12
DBW32
Memory
DB 12.
DBW34
R.... ult
'"'
ADD_bUT
"""""
-MW 40
'"'
'"
'N'
ADD I
-OUT
Memory
ADD I
-OUT _
DB 12.
DBW40
'"
'"
19 Block Parameters
~unct i ons
For the dam type of a block parameter. a ll elementary, complex and user-defined data types
are permissible as well as the parameter types
(see C hapter 3.5. "Variables. Constants snd
Data Types").
ST EP 7 stores the names o f the h lock paramete rs in the non-executable section of the blocks
on the programming device' s .'torage medium.
The work memory of the CPU (in the compiled
block) contains only the declaration types and
the data types. For this reason. program
changes madc to b locks online in the CPU must
always be updaled On the programm ing
device's data medium in order to reta in the original names , If the update is not made, or if
blocks are transferred from the CPU to the pro_
gramming device, the non-cxecutable_b lock
sections are ov~rwrittcn or deleted. The Program Editor then gcnerates rcplacement sym
bois for d i8play or pri ntout.
Fe and
~unction
Bloch FB
by specifying th~ data tYP<' and possibly a com ment in th e declaration table u nder RETIJRN
and the n ame RET VAL.
As data type of the fWlc\ ion valt.lc, all elementary data type, as well as the data types DATE_
AND_TIME, STRING, PO INTER, ANY and
user-defmed data types UUT are p.:rmiued , The
data typ es ARRAY and ST RUCT arc no!
allowed.
As the fir<t outp ut parameter, the function va lue
has no spec ial role to play in the LAD or FBD
programming language. It only g ains significance in the SCL programm ing language,
where you can usc the block type FUNCTION
as a '"genu ine" function. Here, a function Fe
can stand in p lace of an operand in a printout:
the function value then rep resents Ih e value o f
th is function.
'"
Table
1~.1
;
O~
,=,
,
,
,
,
type,
DT. STRIl--'G
ARRAY. STRUCT
In dividual binary components
tndividual digital components
TIMER
COUNTER
8LOC K ]C. BLOCKJB
BLOCK_DB
BLOO,_ SDB
,
,
,
,
,
,
,
,
,
,
,
,
,
Possible
yes
'"
M
,..
ye,
"..
,,.,
yes
,"
0"
0"
J 9 Block Parameters
19.3
A~tua l ParaJT1ete~
P aram<t~f"
,tructur~ S
"
Cornponetlts of arrays or
"
19 Sloek
ParameI~r1
,
,
,
,
<
<
"
,., "
Qy.x
:-t
<
,
<
DID
"
811
1 '''''If'--'-' ------'-"-'''"''"''--1
1f'-"--'-1
,
(R
BilmX.y
F i~.d
Signal StOle
VOn
block
parameter~
of
typ~
ANY
~Ic" ... _ y
Fe ,ails Fe
,
,
, ,.flJ enll. , ,
Fe
,
,
,
,
Fe caUs HI
,
,
,
,
,
,
,
<!au 'YP<'
,
,
FB calli FR.
'-
,
,
,
,
,
,
..
19.5 Examples
""
The function bloc!.; "Conveyor_Belt";$ 10 e<>ntml tv.o e<>n'-cyor belt!. f or this purpose, il will
be cal1.-d Iwiee; Ihe 11rst time wilh the inpulS
a~d OUlputs of conveyor belt I and the second
19.5
FB "Conveyor belt"
"=, =
,=,
,=, =
,=,
=
'OQ
eOQ
~"
R ""dyIo.1od
c.,.-,U oo"
R~ady_r ..."
B8,,"_,t
B~._mot
Man_oo
f=
,~
BOOt.
En'U,oIt
M fault
STAT
Lo ~ d
,=
,=,
,=,
,=,
" ,=
,=,
,=,
,=
RornovQ
EM_ R . m_
EM_Rem_P
EM_ Lo.o_N
EM_ Loo_P
TEMP
E xamp l~s
PM_Rom_P
PM L"" P
F I~u ,.., 1 9 . ~
FB"P ""
,=,
,=,
,=, '"
lbanier
F.';"r..d
Fau ll -
Ac krK>w1
COUNT ER
WORO
T IM ER
S 5TIM E
S 5TIM E
=
=
~m
Ou. n tlt~
,~
~. ,
Ou",2
STAT
EM_ LB_ P
EM_lB_N
EM_AC_ P
EM ST P
T E MP
PM_ l B_ P
PM_ LB_ N
' _ BOOl
t S5T IM E
,=,
,=,
eoQ
,=,
,=,
ElOOl
e OQ
,~
S5T IME
FI>!UN 1\1.6
'"
19 Ulock Parameters
''CoumOal''. You can \1.: Ihe inputs. OUlpuU.
limer and oounl~r from the Symbol Table
(Table 19.6 in previous example) as actual
panom<.'Tcrs ",hen calling the function block.
19.~ .J
Feed Example
!I.Ir.... ~1
L ~""1
-...2"
and SlQP.
The following program fQl" fUneli on block
Feed' is de'igned in the same "" y. Thc input
and outpUt parameter.; ot"the function block can
be taken from Figure 19.7. I" addition. the dig.
ila l valu~, fo r 'he pan . counter Q,umlil),. {)~r~'
~nd [J"ral are designed as input parameten
hel"<' , We declare the data of the individual con veyor belt controls ami the data of the pans
cOunter in t1J.e slatic local data in exactly the
same way as for a user-delir>eo;!. data ~, i,e.
wuh name and d3ta typ<". The variable Belt l~
is '0 receive the data .trucrure of funcllon block
-COIl\"e)"or Bel:', as is variable "Belt2~, ~tc.;
the ~ariable "Check~ 1"C<:eives the dala stroCIt.ll"<'
ofth~ funetion block 'Pans_counter" .
The program ill the f\.ouction block ~Ians with
the initialization of the ,;gn~ls common to all
conveyor belts. Here, we make Ui~ of the flltt
thu, the b lock parameters of the function bloch
calle<.! as local ill~tarn;c. are stat ic loca\ data in
the e um:nt block and can be lIeuted u sucb.
b lock parameter M,m 'III in th. current
funL1ion block controls ihe M~" on input
paramcters of an four conveyor bel! controls
with a singlc a"ignmenl. We proc:ectl in the
:.ame way wim the SIgnals SlOp and Resel. And
no,,- thc conveyor belt controls an initialized
wi,h the COmmon .ignaI8. (You can, of ~"(>ursc.
also jnirializ.:: These input pe.r&met<TS when the
func,ion blOCK is c:alled.)
n'e
M
dre<.'
}bme
-lion
,.ill
StOTt
HOOL
R"",ovcd
BooL
L.
" .
\fan_'tart
Stop
D~L
.""
-..
"
t
om
Re,et
BooL
BOOL
Count
Quantity
Tim
Dural
Dura2
COUNTER
WORD
Lo ~d
BOOL
BooL
Remove
,.,
,.
"
"'.0
0.'
I 4 .0
tni',aJ
Val""
FALSE
FAl.SE
FALSE
FALSE
FALS F
. Comment
:;;'J
W # I6#200
.Numbc:Tofp~tt.
S5Tl/I.IE
"
S5Tlt5S
S5TnfE
10.0
SH"IQS
FAL SE
fALSI::
"'
....
"]"l \l~. R
...
r:IN~OUT
STAT
Bcltl
Belt2
Belt 3
Bd!4
Conveyor_ be lt
c.:m",:yot_bc lt
CO!lveym bel t
Conve yor belt
32.0
Check
3R.O
14.0
20.0
26.0
TEMP
263
19 Block I'aramc{crs
I #Ma!-f__"-,________________________'_'~__'~Ma)"--oo_1
#Be~.Mall_on
IIBeltJ.M9
ItBel\4.Man_0Il
)--I
~of'---,--------------------------'-'~eltl ~
#Beltl.Stop
e - --
e --
- -- --{, )--I
L--_
- - --{)--I
#Be~3.S{OP
II'B@it4.S\op
_ _ _ _ _ _--{,
)--I
~ef~~':..-__,---------------'~'~'~'~"_{BaH
f-_____________'~'~.~'~O:,:Ba~
f-______________~'~'~.~"~':,:.Ba~
L._ ___ _ ______ ___~'~'~.~"~',:B9H
1------1"
" ''"
f--H----1
"""
ItBel!!
Ro~dyload ~ #load
tH
#Bel{l(fl_'_'_"'_'_'________________________'__"~'
;r;Belt2SU>rt
( )--I
tlgurc 19.8 Program for he<l example (LAO)
Con,jnued overleaf
19.5 I::.umpid
e"",/n"N:
IIB.1t2
.,-
'NO
'"
ee~_mo l
End_belt
"lMfa>lll2"
Mfeu lt
I1t8ett3(Qadyi<n<l
"B~t2.ConIinufl
)--I
IjRIlady-rom
f-I-"'--- - -- - - - i l )--I
_3.Stool1
.. eeN3
'NO
'N
.~.
"lMh"'~"
.,
""'--
'"emo<
_ __ mol)"
Mfault
l",eelt4te~dYload
f-I- - --
- --
#8eH3 .ConUnU9
---<1
)--I
1'8.K4
'NO
"
Conbnue
Rncl)"-,,,m
End_bell
Bait_mol
r-'R~
"lbalY4"
"lMfaul14"
f--'
Mfau lt
..-
~- ,
"
"',
~~
"t.berrt"
lbolrri.,.
""'.
"""""
""""'" -
-- ""~
OtOu<e1 #Oura2 -
"""
"""
'"0
,,- rFeuN
r-
"FlnItllacl"
' FauII""
(LAD)
M.lan~ .tar1
IIBNll .Man.-,)n
# Belt2.Man on
#8ek3.MaR_on
~.Man_on
IISiop
/l'8e1t1.Stop
#Belt2 .Stop
IlBeIt3.Stop
llBe1t4.Stop
#Reset
IiBen1 _Bnlc_,t
#8eIt2.Ballc_11
.Bett3.BIoalc_u
ItBelt4 BIollc_u
/t6e ll t
"'"
""'""
"'Loom
En<C~t
"/MfauIt1
----i
1IB<IIt1.R&ady_rem
---1
26'
"-~,
~LmoW
MfauH
118e1t2_lWadyIoad
COlt''''~~ o ...,,./~af
Rudyload
Bell_mot
Exampl ~
1l'8e~ 1 .Conlinue
IIB& rod2.Start
(FBD)
#8 ..,t2
"Lbarr2":=~;';
";'~_;O:.:"___':.:':'~m:ojt~ 'Be~_mot2"
Mfault
#Selt3 .R&adyload
---1
#Be1t2. Conliflue
80
# Selt3
"Lb",,3"
E~d_b9~
"fMfault3"
#aelt4 . Re~dytoad
Beicmot
Mfault
--1
118..113. Continue
&
#Band4.Start
#B@ lt4
Ready rem Continue
Belt_mot End_ belt
Mla ult
#Removed
"Lbarr4 "
"fMlault4"
~~jset
#Start
"Admowl"
"Lba rrl"
#c<>unt
#QuanUty
#TIm -
#Dural -
Ack~oV>1
"'~,
Finl~hed
Fault _
#Remove
'a9~_mO t 4 '
"Fin ished"
"Fa un"
Lbarr\er
Cou nt
Quantity
Tim
Dural
'"
19 1llo<:k I'lonuneCen
T.bl~
111.6 Symbol
T.bl~
."
"
conveyor
com.yor
"
"
"
"j
'"
,"
Program (',"""cssing
Program Processing
20
.\-hln pro;:rllm
Program "tructure; scan cycle contr()l;
respon>e ti m~: program functio"",: mu!!i computing ope ration; data cxch&ngc with
system fun~tions: start information
2t
Interrupt handUng
23
Error handlin;:
Sy nchronous errors (programming ~rro"_
acces, errors); handling synchronous
elTor evems: asyn~hronous ~rror'; sysl<-'1ll
Jiagnwtics
'"
20 Main Propm
20 Main Program
A divided uocrpmgratn can be more easily configured. and cnn be programmed in Sl:Clion.
(even by ."v"nll people in the case of very larac
n,
"" ,
Ne5llnk de plh
Intertocl<3
Ben control 1
Belt control 2
Oeta
acq u i s~ion
PI'OCfIU
Oata procnslng
Conveyor data
0.18 preparation
Communication
PU Cllee-r dliled p r Oil r anl Or i anlzAllon
CONTROl
Fill" .... 10 . 1
E~~mple
of PTOgnr.m Structuring
271
20 Main Program
are llsed for signal interchange between different parts of the p laJlt.
I)rogram .tr uctul~ is
based on the control function to be cxecuted.
Init ially, this method of program strucroring
docs not take the contL"Ollcd plant into account
at all. The plant s(rueture firsl be~omes apparent in \h~ Sllbordinate bloch when the control
function defined by the rough strucro", is
divided nmher.
A
function-,..,I at~d
imag~s
Start nexl
cycl ic e~ecul i on
Cur ....nt c c ia time 08 1
...
...
...
Ma in ;>rogram 08 ,
'"
"0
'"
...
Start next
eyel ic execu~on
Current cycl e time 08 1
PIO
...
I PII
Main progra m 08 1
P IO
...
...
...
I PII
Ma in program 08 1
..
,,,
End Interrupt
hand ling
anlzetlon blcck
...
SP IOn
inpu' 'aM.
or ,,,PP""C'J,.i,,,,,1P' 0
NO
SPIt"
Subp""""'.im"!(e" ihpullabl.
Sub nxe' i"",K' n ",,'pur ,"ble
...
SPtln
proc<Mr,"a~e
Sf'lU"
SFC 26 UPDA"f_PI
SFC 21 UPDAT_PO
The system func tion SfC 26 UPDAT_Pl
updates a subprocess image of the inputs , the
system funct ion SFC 27 UPDAT_PO updates a
subpro~css image of the o utp uts. Table 20.1
shows the parameters of these SFCs. You can
also update subprocess image 0 wilh these
SFes.
You can carry out updating of individual subprocess images by call ing these SFCs ," any
time and at any loc ation. For example, you can
define a subp rocess image for a priority cl ass (a
program execution level) and you can then
cauS e this subprocess image to be updated at
the Slan and al the end of the relevant organ iza
tion hlock when 'his priori ty clas< is processed.
Up<lating o f a process image can be interrupted
by calling a higher priority class . If an elTor
27.1
20 Main Program
<>ccu r,; during up<iatitlg of a proc ~", image. c ,g.
i:>ccau,e ~ module c~n no longer b e ac~~,>ed.
this error is reponed yia th e flu"'tion value of
The src.
Cyd .. statistics
If you have aD online connection from" programming dev ic e to an operating CPU. >d~e(
PLC ---c> JI,10DIILE lN FORMATIO~ {o call IIp a
d ia log box thm contain, " ~' nal tabs . The
"Cycle Time" tab ,how , the current cycle T im~.
as well as the >ilioncsT and longest cycl~ Time .
T:tblc 20 t
Para mct~.,.
h"'-TJ'tSt.cr_'<""""
PART
RCT
V~
FLADDR
(>
(>
>
s~"nning
("no_load
"Ie
5)FC
De.:!aration
D.", TYl><
"" "n
n
"
I
INPUT
BYTE
RETURN
OUTPUT
<NT
WOR!)
C"tlte~"",
n . ""Tiplion
~u mber of the ,ubp",)..-"" image (0 to 15)
Eaur infOTTTllitiun
On an ac,ess error: Tbe adc!ress of tho firS t
hyte to ca",. the e<ror
ground Scanning
\V,th a ppropriate ly equ ipped CP Lls . yo,", may
s pecify a minimum scan cyd e time _ Tf lhe main
program (inc!",jing interrupts) lak es less time.
the CPU waits unt il the spec itied mi nimum
scan cycle tirn~ has elapsed h efore be ginning
the next cycle by recalling OS I .
Th~
8 #1 6# 91
A fter a Cl'U restart:
I>
B# 16#92
After a h lock procc,",cd in OB 9 0 wa"
deleted or re placed:
"
B #1 6#93
After ( re)loading ofOB 90 in RU"l mode :
Background . canuin g OR 90
In the int~rva! between the actual e nd o f the
cycle and expiration o f the minimum cycle
time, the CP U executes organ ization b loc k DB
90 "Backgro und scanning" (Figure 20 .3) _ on
90 is cxttuted " in ,li~c ," , \Vben the ope rating
system c alls OR I , cxc~U1ionof OB 90 i, interrupted : it is Then resum ed at the poilll of inlerruption when OB I has lerrnin" ted , OB 90 can
be int<-rrupted after each statemenl, any sy ,\~m
[>
B#1 6#9 5
After Ihe program in OB 90 "'a" scanned
and a n e w b,,~kground ~yd e begins.
...
...
Main prO>jram OB 1
'"
"0
Contin uation
of execution
in 08 90
Start next
cycl ic execution
Backg round OS 90
Current c cletlme OB 1
PIO
! PH
...
...
Ma in program 08 1
"i',
0"'
'"
Contin ua tion
of execution
in OB 90
Ba ckground OB 90
,'.'.
.:,;..,:;,';:';::,:
Start next
cyclic execution
P IO
I Pit
08 1
275
20 Main Program
we
Ipl,o
'"
-- -
---
User progra m
Sensor sijon,,1 chang~ without
transf" , to prQc~~s~mag o
I ,>0
. --
'"
Transfar to
proce ss-tmage
I PIO
. --
User P"'llram
O UlpU!
'"
si gn~ t
chan~e
!l
~~
1:I=16i!'03 -
B# 160f()4 -
20 Main Program
Table 20.3 Paramctcni for SFC 6 RD
SFC
Parameter Name
RET VAL
TOP_S l
START UP
,EV_CLASS
,EV_NUM
,PRIORJTY
,NU>.1
_TYP2 J
.TY PI
.Zl l
_li2 3
"
S l~'FO
Decl ....ation
RETURN
OUTPUT
OUTPUT
D.ta Type
INT
STRUCT
STRUCT
BYTE
m,
om
" '
BYTE
,m
WORD
DWORD
SFC 0 SET_ClK
Set datc and time
t>
SFC I READ_CLK
Read datc and time
"
t>
Con!eDts. Dc,;criptioD
F.:mr infonnatinn
Slart information for the CurrOn! DB ("'ilh the
same strucNre os START UP ")
S"'rt information for tho last OB started,
E"ent ID and ''''~ nt clao<
Even' Dumo.r
E~ocution priority (number of tho <"""mion leve l)
OB number
!D o[sllw1emem.ry information 2_3
lD o[sllpplemem.ry infurmation I
Supplementary information I
Suppl~m.ntary information 2
20.3 f'Togram
tb~
CPU Clock
SFC
Parmnet:::r N_c
Declamtion
Dan'l)'p
Conte~l6. D_r;l>lio~
",
mT
m,UT
DT
RETURN
REnrRN
mY
Error lnfo!"Illation
TNT
Of
Error information
Date and lime (curre nt)
INT
Error informa1ion
BYTE
Operatin~ rnoo~
V~
ROT VAC
CDT
RET V~
MODE
"W"
~Unclion.
OUTPUT
RETURN
INPUT
POT
OT
CORR
iNPUI
L"IPUT
S UMMt:1I.
INPUT
llOOI.
I!-.PUT
ilOOL
RETURN
'NT
ANN_
RET
V~
L"T
Time s tat us
The time status is set whell parameterizing the
CPU with STEP 7 or w ith the SFC 100 SET_
eLKS . The time of day and the time statU.'< ean
be read using the SI'C 51 RDSYSST vi a the
system stams list (SSL_ID - W# i 6#O 132 with
IND EX W# I6#OOO8). The slaWs v<mable
includes:
p.
to>
[>-
The
v~juc
(bit 7)
p.
hour (bit
I ~)
Dc tim'd t;mo
Differe nc e f,om ba<;e time in O.5-hour inter
"ah from -24 to +26
Summerlwint.r time id.nt;fjc~tio"
CI" - s um mer tirn~)
Announcement of time ,witchover: a " 1"
indic"'e' that" ,witch is made fmm mmmcr
time to w lnter time or vice vcr,~ the ne'~'
time 'nat th~ hour change"
Error informatiOll
Time synchronization
In an automation network wi th sev<'-"ral
STM"ATTC stations exchanging dat<I with one
anot..'>.eron subners, it is possible to synchronize
the clock.<; of ~11 CPUs. You parameterize the
n
cloc k of one CPU as the "Masterciock , and ~et
Ihe interval at which the synchroniation is to
be carried out. You parameteriz e the blocks to
be synchronized as "S lave c1<><.:ks".
The synehroni'lalion can be carri ed out within
an S7 stmion over the conmlUIlication. bus
(ba ckplane bus) or between "Iation~ over the
MPI bus . This is carried out at th~ parameteri ~~,<! interval aUlmnatically wh~"Il (he master
e lock is set for th~ tlrst tim~. Jfyou set a
clock with the SFC 0 SET CLK or SFC 100
S ET_ CLKS, al l other clocks in the subnetwork
are automat ically synchronized to Ihis value.
==
20 Main Program
By calling the SFC 48 SNC_ RTCB in the mas clock, you can synchronize all slave b locks
independent of the automatic interval.
0-
0-
UDT 60 WS RULES
Rules for switching over summer/winter
time (e.g . time for switching over)
lCT
TIME#Oms to
TI!I.1E#24d2 0h31m23sM 7ms.
In th e evcnt of an overflow, the clock stans
again at 0. Newer CPU. update the 'yslcm
clock every millisecond, older S7_JOOCI' Us
every 10 milliseconds .
SFC 64 TTl\IE_TCK
Read srste m time
You can read thc current system time with system function SFC 64 TIME_ TCK. The RET_
VAL parameter contains the system time in the
TIME data fomlat .
b-
FC60LOC_ TTME
Determine local time
b-
FC 61 BT_ LT
Convert module time into local time
b-
(>
0-
FC62LT_BT
Convert local time into moduk time
FC 63 S LTTNT
Sett ime-of-day interrupt to local time
FB 60 SET_SW
Switch over summer/winter time
'"
20 .3 Program Functions
Table 20.5 Parameters uflhe SFC. for the Run_Time I>letet
.,
'"
,.
"
The range of values and the number ofron-timo
me= per CPU dcpend on the CPU, The rang e
is 16 b its (2 15_ I hours) or 32 bils (2 31_ 1
hours). When the CPU is at STOP or HOLD,
the run-1ime meter also .10pS running; wh~n Ihe
CPU is rcstallcd. the run-time m eter must be
restarted
When a run-time meter reaehe, the maximum
time d "ration , it StOp, and reports an overflow.
A run-time met ~r can b<: ,Cl to a ne w value or
reset to zew only via an SFC call ,
Thc fol lowio g system functions are a vailab le to
control a run-time meter;
D-
SFC 2 SET_RTM
Sel I 6-bit run -time meter
B# I6#01
B 1t 16 ~02
Stop meter
B#1 6#04
B#I6#05
Sol- l6#06
D-
D-
ev
'"
PV
281
20 Main I>rogram
M~moQ'
P....,.,,"~ ,
'I
III00S ' 1
Figure
20.~
12 I
t>
The y m'-'5t al l be
same restan mode:
wi th th e
t>
20 Main Program
[NT
OUTPUT
nTKT
tim.", .'" to be
a~ - 1
prionty cla"es
Interrupt"'n by 06
01 highe, p riority
IRUN .
I
I
v. tu in ,o.. SfC 71
p" . . m.
' ....
Fig",,",, 211.6
'"
Ca llin ~
O'n
s tart ' '''luest
(OS_NOa xx)
(j)
SFC780a ii
l tD
O'n
processing
includ ed in LAST_RT
(@).
L A ST RT indic ates the nl!)lime in m;""" ec onds o f the laSI co mr leled 0 13 e"ecution (ex am pl es (%) 10 @). The -'n et" runt imes arc output. lnterrur t tim es cause d by OBs wilh higher
Sl OP
a~ nOI
I
I
II I
II I II II
II
I
I I
I
I
I
I
II II
e~amples,
S FC u llin th e pr ognm nr th e 08 10 be
mCll~ ured
~E'
In......,p1lon ~ OB
of high prio rity
o,~
processi,,!!
oe~
SUrt requNt
~.Iuo.
'.
r--1
, _ __ _ __ _ _ _ _ __ _ _!Il_.L_______
,i
iI
I , ,,
II
I , I ,I I, I
I '
o'il~ni:<ati()fl
block 10 \>0
moowred
"
____
,I'
'J! I1
I'~
m~ .. urcd
I' ..
I"
Iff
j .:"'
:':
I
De
20 Main Projram
, ,
Prot..,tioo level I
(@).
CUR_T indicates the rdative lime in micro~
o nds (statuS of the counter in the operating system) o f lbe Sla" request of the OBs. "'hen - as
in the following ex .. mpln - the SFC 78 i.
called within the OB. On completion ofOB exec ulion. Ct: R_T i ..,t to zero.
CUR RT indicates Ihe effect"'e ""eculion 11mc
a fthe OB in microseconds uotil cBlhni ofSf C
7 8. After completion ofOB ex e~ution. the value in Cl,-R_RT;s trans fcm:d 10 LAST_ RT and
C UR R T is set 10 ~ero. Int~rTUpt lim~s cau~ed
b y higher priority clas...,s ftre nol included in
C UR_RT {@ andlt)).
CUR_ET ind icates the tune pe-riod from the DB
SIan rc:quc~1 to tlllling of SFC 78 in mierase<:oods. A fle-r comp l~t;on of 08 e~e<:Ulion. the
value in CUR_ET is transferred to LAS T_ET
and CUR_ET ii set to zerO. CUR_ lOT IIlso con lains Ihe ruJ1\ime~ of the higher_priority OBs
Ihat inlerrupt the OB current;y to be measun-d.
time from the ne"t DB
stan request to caJlmg of the SFC in microscc-
NEXT_RT indicale5
'"'
th~
Co
20.4 C ommunication yi a
Dis t r ib uted V O
Distributed lIO is understood to be m odules
connected over PROFIB US DP Or rROFlNET
'0.
With PROFtB US Dr, the DP maSter communicates with the DP sla vcs assigned to It OVer the
PRO FtBUS sub n etwork. With PROFINET 10,
it is the 10 controller which exchanges data
with the 10 de vi ces assigned to it over the
InduSlrial Ethernet sub neN'o rk.
Th e data tran sm issio n is carried out 'automatically", you do not need to be invol ved. You
configClre and address the d istributed VO using
the Hardware Configuration tool in a manner
similar 10 with the central modules . From the
user program. yOCl can address the inputs and
outputs in the stations of the distributed lIO just
like the inputs and outputs of the central modules.
20.4 .1 Address in g PROFmUS DP
The d istributed modules (slations, Dr slaves)
with PROFIl:IUS DP are assigned to a DP master in" manner simi la r to how the centra l modules are assigned to a CPU and controlled by it.
The DP master with all 'its" DP slaves is
20 Main I'rogmru
..tl~ otIr)
. Idd ....
(Dlllln"
__
@.
_ _-
Module< DP ......
_.
SIoto
..
/
Slot ~
"M
;;B~
""VIo1u8I" .kot
(not pI"l)....,.,. ",,;0''''')
SIolO_..",,,, _
1020 Sla!icn
101 9 '
,,~
E837
'" .,.,
"'",
.,.,
""""Io" ".1klI!
In ..""" modui<>
1M).
"',,_.
A8 506 00& .. 0
AB~!
B\"U \
00
"'.Y)
"r
a d dress..
The ",,,,Ilest logical ad d,ess of a module or station is the mooulc starting address (sec also
C hapler lA, "Module Addresses").
Dia::nostic,; addu ..
Modules an d stations which can deli ver d iagnostics data and d o not h ave a u ser dats address
themselves are identified by the diagnostics
address. The diagn"sties add..,,. occnpics one
byte ofIlO input in th e logical addre " .." lum e .
In the d eb ult sening, STEP 7 as,igns the diag nostics addro" starting w ith the high~ ,t address
in the 110 "re~ of the CPU. You can change Iheo
diagnostics addr,,"s. Th~ addre" overview io
the Hardwm... Configuration tool identifk, the
diagnostics addre ss by a star.
Signal mod ules or u'~r data areas in \he t",ru;f~"T
m~mory of intellig~nt DP slave, ha"e logi~al
addresses, also for scanning d iagnostics data.
Thc complete station delin"Tll its d iagnostics
data via one diagnostics addres, which is
"",i;;n~d to virtual ,lot O. With modu lar and
intelligent op s laves, the bus interface can
del iver it' d iagnostics data v ia the diagno>lics
address oislot 2.
'1l"'-
scano ed using system b locks . The system TImetion SFC 13 nPNRM DG is " v"ila bl~ for this
with conventional 01' >tandard s laves. The SFC
S9 RD_REC is used w;\h OP S7 slaves in orde r
to read the data record OS 1 w ith the diagnostic .
data. DrYI s lav es a.., able to provide more
eompreh~n,ive d iagnost ics data wh ich can be
rcad with th e system filllction block srn 52
KDREC. Th e modules are addressed by m~an"
of the logi cal module starting addr~ss of th~
user data or by means of th e d iag no",ics
addresses.
Transfer me m ory o n in telligent DP .Ia,cs
In the cas e of eornp",:1 and modular DP sla.ves.
the addr~ sse s of \he inP <llS an d OUtpnts are
locat~d together w ith the addresse, for tbe cen!nil modules in the address volume ufthe mal<ter CPU. In the ea , e of intcllig~ m ,Ia,cs, the
maste r CPU has no direct ae~eSS to the input!
output m odules of the UP sl ave. Every imelli gem Dr slave therefore has a tra n.fer m emory
whosc size depends on the CPU used. TIle
transfer memory can be divided into several
areas of di fferent len~>th and dam ~onsiSlcney.
The indivi dua l areas then respond like modules
whose lowest address i~ th c module starting
address. From the viewpoint of the master
CPU, the intclligem DP . lave then appears as a
compact or mod,, 11lC 01' s lave. dcpt.."Ilding on
the division (Figure 20. I 0).
\Vh~ n configuring thc slavc, you ~an configure
the individual areas of th~ !nmsf~r memory as
inp ut,; or outputs wi th the "module starting
address" and the area length. Exception; if the
CI' 342-5 01' provide s the DP interfac~ tor the
intelli gent slave, the divi sion of its transfer
memory is only configur~d when coopling to
the DP ma ster system . The addresses o f the
transfe r m emory must not overlap with tho.e of
th~ eentrol m odules in the intclligent DP slave.
Tf the addrcsse, are present in the process
image . the areas can b e handled by the o,cr program l ik~ inputs and outpUI:l, o\hcrw isc Hke
periphcral inputs and outputs. If the s lave C PlJ
possesses panial pro<:ess image . you can
assign a partial process image to each area.
20 Main l'ropm
Mu~'
CPU ((1120Pf
CP m..
t.,
--.
;" IhrI
.wit~the
..
<l> -,~-:-.
_algent OP ...""
LL.. \
OPIro_
819>'
1$381 '
SIo"UI/IIIOn
8189'
1&380'
Bu.in>:o<f_
8188'
'
"
I ::r-'"
I,
"""llIg.nt OP I I.""
"""" wrtrl _
.d<I,Mse.
SI.,.. CPU jJ14(:2 0P
---
OPin_
The...." .."""."
inlhrlslaYeCPU
L_ "'"~~'"','-,~;.".".""""",-",~",-,-,I ;:J
Mo~ul . ,
OP .ro ....
L______J---"*'"
OP~
1~75'
r,
S\o lIIIon
..
addresse_
- _ uI> {_
~-"'"
1bo
"n.
c?\.).
...-
1_ . -1... _ - , -
"""'""lOt
---_......_.
.,,-,-~
F----~----..Ii
""
The _
... iJlM> urrl"o 100" Jio;ooon
_ ... wlti,h ..... in .... ob,o;:t _ n i .. ~I"" .... ,;on
in th. "Moo." ",b (rIoob!< '1I<k 110< "lW' Ii"" i. tiro
.II,-.UU).
r ... ___ _
.~
- -"...
- .-'-:;'~=:
__
----~.
~-
20.4
B 05
system
\. _~I!~_
Int~,r,,,;,,
"_""~~~:;::::,"~'~':;I~I. _ 01DiagDPnostic.
add ... "
{ntarfaoe
Tran.f. rmGmory
'"
Communi~at ion
(lOOP m.aot&r)
DP "aU""
~~===~~2F: Dia~noslic"
0/
add","
of bu. ir.tillfOC8
(oJav. C P U )
UO<Irdata . "'."
".wof
'"
20 Main Program
SFC 7 DP_PRAL, and a diagnostics or process
interrupt in the master CPU using the SFB 75
SALRM.
20.4.2 Configuring PROFIBU5 DP
General procedure
You configure ilie distrib uted I/O on the
rRO F1BUS DP in essentially the same way as
the centralized modules. Instead of arranging
modules in a mounting rack. you a"ign DP Stations (PROHBUS nodes) to a Dr master system. The following order is recommended for
ilie necessary actions'
I) Creale a new projec t or open an existing
one wiili the 51MATIC Manager.
2) Create a PRO FlBU5 subnetv.. ork in ilie
292
drag th e relevant icon (in th~ hardware catalog under "PROflBUS DP" and '"Already
configured stations') with the mouse 10 the
DP master system.
Open the icon and assign the already configured DP . lave e'Connect"), assign a
node address and configure lhe user data
interface from the viewpoint of the DP mas_
ter (or from the viewpoint of the cemral
rna~ter CPU). Proceed in the same way with
every int.llig~nt DP slave.
8} Sa"e and compile all stations. The DP mas_
ter system is now configured . You can now
supplement Ihe configuration with centra'ized modu les Or with further Dr slaves.
[/0
cons ; st=~y
co mp a~t
DP , Ian'.
20 Main I'rogJ1lI'l
"pitcked~
I>
I>
to a "pacKed"
For thi~ reason. a d iagno;;\k, address is assigned for thJ.s module (iodicaled
by italic. and &. star III the oonfiglffillion table). You can ~ceive intenupt infonnation
.... de' thIs add~.
addres~.
I>
"Pack add...,ues" an<l "loservn:rnov~ module intcrropt- arc mutually cxc 1m i,-e.
,9<
addres5C5.
The addreSS<'.
-"~~-.~
11"_.. '
,- ,,-
--.
-.-
I~'
....
jop
ie-
"
"
I>I-.-~~
.oj
10
...,
1"'-
f-." ""'"
""
_090
I'
I '~'
I"
"I
.
--._....- ,
~-
_ .,
~--
"-
--
11
, . .. R
"
'"
"
"
FIgure 20 .11 Configuring the Tromfer Memory of an ImeHigent Slave "';th Im.gml DP Interface
a.
EDIT ----> OBJECT PROPERTIES in the case ofa selected interface X I, or double-dick the MPU
DP interface to open the Prop~nie, window. On
the "G~neral" tab. selcct PROFIB US as thc interface, and in the Propcni es window of the
PROflBUS interface select the Slation ad~ss
and the PROFIBUS subnct . If the PROFIBUS
'"
20 Main Program
In the ~ o f Ihe 1M 1$4.8 CPU, yoo ean di
vide Ihe enlin: transf.. r mfll'lo1')' imo I lOlal of
32 addn: ,9 . n: as thaI you can ace ..... $oCpBralely.
Such an address a...,a cln be up 10 32 bytes in
size. Th e entire transfer memory can enComp;l8s up 10 244 input addresses and 244 OUtpul
addn:llse8.
The loully defIned addn:nt'S are wilhin Ihe addre.~ vo lume of the ET200pro CPU. These add..., sseJ musl nol o verlap uddresses of The cen
Iml or di~tributed modules in Ihe ETIOOpro 'Ia lion. The luwest ad<IrI:!.:I of an address 1n:3 is
the " module 5tarting address".
Further COnfIguralion of the ETIOOpro sliltion
is carried Out in the same ,,"ay as that for an S7300 stalio n wilh fixed slol addressing. You can
o nl y arrange Ihe modulel Ihal can be found in
the hardware catalog undu l\.lI54-8 CJ>I;.
You terminale confilluration of the inlelhlletlt
OP slave wilh STAno,," ~ SAVE M.'D COMPILE.
ConllC<,:linlllhe intellia;ent DP slave inlO Ihe 01'
ma.sler system is de.cribe<! below.
Conflllll ring I n IMI$I!CP (; ..
an Inteiligeni DP sl t
If you Wa nt 10 generate an 1"2ooS as an inte llige nt D P $I ave, flISt insert a SIMATlC 300 ~Ia
lio n under the proj""t in tbe SIMATIC Manager
and open the Ha,rI...arfl object.
Now dnlg the obj"'" IM/JI/CPU umkr
"PRO FIBUS 01'" and "ET200S" in the liardware Ca1alog to the free window or seleci it by
doubl e-~Ii~k ing on il.
If the 1M I 5 IIC I'U does not bave an ).11'1 jnlerface.the attributes window oflbe DP interface
is displayed. SeleCI the node Bddress hen: and
the PR OFtl.lUS mbnelWQ1'k (or generate onc
and assign il \() the 01' interface).
You will iICe a confiiUT8lion table like the ooe
for a S IMATIC 300 ~talion. The inteHillenl 1).1
15 1 of the ET200S station is present be",
instead oflhe CPU .
Double-clicking on the lVl 151 Hne o~ns the
window for \he 1M pro~rtics; double-clieking
on the DP interface opens the propcTlles "'indow of the interface. If you have not already
done so, 'el the node addresses and the PROFI -
".
CP 342-5DP as DP slave
You open the properties shect by dragging to
the DP master system Or by d<Jublc-dicking on
the DP slave. The slaves alftady con fi gure{! for
20 Main J>roaram
Conngu ri ng
Ih~
With a $elected DPIDP coupler. the configuralion tablc for the t"'!!.'i fer memory appears.
Now "Coon.,.,t" the desirt'd modules listed in
the hardware calnlog under DP/DP coupler into
the configuration table. without gaps and s1arting u\ SlOt I. You ~an set tbc universal module
to the desin:d number of inputs and outpUts.
The uscr data addresses tha! you spedfy in the
module propenic! are in the addro:ss are. of the
opened Dr master CPU .
Configure lhe seond pan ofthc DPUP coupler
in lhe .same way. The structtIfl' of tbe tfamfer
memory must agree with that of the first part.
Please note that inputs on one side are outputS
on the other side. and vice VcrM. The addresses
in bolh parts of the DPIDP coupler arc oriented
to the address assignments of the relevant mas
ter CPU and can differ from each olher.
Configuring t he DP/AS-; lin k
You eonfi auTc lhe DP/ AS-Interfaee link like.
modular DP slave_ Yon will find th~ moduks
that yoo can drag 10 the DP master system.
such as the DP/AS-i link 20 below. in the hard
W8n' catalog under "PROFlliUS 01''' and ';DP
ASi", Then yoo set the propcnie! of !he DP
section aod configure the AS-i sla,es dcp<.:odina on the link on the propenics shel'! o r
in the configuration tabie_
The AS; master sy5lem with the ASi sl."es is
not displayed as a subne. by the hardware confiiUTRt;on.
'"
VP/ASj Link 20
"Drag'" the Dr AS; Link 20 from the hard""arc
cataloa to tbe bar ofthc PROFlBUS DP master
system. In the displayed windows. define fiTSt
the pn:SCt configuration ( 16 or 20 bytes), and
!hen Ihe node addre", .
On the DP/A S-i link 21), you eRn define 16
bytes of inputs/outputs as the selpoim configu_
ration. with an addi1ional 4 bytes for control
conunands . In the latter case. the lower s""tion
of the windo,,' in the Hardware Configuration
suggests 16 bytes of u.ser data with addressc5 in
the process image and 4 bytes of comman<ll
with addresses from, c.g. S12.
Sel""t the DP slave and then EDIT --+ OBJECT
PROPERTIES, or double--click on the DP slave, to
opcn a window in which you Can ehanae Ihe
addresses suggested by the Hardware Confign_
ration and also set Ihe subprocess image. provided you have a suitable CPU.
Select the DP slave and then EOlT --+ OIIJECT
PP.OPER TIES, or doublc--click on the Dr slave. to
open Ihe slavc propenics window. On the
"Parameterize" tab. you set lhe parameters of
the ASi slavC'S. with 4 blls for each slave.
DP 'AS-i Link Ad"anced
"Drag" the DP AS-i Link Advanced - e.g. the
double rnast~ 6GKI 41S-213A20 _ from the
hardware catalog to !he bar of the PROFlliUS
DP master system. [n th.., displayed window. set
the propenics of the PROFIBUS inK.,.face. A
~onfigurntion I8ble with the AS-i inlerfaces and
AS-i slaves for the two masters appears_
Now selthe address area under which you want
to access the ASi slaves from the user proilfMll.
EDIT ... OBJECT PROPERTIES with a se lected
AS-i master interface (in the COnfiguralion table), or double-click on the master hne to open
the propenic-s dialog. On the "Diaital Addresses" mh. set the start address and lhe area lengths
reserved for inputs lIDd ootputs. This tab also
eontD.Jru the "Pack llIld "Son huttoM with
"lUch you can optimize the ad<ircss aSlli gnments after yoo ha'-e coofia;ured the AS-i
sla\cs.
H
20.4 CommunicauOll
ViM
lJi'lJibuted IK>
-'._':,=~=::;~~::::r'~'~'~'~=====::~n
II_ ~
:I
Ill_ I, ,. 3
e-o '
~-
~-.-
--
r ll'--~""""''''''
.... R_"'.....
-,
_ F""
"0.0 , ."
Gsn tIIn
You can "post ;nstal!" DP slaves that arc 001
included in the modulI' Cala]og. FOT this purposI'. you requi...., Ihe type file taIlored to the
sla~'e (O SO file. General Station Description.
device database file). From GSO ,'enion 3
onwards, DP slaves in.talled w,lh a GS O file
,uppon Ihe DPV I functionality. Sele\:\
OPTIONS -I> INSTALL GSD FILS in the Hardware Configuration and specify the directory of
Ihe aSD file or another STEP 7 project in the
window thllt ..ppears. STEP 7 accepts Ihe GSD
file and displ ays Ibe slave in thc hardware catalog under "PROFIDUS DP" and "Addil;onal
Field Devices-',
SYNClFR[Zl: grollps
""
20 Main Program
rent input signal s!ates simu ltaneously (syn
ehronous ly). in order to allow them to be then
fetcbed cyclically by the OP master. The
UNSYNC and UNFREEZE control command,
revoke the effect of SYNC and FRE EZ.E
respectively,
It is a requirement that the OP ma<1er and the
-,
0_
- 1
p~
r_~
-.._,-,
I,
13
-,
-,
p~
p~
i''''''
"
, ,
'" ""EZE
"-=
p ~
p ~=
F7 "'0;:
rv
P .n.C
'" "''''''"
.,., .
~~~
~
""IZr
"'"
~x
~~~~~
13
Di~tributcd
1/0
Eq,,;d;u,mce
Normally_ the OP maSler control tllc or $lay1.'8
IJsia;ned 10 it cyclically without a pause. With
S 7 Communication, such as when the PTOIo'Tllmmma deyice executes modify function!! yis the
PROFIBUS subnety..ork.. this ellll ",suit in
""riations in the time intervals. If, for example.
tile outputs arc 10 be modified yia DP slaves at
a regular inter>'al, you can SCI cOllStant bus
cycles with the "PP'op, iately equipped DP
muter. For this purpose. tbe DP master must he
the only Class 1 maslo.--r on the PROFI8US subnetwork. Constant bus cycle time behavior is
po .. ible with the bu. profiles "or " lind "UserDefined" . The PROF!BUS subtle1 ,"US1 not be
project-wide and no IT ~ystCtn or Ci R (Config_
uration in Run) object may be connected.
If you conftgUre SYNC!FREEZ E gmups in
addition to Ihe constant bus cycle time, pleas.:
nOle the fonowing:
:>
Co
'"
20 Main Program
time if you have a lready configured slaves
for group 8.
Isochronous mode
Reference is mOOe to isoxhrone mode if a program is cx,..;uted in synchronism with the
PROFIBUS DP cycle. In conjunction with constant bus cycle times. this results in reproducible response times of equal length to the 110
that include distributed signal acquisition. signa l transfer via PROflBUS and program execution including proxc.s image updating. The
user program executed in i'oxhrone mode is
present in the organization b loxks OB 61 to OB
64. The system functions SFC 126 SYNC_PI
and SFC 127 SYNC_ PO are available for
updating of the process image in isochronous
mode (see Chapter 21 8. "Synchronous Cycle
Inturrupts).
Figure 20 .14 shows the timen; involved in isochronous mode. is the lime required for re ading in the process values. It contains the execution time in the input modules or electron ics
modules. and, in the case of modular DP slaves.
the tr~ru;fer time on the backplane bus. At the
end of 11, the input information for tnmsfer using !he global control command is avai lable.
Then the equidistance time begins. It is the time
betw""n two global contro l commands and cncompasses the transfer 10 the subnet as well as
the execution of the isochronous interrupt OB .
-----
To is tbe time required for outpUlling the pro cess values. It begins ""1th the globalcontrol
command and comprises the transfer time on
!he ",bnet as well as the proxessing time in the
output modules or electronics modules. In the
case of modular Dj> sla"es, tbe transfer time on
the back--plane bus is also added. The re sponse
time in the case ofisoxhronous mode is the tOlal
of the limes n, equidi,tance time and To.
Correspondingly dcsigned OP ,laves allow a
reduction in the response time thanks to overlapping iso,'hronous mode. This involves overlappin g updating of the inp ut and OUlput signals
(overlapping of 11 and To). In this case, you
must deactivate tbe cbeckbox "Times Ti and To
ideotkal for all sla'-es ' 00 the "Equidistance"
tab , and enter the individual rimes for the participating modulcs. If isoxhronous modules
have both inputS and outputs. overlapping of
and To is Dot possible .
tsochronous mod" os
---
---
Matn program
0'
---
---
\ OC
GO
-- -- ---- -
\1
I
SlaY<!
11
--
ISta"e 0
Cyclic
data transmission
Acyclic
Acyclic
services
ISlave n
Reserv&ci for
equidisrance
Output
Input
"
DP cyet. tima
'0
- - - ------
2 0. 14 Re.poru;. Time with Iwchrone Mode ond Con"ant Bus Cycle Times
Output at the
modu le termtn al
20.4
r-T.....
, .., ' -"'0
""'
__
= ...
-,~
<><-
J I --
o,'ervi ~w
of DP ,Ian pWp"r1ies
EDn -4 ISOCIiRONE MODE g ives you an overview of all componenls involved in isochro-
20 Main Program
_odd,...
ure 20.16) .
i\lAC addr....
S'<)\ 0 "'0rM6nlS
\
02 ( ~.
"
-'-"r~'
eemplo,. ,"'on
tr~
""M'toce.
~_.__
e,M'
~~,
X~ .'" !II_
Pf>.ro"" """"
D","oo nu"'''',
(ato;""
,!
n"mb~~
' 'Skl!OX,
Lov''''' odd,n
.
aocr,,,,")
(""'" <lata
(~"")
S ~ot
~SIot2
,
r Sio! ,
ct''''
;CpuI 01
D;,;:toI 00'''''' DO
va
Figure 20.17
Exomp l ~
Supplementary to the device name. the HardWare Configuration also assigns a dC";ce number to each TO device which is independent of
the IP address and which you can change. You
can usc Ihis device number (station number) to
address the TO device from Ihe user program,
e.g. as an aemal parameter on a system block..
G col:raphicaT address
siSls of three bytes with the vendor ;dentifica.
tion and three bytes with the devic e identification. The MAC address is usual ly printed On the
device, and is assigned to it during the configu_
ration procedure (ifnOl alre~dy done in the fac
tory).
lP addO'",
Each node On the Industrial Ethernet subnet work which uses the TCPITP protocol requires
an 11' address. The IP addr~ ss must be unambiguou. on the subnetwork. It is a"igned once to
the 10 ~ontroller for the nodes ofa PROF1NET
IO system. Basedon Ihis. the Hardware Config uration assigns Ihe 11' addresses to Ihe 10
devicn in a,cending order.
The IP addres, i, four bytes long, each being
separated by a dol. Each byte is represent~d as
a decimal number from 0 to 255.
Th~ II' addr~ss comprises the address of the
subnetwork and the address of the node. The
s ubnctwork mask defmes the share oflhe network address in the 11' address. Like the lP
address. it consists of four bytes whieh can
assume a value of255 or O. Those bytes with a
value of2.5S in the subnCt\<-'ork mask defme the
subnetwork address. Ihe byte. with a value of 0
define th~ node address (F igure 20.17).
numb~r
;0'
ST,,-nO~S
ON THI!
S1..'B'TI.
eo n troU ~r
OWECT PROPERTIES;
.~-
,_
.1_
x,
"
c-._ !
Flwu~
20.18 Conliguri0H tho PK/P:-I couplo:r, Connection ""d cluro"<Ie, i,tlc, of tbo tTan.fo:r in1o:rface
20 Main Program
30~
transfer:
(>
t>
User data (inputloutput information) is ex ch ange d e)'cli~ al1y between the 10 ~ontrol
ler and the 10 device (r~ al-lime RT) within
a deti ned tim~ p<:riod - tb~ update time.
'>
A pcrrmmcnt commU1l1Cal!01l channel is re,erv~d on the Ethernet subnet for IRT COffilllU'
nica\iol1. RT corrununic"tion - cycl ic data ex change bcn.vecn thc 10 controller a nd 10 devices - and nonreal_time TCPIlP communication
take place ill parallel within the update time. In
th i. way, all three conununicmion lypeS can c xist in parall cl on the s ame subnel.
20 Main Program
Stnd
~yde
time/updau time
Cycl ic data exchange is handled within a speci lk time frame, th e send cycle time. STEP 7
caJculal~s the send cy~le I1me from me configu ration infonnation on the PROFINET 10 systern. T'hesend cycle time is the ~hon= possible
u pdate time. This is tlw tim~ p...""'Tiod widun
which each 10 device in the 10 system ha~ exIlhanged it. user data with the 10 controller. 111<:
actual update time for an [0 device can be a
multiple o f the send cycle time. You can incrense the update lim e manually. in order to!"Cduell the hus load. for example
'''Il update ti me;$ the same length focall 10 devices in me 10 system as <tlJldard. Under cerlain cin:umSlances. you can reduce the update
lime f"" individual 10 devices if y{)\1 increase
the lime for other devices wbose u~er data Can
be eXllhanged non-lime_critlcally.
You can configure the send cycle time (without
IRT conununication) centrally in the Properties
dial og box ofthc PN imerfaee on tbe PROF!NEr' tab, or in the Propertiel dialog box of the
PROF[NET 10 sy~tel11 on the "Update time"
"".
This tab also IislS the [0 dc,ices with Ihe liPdM~ times. You can lncreas~ Ihe time for an 10
device by .dc ~ling it and clic king on the "Ed,,'
hunon. or you can sel th e lime in the Properties
dinlug box of the 10 de"ice On the "10 cycle"
lab .
In addition to tho: upda!C~ time. ~ou can j("[ the
watchdog timer in thc device properties. This I~
the produci of the update limo: and the Xumber
of accepled updale cycles ",ith missing 10 dala '.,
If Ihere is at least one synchronized d~vice in
thll 10 syslem, th e send cycle time is determined by the .ync master of the sync domain
and C311 only be modified in the properties of
the sync domain, Select tbe [0 system in the
Hardware Confii\lT8tion or thc subnet in the
Nctwork Configuration, Schect EDIT .....
I'ROF INET 10 ...." DoMIUN MA ....AGnIENT. It
can tben no longer be modified at another localion.
'"
Real time
Rca l time ( RT) means that a syStem processes
extemal events wilhin a defined time. If il re_
sponds p~ictabIy. il is called deterministic. In
RT communication. transfcr takes place 01 a
SpeCIfic limc (send cycle time) Wilhill a dcfined
interval (upllarc time). PROF~ET 10 allows
Ihc use o f nanda. ."d IlIlN,ork components for RT
communication.
t>
20,)9).
To create a new sync domain. ,elect Ihe PROF!NET 10 ,ySlem in the Hardware Configurat ion
orlhe subnet;n the Network Configuralion. and
select EDIT ..... PROFrNET [0 ..... DOMAIN
MIINIIGIlMU-'T. "The "Domain Managcment"
window that appears shows the sync domain
syncdo",ain-defrwll aod all 10 systems on the
same suboet that arc located in the sync domain.
Create a neW sync domain with the "New" bUIton, a<sign a name, and select an 10 system
wilh the "Add" bulton. lfyou wam 10 add further 10 systems, repeal the procedure. 10 systems added to the newsync domain are no long-
3I1
'-' __
rl,"_iO-----c~,.
'.1
312
Th" wble .'Iew sho" he port pairs of all configured acti'e and passive compoDentS iD thc
in.erconnections table With fihCT selling . you
can dIsplay an pons. or only w inle~nnected
pons. or only the nOIlinterconnected ports
(figure 20 ,20) ,
You cnn Sel the connec li on to the partner port in
the objec t proptnifl o f llle pon. You can clear
<Iown aD in.enwnnlion hy ..-Iectina .he port
and riah1-clid,ing on D1SCO:>'N"Ecr PORT I:-.TER_
CO"'~~CTJO.'I
''''- 1-
- 1-- -1
--
... '---
- .-~ ~
Figu..., 20.20 Tabular and graphical vicw ,,1' the TopoloaY '[.d itor
To facilitate editing, you can "dose " the rcpresentatioll uf ~he stations, hid<: the thllffihnai 1an d
the ca.alog of the passive components ("Options" hutton and "Option,., tab), a"d cnla1"gc or
red""e the view by .crolling wi th the m idd le
mouse key.
Il,"TFllCO"N ~C TlON.
On the Offline/ O"line comparison tab, the topology ~onfigured otl:1ine is shown alongside
th" topology dCkrmin<:"d online tor compari!<On
purposes. Alllhe stalions and modules are displayed ...- i\h !hcir ports. rele"ant partner port
and cable dala. In this way, you can ch~'Ck the
configumtioll w ith the connections and cableS.
and supplement missing 'ystem compon~"ts if
Tcquired.
A ,election can be made with the relevam fi ller
se tting, . In the overviews the d~Knnined dift" .. enccs, c.g. the module" that the Topolog y
E dilor conld nOt assign, are highlighted ill color. You can now undertake manual assignment.
313
20 Main Pwgtarn
2 0.4.7 S}'ste m Blocks fo r Distribut ed lIO
t>
You c an use the following b locks in C<Jnj unction w ith the distribu ted lIO,
SFC 11 DP SYN_F R
Send SYNC/FREZ command s
t>
SFC 12 D- ACT - D P
Activate/deactivate distributed station
t>
SFC 13 D PNRM_ DG
Read diagnostics data from a DP standard
.Ian,
:>
t>
>
FB 20 G ETIO
> FB 2 1 SET IO
Write to all outputs of a station
0
FB 22 G ET IO]A
Read so me inputs of a station
FB 23 SET IO PA
Write to some outputs o f a stati on
SF B 75 SALRM
In itiate interrupt
",,,,",,,,,,c",,,.,,,,,,,
Writ~
t>
us er data
in
th~ANY
nicarion Bloc/es.
You Can usc all listw system blocks with
PROf"lBUS 01', me system functions SFC 12.
SFC 14 RJld SFC I ~ ~rc SUItable for PR.OFINET
10. In order to read diallOostics data with
pROFlNET 10, u,;c the SFB 54 RALRM .
With lJPVI mode sct and DP 5]avcs ..... hieh support Ihe DPVl functionality. you can USc other
syllem bloch [0 paramClenze Rnd read the
diagnoone data (S<."C Chapters 11 .9.3. "Reading
additional Interrupt Infonnation" al>(! 22.S.
"Para~terizing Modulc$'.
t' 8 20
I/O
w.
The source area specified with the OlITPUTS
parameter mUSI be exactly the same lengl~ all
me ~onfigure<l length or the OUtpul area to be
wnnen 10. This is why infonnat;on in the LION
parameter is im::k"ant.
G~:TIO
Oi~lribu[ffi
10.10
Par.tm~'"
FH 22 GETIO pA
Read ~Om~ Input. of a .Iallon
FB 21 GEnO~PA usc. SFC HI UBLKM OV to
consiSM1I\Y read some or the input data or
SOIne of the data of an inpul area of a DP mlDdud slave or an 10 dcvice in thc c~ ofmodular $tal;onS. The righI_hand word o f the ID pa-
'T~II>I<
lO.t1 Parameters
fDl" SFC.
.,
,,
.,
,.
rqIC.,....
'"
S FB ?S SAt.R."
ber of tbe first byte to be read , lIOd the LEN parametcrcontainsthe nUIl'1bcr of byte,
The input bytes In be read m"-~I be addrcsSw. in
the pro<:e$s image of lhe input in order 10 usc
the FB 22 GETlO_PA. Ifpossib1c. it is prtfmt
ble 10 usc a partial process image. Plea~ CTlsure
that the OFFSET lUld LEN paramclcn do nol
violate any bound~ries with n~illhboring d~ta of
otber ~lations.
Use the AI\lfO paramel<:T to \J1Inlfcr supplementary interrupt information which you ha,'e
Ii( fined and which caD b<: evalnaled in the interNp! 09 of the master CPU. The reference to
Ai'-l'O i, Il.~an A/'."Y poi-ntertoa data arcll. The
length orlhe sent informalion is defined by the
LEN p"'lImcter and by the area lenllth nf the
AXY poimer (the shorter length i~ de<:i~ive).
The first 4 bytcs ~ displ.yed in the start information of the interrupt OB in the ma~tC'f CPU in
byte,; ~ to II (the vatiabk OHxx_POr~T_
ADDR for process interrupts, lhe data record
DS 0 r"r the dillgno5lic imerrupt). The complete supplementary interrupt infonnation ClIn
be read in the master CPU using SF IJ S4
RALRM.
S f C 7 DP _PRAL
Ini tiat e a prucc.. ln ttrrupt
With SFC 7 OP_PRAL. you initiate a pro<.:eu
inrerrupl in tbe OP rna",r associated with an
20 Main Program
intelligent slave from the ">SCI" program oflhat
slave.
At the paNimeter AL_INFO you transfcr Bn
interrupl 10 defined by you that tS traIlsfeITed to
the Slart information of the int~rrupt OB called
in the 01' master (variable OB",,_pOI}/T_
AOO R). The imenup. request is initia.ed with
REQ _ "I"; .he paramcll;~ RET VAL lind
BUS Y indica ., the job status. The job is complete whe n the interrupl 08 in the OP mllstcr
has been e xe.:uted.
The transfer memory heTween the DI' master
and the intelligent 01' sl.,e can he di\"ided intO
indi\"id ual add...,ss areas that represem individual modu les from the vie ...."J>Oim of the master
CI'U. The lowes t address of an address """a is
SfC 11 DfSYN_ FR
Sy;o;C/t""REEZE comm a nd.
~nd
With SFC 11 DPSYN_FR, you srnd the commands SYNC, UNSYNC, FREEZE and
UNF REEZE to a SYNC/fREEZE i'OOp that
yOll have configllred with the Hardwa~ Configuration. The SE!'-.'D is initiated wim REQ " I " and i$ completed when BUSY - '-0- is signaled,
In the paramet ~r GROUP ncb group occupies
one bi t (fro m bit 0 - group I to b it 7 -afOUp 8).
Tbe commands in the parameter MODE are
also organized by bit:
<> UNFREEZE. ifbi! 2 - "I"
t>
FR EEZE, if b it 3 - 'T'
t>
UNSYNC,ifbit4-"\"
t>
S FC 12 D_ACT_ DP
Act h 'a tud ea ct! \"Ile d lstrlbut.. d UlOlLo n
SfC 11 O_ACT_DP deacli'll.tes and activates
o f the distributed UO and allow. sc anning of the deactivated or activated StatuS. A
distributed station can be a OP sl,,'e or an 10
device.
~talions
SFC 12 0 _ACT_ DP;I called in the cyclic prognl1n: callin g in the !"estLUt TOutme is not suppnMcd. The SFC operateS in asyn~hronous
mode. i.e. processina of a job can ext~Dd over
sC\eral program cycles. A "1'" at tbe REQ
parameter stlllU an acttvation or duCti~1ItiOD
job. As loug as the B1.:SY pammeter is '"I", ,be
REQ
~en
the call.
S FC 14 DPR D_DAT
Read use r dala
SFC 14 DPRD _OAT reads consistent u_ dala
with a le1li1h of 3 bytes or greater titan 4 byteS
from a DP slav~ or an 10 devicc. You specify
the l~ni!h of th. data consistency when ),ou
pa1'1lmeterize Ih. 'Iation,
Th~
SFC IS OP\VR_DAT
\\'rll",
u~r
dala
SFC 13 DPI\IR:\! DC
Read dlagno. tlc data
in the data.
20 Main Program
5tMATIC 51.t8lioo
Glbal data table
:. FI : I
u.."
CycIU: "...
~ ra t l ","
:J
20.5,1 Fundamentals
Global data communication (GO communi cation) i, a co mmunications s t t'\i cc integrated
ioto Ihe operating system of the CPU and used
for exchanging small volumes ofnon-time-eritkal dala via the MPJ bus. The lnIn, ferab l" glo
bal data include
t>
t>
Memory hilS
t>
5tMATtC 51 st.atlon
oe"
Cydl~ :
.,.
-:j
.. .. =
60161
GloOooI
-"""'.,"
..
..
Subn
,~nt.
<I.'. tab<o
':;;::,.' _._." : I tI
PfOI1f3rt'1
\IS<t<" ~O\j,am
..,""'m trarlr..fS
u .~,
--
,eo
.,.
l..
_ $," 11"_
-""
do", ",1U""" U_
Pf'O\Iram
.lo----j
20 .5 Global Data
It is a requirement that the CPUs atc networked
GO drcl e
[>
[>
GD packet
A GO packet comprises Ihe pach1 hca<k-r and
one ot more gl obal data elements (GD elements):
[>
:>
[>
:>
[>
:>
Each GD element consists of2 bytes of de scription and the a ctual net data. 3 bytes are required
CPU 31-1
Comm uni~alion
20 Mllin Program
in the GD packet \0 tran8f~r B m~mory byte. 4
bytes B' requi,d for B memory word, and 6
bytes for a memory doubleword . A Boolean
variable o<oeupi~s I byte of net dala; it therefo~
rcqui,s the same space as a byte+sized "arlttble. Timer and counter valuei wltb 2 bytcs
eacb occupy 4 bytes each in the GD packet.
A G O clement can .lso be an address arca.
MB 0:15, fo r example. rt'Jlrellents the a,a
from memo ry byte MB 0 to MB 15, and
D B20.DBW I4:8 represents the data area
located in DB 20 lbat .tart!! from data word
DIlW 14 and comprises 8 data words.
The maximum .ize o f a G O packet is 32 byte~
on lite S7-300 and 64 bytes on the S7-400. TI:.r
maximum nwnbcr of net data byte, per packet
is reacbed with tlte transfer of on 1)' one GO element that cODlaifl!l up to 22 bytes on the S7-300
and up 10 54 byte!! on the S7-400.
Oat.
con.j.t~ncy
i' ..~----------- Up
Requi rement.
You must bave created a project. th".,.., must M
/I.I PI subneM'ork IVlilable and you must
ha~e configured the S7 st,tiOttll. The CPu. Bt
least. must be a vailable in the stations. Under
the "l'Topertie," b ulton of the MPI interface. on
the "General"' tab of the properties window of
t~e CPU (double-di ck on th e CPU line in the
Hardware Configuration or o n the line Wilh the
MPI interface submodul c), you can ,et the MP[
Id<ln:$, and select the MP[ subnetwork with
which rhe CPU is COlIDected.
811
Gl obal da t. tlIble
You configure G O cOlDmUllicatioll by tillillK
ou t a table. With the icon for the MPI subnct"W ork scl~ ct~d in thc SIM AT! C Manager or in
t~e Network Conflgurotlon. you can call up an
emplY table witb OPT10-';S ...... DEFL'lE GLOBAL
OATA. Select the 51allon in the left half of tbc
project selcctioll window that rhen opens. alld
to 15 CPU," ------------,~
."
GO circle 1
GO circle 2
GO cirdo 3
GO cItde 4
Hp&Wlll
,,
Hp"cke!l ~
~pacl<.t 2H
,,
,
,
Hp~tr-:
"
'.
p,"ek6t ' I
..
~'
i
i.
Ipacket3H
,,
umM.
To config ......., data transfer octwecn CPUs.
scl~cI llIe first line under Ibe send CPU and
sp<:<.:i fy the add",,!! .... hose value is to be tranSfcm:d (terminate wllh RETUR:,").
GO 10
fQllowing error-free compiling, ST EP 7 completes the "G D I D" ~Qlumn. The GO ID shows
you bo" Ihc transferred dOli arc strucrured into
GO circles. GO ,,""ckets and GO clem,'nts. For
example. the GO ro "GO 2.1.3" carrcsponds '0
GO cir<:le 2. GO packet 1. GO clemcnt 3. You
c;[.ll; llIen find the rcsourc~ assiaruDenl (num"""
of ( ;0 cireles) per CPU;n the CPU column of
the global data table.
GO stat u)
SCln fMC,
.-. ner compi ling (phase I J, Ihe system data cn:ated are suffieienl for global data communication. If you also configure the GO Status (Ihe
. tallU o fthc GD connecl;e>n) nnd thc scan rates,
you must then compile the GD tDble for a ,ec_
ond lime .
Follo" i" a
addl"C'~"'s
~ a se.
The GD eomrnunicalion Krvice ....,qu i",s a significant ponion of execu tion I;me in the C PU
opC1"Bting .y"em and demands transm,ssion
lime on the MPI bus. To keep this "communica\;OII!IIOIId" 10 a minimum, if is ]IOIIsible to <peeifY I "SCaD ,,!.tc. A &can rate specifies the nul1\ber of pt"Oaram cycle" after which the data (or
mQl"~ pre<: i~e1y. a GO pack\<t) are 10 be scnl or
received.
323
20 Main Propm
S incc !he d aLa are DOl updated in ." cry pTQjp1UI1
cyd c Wilh a ,c;:an rat~, you ~houLd a~'oid ,ending time-c;:ri(ic;:al data via this form of~ommuni
cPtion.
A fler the fir~t (error-frce) compilation. you elln
use V IUW ..... SCAN RA TFS (0 define Ihe scali
fIIles (SR.) yourse lf for each (iD packel and
each CPU. The scan r~t<: is set as .Iandard in
such a way that with an "emp ly" CPU (110 user
p rogram) the 01) packets are sent and r<;<;eived
approJl:imalclyevcry 10 m...lfa user program is
then loaded. the time interval increases.
~witch
S FC 60 GD_SNO
Send GO packet
t>
SFC 61 GO RCV
Re<:eiYe GO pac ket
noWl'1.0AlJ TO '-10l.llJLIO.
324
A ddre ..inl:
nod,-. <onntio n,
51MATIC 57 .1alion
u .....
20.23
51MATIC 57 slillo n
M"d'.l~~
in ll><t CPU
On .. w~y C1>nrMc'i<>n:
In \he ~ _
. fnm' fo, is with
SFC C<II I in u,"" p<09<~ m
Fi~u""
O_ w~y
In II",
'ys"'~
.,
.,.",.,..,Uon:
~ ng
.:J
S7 Basic Cmnmu:::ica<ioo
325
20 Main Program
Tobie 20. 1~ SFC PanMC,e" for Slati<m_ln1<.>rnaJ S7 Ha.ic Communica1ion
,.
S FC 72 I_GET
Read data
SFC 73 I PUT
Write datn
SFC 74 I_ABORT
Di.connecl
s.c n
t _G ET
Itu.d data
326
A job is inlli&lcd with REQ - "I and BUSY.'O~ (first cal!""). While Ihe job is in progres.
nUSY is ,et to .'\-. Ch:mllcS to the REQ
parameter no IoniC, ha"e any effect. Whim Ihe
job i.completcd, BUSY il reset to .'0". IfREQ
is still T'. the job is immediately reslancd.
Fundal1l~otal.
S FC 74 CABORT
DiJcanno:'C t
StMATlC S7 station
I",_,=,,.=.m='"=~=c:~,,
o...--~~IIon:
,c~~;;;;;~
SIMATIC S7.tatlon
CPO.!
"in""CPO.!
:J_._. ~~~~ -.
- '1~
T..... _
o.w
I. .~ ~~ .o---.....~I
FI8U~ 2a . l ~
;;::l
,
c; ._
~
~
u_" .......
_ 0 1 ' cOOH_IiOo"
... \he d ...... it ....- . 1M ..............
oySIem WdIft
1M dew.
ct"-
~5
.:J
20 Main Program
because of a lack of rt:so~s in either the
sender or the rccci"er, ''tcmpoolTY lack or
rcsoun:e~" i, reported. Thc InInsrer must Ih=
be retried. Belween two communicatiOD partners. there can be only <)fie conne<:tion in each
dircrtion.
00 a transition from RUN to STOp, an active
conncctiolU (all SFC. except X_ RECV) are
cleared .
20.6.4
S!'",~m FuneTioo~
SFC 65 X SEND
Send data
SFC66X_RCV
Keceivc data
SFC 67 X_ GE"l
Reat! data
SFC 69 X_ABORT
Dtscouncct
I'r~
liste d in
is
conn~":lion.
SF C 6!1 X_Sl:S U
Send d>lla
A job is initialed ,,";th REQ = " I " and BU SY "
''0'' ("'fiThI call") . While the job is in progrcs~,
BUSY i~.et to "1 "; changt:s to .he REQ param~
cter now nO !(mgL"!" have any dr~"CI. \Vbeo the
job terminate., BUSY is sel b ack 10 ''0'". IfREQ
is stilt "1". the job i. immediately re.lltlc d .
On the fir<;1 call. thc opc: .... ting. system U"ansk.....
S7
ba.~ic
J2H
ar~a
from
wbich the datn to be .,Ilt a1"C to be read . Actu"l
parameters m~y be addresses, variables. or data
areas ~d<.lrcsscd with an A."IY pointer. S~-ndand
Recei,e data are nOI cb""ked fnr matching data
"P".
'ill
SFC 66 ;'CRC V
Rffetn d.t.
20 Main Program
SFC 69 X_ABORT
Disconnect
20.7 S7 Communicat io n
20.7. 1 Fu n damenlals
ce"
tto \>l ~
1., :'!1'
~I
-I ~I=
~
t''''
, ~=rvrn 1"1
CPU
o",,_y co",,_ellon:
In the C~ ~ litlg station, ""no!<or I. wfV\
FBISFB ""' . in UOOf
SIMATIC S7 $t$lloo
StMATtC $7 su.tlon
Co.mectioo
Connection 13b le
":'";.::0
u ....
in the CPU
o" ....... y conrr.crion:
In l~. de"vertng
p<
, ~tm
program
"''''
.""ion,"'"
operati"ll
tile
letc!tes or _
d~ta
j""
Two-way co.on. clion;
"
j
T ........
..<-~...
-"
=
- "
SfB
- 12113
Sub"'"
20.25 S7 Communication
II
20.7 S7 CommWlicntion
8Uhnern oM<:: !hi> "an be an I>fPl subnern or!<. I
sulmctworit or aD Ethernel _ubnel_
work. !hi: communi~-.t1i(>1U connections are
'!alic; Ihey an: configllred in Ihe connection
lahle ("CQmmUIlicalion yin cQnfigu",d connecTionsn).
rRormus
eommllnk~tlQn
The same
Jl) -local cannlion lD fiom Lhe COIUWcIlolltabk ( <.lata Iype wo~n \v# 1 6~~xxx)
t nili.ltUll ion
57 communication m",,' be iniTialized at RSLart
.so tru" Lhe cOIln~-.:lion to The commllni~RTion
20 Main l'ropm
"""e
BOOe
WORD
SD_2'J
SI)_] t)
"
,
,,
Bom
"'''''
ErT(>1" occurred
'00
Second Send II/"Ca
Third Send ""'"
Fourth Scr.d area
RD_ 2 Il
1U)_3 "
Th ird Receivt
OUT
cortne>clion lO s thll' are located in the cOnDec,ion table in Ihe $ame line . You cattalso u.~e sevCOI l " block pa in; which are !hen d;s';n\li~hed
from eac h other by Ihe joh ID.
Thc ruUuwin SFlls arc a~ailable for ." ....,,"'y
du'~ inlCTChange:
~ FIlIS FIl R USEND
Uncoordinated send ing of a data p.d';~l uf
CrU-specit1c lenglh
to
FliIS!'"A 9 U RC V
Uncoord inat ed recei vin g ofa
CI'U_~r<-..,i{k kong!h
d",~
packel of
J>
F BlSF B 12 BSEND
Send ing ofa dam hlock of up 10 J2 or 64 KB
in leng,h
J>
FIlISFIl IJ DRCV
Rcccivinil of a data block of up 10 32 or 64
K.D in lenglh
~rc~
FB g USE-"':U a nd FD 9 LKCV
'h"
20.7 S7 Communication
FB 12 BSE ND a n d FB 13 BRC\'
S FB 12 BSE:"n and SFB 13 IIR C\'
Blo ck -o ri ented s~ndl n g and ,"" c .. i,in g
Emer a pointer to the fil'>t byte of the data area
in parameter SO _x or RD_ x (the length o H m,
act ual pararn~ter detennines the maximum size
of the communi~ation buff~r when called for
the first time_ it is not evaluated w ith the further
calls); the n umh<"r ofbyles of Send or Receiw
dBta is in the LEN pa",mcter.
Up to 64 KB (3 2 KB with non_ integrated iDlerface) may be transfe"",d; the data are ,raru ferred in b loch (somnimes ~alled frames). and
the t",n,fer itself is asynchronous to the user
program scan . The LEN pammeter is updated
following each recei"cd b lock.
A positive edge at the REQ (request) parameter
starts (he data ex~ha.nge. a positi"e edge a'the
R (reset) parameter abort' it. A " I " in the EN_
R (enable receive) parameter signals that the
partnet IS ready 10 reeeive data. "0" can be used
t<J abort a current j ob.
When the NDR parametcr bas as,umed Ihe
value -'I" following the data transfer. call the
_ or).
20 .7.3 OD e- Way Data Exe hang..
In one-way dala exchange . the eonununication
block oall is located in only one CPU. In t h ~
partner CPU_ the operating system handk< the
necessary communication function< .
The following blocks arc available foronc-way
data int~rchange
~
FB SFB 14 GET
333
20 Main Program
Ta b l~
ID
DONE
ERROR
S1ATI..'S
"" "
"
" "
"
"
INPUT
WORD
OUTPUT
ROO'
Job terminaleJ
OUTI'U>"
ROOt.
WORD
Error occurred
OUTPUT
J"b iit.im
Second data area in p'rTn~"T CP U
Third datil arc. in partnej" CPU
'0
RD 2 1)
'0~3
1)
"
""
Use the ADDR~n parameter 10 spe~ ify the vari~ble or the arCa in the partner CPU from which
you want 10 fetch or to which you wanl \0 send
th~ data. The ~reas in ADDR n mu,t coinc.ide
w ith the ~reas specified in SD ~n or RD_n. Use
the parameters without gap', beginning with I.
kW
A.,.'iy
A },'Y
,"'
WORD
ERROR
STATUS
OUTIUT
OUTPUT
'00'
WORD
Error occurred
Job .tatu.
Second vwioble
Third ,..nable
(>
(>
SFS 19 START
E.",eute a COld or warm restan in Ihe panner
contrOller
SFB 21l STOP
Switch the panner controller 10 STOP
SFB 21 RESUME
EKecuI" a hOI rcstan in the panner comrol'
["
SFB 23 USTATUS
Receive partner SlalUS
20 Main Program
"
OUTPUT
M"
"
.
OUTPUT
BOOe
IX - 0=
~y
~y
'ro_
IX_OUT
"
BYIT
Pre",nt in
SI'II
REQ
".
"
"
"
""
"
"
EN_ R
ill
NDR
ERROR
STATUS
PHYS
WG
LOCAL
(>
(>
(>
Declaration
Dat. Typ'"
Contents. Doocription
INPUT
""
"
""
INPUT
BOOe
BOOe
INPUT
WORD
Connection ID
OUTPUT
OUTPllT
Booe
Booe
O~UT
WORD
Error o<curred
Job,tatu.
IN OUT
A~
Phy,ical statu.
lX_OUT
ANY
Logical 5tatus
IN_OUT
A"Y
"
"
"
SFC 62 CONTROL
Chock statuS of an SFB instance
FC 62 C CNTRL
Check stalus of a connection
SFC 87 C_DlAG
Determine connection SIan,s
SFB 22 STATUS
Ch ee k the st atus of the partner d e " ice
SFB 22 STATUS fetches the status of the partner CPU and d;<play< it in the PIIYS (physical
'"
SFB 23 USTATUS
R ecclve the natus oftbe p artn er device
SFB 23 USTAl'US receives the slatus of the
partner. which it sends. unTcqucsted, in Ihe
event of a change. The device staN' is dis,
p layed in the PHYS, LOG and LOCAL parameters.
20.7 S7 Communication
Tabl, 20 22 'Paramet=< of the Block< Fe. fi' C CNTRL and src 62 CONTKO)
~:-BK
"
SFC
OFFSET
"C
Fe
RETVAL
REnJR"
ERROR
SIT
oun'tTr
,m
STATUS
FC
"C
I STATE
SFC
src
' _CONN
I STAniS
C_CO~
FC
C STATUS
"
SFC
,=c
d.,. block
rt-.l'I Jf
BLOCK DIl
instance
I N~UT
WORD
L,",PUT
I "c
,om
INT
Error ;ntormat;on
Oun'UT
OUIT",
WORD
~.rro' <iele<:ted
Statu, wora
OUTPllT
IWTf.
src
OUTPUT
Bool
sec
OUTPUT
,=c
Ii.,
,~
in<tance
OUTPUT
,=C
OUIl'I.l
WORD
SFC 62 CONTROL
Ch~cll the ~r!ltu ~ of 9 ~ommunicarion
instance
In S7-4-()(l 'ystems. SFC 62 CONTROL det~r
mines 1he Slatus of a commnnication instance
and the associatcd ~onncC1ion in the loc" l ~on
troller. Enter ,ne SFB', instancc data block in
the I_DB parameter. II the SFB is called JS
local ;n, tance, 'pe<:ity the number of the local
instance in the OFFSET parameter (zero" hen
no local in51ancc. 1 ror the (irst local inSlaoce, 2
tor th~ second. and so on).
Cotllle<lion "atu'
~ - connection exi,ts)
eI
Co~jon
""tm
Fe 62 C_ C:"<TRL
Check thc ,tatm of a connection
Thc C _ COt-<"N and C _ STATUS parameters pro,ide information on the acrual ""mnection Sla-
tu,.
337
20 Main Program
SFC 87 C_DIAG
Iletermlne thc connection .Iatu.
The system function SFC 87 C_D1AG determines the a~tual status of connections wilh a
r,xed configuration, i.e. all 57 connections and
a ll fauIt-tolernIlI S7 ~onnections. With each
call, the SFC 87 C_ D1AG reads the conne ction
data from the operating system and enters them
into the uSer memory for cvaluation. The SFC
then aeknowledges that read ing has taken p l ac~
in the operating system so that a change in status since the last read operation can be
recorded . If you wi,h to monitor the connec_
tions pennancntly. call the SFC at r~gular intervals. c.g. cvery 10 secon ds in a lime imerrupt
organization block.
IIData
con_~e<"!
OClOL;
cc<>_busy
<:en e=or
ca"J_ inde><
=_6tatus
BOOL,
~,
>==
Sl"BY COl<
DLS_PCON
=0
-,
DIS
[1 . . 12]
WORD;
OJN_lP
s:rAT_OJN
~he
c~~ect 1 on
data
I/n-i gger j ob
I Neb running
IIError informa~1cn of SFC
I /~r ot field eleme:-.t ~ read by SFC
1m;
-,
bloCk with
OF STRUCI"
IJ
/ /C=.r-"ct:ion
~tatus
BYTE;
//Connectian
BYr"E,
BYTE,
OClOL;
8l"1>,
BYTB;
!/~&erved
BCOL,
producti~ connecti on
of standby connect i on
tolerance
(.. i~hout ta'~l t tol e rance I
o!
You Can usc your own expressions for the names of"ariables and compone nts.
The call could then be as follows, for example:
CALL C DIAG
~O
=,
PEr_VAL
00"
"-"'"
=-
'"'
, ~ oon_data.oon_~,
,.
Bi/16/102,
,_
".
:_
:_
20.8 IE cmnmUJ1kation
"
I>
I>
MODE - 8';161102
Th~ SFC only cop;e, th~ COun~"tiOil data if
they have changed, and acknowlcd~es reading om - even ifno cha0i:cs hi"e occtUTCd.
YlODE '" B# lbI'03
f he SFC c(I,ne$ the conn..,l;on daTa" !Ihom
admo" kdgmg.
S~C
~onnection <iali
call
be
I>
20 Ma in Pmgram
CPlJiCP "":~
.,...on,
o~
:'J"
__1 -:1'
__
\;6 Jt~ ~
CO,
671GB . . .
, :J
.'
Bcfore data can be U-ansierred with IE communication. a cotmection must be e,tablished w ith
thc partner device ( in thc c~se of TCP native
and ISO -on- TCPI or wi th the communication
laycr of the operating system (in thc case of
UDP) . The following blocks are available fur
this purpose:
I>
FB 65 TCON
E"abli,b cOTIDec\ion to the communication
partner or thc communication laycr of the
opcrating 'yst~m
""
FB 66 TD1SCO:'>l
C lear down connection
HO
[>
20.8 IE communicatiun
BUSY
65
66
ourPIJT
ERROR
65
OU11'UT
STAn;S
6~
66
66
OlJTrtJT
,.s ,.
""""""",," """
""
,
000'
WORD
..,he " ..
,.
"
remj taddr_
"
"'m_....p_
i<Ucn
,,-
rem_ mbn",
J4 ,u
SO-
"
",ference
B ~16'101
Conn"""""
!)"pC
Tcp1 P na"v.
n-l~1
(coml"'ibih,y m<><Ic)
..
"
a# l6/j l 1:
R ~16oi 1~ :
8"164IlJ:
TePIll' nat;'.
ISO on Tel'
um
'1'''''
"
llYn:
BnlM02
Leni'h of
.m
l1'116::00
IIYlE
S ~!6.oo
.m
B!f16"OO
with VDP
DO"<
S ~ 16>oOO
AI{RAY [ 1..6)
OFLWTF
6(B~16"OO)
C"""ntlY!lot used
",m_"addr
ARRAY [l .6]
Of BYTE
6(R~16"OO )
rem_....p)d
,"RR/,S [1..l6]
16(B# 16ioOO)
" "
.."" "
C~ti'""
rem_,ub_
,,"
l'!~~~~~;;;======
,ice (_ TtIaIWIJ
l",,"l_tsap_
~,
W :< 16=OO(IO
orSYTE
n.,,_otI<I<h
.""
ARRAY [1..61
Of IWTE
6(8"'16fIOO)
WQR!)
W .. 16IIOOOO
20 Main Program
F'B 65 TCOK
E ~tll bUsh ~onncction
FWlction block FB 65 TCON cr~atcs the prereq uisites for IE communication . The parnmeters
required forthis arc located in a data area that has
the structure of the user-d~fllled data!)pe UDT
6~ TCON_ PAR.
VvbCIl using the protocols TCP native and ISO
on TCP, a conmx:lion is establi.hed to the communication partner. The station for which -'A ctive connection serop" i, entered e,tab1i8bes the
connection. Thcpartner stlltion must then be designated as )lassive_ This designation is independent of the d irection oftnUlsf~r of the data,
FB 6 6 TD ISCON
E!tablbh ~t1nne~titln
Function block f B 66 TDISCON te""inales
the pr<"requisites for IE communicat ion, It
clears doY.-n the connection to the communication partner ur de let., s the communication access pumt.
You des ign ate the communication connection
by assignin g m e ID parameter. The specification must correspond to the v ariab le id in the
connection data,
In the initia l state. the parameters REQ, BL' SY,
DONE and ERROR ha"e s ignal ,ta,e "0 . Vuu
II
rising edge
'"
connection data. You can specify the ~nd trUlllbo~ with Iht pointer allhe DATA parameter.
to-
Fa 63 TSEND
Send data with loile c:onntion
> FB64TRCV
Receiw data "~th loiic
c:onn~
You have to establish tnc connection to the panIlCT station with FB 6S TeON ~fOR Irnnsftrring the data (see Chapter 20.8.2, "Establishing
and clearing down connections'). Data can b<>
eJ<changcd simultaneously in both dtrt'C1ioos
ovcr the connection with FB 63 TSEND and fB
64 TRCV.
FR 63 TSEND
,-Tabl~
~Q
""
rn
LEN
00""'
,UR
BUSY
[RROR
ST...TUS
RCVP_LEN
DATA
with FB
DllIlarion
Data I)'po:
BOO,
(:""'''''10, Lksc:riptiucl
S...,., data transfer ( ..ilh n5m, cdll")
FIl rudy 10 r~c<i, . (with "1")
WORD
".
" ,,.,"' '00'
"
,m
"
IIIIIfIina
BOO'
".
""'"
BOO,
"
"
""'" -,"" IN_OUT
...
..
....
..
""'-~
INPUT
1r-.'1'UT
l'umi:>er o(b)~.,
OUIT",
Job
("OM) or .~"'Ul"" without mwt (MI")
Sob runninll (""OM) or oomplmd (~ l i
OUTPUT
OUTPUT
OUTPUT
10 b. ><111 Of
r=i"t<j
OUTPUT
WORD
0",""
~,
Al'.'Y
20 Main Program
With each s"bseq"~nt cali, another data blo<:k is
received
F1l64 TRey
I~nglh sp~cified
"'"'0
10col.
>
FB 67 TUSEND
Send data w ith UD P
"0
1\'_
m
I.EN
DONE
~,
BUSY
ERROR
STATUS
RCVD LEN
DATA
ADDR
'"
Deebration
TNPUT
TNPUT
Data tYJ>'-'
" '"'"
"
". '"
"
" "
" "
""<IT
""<IT
WORD
INT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
OUTPUT
'OOC
BOOC
BOO'
'"
" '"
" '"
OOTI'UT
Th'_OUT
JK OUT
"ith I'B
" '"
.
,om
,om
BOO'
wo=
! Con'=';, Do'criplion
"l ~
""
A~
ANY
..
20.8 IE cOllllDWlieation
FB 6STIJRCV
R<;:<:el~e data with UDP
Table 20 ,27 shows the pa ramete~ 'Jf the function blocks, and Table 20,28 lihow~ the .truetun,: OrlM UDT
Yw ha~e to establish" C01U1lIon to the communication layer of the openlling system wilh
fB 6S TCON before UVlsfeninll the data (see
ChKpt.". 20.8 ,2, "Establishin8 and clearing
down oonnlio",'I, The K,Jdress of Ihe COlD_
munication partner is located in a data area Ihat
h~, the ,tru~t "r.: uf UDT 66 TADf) _PAR,
.. B 67 TUSl:"D
Se nd data wi th UDP
The function block FB 67 TUSEND ..,nds data
with the UDP prumco!.
"0" ,
The ([,ata in the send area can then be moditied
again ",'hen either DONE or ERROR has signal
state ,'.
fB68T URCV
R~~~IH dlllM wilh UDP
The function block FE 68 TU Re V receives data with the UDP prut<><:ol.
The assignment of the I[) parltmeter designates
the conDcction between the U$CT proaram and
the communication layer of the openoting s)",tern. The ,'alne must ai:f'X' with tbe variahle iJ
in the eOllIlCClion dsla. Specif)' tile receive
mailbc.>x "'~Ih tbe pointer at the DATA fl'll'aDX'-
'cr.
The infonnation On the communicatlDD partner
is located in a data area!O wtti~h the pointer a,
the ADON. parumeter points,
The number of bytes to be rece ived i, oct at the
LEN parameter ( I to max. 1,460), After a data
block ba" been received, the number of bytes
recehed IS made available on the RCVD_LEN
pllnometCT, and NDR i. 5eltO signal stale " I',
Data is only received wben the EN R parame
tel' has signal stale "1'",
-
consi~leDl
wbm
3"
20 Main Program
_
.,. -~ ==~;" _ 1I~'
:J
__
.... -.--J-
oo ",.
- ,,"
RK~12:
In. "ansfe,. A
~_ p~ram
"
-,
'
;
:
'
:
'
E
:J
a lso required.
conlrol.
.ynchroni='' ' DB i.
'~I -
~ ~:J . ~
",
with S7-300C
20.9.1 Fnn d amelUal.
\\'hcn u,ing point -IO-point communicanon
(PtP), you transmit data over a .crial interface
10 a communications partner. e.g. a printer or a
SIMATIC $5 station. With cena;n S7300 compact CPUs, an RS 4 22/485 imerface (X,27) is
alre ady int egrated.
The communications connections arc specified
using the Hardware Configuration tool when
parameterizing the CPU's imerface properties .
ASCII mode , the 3964(R) procedure and the
RK512 computer coupling arc avai lable as
transmission protocols .
The communications function, are system
function b l ocks $FB wh ich are integrated in the
operating system of the S7.300C CPu. The
instance data blocks for these SFBs are present
in the user memory. The SFBs do not test the
parameters . if parameters are set incorrectly, it
may occur that the CPU goes to STOP. If you
USe the u-ansmi ssion protocol of the computer
coupling. " synchroni>:ation dala block ;s addi
tionally us~d (once for all computer coupling
SFB, in the user memory. Figu re 20.28).
~".i----< ~
-.,..
-"""'-
B
S:l
~-
Cun fl~"rlnII'tP
commun;cy!lo n
Ihe
H~rdware
You can send and ,..,ce iv~ dala v,a the poinl-Iopoint cQnn~~lio n wh~n usinS Ihe ASC I1 driver
or Ih~ J964(R) procedure_ The following system function b locks are requll"<'d ;
Irnn~mis~ion
I>
ASCII mode
'f'he data are mmsmined as AS('U charneI~, The Ilanlimis>;ion is nOI acknowledged_
Sening ohignalassii'UJlC1llS and tnln'lmis--
:>
endof-Ie"t characler.
(>
Rec~ivc
t>
po
39 64 (R) pro<:wut'C
The data arc SCn! to the communications
punnC'!", and positively ncknowledged by
Ihi$ when recrived corr:dy. Setting of signal liS,ignment'l and tnlIl~missioD patamc_
lent ~och as baud rale. parily, block cheek.
po
I"r=<:n. in SFB
"0
IN_R
LAJ)OR
00"
""
'"'" ."
W
".
""
."
!IIDK
ERROR
STATUS
SDMi
ROM]
<EN
"
Da:la..n",,,
SF B 62 RES_RevS
Wilh The 3964(R) and RKSI2 lransmi~.ion protocoill, the communication, pouners must have
<lirr~-renl priorities in order 10 ddine lhe
sequence when ,..,quests tn transmit .'" sent
imu '''mcous 1y.
or J%4(R)
,-~
driv~'"
"'~u<
no,,,
""'"
TNl'tif
",X>c
Reccl"e CDlIblc
With MJ". ,he job i,
INPUT
OUTP UT
OUTPUT
WORD
ROO'
I"PUT
Olm'u<
DUO!.
""'"
.bor1~
OUTPUT
INMOUT
INMOUT
WORD
A'<Y
Error inf<>rmarinn
Al'-'Y
Send mailbox
Recci,c lIilIilboA
TN_OUT
lNT
20 Main Proaram
send up 10 lenglh specified by Ibe LEN panlmclef, or send up 10 an end-of-text cbanlcter,
"scn d rl n
r or
""
S FB 63 SEr-'D_RK
Send data with RJ(j 12 compuler eoupl;nll
:>
SF Il 64 FETC H_RK
FCich data with RI(j 12 comp uter coupling
~y"_
of t ran sm lulon . r r.
SFB 63 SEND_RK sends from the area specified by SO_I, and addrencs a data block area
in the partner device. SFB 64 FETCH RK can
access all address areas in the partner device.
and S10Ies the fetcbed dala in Ihe data block
atea specified by the R D_ I pammett'1',
5FB M SERVE_RK can saVe received data in
a data block, and make daa available from all
address areas. The pcnnissible u$;pmcms for
the parameters are li.led in T"ble 20.31. Certain
values.re only meaningful in conjunction with
a SIMATIC S5 slation as Ihc pnnner device.
Table 20 .311
,>
63
64
CPU
>,
'"
20 Main Program
Tabl~
Pamtt.l>w;,' 'j ,
7:i1JC;
...
SI'Il64
S,nd da",
f<'" b u. ...
SFBM
~elT'
Pt<,..Wo.n
"f Jot"
m.
Oto 4
~,
C~
D.X
D,X.M ,
E.A, T. C
TY P!:',
CHAR
INT
INT
o to 255
o to 255
0 105 10
Ot051O
I)
10 2S!
Otol024
Ot01 024
,
,
DB}"O
DBl--'O
R OFFSET
,_
OFFSET
m'
~
.\1<aning
'SFB 65
0104
- CPU
"
SFB 6J
.-
,-
U M,
A. U
to n
>inglo_pTOec,"O!" mod~
0
num""r of CPU in multiprocessor mooo
D ~ d,ra blod. DB
X - exte nded dala block [)X
,1 _ fla~ memory "c~a
E - pmce image of inputs
A " proce,s iTIUl~~ of output>
T - t im er valoes
Z - counter val"e.
K umber of dal<O block (irre levant
with M, E. 1>., T and L)
c,
I to n
CPU-,peclli c
350
SFB 64 F"ETCH_RK
]>lIn~
!iy~teIll function block SF8 64 FETOi_
RK is used to fetch a data. area from u commu -
The
You cnuble process ing of Ihe job by sign al staNS "j" in th .. nCR parumctcr. Signal Stat"s
"1" in Ihe NOR parameter indi~Bu,s that new
da\.a have been ""cces~fully rec .. i,ed o r
fetched. In the event of an error, !be ERROR
pan.metc:r ;5 Se1to "1 ~ and lbe error in fonnation
ourput in the STATUS parametc:r.
You
~un
Slatu~
'"]"' on the R
p~r~mctcr.
Imd resel th e
20.10 C onfiguration In R UN
Confiiuration in RUN (CiR) means that
chanlles to the system can be made dwing operation. Thi. functionality permits you to change
Il,e configurat ion o f the dislrib tncd I/O of an
S7-400 station Wilhout Ihe CPU enlering STOP
or hll ving to be .et to STOP.
The ]"IO~ible chang~..,. induOc the add ition of
compaCt DP sla\',,'<, ET200M !>l8tions and PA
master SY$tcms to an exi~tinll Dr ma~"1"r systc:m. Ihe addilion of modules 10 T200M ~lB_
rion . tmd the addilion of PA slaves (fiel d
d~vlces) to exisling PA master ~y"em'. All
objecls adder! d uring runtime ean also be
removed all" in (Figure 20.29).
Pr..requtsites and hmJlalions Clt,st ill add1l101l to
th.. faCI that all involved devices must be able to
handle Ihe CiR funcrionalny. For example. Ihe
PROFIBUS OP m3SlcrsyslClO must be 8 mOnoll\II,tet" sylilem and musl nOI cxhibit constant
bus cycle times, tbe useofintelligetu DP .laves
is nol p.. rmi .,iblc in the !lSSOdUled stal'nn co,nponents, and the module paramctent must be
saved on Ihe C PU.
Component., ""Ih and withoul Cil{ fu nct io nality can be mixed: however. changes are only
possible on componentS wilh CiR capabil ily.
During n.-con.figumtiOlL processing is mtcrrupto..i
for a dton period (typically 1 liI, can be progranli1lW). The time can be kCJlI short if only a
f~"W
QUt.
'"
20 Main Program
coupl" ,
",,",,,,,",,,,1 dovic..$)
Pboe holder for subsequently added PA slaves
(c{mtain< the max, !t umber of a,lditional field devices
and the upper lim its of the additionalll!icr data volume)
y,,,, Can also provide srace in an ET200M station for later expansions . Add a station with an
imerface module JM I 53-2BAOO-OXBO or better to the DP mastor system, and acti vate the
checkbox "Module replaeemem during runt_
imc" on t.he "Special" lab in the propertics of
the station, The active bus modules r.. quired to
caoy out Ihe mOdule replacements are d is played ill the boltom window area (they are
required Tor the mechanica l de.<ign. but are nOl
configured ). It i. recotn m~n dablc to fit the
ET200Jl.-l stmiDn with active bus modul es up to
n7-
I>
I>
I>
I>
I>
p.
,
,
Process imtmJplS OS 40 to 08 47
Timing error 08 80
DiaanOSlic interrupt Oil 82
Hot swapping interrupt OU 83
Program I!"xurion fault 08
Rack failure 08 86
J,O atC(!5S fault 08 122
8~
20 Main Program
When adding m odules or slaves, you .hould
first load the configuration and then th~ matching u.er program . Whcn removing modules and
,laves, lirst load the aJaplcd U'le. program and
then lh~ ",od;:fi~"<I contigueat;on. Adding or
rcmov ing rea l modul~s or ,Iave.< tm..~t only be
carricd out foll"wing loading of UlC modified
confi guration (whcn the DlTF LED on the C PU
has gone off) _
'Vilen R-parameterizing modul es you must frrst
load a user program which no longer addresse,
the ao;.~ociated modules or no longer cvah,ate,
their imcrrupts _Then I"ad the moditied c"nfIg uralion, change the hardware if necessary. and
lo ad the ul;<.... program a daplcd to the moditica tion_
354
,;
BIII6/!IOO:
S "15itIOL
S"I6Kl2,
,""lomIT--tru"'__tiS"I~);
21 Interrupt Handling
[>
[>
[>
)0
Hardware interrupt
An interrupt from a module, either via an
input derived from a proce," signal or gen erated on the module itself
DPVl interrupt
An interrupt from a PROFTDUS DPVI
slave
Multiprocessor interrupt
An interrupt generated by another CPU in a
multiprocessor network
Synchronous cycle interrupt
An interrupt from a PROFTDUS Dr master
synchronous to the DP cycle
[>
Time-of-day interrupt
An interrupt generated by the operating system at a speci fic time of day, either once
only or periodically
Time-delay int errupt
An interrupt gl-"Ilerated after a spec ific
amount of time has passed; a system function call determines the instant at which this
time period begins
WatChdog interrupt
An interrupt generated by the operating system at periodic intervals
356
Curr~n '
sign a l . tat e.
21 Inkrrupt lIandling
Int~rrupt.
<>
Single-shot' th e re levant OB
only at the specified tim~, Or
j<
called o nce
Performance characteristic. on error
as
VariabLe Name
Il.!a Type
Ileseription
Cnnt.nt,
Olhx EV CLASS
IlYTE
b.nt elMS
11,,16#11 - UP
~,
BYTE
B "'I6'!'II- OB.ll
O BH PRIORiTY
BYTE
Priority cla"
BYTE
all ,,-umber
B# 16"""
BYTl'
R e se,Ye <l
BYTE
Re,cned
WORD
Se e dc><cription of
S~C lH SET
I}lT
I{esen:.-d
'"
DII1'Io_A.'I'D -
R C;<Tved
OExx STRT
,
,
,
,
OBx~
OB NUMBR
Olh,x J/FSERVllD
O B xx RESERVED
6 .. 7
O lh ~ _ PERIOD_ EXE
8.. 9
aBxx RLSERVl';O
OBu R ES ERVED
"
""
xx
-',
T IMF.
''''''"><'Dc, th e OB numbe" 10 to 17
OccUITc'ncc of
C'"Oo.t
~\'~nt
,m,
'.'
If you adivate a lime-o f_day interrupt on a periodic basis, and if the start time has already
passed (from the real-time clock '. point of
The -'Acti\'c" option a ctivate, automati c Starting of the time-of-day interrupt. Thc "Execution" option screens a list whi~h allows you to
choose wbether you want the OB to execute on
a single-shol basis or at specific interval,. The
final parameter is the sian time (date and time).
error). IfOB
to STOP,
~O
"
SFC 29 CA'-I_T1NT
Cancel time-of-day interrupt
;>
t>
SFC 31 QRY_TrNT
Query time-of_day interrupt
"ME
\\"#16#0401
\",#16>11001
\>,"#16111201
"'.-"#16#1401
SFC 30 ACT_TiNT
Activate t1me-of-day interrupt
A time-of-day interrupt is activated by calling
system fnnction SfC 30 ACT_TINT. When a
TOD interrupt is activated. it is assumed that a
time has been set ror 'he interrupt. If. in the case
of a single-shot interrupt, the SIan time is
already past, SFC 30 repons an error. In the
ca.~e of a periodic stan, the operating system
calls the relevant OB at the ncxt applicable
time. Once a single-shot time-of-day interrupt
has been s<.-'fViced. it is, for all praeti~al purposes, canceled. You can re-set and reactivate;t
(for a different start time) if desired
SFC 29 CAN_TINT
Cancel time-of-day Interrup t
You can delete a stan time, thus deactivating
the time_of_day interrupt, with system function
SFC 29 CAN_TINT. The respective 08 is no
longer called. If yo" want to use this sarne time of-day interrupt again. you must fIrst set the
start lime, then activate the interrupt.
SFC 31 QRY_TlNT
Query tlme-of-day Interrupt
You Can query the status ofa time_of_day interrupl by calling system function SFC 31 QRY_
TfNT. The required information is r~turned in
the STAruS parameter.
When the bits have signal state 'T', they have
the following meanings'
4
5
IIY'O-
v.ti~\)~
'1.mo
0.1.a TJipe
De<criplion
Con""n"
fl#l ~~ 11 _ lIT' evonl
OB"" FV CLASS
OB"-'._STRT_INF
BYTC
BYTE
Event. 01
5t"" requ.e.t for lho
inlc"fTllpt OB
OBu_PRlORITY
n YTF
I'riorily clhS
Ikfioult "~l","" J ~o 6
BYTE
011 """,lin
'Ynl
Rc>e1""\"ed
R......".,...J
WUW
lob idcnl,/iC"tion
,
,
,
ODu RESIlRVtO
~,.7
U"~ .
8.. r I
Olhx_DTI),1E
"flME
12.. 19
ORu_DA1F._Tf\.fF.
DATE_
A)\."l)_ T1:>'"!E
Oc(:lU1ef\Ce of .,,<."n!.
o ,~
o.~
OR KUMBR
RS" IIV F.[)_
51G:<I
,, ",..
"
...
B#I6<:21 _ 00 20
.
Se, ~ .",ripti"" "f
SFC 32 SRT DINT
s deSCription ~f
SFC J2 SRT_OlNT
Call lim. of OR
which
"r
"~tua\ly
r~marb
tim~.<Jclay
interrupts. On a hoI n::'lISn. the sc(t;nl,ls are remine<! umil pnK:c.lsed ;n }tUN
mode. whereby !he 'residual cyc le'" ;s cOlUl led
as part o f lhe ,(art-up rout;nc.
You can <tart a timc-<lelay inlerrupt in the Slan up ........tine by calling SFC 32. When thc delay
inl""alllas expired,!he CPl; mUSt be in R\.N
mode in oro", 10 be able 10 Cx~te tb<' rdevam
olllani2arion block. If lhis i~ nol the CllSe, the
CPU w~it!\ \() call !he organization bl"",k until
the slnn- "p routine has terminated. then calls
!he limedelay interrupt 08 b<:fo...., the first nctwork i" Ihe main program.
"'en:: deseleciCd
during CPU paramet~riza.ti()n cannOt be ser"i~l!d. c,'en when the respeclive on has bttn
prOl:lf&mm<:d. The CPU goc~ to STOP.
361
21 Intern,ptJ-l"ndling
Dis a bling,
dehl~ing
21.3.3
and enabling
Sy~tcrn FUll~tlons
ror Time_Delay
Interrupt.
Tb e time-deJay interrupt 08, can be disabl~d
and enabled w ith system functions Sl'C 39
nls IRT and SFC 40 EN lRT, and delay~d and
Clw bied with S.I'C 41 DTS_ AIRT and SI'C 42
EN AIRT.
Int.~rrupts
0>
"
0>
SFC 34 QRY_DINT
Query time-dclay int.enllpt
In 57-300 controllers, the priority i, I'ennanently preset to 3. III S7-400 controllers, you
can choose a priority belween 2 and 24,
depending on the CPU, for e ach possible 08:
choose priority 0 to deselect an OB. You should
not 8s>ign a priority more than once, as interrupts could be losl if more than 12 interrupt
evet){< wi th the same priority OCcur ,im"llaneu"sly.
A time-delay interrupt i. Rt8rted by calling system function SFC.n SRT~DTNT The SFCcall
is also the .tart time for the programmed delay
;lI1crval \Vhen the delay interval ha.> expired,
th~ CPU calls !.he p rogrammed OB and passes
the time delay value and a job identificr in lh ~
start information fot tllis OR 'fhe job iden tifier
is ;;pccified in the SIGN parametcr for SFC 32:
you can read the same "al ue in bytes 6 and 7 of
lh~ start infonnalion for thc assuciated timedelay inlerrupl OB. Th~ time Jelay is ~et ill
increment;; u f 1 ms. Th~ accuracy of the time
de b y is also 1 IDS . .'-IOlc that execution of the
time-delay interrupt OB may its e1fbe dclayed
I ,i
'
I "ON
ti
Error
31>2
infom1at~
Job j
SI-C 32
time-delay interrupts. On a hot restan, the settings are retained until proce~~ed in RUN
mode. wherehy th~ residual cyc le" is counted
as pan oflhe stan_up routine .
data.
Tim~.Oel~y
Interrupts
longer be called.
You can query the
rupt
statu~
of a time-delay inter-
'"
21 lnlerrnpillandling
OR
,,
,,
Time
Int~rvat
I'1!tic
"m,
..
,
,
Priority
"
""
"
""
""
UP 10 RUN. The call in!t8nl for a watchdog intCTT\Jpt OB is Ihus the lime interval plu5 the
phase ofJSO:I. Figun;: 21.1 .hows an exampl., of
Ihls. In the left SO'Ction. no phase offset is !let.
and consequently stan of processing ofthc low'
er priority organization bloc\.; is delayed by thc
cum=nt processing time of the higher priority or
gan;7.8tion block in cach casco
In an 87300. there i. n limiled choice of watchdOli interrupts with fixed priority. depending on
the CPU. You can ..,1 Ihe imerval in the range
from I millisecond \0 I minule. in ' _millisec_
ond inerem=ts. by parameterizing Ihe CPU
accordingly (;m interval of SOO IlS on the CPU
319 from finnwa~ version V2.6).
nffse l
""
PI(X",.sing
of higher_
'"
'm.
"
.
,, m,
,~
Sooms
ZOOm.
,~
"",,20
, m,
m,
tOms
Om.
""
"
o m~
"' "
priority OB
PhBseoff"1
'"
21.5 HanlwareJnlemlpU
handl;"1!: 08 ;5 still
c~ecllting.
Ibe opaafing
nex t opportunity. On ly one unscrviccd walchdog imcrTIlpt is saved per priority class. ",garo1C$8 of how many unserviccd watchdog inter.
rupts accumulate.
--t
From hcff. you can load the parameter assignment data into the CPU while the C PU is al
STOP: tbe data take effe<:t immediately.
OBJECl" PROPER-
In an intelligent DP .In.., equipped for this purpose. you ean initiate a process intelTUpl In 1M
maSICT CPU wilb SFC 7 DP]RAL.
21 Julerrupt Handling
T.b l~
Data Type
BYTE
,
,
,
,
,
6 .. 7
I3YTE
OB,,", PIUORITY
OB NUMIW
OBxx RESERVED
OHxx >0 FLAG
OB~
IlYTe
IWTE
BYTE
B~E
WOHD
n.::.ciipt;<>tt
Event cia"
Stan request for Ihe
interrupt OB
Priority C~"\5'
DB numb-cr
ReseT"ed
I/O id~nti fi<'a tion
Module
Conte"t<
B1I1 (,# I I ~ UP event
1311161141 - 0B41
Defauh .alu~> I n to 23
(013 40 lO 47)
B'I161txx
.
B".I(,#54 _ inpu'moouk.
input s" bmo<l<,le
BII 161>55 - output module.
out put submooule
'''~rting.
add",,, of compo_
o~nl; In);!':c"";n);
8 , II
OB",,_POIN"I
12 .. 19
~OR
DATE
intC1"nlp'
Intc"ITupl informalion
OccuITcm'c of
AND T IME
O\ ' ~ n l
DWORD
Rc~nlution
nn
th~
S7 -300
If an cvcnl ",",CillO during "x"cution uf u hardware inlCtT>lpt on which ilsel f would trigger
gencralion oflhe same hardware interrupt. that
hm-dwarc inte rrupt will b~ lost when the eV"m
Ihat lriggered it is nU lung<.--,- prc""nt following
acknowledgment. It make. no diffcn,nce
whcther th" event comes from thc module
whose hardware interrupt is currently being
serviced or from another moduk.
A diagno'lic interrupt can b e generat"d while a
hardware interrupt is being 5ervieed. Ifanoth.".
hard ware interrupt oCcurs On the ,arne channel
between Ihe time thc lin;t hardware interrupt
was g~-neroled and th" ti me Ihm interrupl was
;lcknowledged, the loss of the laner interrupt is
reported via a diagnostic inlerrupt to system
diagnostiC-'.
R~sol"tion
on th e S7_400
In the stan.up routine, the modules do not generate hardw are intcrrupl.>;. lnterrupt hanilling
begins wilh th e transition to RU N mod~. Any
21.6 DPVllnterrupt.
hardwar~
Error handUng
If a hard ware intcITUpt is generated for which
there is no hardware interrupt OB in the " ,e r
program, the operating system calls OB 85
(program e ~ecution error) . The hardware interrupt is acknowledged. If OB 85 has not been
programmed, the CPU goes to STOP.
Hardware interrupts deselected when the CPU
was parameterized cannot be serviced, even
when the Olh for these inK"mJpts have been
programmed. The CPU g008 to STOP.
Disabllng, delaying and
I>
~nwbllng
\>
'"
21 Interrupt l landling
T .bl t
2 1 .~
Stan In formation
6~1.
Vat,.ble Name
Data Type
ik>eripliun
,
,
,
OBxx_ EV_CLA SS
BYTF
E,,~nt
BYU:
clan
I Contents
6#1611 1I -
lt1' .vCnl
R1I16"xx
O'u
OBu]R10RlTY
,m
Priority cla~!
[lYTE
OB number
B"I6'<x:<
BYU:
Rc"",,'cd
OB"",_IOJ'LAG
"""
L'O itktlufic.UOD
6.,7
OBu_MOL_ADOR
WORD
!>1OOulc Itan;",
addre ssofoompo!!e<l! tt1iiefU'i Ihe
Wlerrupl
OBu_LEN
OYT E
!. onJilh of intorrupt
<Iota rccord
OBu _TY PE
BYTE
[(Ientille.uon of
ioterrupt .ype
0 1l1Ol_ KESERVED
"
OBu_SLOT
BYTE
SIo. number of
~O",p<Jnen l triuer.
;"II.he interrupt
"
OBx,,_ SPJ:C
BYTlO
Sp<.cilkT
"
Olh~_O ATIi_TL\tlo
xx ~n\l
'"
DATE
AND_TIME
~6otr
Occurrence of
event
"'""1'>'<'<1
Bi", I and 0:
00 re~n.d
0
UP .."em
0 DOWN e"enl wi,h error
DOW"< evenl w,th funilcr e<mrs
Bit 2:
o no addi'ional tdcn ..... kdgment
required
additiooal acknu",l<:dgmcnt
required
BilS 3 to 1: rescn-cd
,, ,,
12 ..
",.crv.'<I
diai<>'lic IntCTTUP'
han:lwatc LIl'em.tp'
removal Interrupt
itucrtion In,omup1
...IUI interrupt
up<btc interrupt
n:scn..:d
"cndor InlCTTUPI
Call tunc uf OB
Ih~
21.7
l\1ultipro\!~ssor
Interrupt
General remark.
An SFC 35 Io.-1P ALM call initiatcs execution of
the mult iprocessor interrupt OR Tfthe CP U is
in single- processo, mode, Oil 60 is "lart~,j
immediate ly. In multil'rocessor mode, OR 60 is
started simultafleously on aU participating
CPUs, that is 10 say. even the CI'U in which
SFC 35 was called waits before callin g OB tiO
until aU the other CPUs have indicated thaI they
are ready.
Multi-pmce.",r Interrupt
mterrup ~
interrupt
'"
tool (s~.., s e~lion. "Configuring ~on't~nt bu, cycle times anJ isochrone
modc" in Chapt.,,- 20.4.3. S ~cial Functions for
I'ROflli US DI'"). Table 21.1 I shows you the
Win informalion for the synch ronou, cycle interrupt,. The dummy value xx represent' the numb~r of the ~ssociateJ interrupt organizatiou block
wa~e Configu~ation
61 to 64 .
0''''
1\ ;
"ITQ,
I>
Ifan ac~ess
oce,," when updati ng
pani,1 process image of the inputs.
inputs of faulty modnlQ ' " 5\to ''0-;
OB 8S "'Program execulion error" is
ealled.
I>
the
tbc
tbc
not
21 Interrupt Handling
Table 21 12
With SFC
~arame t e",
Data Type
Contents. Ue'CripliOll
,~,
INPUT
BYTE
RFT VAC
RFTUR.."""
OUTPUT
,,~
Parameter
N;'lJOe
'"
126
m
m
'"
t 'LADDR
WORD
C~'de
SFC 39 DIS_IRT
Disabling interrupt.
Syste m fimction SFC 39 DIS_ IRT disables servicing of n .... w interrupt, and a,yn~hronous
errors. All new intctTllpI" "nJ asyn~hronous
~rrOrs ar~ r~jecled. If an im~'1TUpt or a,ynchronous error O~curs following a Disable. the organi:.:ation block i, nOt executed : if th~ OB does
not exi.'!. th~ CP U docs not go 10 STOP.
The Disable remains in forcc ror all ptiority
classes until it is revoked with SFC 40 E N IRT.
A fter a cold or warm restan, all interrupts and
asynchronous erron; arc e nabled.
S FC 41 DIS AlRT
Delay interrupts
:>
SI'C 4 2 EN_AIRT
Enable dciayed interruplS
Fore~ ampk,
SFC 41I)1S_AlRT
Delayl n \l lnterr upts
Sy~tem function SfC 41 DIS_ ATRT dcl.ys lbe
servicing of higher-priority new imcmlpTs aod
asynchronous CrTors . Delay mcans that tbe
",peratln\: system saves the interrupts and a,yncllronou5 errors which occurred during The
d~lay and ~crvices thcm when !he delay interval
ha~ expired. Once SFC 41 has been called. the
pn!1P"""' in The current organi7J11 ion bloc'" (in
the currenl priority class) will not be inlcrroptcd
by a higher-priority intcmtpt; no intcrropts or
asynchronous =OI1:i arc lost.
Vou can eaU SfC 4 1 s.c:~eraJ limes in 5UCCCSsiOll. The RET_VAL parameter sho"'s lhc number o fcal1.i. You IDU" call SFC 42 po:<:isely the
same nllmber "'f times as src 41 in order to
reenable the inlerrupt~ and asynchronous
errOrs.
21 Intcrrupt Handling
T~blc
223.
The assignment of the MODE paramekT
Mfine s the operating mode of SF B 54
RAL&.'\t. W ith ",lODE - O. the SFn shows
ramm~ter
Declaration
DataT~
Comem~.
MODE
INPUT
INT
Opa.lin mode :
,m
INPU T
DWORD
MLE."i
INPU T
<NT
,~W
INPU T
BOOL
SlATUS
OUTPIJT
DWORD
Error i<kntitication
OUTPUT
DWORD
Module
OUTPUT
,,~
~"
~"
THfj(d orea for O il start info rmat ion and adnlini.lnltiun intonnat io n
LEN
TIN,"
OUTPUT
A1NFO
OUTPUT
p.,,,,n p'ion
,t:artin~
or".
Target
for beader infortnation and .upplemen tary interrupt
infurmation
E~cnts
l)r.blt l l .H
Admmi.tn
By""
0", 19
"
,.
Header inf",,
SUl)I)lemeotary
nonmfurwo
000
="'"
.... t.""
!j}1e$
By"'"
010 3 )
'
",~
4 to 221 I'
20 to 27
~,
inmrurt1.
,.
"
22 Start-up Characteristics
22 Start-up Characteristics
Power-up
-----<D------+
STOP
+----@-- ~~==H=O='::O::::,
__--'"--+
RU'
_____~
In HOLD mode. the oUlput modul~. ar~ disabled. Wriling to the modules affects the modul~ memory. but docs 1I0t switch the sianai
stute~ "'oul"' to the module output.!<. The module! arc POI rnablcd until you exit the HOLD
mode.
In HOLD mode. C'O'erything ""vin~ to do with
timiog i~ discootinued. This includt'!<. fOf example. the prucCS3ing of ti"",rs, clock memO!)' and
runtime meters, cycle time monilorina and
minimum scan cycle time, aoo the ... rvicing of
Iime-ofday Wld tim<;-delay inlerrupl~. Exceplion: the re31-lime clock cOIltinues 10 function
normally.
in OB 102 or in OB 100. you mu.t load tile signal slatc~ from the module using direcl access.
You ean th~'1l SCI !be inputs (transfer !hem. for
IDstance. with load statements or with Ihe
MOVE box from addrc"" lIll:a Plio address
area
then wor\:: with the inpllts.
n.
glob~l
On
22 SlImllp Characteristics
22.2
Pow~r-U p
In
the following
iMtaneC!l:
~
~
~
switch~d
on
, ..
a\~o
"
22.2
The CPU S<:1lI the paranlCrers for .11 modules,
including irs 0,,"'11. ro their derau!! values. The
MP[ parameters of the first interface are an
ucq>rion. 'f1lcy are not changed so thar. C PU
whose memory luis been reset can srill be
addressed en rhe MPI bus. A memory reset alsc
does DCr affCCl rhe diagnosric buffer. 1M reol
Lime clo<=k. or thc runrime merC1"S.
I>
Procc-:d as follow"
again.
I>
t>
p(nIo~rUp
22..2 .4 R t lenlh"lly
A memory area
t~
CPU.
Tbe contents ofdauo blo<=ks in the RAM cun al
so be rctCTIli\~. The nallable retentive ...... i.
CPUspecific . You can doflll. tbe retentivity of
a data block with Ih. block propeny NOIIRe.
ra;" (S Chapter 3.2.3 , MBlo<=k l'1opcnin'.
With the 57300 wilh micro memory card. th.
bit IDCmones, timers and eounlers SC1 as ret""
ti"e
welT as the user prognm and user data
aTO saved on the micro memory card. where
tbey an retent". C"CTI without a haUeI)'
backup. With.,..11m ~wt. !he non memi"c
bit memories. time", and counters are deleted.
The conrents of data blo<=ks declared as MTIOfI
rctenlin" are initialized during. warm resUU1
(loaded with the inilial "a1ue< from 10M! memo
ory) or set 10 lmt if a load memory objecl is nol
&.
~"""t.
I>
22 Start-up Char""tcri,tic,
A r~ start is ex~cu!ed even if the paramClCr_
ized hardware configuration d=s not agre~
with the actual configuration. Exc~ption:
thc cunfigurcd PROFTBUS DP interfaccs
Ill ll,t a lways be pre8ent and ready for opemt,on .
~
com-
cxccu!~s
A ma"",,1 restart is in itiated vi~ the mode se lector or a commllllication function, ,m alltomalle
restan by switching on the mains power.
I/O.
~
In the restan romine . the CPlI updates the time!"s. the TUn-time meter. and the rca l-timc clock.
During restart, the ontpU1 moo"l",s are disabled.
i .e ., o"tpu, signa ls cannot be 'ransmitted. T he
OnIput disabk is only re,oked at the end of the
restan and prior to starting the cyclic program.
A res tart rout ine can be aboned, for instance
when the mode sele ctor is aelua!<:<i or when
there is a power failure. The aborted restart routine is then executed frum the beginning when
the power is switched on . If a cold restart ur
""ann stan is aborted, il muSt be executed
again. If a bot rcstart is aborted, all restart IYPCS
are p08sible.
HoI RHtafl
Dlsablt
-""'''''
...
lnitializll
W.nn It"torl
~.
QUIpOJ!
fI'ItIduIes
.........
Reset pooc;els-im&Q&
""'
Cold Rutl"
"""
0UIpUl !I1oCId<Ji<ls
-....
-.....
R..... t~
08101
HotR. .1M
=~"Kr~
,-
~0UI P<l \$
p<O!SI outputa
, .~
non-relOOU.. datil
IniOOWze modules
--~
06100
08102
w."" A_tlrt
Cold It.....rt
~-~
m.ge
Inl'\IIlIIble
-.~
~l
-""".-.,...- II
outpUt
Warm Restoon
'" _
.. /
''''''-______r.-.
-'0
001
modules
,o.
:"'O$f&r proce$l-
r ---'
Update
prooest..
.. . . . . .
0",
( STOP )
rl~" ...
22 Stan.up Characteristics
dclct",s all dala in tbe system memory (including the retentive data), ",ails OB 102. and then
executes the main program in 08 I fr(lm th'"
beginning.
The current program and the cum:nt data in work
memory are deleted and with them also the duta
blocks generated by a system function: the pro
gram from load memory is reloaded. (In contrast
t() tnen1()ry reset, a RAM load memory is not
deleted.)
22.3.3 Warm
I'Ihnua l co ld f"t'Sfan
With neWCT CPU~. a cold reslan Can no longer
be tnggered mll.n ually .... ing the mode selector.
Wi th older CPUs, a manual cold '""'Stan is triggered using the mode selector if the switch is
hcld in the MRES position for at least 3 5 before
transferring from STOP to RUN or RUNP.
A manual cold restart can also be triggered by a
~ommun;cations funelion from a proinumning
device or by a system block from another CPU.
In thj~ "''". the mode switch must be at RlN
or RUN_P.
A manual cold rcstan can always be initiated
unless tbe C PU requestS a memory reset.
Autonul\k cold rHlart
An automatic cold restan is initiated by swnch
ing on the mai ns power. Tbe cold restan is exe
cuted if
!>
R~S larl
r~nan
;nit;~lcd
in the fol-
eo
Via the mode selector on the C PU on a Inm sition from STOP to RUN or RUN-P (on
$7-400 CPUs with <cstart type switch, tbis
is in the CRST position)
po
I>
I>
I>
lfth .. re is a testan type switc h. it n."TJUIins without effect in the case of automatic warm restart.
Ir t.hc CPU contains s. micro memo!), card, it
reaclS exactly like a CPU wilh backup battery_
Wben operated without a mIcro memory card
and withoU! a backup battery. the CPU executes
an 3U!omaric nonretentive wann restart. The
cpe starts the memory reSet automatically,
then copies thc uSer proinlm from the memory
22A
0,
t>
Module Address
~rtaininj.
An automatic hot rt'start is initiated by switching on thcc mains pow",.. The CPU executes an
automatic hot restart only in the following
Instances:
t>
t>
t>
22 Stan-up Characteristics
I>
SFC 70GEO_LOG
AS(:~'Ttliin logical base addres~
I>
S FC! (1AOR_LGC
A5Ce.181n logical addre~s of a module
channel
I>
S}-C SORD_LGADR
Ascertl<in "jj logical addresses ora module
I>
SfC7 ) LOG_GEO
Asccnaill geographical address
J>
Table 22.2 shows the parameters for Ihese syslem bloc ks.
The SFC ~ GAOR LGC, 49 LGC_GAOR and
SO RO_ LGADR Ita"e 10 lD amJ LADOR as
~'Ulwnon parametcr!! for the logical address (address in the 110 area). 1010 is either
8 #16,1:54, whieh stand. for the pt'ripherul
inpuis (Pis) or BII I6#5 5, which .Iands for the
pt'ripheral OUlputs (PQs). LADDR ~"llIuins nn
1/0 address in thc PI or PQ area whkh eolTt'~pollds to th.., sp"cifi..,d challn~ l. Tflhe channel
is O. it is Ihc module Stan addr~ss.
With the SfC:s 70 GEO_LOG and 71 LOG_
GI:::O, the logical ad dress is on its own in the
LADDR parnmeler. A difl~remiation is made in
bit IS as to whether the address is assigned 10
an input (m 0) or an output (= I).
For lhc: ....J<Jrc~~es determined using the~ sy~_
t<:;m block$. an MSilPllDcut must hne been
made using the lIardware Configuration tool
between logical addre~s (module ~ta"ing
address) and ,.I<>t address (location o f module In
a rack or in a .u ti o n oflh., dislributed (10 ).
b~
address of Lbo;; submodule. With SURSLOT - 0, th .. diagnostics address ofthc module o r station is rerum~d,
SFC 70 GEO _LOG replaces Lbe SFC ~ GADR_
LGC, and Can be lL'\d in conjunction with
? ROFINET 10.
~ddrc.,
of a module
S FC 49 LCC_GADR
.o\sccnain th e ~ IOI .ddrcn o f a module
SFC 49 LGC_ GADR retutlu Ihc slot ad<Jrcs~ o f
a module when you specify an arbitnuy logica l
mooule addres;; . Subtr-.. cllOg the addr.::ss offset
(parameter SlJBADDR) from the specified
user data addre3S gi'es)'Oll the modulc statlin g
addre, . The value in Ihe AREA parameter
spccifi~s the "Ys!cm in which the mod,de is
operated (Table 22. 3).
- crul-alL'O
- PROFffiUS DP
22 Slarl-up Characteristics
Tab le 22.3 Meaning of Output ParameteTS "f SFC 49 LGC- GADR and SFC 71 LOG GEO
AREA
System
S7_400
,
,
,
S7-300
DiS!ri b"ted
~CK
00
,=.
"
"Q=.
"
"
1M3 area
IM4 area
On reslan
:>
1>
=
22.5 Paramct<!'li.zilli Modules
"'1m'
,torw
val""
DOla reCQrds with Inc numbers 110 24 0 nrc permi!! ihle for the system fun~lions for mod ule
parameterization. The . peci ti ed data reco rds
muSl be pres ent in the sy.tem data in the case of
SYSI<;m block.~ SFC 54 RD_DPARM, SFC 56
W"R_DPARMandSFB 81 RD_ DPAR.
22 Stan-up Characteristics
r>
r>
"
SFR 81 RD DPAR
Read predefined parameter:l
..
r>
SI'C 54 RD DPAlUvf
Read prcdefUleO parameters
SFC 5 5 WR PAR M
Write dymuni" param eters
SF C 102 RD Dl'ARA
R~ a ding prldelined param et e rs
System function SFC 102 RD_ DPARA transnUts the data record with the number specified
C PU's memory
Module
Load memo
,S OB
(SFC 54)
(SFC 102)
S FB 81
.','::
,"
/
(SFC 56)
(SFC 57)
(SFC 55)
(SFC 58 )
S FB 53
1....-_/
(SFC 59)
SF B 52
,,_...J
'--------/
F1gu re 22 .3 Sy<1cm Bloch for M,><lul~ P;u-am eteri ntion
The b loch
printed in bold
')'1'" rcp l",'e
the pa,-" nnhc,iz"d
blo.;ks 000" .
th,-m, lUlU Ulll
Tlbi.
in the RECNUM parameter fmm the corresponding SOB !ystcm d"ta blod: to the destination area spcdfi\XI at the RECORD.
The tran;lmiSJion is c""';ed out in asynchronous
mode. and can be divi<kd belWttn 'c'era1 program cycle,; Ihe BUSY parameter ;$ .. , . during
Ihe tranlmiuion .
SFC 102 replaces the SFC S4 RD_D?AR.\1
wbicb works in synChronOUi mode.
SFC 54 RO_ DPARM
Readin.: p N! litfioed p.r.mtlcr.
Sy",cm function SFC S4 RD_ DI'ARM transfe"
the Will record with Ihe number specified in Ibe
RECNUM parameter from Ihe relevant SOB
sy.tem data bluek 10 the destination area
fied at the RECORD parameler.
'pee"
22 Start-up Characteristics
module specified by the IOID and LADDR
parameters. Specify the nu mber of the data
record in the RECNUM parameter. The data
r~""ord may only contain th~ dynamic modul~
parameters . it must not be data record O. If the
module parameter, are prese nt in the associated
SDB, thcy must not be identified as static
Wh en the job is initiated, the SFC reads the
entire data record: the transfer may be d istributcd over several program scan cycles. Thc
BUSY parameter i5 '1 during the transfer.
SFC S6 WR DPAR.M
Writing predeflned parameters
System function SFC 56 WR_DPARM transfel1l the data record with the nwnber specified
in Ihe RECNUM parameter from the relevant
SOB syslem data block to the module identified
by the IO ID and LADDR parameters.
The transfer may be distributed over several
program s,an cyd~ s: th~ BUSY parameter is
'1" during the transfer.
SFC!l7P'-\&"\1_1\100
Parameterizing a mod ule
System fun ction SFC 57 PARM_MOD transfcrs all the data records programmed when the
modulc was parameterized via the Hardware
Configuration.
transfcr may be distributed over several
program sean cycles; the BUSY parameter I S
" I ,. d llring the transfer
Th~
Ta ble n.s ParnmC1ets for Sy<!= Function. U",d fOf Data Tro.nsftl
,;
J<><J
22 Start-up Characteristics
The system function block SFB 53 WRREC
contains the functionality of system function
SFC 58 WR_REC, and can replac~ the lattCT.
SFC 58 WR_REC
Writing a data record
SFC 58 WR_ REC transfers the dala record
addressed by the RECORD parameter and the
23 Lrtor Handling
23 Error HandLing
The CPU's ""crating system generates a syncm-onous errorwhcn an error occur<; in immediate conjunction w itn program ;;canning. A distin ction is nmde between two error types :
"',,'T
'~~~';';';'~i~~~~~=======
1
..
Fe: Bi;I6#8C
,
,
Bn aCCen
Brte acceSl
.....ord access
DoublewOTd ae,en
,,
,,
,,
doa,.
12~:
'"
I
Tobit D.l SFC Pan",.,.".. for Syr><:hronvus Em>r H.ndlma
depth. The
nesting depth per priority ~1'!I pmnissible for
a CPU ;~ the Iolal of lhe nesling depth of the
"normal" proces~ing and tile nesting de-plh of
nffilflg
p'~~~",""
t>
SFC3SREAD_ERR
function~
SfC 36
MSK~
ERR.
SfC 36 MSK_FLT
M1tSk synchronous errof$
(disable OB call)
T.b~
"
Ii
,,
'"
23. 2.4
Rud ln ~
th e Error Reghl er
extsa.
SFC 38 ",rums a ~l~ in the OUlput paraml:lCTS
for Ihe ~lected errors when these errors
o<:cum:d. and deletes these: errors in the mor
tl:1I;5t ...... wben they a,e queried. The synchronous errors that are reponed arc thOle in the
current priority cla" (priorir;. le"el).
~55ing ~bort
OB
ermrs on 80
398
~ rron
OD 81
:>
1\1 !I!!m
Co
(>
expansion unit
on 81 is
caU~d
C PU hardwan faulU OB
8~
Rack fl.lI ur e O B 86
to>
to>
110 a.'ecss error while executing (automatic) updating of Ihe (IfOCes!l ima\:c on the
system side
:>
01:1
[>
Ihi~,
it is
=0.
Comnlunkatl on error 08 87
The operating system calls organizalion block
013 87 Whl-n a communication error occurs.
Some e~amplcs of communicatioo errors Arc;
to
t>
to>
Clock
I>
')lnchroni~.alion error
Wilh a
.ynchmn<l\l~
errur, the
pe-rmi~sib!e
j~ t':<CC<.-dcd.
deflth i,
to>
c ~c~ed.
t>
t>
t>
t>
t>
t>
ctl"flr
OB 7.3
Modules with d iagnostic capabi lit ies distingui sh bet'Vttn programm able and non-pro
grammable d iagnosTic events. rogrammablc
diagnostic even,s are reported only wheu you
have sct the parameters necessary to e nable
diagnostics. Non-programmahle d iagnostic
evt"nts [I re always reponed, regard less of
whether or !IO! d iagnostics have beeu enabl ed.
In the even! of " reponable diagnostic event,
t>
t>
t>
t>
t>
"'"
"
The event ID i, identical (0 (he f1NtlWo byt..
of th e buffer cnuy (Figure 23.1) . Permissible
for a user enny ar~ the event classe, 8 (diagno
tic entries for signal modules), 9 (standard user
events). A and B (arbitrary user event ,).
Additional information (INFOI) corresponds
to byte, 7 and 8 cfthe buffer entry (one word)
and additional information 2 (INF02) to byte;;
9 to 12 (one doubleword) . The contents of both
yariablcs may be of the uscr', own choice.
Set SE:t--'D to "j" to send the d;agnostic entry to
the relevant node . Even if ,ending is nOl possi
ble (be<:ause no node i. logged in orbccause (he
Send buffer is full, for example), the enny is
still made in the diagnostic buffer (when bit 9 of
the event 11) is set)
When a diagnost ic interrupt is incoming or outgoing, the operating system interrupt' scanning
of the user program and calls organization
block OS H2. If OB g2 has nOl been proEvent 10
~umb8r
"'- ~
.....m
'------ ,.,':.:.~'~":.:"'~.:""~-----'
l (i(J()
EVMt bits
~r.ot'1C ~mr)'
Eoftnl cia:
gnmuned, the CPU goes (0 STOP on adiagnostic imerrupl. You can disable or enable Oil 82
with system function SFC 39 DlS_IRT or SFC
40 EN_IRT, and delay Or enable it with system
function SFC 4 1 DIS AIRT or SFC 42 EN
AlRT.
for.ignot modulo
"'w.t""
'"
23 Error Handling
"~
",
,
,
6 ... 7
..0
"'
i:i
"'
"'
"
,"
,,'
..
OB82 EV CLASS
BYTE
~m
'YTE
ETTQTc<><I ~
~
~
~ ~
..
~~
10.6
10.7
11.2
)1.)
11.4
11.5
WORl)
~
,
BOOC
'OOC
Front
BOaL
~
I
,_m
~ ~T
~
~ ~HT
~C)'CT
..
'.
1.
Bil 4 channel information pr.,ent
Bit 5. u'er information p~,e n t
Bit 6 <ii"!!TIo>tic' interrupt from proxy
Bit 7 ,..,,,,rv.. d
C(}mmuni~alion,
BOOe
BOOe
BOOe
statu.
fa ult
l>lodukm,=1
f.iled
Flat banef)
..
~
f"jlur~
BaaL
Proccs.or
IJOaL
EPROM roul!
BOOL
RAM faul!
BaaL
ADCIDAC fault
~
OT
;ro;
..
Timwu' has
BaaL
'OOe
-;;om
ii-' " ~;
~
11.6
110 i
OR
R.,erYcd
R=
-;;om
,0;
10. 5
BYTE
,
>D,
,
10.4
..
..
,,
~'"'',
.
iIi
~
lime of, i
SZI. ID
Readln~
the
Sy~lcm ScMtu~
List
system $JanlS Ii." (SSL) de!cribe. the current S13tll<l of the programmable controller.
Usi ng inforonation funclion~. the list C1l;) t>e
rc"d bul Mt modified. Since the complete Sylit,m starn,U" is e"tremely larl!:e. r d ing is car_
ried out in subli.1S and subli.t eJltnoels. Subli.1>o
lin.' vinuallil;I~, .... hicb mellllb tblot lhI:y are made
a~aiillbk by Ihe CPU operating system unly on
request.
The SSL In ex ists in orner tn identify a ,ublist.
Thi. contain. the module type cIa .. to whi~h
the liil applie~, the number of the subli$t
e"tract, aod the aetual SSl .ub.ist oumber(figun: 23_2). YOtl Ire providc4 with thc desired
infOlmation together with Ihe index which
specifi~, an object of a subl i~t. A S standard. the
CPU provides infrn"lllui on on the au:om8tion
system, but n... and CI' modu les can alSQ use
tbis 5crVlce in ord.,.- 10 make informatiml mvail_
able (see module doc:umMltalion). The p!}'I~ib!e
,ystem nntu) li.ls for a CI'L are described ;n
the operotiOll)j do~criplion .
ReMdi ll g lit e huder ;nfonnHtlon
U!;e the SSllD WII16#OFxx 10 ~8d the header
infomlSlil,)ll of Bn SSL subli.. t witholll Ihe usoe ialed data ~co rd (xx SS!. suhlist number).
The SSL_H EADER. N_ DR parllm eter (number of daJa <ords) then returns the maximum
po;t.iblc number of data records of the .-ubli.t
CAtnoet which th .. module can deliver with all
Ta bl~
23.H
~""""Cl<:rs
0000 - CPU
0100 - 1M
tOOO~
fLl
1100 . CF'
""
23 Error Handling
The Web server a lso suppons thc Terminal Service of \Vindows ,u that thin -cli e nt ,oimions
can bc u,~d w ith mohi1e devi ces or lIM! sta t;ons w ith the thin -clienl opliun llmier Windows
CE. In this case, ,p~eifythe address in the I'}fin
hllp.-!Iaaa.bbb, ccc.dddihasic.
You call navigate to fu rther information from
the 5taIT pase of the CPU. Plcase nute that the
information ollcred is "ati c and you h" v~ tu
prov ide fur up dat ing o f t he screen content yoursel f The c ur,..,nt intormaliun frum the C PU is
nse d for printing OU1, r~gardless of what is on
the display.
Note : P.-oteel your Web server against un anthorized aCCeSS by mean s of a f'irewall ,
the lP address ofthc CPU in the Object l'ropertics of the PROF~ET intert3ce on the " (j~ner
al" tab.
Sen- ~ r
Yu u can a c tivate the Web se rver when parame teri"; ]]g the CPU with the Hardware ConfiguraI.ion . Whe]] a Cl'U is sde~ tcd. EDIT --;. OBJE CT
P PQP r.RTl ES selects th~ "W~b" tah 0]] which
you activate the VI/e b server and s~l ect the la n g uage fnT th e me,sage texts and the entries in
the diagTIuslies buffer. 11 is also pu"ib l ~ tu >elect severallanguages, depending on the mem ory capacity of the Cl'U.
Th e lang uages installed with STEP 7 arc a,,~il
abk You c an establish agreement w ith the languag e' in'talled in thc proj~~t in the S1MAT 1C
M anager: Sel ec t OPTIU~S --;. L ANGtJAC,E FOR
DISPLAY DEVICES and dcfin~ the languages ,
Th e W~b s~rvC1" is rcady for usc afkr the contigurmion data have bc~n loaded onto the CPU.
"
>
Oiagnostics buff,,'!
"
[:>
PROFINET
interface
v Variable status
> Vari"ble tahle,
The first p age pro vid ed by the Weh server is the
Welcome page. From here, cliCk on ENTE R to
reach tne Stan pa ge . If you want \0 skip this intra page in future, activate th~ option "Skip TnIrO",
23 .S Web Ser.,..,
buffer "'lItries per display interval. Detailed in
formalion about the selected event is di splayed.
You can select the display languagc in the lOp
right window. Jf the selected language is not
configured, the in formation is displayed in
hexadec imal code.
Mc~sage.
Variable sta tu s
You can monitor the status of up to 50 variables
on this page. Wh ..'lI you specify the address of
the variables and the display formal, you rCc~ivo the value of the variable _
You can select the di splay language in the window "1 the top right. When specifying addresses, please note that the mnem011ic, for English
(eg. I for input) differs from tho"" "fother Ian
guage. (E for Eing ang"' in German, for example). S)1Itax error, arc indicated in red.
Variable tables
The Web server allow, you to monitor up to SO
variable tables with up to 200 variable, each.
fhe memory space avai lable in the CPU might
not Ix sufficient to make use of all the possibil
ities . If variahle tables are displayed incomplete. reduce the memory required by the mes
sages and symbol comments, if pmisible, use
only one language, and keep the number of
variables per ts.ble low.
Select onc of the configured variable tables for
display. f irst. you must prepare the variable tao
ble for use by the Webser"er. If you select EDtT
~ OBJECT PROPERTIES whL'lI a ,'ariablc table is
.elected, Or if you create a Dew variable table,
the Properties window operu;. Emer VAJiolVEB
as the family "n the '"~neral- Part 2"' tab, or
alternatively, activate the Web seITer'" checkbox.
'"'
Appendix
Appendix
This section ofthe book contain, useful supplements to the LAD and FBD programming languages, an overview of the COntentS of the
STEP 7 Block Libraries, and a function overview of all LAD and FBD element'; ,
t>
t>
You can use a funher function ofSTL. indIrect add r essin g. to transfer data arcas in the
LAD and FB D programming languages; the
addresses of these dala areas arc then nOI
calculated until runtime. The "LAD Book'"
and " FRD_ Book" libraries which you call
download from the publisher's Wcbsite (see
page 8) each contain a "Sample Message
Framc" showing how to sel up and transfer
data areas.
t>
t>
Bl uck L ib r a ri es
Organi~at ;on Blocks, System Funct ion
Blocks, rEC Function Blocks. 5 5-S7
Converting Blocks, TI-S7 Converting
Blocks, PID Control Blocks, Communication Blocks
26
2~
Supplements to Gnphie
l'T<l~mmini
2)
3)
4)
I>
I>
c>
C~a te
Open the source file (for example by 00...ble-<.:Iicking on the source file symbol in
the SIMATIC Manalleror ~ith the Edilor
and Fu.E -+ OPE-'1). You now see the
ASCIl source of you. lA DIFB O block. If
you have ~usly KlectW $evenl
block~. these blocks will be LImInlled in
order in the source file.
order:
I>
I>
:>
."
Do
5)
6)
t>
Do
Do
thre~
types o[pointers:
P"'Zy,,,
IS
as
24.2.3 DB Pninter
In addit ion to the area po inter, a DB pointer al,o
contain, " d ata hlock number in the form of a
positi,-e TNT number. [( specifie s the data block
if the area pointer points to the global data ()r
ins tance <lala area. In all other cases, the lirst
t,"o bytes contain zero.
The notation of the pointer is familiar to you
from full addres>ing ()f data operand,. llere
also. the d~ta hlock and the data operand are
Aru4nlerruol poI_
, , , o
0 0 0 , , , , , , , , , , ,, , , , , , , , , , , , , ,
0
~,
0"
0"
8yte acl<!res.s
,
,,,,,,,,,,,,,,,, , ,
,,,0 0 ,,, 0
"""",.-
0 0
8 8 n+2
eMl
00
o,
Byts n+l
!-
lS-10
1S-10
lS-10
By\e n+l
""
Type
""
8yte
Byte n+5
Byte .. of!
SytII n"2
8)'11 .. +3
n ~3
I-- '"" -
1-- ..... -
B)'II n+4
I--
Byle ... ~
8yte nH
number -
Byte .. +7
Byte .. +8
f-
,, ,,
0
0
,, ,
,, ,, ,
0
0
Ouantity -
""0 """
num!l8r -
I--
r-
Ouantity -
f-
f-
16#0000 -
f- 16)000
'''.
,""'"
potnter
Byte .. *9
1--- -
f-
OUlntity -
161JOOOO -
1----
Campi..
dall ty pe.
"" C"'"
"'"
' ''
"'" 0''''
""" ,'-"" mo
OWOR'
OE DT
13 STR ING
Par,mat type.
17 BLOCK_FB
18 BLOCKJ'C
19 BlOCK_DB
DATE
10 TIMER
Zero pointer
OC
TIM:
$5TIM E
00 NIL
.m
BOOL
WORD
OA
"
FI~u",
f-
r- .... -
Add,." , a:
0
0
0
0
ANY point
Byte n
Byte .. ~2
Dala block
S~8CSd...
ANY polnll.
ANY point"
Byte n
0"
8yte acldfes!l
DB pointe,
8illOdd''''''!
~~ ~~~fE~8
'"
Examples:
'>
I>
lupu t I 1.0
In the C38e of paramet~r type., you write the
pointer as follow>: L#Nmn bcr Type Qllantity
Exampl~s:
~
L#lO TIMER 1
Timer function T JO
Li'2 COUNTER 1
Cowlter funct ion C 2
IfYOll do not specify any o.!cfaults when dcclaring an ANY paramc t"r at a function hlock. the
"Editor aS8igns l0h<:x to the syntax II> and OOh<x
to the remainin g byte.,. The Editor then r~prc
, em, this (empty) ANY pointer (in the data
yiew) a. follows: P#PO .O VOl D 0.
24.3
You C~~l~' variable of data Iype A)\."'Y in I~
temporary local data and usc this 10 initialize an
ANY pMIIImeter. The Program EdilOrihen doe~
not generale &n ANY poinler (as it would if you
trt"aled 8 different variable). but use;; lhe A~"'Y
var iable in the tempomry local data as an AI\'Y
pointer to a jOU!"l:e or destination ~rea. The
ANY variable ;1\ the temporary local data is
s!nlcrured in the same way as an A"IY point;;r~
you can now modifY the individual entries at
nlnlime.
This pro<:cduu functions!lOl only in the case of
SFC 20 SLKMOV but also willi block parameten oflYP'-' ANY in other block!!.
The "LAV_BOOK" and --FBD_Book" libraries
which you can download from the publisher's
Website (IC<; page II), e~eh contain a --Messase
Frame E~amp\e" program, which in turn both
contain an e:<ampk of the "variable" ANY
poimer.
Blwf~ptiOD.ofthe
l\I~nal:'
E.umpl~'
frame dAta
The eump1e sbows how you can define frequently occr.ming data. "mClUres IS yOllr own
dala type ,nd how you use Ihis datH 1)'1)<l "'ben
declaring variab les a.od parameten.
We construe! II data ~!or<: for incominll and outgoini me,s~gc frames: A Send m~ilbo~ wilh
Ihe llnltlUre of a mc>sage frame. " Rece;ve
mailbo~ with Ihe S>IIIIe $lnlClUrt". ~nd a
(~~ei'e) ring buff~r Ihat i~ to provide inlc-rmediute 'I()ralle for incoming message fr8me~.
Since the data struclUJe of the message thune
occun [requmdy. "'"C will define il as II user
dcfinro data 1)"1'" (UDT) frame. The nru:IU#
jram.. contai1l'l a frame header whose ~tnK."\UI\! we
alsu ,..ant to~"C 3 name: 10. "The Send mailbox
!IDd the R~h'e mailbox are 10 be data blor.:b that
each eOl'tain a ~-ariable ,,~th the StnlCtUl"e of the
from ... Finally. there is 31so II ring buffer. II da13
block with an array 1."<lIlS;';ting of eighl camp<>nems 1M! also ha~e the same d<ila structure "'" thr;
frame.
I>
I>
!>
I>
Sav~
~rop)'mi'
Figure 24.2 $1>0\1.... the program and dala structure for Ihl' example.
'"
0861
DB"
MeaSUllld values
Send ms_b
Valuoel(1 .. 4J
V8IuII92[1,,4J
ldentinll'
Numbo'
Va lulIs3[1,.41
----_~
Va lulI&4[1,41
08"
0.101
DB"
Flee: malib
ldentift....
Number
"""
Figure 24.2
f)at~
F"C S2
CopyOata
E~aml'le
program~.)
Renamj"K .uondorrifimcrions
Symho/ic
add",,'~
Byte t
Byte 0
woro ,
16#10
F i~D""
SoType
24.3
Sln!L~UTC
SoNu m
ar~a
Area Pointer
Ward 4
"'0'
!1
..
"""
.~
SoByte
SoBlt
413
'"
25 Block Libraries
2S Block Libraries
,
,
,
,
,
,
,
,
Organization Blocks
00 Pri o Designation
10 2
II
12 2
13 2
13 2
2
16 2
"
Main program
Timc-{)f day interrupt 0
Time-{)f day interrupt 1
Time.of.day interrupt 2
Timeofday interrupt 3
Timc-{)f.day interrupt 4
Time-{)f.day interrupt S
Time-{)fday int~rrupt 6
Time--of day interrupt 7
OB Prio Designation
20
21
22
23
3
3
5
6
Time. delay
Time delay
Timedelay
Tim edelay
30 7
31 8
32 9
33 iO
Watc hdog
Watchdog
Watchdog
Watchdog
II Walchdog
Watchdog
II Watchdog
Watchdog
15 Watchdog
interrupt 0 (5 s)
in terrupt 1 (2 s)
interrupt 2 (I s)
interrupt 3 (500 ms)
interrupt 4 (200 ms)
interrupt 5 (1 00 ms)
inteITllpt 6 (50 ms)
interrupt 7 (20 ms)
interrupt 8 ( I 0 fiS)
16
17
18
19
20
interrupt 0
in terrupt I
interrupt 2
interrupt 3
interrupt 4
interrupt 5
interrupt 6
interrupt 7
"3635 "
37
3S
40
31
32
33
interrupt 0
interrupt I
intcrrupt 2
interrupt 3
"
Hardware
Hardware
Hardware
Hardware
Hardware
Hardware
22 Hardwa,..,
23 Hardware
""46
"
55
56
57
25 IV!u!t;processor interrupt
47
25 Block
Librarie~
DB l"rio De~ignation
6i
62
63
""
'" "
" "
"""
'"
""
70
72
73
8J
8S
87
~,
12l I)
Prio -
I)
Background processing
C T UD
TP
TON
TOF
SFB N ame
8
9
""
20
21
STOP
RESUME
"
STATeS
USTATUS
START
CONTROL
87
C_ D IAG
,
3
"
"100
101
."
Desi gllatioll
SET_C I. K
Set clock
READ_eLK Read clock
S ET_ RTM
CTRL_ RTM
REA D_ RTM
SNC_RTCB
TIM EJC K
S ET_eLKS
RTM
Designation
PUT
62
Offdc!~y
GET
Pul se
On dclay
Uncoordinated Rnd
Uncoordinated receive
B loc k-orienled $C'nd
Block-oriented receive
SfC Name
SFC Name
Up counler
()Qwn counter
Upldown counter
USEND
lJRVC
l:JSE:"O
BRCV
"
19
23
28 III ",~ .. n
CTU
CTO
Osignation
S7 t ommunkat\on
13
W,um reslart
Hot
,""start
10 1 27
102 27 Cold restan
,
,,
"
100 27
12 1
26 Time error l)
26 Power supply fault I)
26 D iagnostics interrupt' )
26 Inse rtlremo'"e-modulc interrupt \)
26 CPU hardware fault IJ
'" 26
"88 "26
"29
SFB Name
~ounl c n
S7 basic communlcMtlnn
SFC ","ame
Dcsignation
65
X SND
66
X _ RCV
67
68
69
X_GET
X_ PUT
X ABORT
72
I G I::' T
73
I PUT
74
I_ ABORT
25 .2
Drum
S}'C l\'amc
Designation
SFS Name
60
Send GD packet
Receive GD packet
32
61
GD SND
OD_RCV
"
62
63
M
61
SFC Name
Designation
SEND RK
fETCH]K
SERVE_RK
28
ANA LOG
30
ACT_TIi\"T
"
QRY _ TTi\"T
n
D
SRT DINT
CAN DINT
34
QRV_ DD.'
35
MP_AL""
mcasu r~m~nt
30
Cumrul puls.e-width
mod ulatiou
"
fu nction~
Designation
Position ing with
analog output
Pm;itioning wilh
d igital OUIPUI
"48
Designatiou
39
4>
CONT_C
SFC Name
63
AS CALL
29
Control counter
COUl\L
FREQUENC Control frtquen~y
PULSE
H CTRL
SET_TI::-"
CANJINT
"
30
38
II -CPU
90
DIGITAL
29
Drum
Send data
(ASCn, 3964 (R))
Receive data
RCV]!'P
(ASCn, 3964(R))
RES RCVS lRlctt receive buffer
(ASel!, 3964(R))
Designation
SEND l'TP
SFB Name
49
Designat ion
Designation
Integral S7-JilOC
"
Function Bloch
SFC :\ame
SFB Name
6<J
DRUM
Syst~'1n
CoDlinuo us dosed-loop
control
Step-action control
Gen~ate pulse
'"
39
40
4>
42
Trigger mul!ipnx:eSSClr
alarm
READ ERR
,="
Read event ,tatus rcgi ..er
DIS
EN
DIS
EN
lRT
IRT
AIRT
AJRT
De,ignation
"
70
71
GEO_ LOG
LOG_GEO
5
50
Designation
CaU "ssembler block
'"
25 a lock Libraries
SFB Name
Des ignation
SFB Name
Designation
52
54
I{ALRM
Receive intcrrupt
75
SALRM
Trigger interrupt
RDREC
53
WRREC
81
RD PAR
Read predefined
parameters
SfC Name
54
55
Designation
"
57
58
59
102 RD DPARA
SFC N am e
DP PRAL
11
DPSYNJR
SYNC/FREEZE
12
D ACT_DP
Dcactivate or activate
DP slave
13
14
DPRD DAT
15
103 DP TOPOL
26
UPDAT_ PI
27
UPDAT]O
Update process-image
output table
79
80
SET
RSET
126 SYNC
"
127 SY NC PO
SFC Name
"
"
"
ALAR.VI 8
;0
NOTIFY
37
AR SEN D
33
SFC Name
Designation
RD_S1NFO
51
RD SYSST
52
Messages wilhout
accompanying values
ALAR.v! 8P Messages w ith
accompanying values
SFC Name
9
10
17
System di a gn os tic.
D~signalioo
"
19
'"
Messages w itholU
acknowledgment display
Send archive data
Designation
EN_M SG
DIS M5G
Enable mes<;agcs
Disable messages
- ,c
READ
"
106 DEL 51
'"'
<0"
SFC Name
Designalion
""
BLKMOV
FU.L
"
CREAr DB
23
DEL DB
TEST DB
"
Name
De, ignation
"'"
LEN
LEFT
RTGHT
MID
Length of a STRING
Let] section ora STRING
Right s~~tion ofa STRING
Middle section of a
STRTNG
"
"
CONCAT
fNSERT
DELE TE
REPLACE
FIND
Concatenate STRINGs
Insert STRINC,
Odele STRING
Rep lace STRING
Find STRING
I STRNG
or STRNG
32
26
"
"
.,
CO:\fPRESS Compress
8'
'"
25
82
83
'"
85
REPL VAL
m~mory
38
STRNG_I
"
STRNG OJ
STRNG R
39
Designation
D_TOD~DT
6
7
01 DATE
30
SST! 'JlM
TIM SS TI
.1,
.13
AD DT TM Add TIME to DT
SO DT T\1 Subtract TIME from DT
SR_DT_DT Subtracl DT from DT
STP
"
''''
WAIT
OB RT
Determine OR runtime
CiR
ConfigllT"tion in RlJ).<
Changing program
protection
SFC Name
Dc,ignation
III PN IN
Update input.
Update output<
Pi': OUT
'" PN DP
De,ignation
DT TOO
30
RE_ TRI(jR
<09 PROTECT
Convert REA L to
STRJNG
Conwrl S'I1tlKG to TNT
3.1
7<
SnU~G
'C Name
Program contro l
SFC Name
,
;J
DT DAY
Compari!(ln ~
Fe N=,
9
28
Update DP connections
"
"
FQ DT
:\'E DT
(i'T_DT
OE DT
Designation
Compare Dr for equal to
Compare OT for
not equal to
Compare DT for
greaK'I than
Compare OT for
g~a\er than or equal to
SO
RAD 16
9<l
91
92
REG FIFO
OJ
94
REG_ LIFO
(FIFO)
Stack (LIFO)
DB_COPY I
DO COl'Y2
96
RETTN
"
LADEN
98
COD_ llS
""
COD 32
"
16bit fixcJP<'int
~l!are root extractor
BulT~r
BCDbinary conversion
8 decade!
Bin3ryBCD convcrsion
8 decades
25.5 TI - S7 Convcrtin2 Bl o c k s
Name
80
81
"'
83
"'
"
SO
Fe
Name
100 AE_460_ 1
101 All. 460_2
102 AE_463_ 1
10) AE_463_2
104 AE_464_1
105 AE_464_2
106 AE_466_1
107 AE_466_2
\ 08 RLG AA I
109 RLG_AA2
110 PER ETl
III PER
En
O<:~iptation
Fe Name
80 TONR
81 I13LKMOV
84
ATT
83
86
FIFO
PTIOO distributed VO
IIT100 dilrib uted 1/0
MMt h functlonl
Fe
Name
Designation
III
113
114
115
SINUS
COSIl\'US
TANGENS
CaTANO
Sine
Cosin<:
T,mgcnt
Cot""t:: cnt
116 ARCSIN
117 ARCCOS
Ilg ARCTAN
110 AReCOT
Arc ~inc
Arc co~inc
Are tangen!
Arc cotangent
120 LN_X
Natur.llogarithm
l<lgarithm to base: 10
Logarithm to any base
121 La_X
122 B_LOO_X
82
RSIlT
83
SET
"'
88
89
TllLJIND
LlI'O
TIlL
TBL_ WRD
90
WSR
"02
WRD_TBL
SHRB
9l
SEO
"
"
ATH
""97
98
HTA
NCO
DECO
BCOCPL
DlTSUM
100 RSETI
101 SETI
99
Dcsignation
".
Desillnation
Lalching ON delay
Tnmsfer data are~
ind irectly
Relet process image
bit by bi\
Set process image bit
by bit
EnltI value in tahle
Output first val ue in table
Find value in tahle
Output last value in tQblc
Execute tahle operation
Copy value from the tab le
SaveualUm
Combine tnble c\~ment
Shift b it in bit shift register
Bit pattern for 7'i~gment
display
A SC JI hCl'adccim ~ I
conversion
I ! el'adc~lmal.ASCI1
conversion
Least ,ig:rificant ,et bit
Sct bit in word
G~ncrate len,
compleme nt
Count sct hits
Rc~et PQ byte by byte
Set I'Q bytc by byte
" I
25 Tllock Libraries
W 2 DEV
IOJ
104
105
106
COT
TEL TEL
SCALE
UNSCAlE
Calculate standard
dcvim ion
C<'l!Tl;wcd data table<
Table combination
Scale values
Un~cale values
FB Name
20
21
'B Namc
Designation
41
Continuous control
Step COntrol
Generate pul<e
Continuous temperature
control
Step temperature control
42
4l
"
"
CONT_C
CONT_S
PULSGEN
TCONT_CP
TCONT_S
22
2l
FB Name
6l
64
6S
66
67
68
1S
Uncoordinated send
Uncoordinated reeeivc
Block~oriented scnd
Alock-oriented recci,'c
Read data from partner
Writ'" dam to partner
FC
Name
Desi!lnation
1
2
Dr SEND
DP RIXV
DP mAG
DP_CTRL
Send data
Receivc data
Diagnost ic s
Control
62
C CNTR
TSEND
TReV
TCON
TDISCON
TUSEND
TURCV
Designation
USEND
URCV
BSEND
HW;CV
GET
PUT
9
12
II
14
Read in put<
Sct Olllputs
Read inputs consi<tently
Sct OUtputs oon~i~tently
IF: cmnmuniclltion s
GETIO
SETIO
GETIO]A
SET!O]A
Designati on
UDT Name
"
TCON_PAR
66
TADDJAR
Designntion
Send data
Receive dutu
Establish connection
Cancel connection
Send data via UDP
Receive data via
UD'
Designation
661 TADD]AR
PO"
FC
Fe
Name
Designmion
60
LOC_ TlME
61
BT_LT
62
LT_ HT
63
S_ LTlNT
ILl
FB
Name
Designalion
60
SET SW
"
SET_SW_ S
62
T1MESTMP
Switch over
SUn>mt'I'lwinter lime
S .... ilCh ov",.
summC1'/winlC1' lime with
limt'stalUS
Send lllCssagCS with
time stamp
U DTNwne
Designation
,
4
.
8
""
"
"
43
N~,
Designation
DP SEND
OP_ RECV
DP DIAG
DP_CTRL
Send data
Re.:eive data
DiBgn05tics
Control
AG_SI::."1\'D
Send daLa
(rROFIBUS FDL and
Industrial Elho.'1IlCl)
AG_RECV
Recti,'t' data
(PR O FIllUS FDL and
Industrial Ethernet)
AGJOC K Di sable data exchange
(ln dustrial Ethem~1)
AG_1J?;'LOC Enable dala t'xchangc
(lndustrial EthernC1)
fTP C O NN
WS RULES
~Iion
to
FTP STOlt
FTP RTR
FTP_DELE
F'TP QUIT
C_CNTRL
UDTName
60
E..'Ilablish
~~,
Rul~
ror summcr/wint.er
Iiitit' JW;lehinll
Designalion
FILE_DB_ HEADER
25.9 SIMATlC_NET_C P
Llbnry p ..... gr am CP 300
F.
,
,
,
3
4
6
9
12
13
""
"
N.~
IDENT
READ
RF.PORT
STATUS
WRlTE
Det; i lllU'1ion
FMS communications:
Identify pIIMDCT
Read dat.a from panner
Transmit variables
Request stahl.
infonnntinn from partner
Write data In partner
eUT
Uncoonlinated send
Uncoon:linared receive
nlock-arientcd 5Cftd
Illock-orirntcd receive
ltelKl (\ata from pIIrIner
Wrill' datu to parblt'r
IP CONF
USEND
URCV
a SEND
BRCV
GET
F.
Name
,
,,
lDEl'<,
READ
RF.PORT
STATUS
W RJTE
"
FC
,
IP_(.'ON f
Send coll/lt'Clion
configuration
Name
Designation
AG_RECV
AG_LOCK
AG SEND
Desil1nalion
FMS communi cations:
Identify partner
Read dau. from partner
Send vanablej
R~esl statull
inronnat;on from partner
Write data 10 partner
Send dalll
(PROFIBUS FDL and
Industrial EltternC1)
Rccei~e data
(PROFIRUS FDL and
Indu.sllia! Elttem et)
Disable data excbange
(Industrial Ethernet)
25 Block Libraries
8
'"
"
FTP CONN
FTP STOR
Establish connection
to server
Transmit data block
\0 server
Transmit file to client
Delete file On server
Cancel connection
"
FTP RETR
FTP DELE
FTP QUIT
"
43
44
60
UDT Name
Designation
RED INIT
451 RED_ DEPA
'"
FB Name
Designation
450 RED IN
'5 1 RED OUT
"I
FC Name
RED IN
RED OUT
'"
Designation
4"
RED DIAG
452 RED STAT
FC Name
450 RED INIT
RED DEPA
"I
Designation
In itialize 110 redundancy
Trigger dcpassivation
26 Fuoction Set un
fun~ ti on.
Sin,. cuil
NO <""toct
MldU ......up.n
NC .......
r
Il.o,ot <Qil
Bi ..... 'Yoper_
'.
--.-
I' 1>----1
SR NIx
<.
'' ' ,
"
Timer fune!i"m
a'' .
,'
~.
MSbo.
"'
,
" a,.
,
,.:: ;.;
""
~'-
J n61~ld" .1 .1'IlI'llf'
Mesa coil
NC <:OIl"",t
,/
( 81)
mod<
NO """Ioc~
1'00111 fd lt<'
,,,f ... oPl"" ~
'1IY>8I" 01"1"'''''
O\llllltior'l
-".....,
-1'1
II
Timer op<!f8.nd .
V1
-,
S_PULSE
S_PEXT
SP Pulse
SE Extended Pulse
8_0D1
SD ON dela)'
5_00TS
S_OFFDT
425
Transf"r fun"Uons
MOVE
EN
ENO-
Comparison functio ns
ou,
'N
=''NN''
Counter function.
Counter op.narK!
S_CUD
- CU
Q~
-
CD
-_ S
pv
cvf-
CV_BC0rR
Counter operand
Count up coil
--{(,cui
Count .. r operallO
--{('co)
w;,lI~t
Rose't'(Iit
-{('scI
Cw",
Counler~nd
--{(RI
accord ""IIO
equal ' 0
nO! equalw
-,
"'NT
REA'
- 0
- R
~,
~o
~R
>0
_ 0
>R
_ R
<0
~O
~R
-="""'
-,
areat"
or "
'0
than
equal
len 'han
Ie.. 'han or
equal to
<,
<-,
I
I
Counter opetlInd
Sec ~'" coil
Compare for
A rhbmetk functions
I
AD0_I
=
=
- 'N'
EN
IN1
Counter operand
NC contact
-{IIf----
--{(,1f----
'"
ENO
OUT
Calc ulation
Addition
Subrr""tioo
Multiplication
Oivi5ion
Moo"'"
accordinj to
'NT
D!NT
AOD_I
SUB_ I
ADD_I)[
MUL_'
01"'.'_1
~
SUB_ OI
MUI __ DI
Dlv_o r
M OD 01
REAL
ADU_R
SU8 R
MUL_ R
OIV_R
~
16,1 Digita l
Mathematical Functions
Shift Functions
'"
M.tb hox
~' unet;ons
ENOrOUT
Shift bOI
SHL W
EN
ENOl-
=,,~,---_O_U~Tr-
SIN
CO,
Sine
SHL_ W
Co , ine
SilL_OW
T~
Tangent
SHR W
"'"
Am ,inc
SHR DW
ACOS
Art cosino
;>ffi -
ATAN
Art tangen,
SHR OJ
'OR
ROL_ DW
Rotate left
SQRT
ROR DW
Rotate Iiiht
EXP
u<
Convcrsiun Functions
I BCD
-EN
ENO IN
OU T
Word Logic
'"'
"'oro
WAND W
AND
WOR W
OR word
WXOR W
Ex<iu,ive OR word
Com'c"iOD of UCD
WAND_ W
EN
ENO
IN'
OUT
ORdoubleword
"
with rounding
CEIL
(0
FLOOR
(0
ne~t
KOUND
lower numoc--r
TR UNC
INV OJ
NEG Dl
NEG R
427
26
FUD~lion
Sel LAD
Stulus Bits
MeR orea
Aet inte
>0
"""11-1-
"""1 1-1-
Reb}'
De.c\i"~t<
f--jMCRAi--l
MCR HrCa
f--j(MCRD)I---1
O~ "
MCRw n e
---{MCR-<))-----i
Clo se
MCRzonc
f----{MCR)-----i
<0
------111-1Block Functions
--jI l-l<>0
"""111--
Ca ll i" g"
fun c tion block
"i(h dota b loxk
=~ O
Re.uH in , ..u ~
(unordered)
O v e rflow
Slore ~
overflow
Binary f8 u lt
SAVE c oil
-"""111--uo
-"""111--
fu nction "bl<><k
wit h d au, block
OV
-"""111--os
-"""111---
#nam "
b l""k or a 'y>1cm
fu nction b lock
as loca l in stallce
EN
ENO
IN 1 OUT 1
IN2 OUT2
BR
-"""111---
C alling 0 fUDction
---iiSAV')f--!
IN2 OUT2
Ckllin. u
Jump Functinns
J ump if
RLO "I "
Entry,
j um p label
CC>
EN
ENO
IN 1 OUT 1
Call ing a
system funct ion
Junlpi f
Calling a s)'S!<IIl
SFCx
EN
ENO
IN1 OUT1
IN2 OUT2
cC>
non.parameterized
fu nc tion
--{ CAll)f--I
Colling a
non.param ete r i7ed
system [wnctioo
--{ CALl)f--!
SFC )(
D.. slina~on
---(JMPN))-----i
De s tination
RET coil,
block end
",">
cL.t. hloc k
c on dit i on~ l
Momor)' FunCllon.
~ f,.,
~ f'OR
~ f&
A.N 1I funotiDD
Bir.ary operaoo
----1 I
Olt function
Bin8ry <>perand
-------1
1/
I--
E.du,lvc-O R
fno<lioD
Binary operaoo
-------1 s I
Binary operafld
-------1
R...,
Bina
operand
--1
Ch .... for
.lgn. I ..... "1"
Cb .... for
d;n. 1
n<!l0tlon
-4
".t. "n",
'R
Sit box
Timer Functions
Binary <>perand
as box
RS
-
a
Po,it"" odge
orlbcRJ,o
Nl1Iath'c Ig.
of lb.
RJ.o
----l
I--
lodlvldnal clcmeots
Tomer operand
limo moo.
T""..r ope'and
Reset oox
-j
~haracteristics:
S PU LSE
S PEXT
S onT
S ODTS
S_ OF FDT
se
se
SO
SS
se
--ct..-
""'
K
Extended Puis",
ON delay
Stored ON delay
OFF de lay
Transfer
~unctions
MOVE
EN
OUT
MOVE box
'N
Co mpariso n Functio n s
CMP = .. I
tNl
Compa rison bH
ENO
'N'
Counter F unctions
Com pare fo r
Count ..r ope rand
SCUD
cu
CV
CD CV_ BCD
Counler box
Individual clem e n ..
Count up
bo~
Reset box
Check
coun ter Slatus
Counte r operand
--1
<NT
"'NT
REAL
= ,
>,
>- ,
- 0
= 0
>0
_ 0
- R
= R
>R
_ R
<D
<R
<-,
-,
eq ua l !o
no! eq ual to
greater than
greater than Or
equal !o
less than
according 10
k than o r
<,
<- ,
<-D
equal to
cu
--1
CD
Counter operand
:::j
PV
SC
Ar hh m~tlc
box
=
-
EN
IN1
IN2
Counter operand
-l
Counter operand
Count .. , operand
----r---cL...
l NT
it"
Up/down counter
Multiplicati o n
Up counter
Di vision
Down counte r
M odu lo
DI V ]
O UT
ENO
f--
27.2 Digitalfnnction.
Malhemadcal
FUDctlon~
Shift Functiuns
Shlfl bo.
MOlb bOl
Si ne
Co,ine
ACOS
Arc <o.ine
SHL_ W
SIlL D W
SHR W
SHR DW
SIlR !
SI IR....[)I
ROL OW
RUR IJW
ROl<l le righl
R(}"'~
left
Word Logk
Con~eNion
Fu nction s
WAND_W
'"
Connr>.ioll bOI
IN1
IN2
OU T ,"0
OUT
ENO
,',',
...
~~.,
M'ITI word
'DO
Conv~"ion
UR word
ofl"'T 10 BC D
10 INT
to ON!'
"
CEIL
H.ooR
ROUND
TRUNC
.... EG VI
ow
WOR_DW
W:XOR OW
A N D <ioubic",,,,<i
OR doubl. word
hclu.in OR douhlowmd
27 Function Se t FBD
Block Fuoctloo s
Result greater
>0
I---
>-0
I---
<0
I---
<_0
I---
<>0
I---
Result e qua l
to zcro
--0
I---
th an zero
Result invalid
(unordered)
UO
Overflow
OV
Stored overflow
0'
'R
C a lling a
function block
w ith data bloo;k
Call in G a
function b lock or
I--I---
I---
Ca ll ing a
fu nu iotl
~>
local instan ce
I---
-------4 SAVE I
Jump if
Calling a . y ste m
fu nction
Jump if
KLO - "0"
E ntry,
jump label
JMP
----i JMPN I
Destination
"'""
MCR u mc
Clo,"",
MCR ,.one
D<......,tivate
MCR area
Destination
-------1 MCRA
-------1 MCR<
-------1 MCR>
-------4 MCRD
OUTt
- 'N'
'"0
C al ling a
non p a l"ame<e!u e d
fune, i<>n
'N' OUT2 -
- 'N
'C.
OUTt
'N '
OUT2
SFCx
-- ' N
-------4
OUTt
OUT:;>
'C.
CALL
Callin g a
non . param elO rized
syS\em fu n Clion
---l
CALL
Con ditional
bloo;k end
---1
Rn
a~.
a,.
---1 a'N
data bk>ck
'"' 'Na
-
Destination
-------4
- 'N
Jump Function.
RLO - " \ "
#n ame
SFCx
I
I
lnde"
Index
A
Actual parameters 257
Address priority 77
Addre.sing
absolute 117
indirect 40H
symbolic 11 8
AND funClioo \36
pwpenlcs
ANY pointer
description 410
introduction 165
Arc functiom 204
Archiving proje<:ls 56
Arithmetic functions 197
status bits 222
ARRAY (data type) 126
AhcI.--rlaining a module
Assign
OOx (FBD) 146
.ddr"",
C
383
50
B
Background scanning OB 90 275
Binary fl ags 22 1
Binary logic opcmtioru; 131
FHD 134
Binary result 222
EN/ENO 225
SAVE 225
status hit HR 222
B il memory 48
Block funct ions for code blocks
Block l ibra ries 415
m ock p arameter'S 252
forwarding
10 1
235
260
Blocks
checking block consistency Ill5
companng 76
COlT'ting interfau 104
<k<cription 98
opening 106
programming description 106
Index
Conncclion lable 65
Conneclions
configuring 65
loading data 68
Controlling 110 b its 233
Convers ion funclioll$ 207
~tatuS bils
222
Counter functions
lEC counters 186
S TMATT C counters 182
C PU hardware fault~ OB 84
CPU infonnution 82
Creating projects 54
system blocks 3 14
Down counting 185
DP maslu system
configuring 292
description 29
direct data exchange 301
equidi'itant bus cycles 301
in network conllguration 64
isochronous mode 301. 302
DPVI intelTUpts 367
398
D
Oata b lock
funct ions 244
monitoring lind modifying data
addresses 92
omine/online 84
open 246
programming 113
regiSlcrs 244
windows and views 11 4
DDta operunds 245
Dala Iypes
complex 125
elemcnlary 120
subdivision 120
uscr-do;:fi ncd 128
DATE (dahl. Iype) 125
OATE_ AND_TrME(dalatypc) 125
[kvice name, device number 305
DillgnO!l ing hardware 86
O iagnoslic inlelTUpt 013 82 401
DiagnoSlics address 44
PROFIBUS 01' 289
PROFINET 10 30~
Digital flags 22 1
DTNT (data type) 122
DINT ehleulution 200
statuS bilS 222
D irecl dala exchange see DP master system
Disable output modules 377
D istributed VO
addressing PROFIBUS DP 287
addressing PROFINET 10 ,,)<
configuring PROFIB US DP 292
configuring PROF1NET TO 306
introduction I'ROFIBUS DP
introduction PROFINET TO 31
"
.J<
Edge evaluation
description 152
Editor
FBD clemcnts 112
LAD clements 110
program 73
symbolic 71
E).I/ENO mechani sm 225
Enabling peripheral OUlputs 90
Error handling 393
Example
binary scaler 154
conveyor belt 260
conveyor connol I ~6
counter control 188
cdillng the message frame 413
reed 262
indirect copying of a data area .\3
message frame 411
parts eOUlller 261
save message frame 414
time-or-day check 41 1
Exclusive OR funclion 138
Exponentiation 205
Extended pulse timer 176
F
Fault-tolerant SIMATIC 24
First check 221
Forcing variables 88
Fonna! parameters 255
FUllction set
FBD 429
LAD 425
G
Gateways 68
Global data communicution
Global data table 322
320
Index
GSD fi1~s
for PROFIBUS OP
for PROFTNET 10 309
'"
H
Hardware catalog 59
Hardware config uralion 58
Hardware in\errup1.S 365
I
IEC counler functions 186
IEC fundious
library 419
lEe tim~'r fllllctions 180
Indirect addressing 408
Input' 46
Tnsewremove module in terrupt OD 83
IN T (data type) 122
IN T calculation 199
status hits 222
Interrupt handling 356
DPV I imerrupt, 367
general remark> 356
hardware inl~rrupis 365
multi processor inlerrupt 369
synchronous cycle imcrruplS 370
time-delay imerrupts 360
limc-of-day imerrupts 357
watchdog interrupts 363
IP address 305
Isochronous mode 301
J
Jump functions
227
L
Language smting 79
Libraries
commnnication blocks 422
creating 56
general 53
IEC function block:; 419
miscellaneous blocks 423
organization blocks 415
overvIew 415
PID control blocks 422
re<iundant 10 (V I ) 424
mlundant 10 CGP 424
S5-S 7 converting blocks 420
SIMATIC_NET_CP 423
398
N
NCcontaet 131
Ne gation
conveNion fun(.1ions
212
435
Inde><
normally closed (NC) eontact
NOT conlacl (l.An) 134
R LO 13<J
scanning ror "0" (FBD) 135
Network
configuration 62
templ~les
IW
NOeontl1ct 131
Number range overtlow 222
IJ I
o
off-delBY limcr 179
on-deIIlY timer 177
Onl ine help 54
Open data block 246
Operating modes
HOL D 377
RESTART 380
RUN (main progrnm) 270
START-U r 380
STOP 378
Opcrnt;ng modes of the CPU 376
OR functi on 137
Organ iz:nion blocks
ltSytlehronous erron; OB 80 to OB 87 398
background SC:;IlUling OB 90 275
detemlining runtime 283
diagnoMic interrupt 013 82 401
in tem.lp\~ Oil 10 to DB 64
356
main prugnun a u I :no
overview 97
redundancy error O B 70 10 73 399
rc.\tartOB1OOtoOBI02377
syDCh runou~~OB 121,OB 122
393
OutpuL\ 47
Overflow 222
['
Parallel eiro;uits 132
Parameter types 128
Parameterizing modul es
!'cripliClllI inpu!.!l 45
Peripheral oulpulS 46
3~6
Pointer
IOcnera11\."lIlI1rkll 408
Power supply crror.s OB 81
Prioriry classes 95
Process image
description 46
isochrone updating 371
su bproce~~ image~
272
436
398
updating
272
abon 08 88 399
PROFIBUS DP
addre~~ing
287
configuring 292
isochronous mode 302
PROF[}'' CT 10
add ressing 304
configurin g 306
send cycle time/upd"tc time 3 10
~ync domain
3I I
topo logy editor 311
PROHN ET 10 systCtn
de~cription
JI
in net ... ork configuration 64
Program cditor
FBD ~lcmeDts 112
gcncr~1
73
LAD dements 110
Program ~lcmcnts catalog 108
Program exe<;UI;on errors OS 85 399
Program length 97
Program organization 271
Program processing m ethods 94
Propttm staru.~ 90
Program ~trucrure 270
J>rogrommin8 code blocks 106
Progmmming daU! blocks 244
Programm.ing net works 108
Project
arcbiving 56
ero:ating 54
genC11lI 53
objKt h ierarcby 52
Project ve rsions 57
Protecting
user program 2116
P1P comrlllmica ti uD 346
Pulse timer 175
Procc~~ing
R
Rack failure OB 116 399
REAL (dat.a type) 124
REAL calculation 200
starns bits 222
Rcfcr~'Dce data
78
Resct 1:>ox 14K
Reset coil 142
Rese! function 148
Response time 276
Restart ehaructcrisricS 376
lnde ~
348
349
fBD
150
LAO 144
Run-time me!er
280
Sf'B2CTUD 187
sm 20 STOP 336
SFB 21 RESUlvIE 336
SPB22 STATUS 3.17
SFB 23 USTATUS 337
SrBJTP 180
SFB 4TON 180
SfB 5 TOr 180
SfB 52 RDREC 390
SFB 53 WRR EC 391
SfB 54 RALRM 374
SFB 60 SEND]TP 348
282
273
273
.159
360
281
360
360
362
SFC J.1 CAN DINT 363
SFC 34 QRY_D1NT 363
SFC 35 MP _ ALM 370
SFC 36 MSK FLT 397
SFC 37 OMSK FLT 397
SFC 38 READ ERR 397
SFC 39 DIS_IRT 372
SFC 4 READ RTM 281
SFC40 EN_lRT 373
Sf C41 mS_AIRT 373
SFC 42 EN_AIRT 374
SFC 43 RE_TRlGR 274
'"
SR memory function
FDD 149
LAD 144
Stan infnnnation
DPV 1 interrupts 368
hardware intemlp'" 366
inl("fTllpt handling 357
mam prugrnm Oil I 276
multil)rocessof interrupt 369
r~stan
377
synchronous cycle intenupts 371
temporary local data 241
time-delay int~rrupts 361
time-of-day interrupt. 358
watchdog interrupts 363
Static local data 14 1
Status bits
binary result BR 122
description 211
e'<aluating 224
fir<t check 221
OR 222
overflow OV 2n
RLO 221
. ening 222
Status 22 1
stQrcd Q"crflQW OS 222
StQred overtlQw 222
370
T
Temporary loc~l data 240
TIME (data type) 125
Tune of day 278
Timc S1amp conflict 104
TT'AF. OF DAY (darn tyfl<:)
Timebn<ed rcadion
125
U
UDT (dala type) 128
Up counting IllS
User blocks 99
liscr program
co mpressmg
load R3
~4
prQte<,1.ion 82
tcsting 90
v
Vari able dedarntion tahle
Vari able table 87
100
W
3112,3113
Watchdog interrupts 363
Word logic
description 217
status hils 224
WQn. memory 27
WRrm rcstarl
439
Ab~viatioru;
Abbreviations
Al
Analog input
CAD
Ladder diagram
AD
AS
Analog output
Me
Memory card
Automa1!on system
MCR
AS-l
Actuator-sensor interface
MMC
BR
CFC
C'
C'U
DB
01
Binary result
Multipoint interface
MP]
DB
Organizati on block
Communications processor
0'
Operator panel
'0
"C
Programming device
Data block
Digital input (module)
PS
Power supply
DC
RAM
0'
OR
EPROM
Erasable prograrnmabk
read-on ly memory
FB
FBD
Fe
Function block
RLD
SeL
SOB
SFB
SFe
SM
FEPROM
FM
1M
Data !"e<'ord
Function module
Interface module
Programmable controller
sse
STL
UDT
VAT
Statement list
User data type
Variable table