Thursday, July 12, 2012

CALL_FC Call FC from Box

CALL_FC  Call FC from Box



Description
CALL_FC (Call a Function from a Box) is used to call a function (FC). The call is executed if EN is "1".
If CALL_FC 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 function.
The BR bit is scanned in order to find out the ENO. The user has to assign the required state (error
evaluation) to the BR bit in the called block using ---(SAVE).
If you call a function and the variable declaration table of the called block has IN, OUT, and IN_OUT
declarations, these variables are added in the program for the calling block as a list of formal
parameters.
When calling the function, you must assign actual parameters to the formal parameters at the call
location. Any initial values in the function declaration have no significance.


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. The state of the RLO must be saved in the
BR bit by the instruction ---(SAVE) in order to be able to evaluate errors in the calling FB. When FC10
is finished, program processing returns to the calling FB. The MA bit is restored. After execution of
FC10, program processing is continued in the calling FB depending on the ENO:
ENO = "1"  FC11 is processed
ENO = "0"  processing starts in the next network
If FC11 is also processed correctly, ENO = "1" and therefore Q4.0 = "1".

Another CALL instruction almost same...........

!--RELATED-POSTS-STARTS-->

No comments:

Post a Comment