26.10.2012 Views

Statement List (STL) - DCE FEL ČVUT v Praze

Statement List (STL) - DCE FEL ČVUT v Praze

Statement List (STL) - DCE FEL ČVUT v Praze

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10.6 Call FB<br />

Format<br />

Description<br />

CALL FB n1, DB n1<br />

Program Control Instructions<br />

This instruction is intended to call user-defined function blocks (FBs). The CALL<br />

instruction calls the function block you entered as address, independent of the RLO<br />

or other conditions. If you call a function block with CALL, you must provide it with an<br />

instance data block. After processing the called block, processing continues with the<br />

program for the calling block. The address for the logic block can be specified<br />

absolutely or symbolically.<br />

Passing parameters (incremental edit mode)<br />

Status word<br />

The calling block can exchange parameters with the called block via the variable list.<br />

The variable list is extended automatically in your <strong>Statement</strong> <strong>List</strong> program when you<br />

enter a valid CALL instruction.<br />

If you call a function block and the variable declaration table of the called block has<br />

IN, OUT, and IN_OUT declarations, these variables are added in the program for the<br />

calling block as a list of formal parameters.<br />

When calling the function block, you only need to specify the actual parameters that<br />

must be changed from the previous call because the actual parameters are saved in<br />

the instance data block after the function block is processed. If the actual parameter<br />

is a data block, the complete, absolute address must be specified, for example DB1,<br />

DBW2.<br />

The IN parameters can be specified as constants or as absolute or symbolic<br />

addresses. The OUT and IN_OUT parameters must be specified as absolute or<br />

symbolic addresses. You must ensure that all addresses and constants are<br />

compatible with the data types to be transferred.<br />

CALL saves the return address (selector and relative address), the selectors of the<br />

two open data blocks, and the MA bit in the B (block) stack. In addition, CALL<br />

deactivates the MCR dependency, and then creates the local data area of the block<br />

to be called.<br />

BR CC 1 CC 0 OV OS OR STA RLO /FC<br />

writes: - - - - 0 0 1 - 0<br />

<strong>Statement</strong> <strong>List</strong> (<strong>STL</strong>) for S7-300 and S7-400 Programming<br />

A5E00706960-01 10-7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!