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

Page 1057

Advertising
background image

L-force | PLC Designer

Programming Reference

DMS 4.1 EN 03/2011 TD29

1055

Example in ST:

PROGRAM ror_st
VAR
in_byte : BYTE:=16#45;
in_word : WORD:=16#45;
erg_byte : BYTE;
erg_word : WORD;
n: BYTE :=2;
END_VAR
erg_byte:=ROR(in_byte,n); (* Result is 16#51 *)
erg_word:=ROR(in_word,n); (* Result is16#4011 *)

Example in FBD:

Example in IL:

16.3.5

Selection Operators
All selection operations can also be performed with variables. For purposes of clarity
we will limit our examples to the following which use constants as operators: SEL,
MAX, MIN, LIMIT, MUX

SEL
IEC Selection Operator: Binary Selection. G determines whether IN0 or IN1 is assigned
to OUT.
OUT := SEL(G, IN0, IN1) means:
OUT := IN0; if G=FALSE
OUT := IN1; if G=TRUE.
Allowed data types:
IN0, IN1, OUT: any type
G: BOOL.

Advertising