Calling function blocks in st, Return instruction, If instruction – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 57: L-force | plc designer

Advertising
background image

L-force | PLC Designer

What is What in PLC Designer



DMS 3.2 EN 02/2011 TD29

55

Calling function blocks in ST

A function block is called in ST by writing the name of the instance of the function
block and then assigning the values of the parameters in parentheses. In the following
example a timer is called with assignments for the parameters IN and PT. Then the
result variable Q is assigned to the variable A.

The result variable, as in IL, is addressed with the name of the function block, a
following point, and the name of the variable:

CMD_TMR(IN := %IX5, PT := 300);

A:=CMD_TMR.Q

RETURN instruction

The RETURN instruction can be used to leave a POU, for example depending on a
condition

IF instruction

With the IF instruction you can check a condition and, depending upon this condition,
execute instructions.

Syntax:

IF

<Boolean_expression1> THEN

<IF_instructions>

{ELSIF

<Boolean_expression2> THEN

<ELSIF_instructions1>

.

.

ELSIF

<Boolean_expression n> THEN

<ELSIF_instructions n-1>

ELSE

<ELSE_instructions>}

END_IF;

The part in braces {} is optional.

Advertising