
Program Control Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
A5E00706949-01
10-9
Example
MCRA
.
.
.
.
.
.
Q 4.0
OPN
DB10
.
.
.
SFB 8
EN ENO
REQ DONE
ID ERROR
R_ID STATUS
SD_1
SD_2
SD_3
SD_4
M11.0
READY
M10.0
DB 8
CODE
DW12
DW14
DW16
OPN
DB10
The Ladder rungs shown above are program sections from a function block written
by a user. In this FB, DB10 is opened and MCR functionality is activated. If the
unconditional call of SFB8 is executed, the following occurs:
The return address of the calling FB plus selection data for DB10 and for the
instance data block for the calling FB are saved. The MA bit, set to "1" in the
MCRA instruction, is pushed to the B stack and then set to "0" for the called block
(SFB8). Program processing continues in SFB8. When SFB8 is finished, program
processing returns to the calling FB. The MA bit is restored and the instance data
block of the user-written FB becomes the current instance DB. If the SFB8 is
processed correctly, ENO = "1" and therefore Q4.0 = "1".
Note
When opening an FB or SFB, the number of the previously opened DB is lost. The
required DB has to be reopened.
Comments to this Manuals