beautypg.com

Instructions, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 760

background image

L-force | PLC Designer

General Editors

758

DMS 4.1 EN 03/2011 TD29

Assignment as expression
As extension to the IEC 61131-3 standard (ExST), »PLC Designer« allows assignments
to be used as an expression.
Examples:

int_var1 := int_var2 := int_var3 + 9;

(* int_var1

real_var1 := real_var2 := int_var;

(* correct assignments, real_var1 and real_var2 will get the
value of int_var *)

int_var := real_var1 := int_var;

(* this will lead to an error message because of type
mismatch real-int ! *)

IF b := (i = 1) THEN
i := i + 1;
END_IF

Instructions
Instructions tell what to do with the given expressions. The following instructions can
be used in ST:

Instruction type

Example

Assignment
(see also: Assignment operators)

A:=B; CV := CV + 1; C:=SIN(X);

Calling a function block and
use of the FB output

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

RETURN

RETURN;

IF

D:=B*B;
IF D<0.0 THEN
C:=A;
ELSIF D=0.0 THEN
C:=B;
ELSE
C:=D;
END_IF;

CASE

CASE INT1 OF
1: BOOL1 := TRUE;
2: BOOL2 := TRUE;
ELSE
BOOL1 := FALSE;
BOOL2 := FALSE;
END_CASE;