Function blocks require a data block – the instance data block – in order to save the block parameters and the static local data. This can be a separate data block or – if the call of the function block is within a function block – the instance data block of the calling function block. You define the data block in which the instance data is saved when calling the function block:
b If you select Single instance, a separate data block is generated for the call of the function block.
b If you select Multi instance, the data of the called function block is inserted as a
“local instance” in the instance data block of the calling function block.
The data of a local instance is a subset of the static local data of the calling function block (Fig. 18.13). The local instance has a name which you define during program-
Fig. 18.13 Data storage of a local instance in a multi-instance Call of local instance
Program execution in the calling function block
Program execution in the called function block Block parameters
Block parameters
Block parameters
Static local data
Static local data
Static local data
Declaration of the local instance
A function block called as a local instance is declared in the static local data of the calling "higher-level"
function block.
The instance data of the called function block (block parameters and static local data) is then stored in the instance data block of the calling function block.
Interface Interface
Data storage of a local instance in a multi-instance
Block parameters Data of local instance
Static local data
ming of the statement. In a function block you can program several local instances of the same function block by defining different instance names for each of them.
The individual components of a local instance are shown in the instance data block in Expanded mode. You can address the components of a local instance from the calling function block as a static local tag using #Instance_name.Compo- nent_name or from any block as a global data tag using “Data_block_name”.
Instance_name.Component_name.
Function blocks with local instances can again be a local instance. In this manner you can “nest” up to eight instances.
You handle the call of a system function block (SFB) just like the call of a function block. Whereas the program of the SFB is present in the CPU's operating system, the instance data of the SFB is stored in the user memory.
Index
A
Accumulator functions (STL) 390
ACT_TINT (SFC 30) 201 Addition of constants
(STL) 393
ALARM (SFB 33) 243 ALARM_8 (SFB 34) 243 ALARM_8P (SFB 35) 243 ALARM_D (SFC 108) 244 ALARM_DQ (SFC 107) 244 ALARM_S (SFC 18) 244 ALARM_SC (SFC 19) 247 ALARM_SQ (SFC 17) 244 AND function
Description 464 With FBD 320 With LAD 287 With SCL 402 With STL 354
ANY (parameter type) 134 ANY pointer
Structure 137 Variable SCL 138 Variable STL 138 AR_SEND (SFB 37) 248 Arithmetic functions
Description 521 With FBD 335 With LAD 302 With SCL 411 With STL 370 ARRAY (data type) 129 Assignment
Description 469 With FBD 324 With LAD 291 With SCL 405 With STL 359 Assignment list 278 Asynchronous errors (OB
80 to OB 87) 218 ATH (FC94) 541 Authorization 31
B
Background program (OB 90) 185
BCD16 (data type) 122 BCD32 (data type) 122 Binary logic operations
Description 461 With FBD 318 With LAD 286 With SCL 401 With STL 350 Binary result
Control with SAVE 565 Save with FBD 341 Save with LAD 307 Save with STL 381 Status bit BR 563 Bit memory
addressing 96 Operand area 92 BLKMOV (SFC 20) 514 Block
Calling 165 Comparing 606 Compiling 273 Editing
FBD elements 317 LAD elements 285 SCL statement 398 STL statement 349 Know-how protection
161
Nesting depth 154 Programming
Code block 257 Data block 270 General 257 Properties 158 Block calls
With FBD 345 With LAD 313 With SCL 429 With STL 387
BLOCK_xx (parameter type) 133
BOOL (data type) 122 BRCV (SFB 13) 688 BSEND (SFB 12) 688 BYTE (data type) 122 C
C_DIAG (SFC 87) 229 Call structure 279 CAN_DINT (SFC 33) 204 CAN_TINT (SFC 29) 200 CASE (SCL) 421 CHAR (data type) 125 Clock memories 93 Cold restart 145 Communication
Open user communica- tion 692
S7 basic communication 675
S7 communication 682 Communication error
(OB 87) 223 Comparison functions
Description 518 With FBD 323 With LAD 290 With SCL 410 With STL 367
COMPRESS (SFC 25) 186 CONCAT (FC 2) 558 Constants table 257 Contact
Comparison 290 Edge 289 NC contact 286 NO contact 286 CONTINUE (SCL) 425 CONTROL (SFC 62) 691 Control statements (SCL)
419
Controlling the program flow
Description 560 With FBD 340 With LAD 307 With SCL 416 With STL 380 Conversion functions
Description 531 With FBD 336 With LAD 304 With SCL 413 With STL 374 COUNTER (parameter
type) 133 CPU hardware fault
(OB 84) 221
CREAT_DB (SFC 22) 586 Cross-reference list 276 CTD down counter 504 CTU up counter 503 CTUD up/down counter
505
Cycle processing time 611 Cycle statistics 182 Cycle time monitoring
183
Cyclic interrupts (OB 30 to OB 38) 205 D
D_ACT_DP (SFC 12) 670 Data
addressing 96 Operand area 93 Data block
Open
Description 583 With FBD 345 With LAD 311 With STL 388 Programming 270 Data types
Classification 119 Complex 127 Elementary 119 Parameter types 133 Pointer 135
DECO (FC 97) 552 Decrementing (STL) 394 DEL_DB (SFC 23) 587 DEL_SI (SFC 106) 247
DELETE (FC 4) 558 Dependency structure
280
Device name, device num- ber 84
Diagnostic address General 72
With PROFIBUS DP 653 With PROFINET IO 640 Diagnostic buffer 609 Diagnostics interrupt
(OB 82) 226 Digital functions
Description 507 With FBD 333 With LAD 301 With SCL 409 With STL 366 DINT (data type) 122 DIS_AIRT (SFC 41) 225 DIS_IRT (SFC 39) 224 DIS_MSG (SFC 10) 248 Distributed I/O
PROFIBUS DP 649 PROFINET IO 636 DMSK_FLT (SFC 37) 217 DP_PRAL (SFC 7) 666 DP_TOPOL (SFC 103) 668 DPMRM_DG (SFC 13) 667 DPRD_DAT (SFC 14) 671 DPSYC_FR (SFC 11) 667 DPV1 interrupts
(OB 55 to OB 57) 208 DPWR_DAT (SFC 15) 671 DWORD (data type) 122 E
Edge evaluation Description 472 With FBD 322, 329 With LAD 289, 296 With SCL 405 With STL 360 EN_AIRT (SFC 42) 225 EN_IRT (SFC 40) 224 EN_MSG (SFC 9) 248 EN/ENO mechanism
With FBD 342 With LAD 309 With SCL 417 With STL 382
Enable peripheral out- puts 627
ENCO (FC 96) 553 ENO (tag, SCL) 416 Error handling 213 ET 200 632
Exclusive OR function Description 465 With FBD 321 With SCL 403 With STL 354 EXIT (SCL) 425 Expressions (SCL) 400 F
FILL (SFC 21) 515 FIND (FC 11) 556 First scan
Status bit 561 FOR (SCL) 422 Force table 628 G
Generation of absolute value 543
GEO_LOG (SFC 71) 173 Geographic address
General 70 GET (SFB 14) 686 GETIO (FB 20) 669 GETIO_PA (FB 22) 670 H
Hardware diagnostics 608 Hardware interrupts (OB
40 to OB 47) 207 Hot restart 148 HTA (FC 95) 541 I
I_ABORT (SFC 74) 678 I_GET (SFC 72) 677 I_PUT (SFC 73) 677 I/O access error (OB 122)
214
IE communication See open user communi-
cation
IEC counter functions Description 502 With FBD 332
With LAD 300 With SCL 408 With STL 365 IEC timer functions
Description 491 With FBD 331 With LAD 299 With SCL 408 With STL 364 IF (SCL) 419
Incrementing (STL) 394 Inputs
addressing 96 Operand area 91 INSERT (FC 17) 558 Insert/remove module
interrupt (OB 83) 220 INT (data type) 122 Interrupt processing
Cyclic interrupt 205 Delaying and enabling
224
DPV1 interrupts 208 Hardware interrupts
207
Introduction 196 Synchronous cycle inter-
rupts 209
Time-delay interrupt 202
Time-of-day interrupts 199
Invert 552
IP_CONF (SFB 104) 672 J
Jump functions Description 568 With FBD 343 With LAD 310 With STL 384 Jump list (STL) 385 L
LEFT (FC 20) 556 LEN (FC 21) 556 Library
editing 43 LIMIT (FC 22) 555
Logic functions Description 549 With FBD 338 With LAD 306 With SCL 415 With STL 377 Logical address 70 Loop jump 385 M
Main program (OB 1) 177
Manufacturer interrupt (OB 57) 208 Master Control Relay
With FBD 346 With LAD 313 With STL 389 Master control relay
Description 587 Math functions
Description 527 With FBD 335 With LAD 303 With SCL 412 With STL 373 MAX (FC 25) 555 Memory card 601 Memory functions Description 468 With FBD 324, 328 With LAD 290, 296 With SCL 404 With STL 358 Memory reset 611 Memory utilization
Offline 281 Online 609, 611 MID (FC 26) 558 MIN (FC 27) 555 Minimum cycle time 184 Modules
addressing 70 parameterization 67 Status displays 608 MSK_FLT (SFC 36) 216 N
Negate RLO With FBD 321 With LAD 289
With SCL 404 With STL 357 Nesting depth
Blocks 154
Normally closed contact (LAD) 286
Normally open contact (LAD) 286
NOTIFY (SFB 36) 242 NOTIFY_8P (SFB 31) 242 Null instructions (STL)
395
Numerical range over- flow 562
O
OB 1 main program 177 OB 10 to OB 17 time-of-day
interrupts 199
OB 100 warm restart 171 OB 101 hot restart 171 OB 102 cold restart 171 OB 121 programming
error 213
OB 122 I/O access error 214
OB 20 to OB 23 time-delay interrupts 202
OB 30 to OB 38 cyclic inter- rupts 205
OB 40 to OB 47 hardware interrupts 207
OB 55 status interrupt 208
OB 56 update interrupt 208
OB 57 manufacturer inter- rupt 208
OB 61 to OB 64 synchro- nous cycle interrupts 209
OB 80 time error 219 OB 81 power supply error
220
OB 82 diagnostics inter- rupt 226
OB 83 Insert/remove mod- ule interrupt 220 OB 84 CPU hardware fault
221
OB 85 program execution error 221
OB 86 rack failure 222 OB 87 communication
error 223
OB 88 processing interrupt 223
OB 90 background pro- gram 185
Online tools 611
Open user communication 692
Operands 89 Operating state
RUN 149 STARTUP 145 STOP 144
Operation step (STL) 350 Operators (SCL) 400 OR function
Description 465 With FBD 320 With LAD 287 With SCL 403 With STL 354 Outputs
addressing 96 Operand area 91 Overflow
Status bit OS 562 Status bit OV 562 P
Parallel connection 287, 465
Peripheral inputs 90 Peripheral outputs 91 PLC station
adding 65
parameterization 67 PLC tag table 254
POINTER (parameter type) 134
Power supply error (OB 81) 220
PRINT (SFB 16) 692 Priority classes 197 Process image
Process image partitions 179
Update 177
Process image partitions 179
Process image update 177
Processing interrupt (OB 88) 223 PROFIBUS DP
Addressing 652 Configuring 656 Direct data exchange
662
Isochronous mode 662 SYNC/FREEZE groups
661 PROFINET IO
Addressing 638 Configuring 642 Real-time communica-
tion 647
Program execution error (OB 85) 221
Program execution types 155
Program status 614 Programming error
(OB 121) 213 Project
editing 41
Object hierarchy 38 PROTECT (SFC 109) 187 PUT (SFB 15) 686 Q
QRY_DINT (SFC 34) 204 QRY_TINT (SFC 31) 201 R
Rack failure (OB 86) 222 RALRM (SFB 54) 212 RD_DPAR (SFB 81) 176 RD_LGADR (SFC 50) 173 RD_SINFO (SFC 6) 228 RD_SYS_T (SFC 1) 188 RDREC (SFB 52) 176 RDSYSST (SFC 51) 227 RE_TRIGR (SFC 43) 183 Read OB runtime (SFC 78)
192
READ_ERR (SFC 38) 218 READ_SI (SFC 105) 247 REAL (data type) 124 REPEAT (SCL) 424 REPL_VAL (SFC 44) 218 REPLACE (FC 31) 559 RESET (FC 82) 517 RESETI (FC 100) 517
RESETP (SFC 80) 516 Result of logic operation
Status bit RLO 561 RESUME (SFB 21) 689 Retentive behavior 151 RLO
Reset (STL) 358 Set (STL) 358 RTM (SFC 101) 195 Runtime meter 195 S
S7 basic communication Station-external 678 Station-internal 675 S7 communication 682 SAVE 565
SCALE (FC 105) 542 Scanning of signal state
With FBD 318 With LAD 286 With SCL 401 With STL 352 Scanning status bits
With FBD 340 With LAD 307 With STL 380 SEL (FC 36) 554 Series connection 287,
464
SET (FC 83) 517
SET_CLKS (SFC 100) 188 SET_TINT (SFC 28) 200 SETI (FC 101) 517 SETIO (FB 21) 669 SETIO_PA (FB 23) 670 SETP (SFC 79) 516 Setting and resetting
Description 469 With FBD 325 With LAD 292 With SCL 405 With STL 359 Shift functions
Description 544 With FBD 338 With LAD 305 With SCL 414 With STL 375 SIMATIC counter
Description 495 With FBD 326, 331
With LAD 294, 298 With SCL 407 With STL 363 SIMATIC timers
Description 477 With FBD 326, 329 With LAD 293, 297 With SCL 406 With STL 361 Slot address 70 SNC_RTCB (SFC 48) 190 SRT_DINT (SFC 32) 204 START (SFB 19) 689 Start information
Data type 141
Read out with RD_SINFO 228
Startup program 171 STATUS (SFB 22) 690 Status bits
Description 561 Evaluate 566 Status bit /FC 561 Status bit OR 562 Status bit OS 562 Status bit OV 562 Status bit RLO 561 Status bits CC0 and CC1
562
Status STA 561 Status interrupt (OB 55)
208
Status word 563 STEP 7
Portal view 31 Project view 33 STOP (SFB 20) 689 STP (SFC 46) 186 STRING (data type) 128 STRING functions 556 STRUCT (data type) 131 Symbol table
See PLC tag table SYNC_PI (SFC 126) 211 SYNC_PO (SFC 127) 211 SYNC/FREEZE 661 Synchronous cycle inter-
rupts
(OB 61 to OB 64) 209 Synchronous error (OB 121 and OB 122) 213
T T branch
With FBD 322 With LAD 288 T_ADD (FC 1) 526 T_COMBINE (FC 3) 526 T_CONV 537
T_DIFF (FC 34) 526 T_SUB (FC 35) 526 TADDR_PAR (UDT 66) 700 Tag tables
See watch tables Tags
Controlling 625 Declaring data tags 273 Forcing 628
Introduction 89 Monitoring with PLC tag
table 621
Monitoring with watch table 624
PLC tag table 254 TCON (FB 65) 695 TCON_PAR (UDT 65) 695 TDISCON (FB 66) 695 TEST_DB (SFC 24) 587 Time 187
TIME (data type) 127 Time error (OB 80) 219 Time of day
Setting online 190 TIME_TCK (SFC 64) 191 Time-delay interrupts
(OB 20 to OB 23) 202 Time-of-day interrupts
(OB 10 to OB 17) 199 TIMER (parameter type)
133
Timer response Extended pulse 484 OFF delay 489 ON delay 486 Pulse 482
Retentive ON delay 487 TOF OFF delay 494 TON ON delay 493 TP pulse generation 492 Transfer functions
Description 508 With FBD 334 With LAD 302
With SCL 410 With STL 367 TRCV (FB 64) 696 TSEND (FB 63) 696 TURCV (FB 68) 699 TUSEND (FB 67) 699 Two's complement 543 U
UBLKMOV (SFC 81) 514 UNSCALE (FC 106) 542 UPDAT_PI (SFC 26) 181 UPDAT_PO (SFC 27) 181 Update interrupt (OB 56)
208
URCV (SFB 9) 686 USEND (SFB 8) 686 User data 91 User program
Cycle monitoring time 183
Cycle processing time 611
Error handling 213 Loading 596 Process image 177 Programming
With FBD 315 With LAD 283 With SCL 397 With STL 348 Protect 187 Response time 183 Testing with program
status 614
Testing with watch ta- bles 622
USTATUS (SFB 23) 690 V
V24_SET_441 (FB 6) 706 V24_STAT_441 (FB 5) 705 VOID (parameter type)
134 W
WAIT (SFC 47) 187 Warm restart 147 Watch tables 622 WHILE (SCL) 423 WORD (data type) 122