Thursday, July 12, 2012
Call FC SFC from Coil (without Parameters)
---(Call) Call FC SFC from Coil (without Parameters)
Symbol
<FC/SFC no.>
---( CALL )
Parameter Data Type Memory Area Description
<FC/SFC no.> BLOCK_FC - Number of FC/SFC; range depends on CPU
BLOCK_SFC
Description
---(Call) (Call FC or SFC without Parameters) is used to call a function (FC) or system function (SFC)
that has no passed parameters. A call is only executed if RLO is "1" at the CALL coil. If ---(Call) is
executed,
• The return address of the calling block is stored,
• The previous local data area is replaced by the current local data area,
• The MA bit (active MCR bit) is shifted to the B stack,
• A new local data area for the called function is created.
After this, program processing continues in the called FC or SFC.
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 FC10 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 (FC10). Program processing continues in FC10. If MCR functionality
is required by FC10, it must be re-activated within FC10. When FC10 is finished, program processing
returns to the calling FB. The MA bit is restored, DB10 and the instance data block for the user-written
FB become the current DBs again, regardless of which DBs FC10 has used. The program continues
with the next rung by assigning the logic state of I0.0 to output Q4.0. The call of FC11 is a conditional
call. It is only executed if I0.1 is "1". If it is executed, the process of passing program control to and
returning from FC11 is the same as was described for FC10.
!--RELATED-POSTS-STARTS-->
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment