24.01.2015 Views

PLC Programming

  • No tags were found...

Create successful ePaper yourself

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

IEC Operators and additional norm extending functions<br />

LIMIT 30,80<br />

ST Var 1 (*Result is 80 *)<br />

Example in ST:<br />

Var1:=LIMIT(30,90,80); (* Result is 80 *);<br />

MUX<br />

Multiplexer<br />

OUT := MUX(K, IN0,...,INn) means:<br />

OUT := INK.<br />

IN0, ...,INn and OUT can be any type of variable. K must be BYTE, WORD, DWORD, SINT, USINT,<br />

INT, UINT, DINT or UDINT. MUX selects the Kth value from among a group of values.<br />

Example in IL:<br />

LD 0<br />

MUX 30,40,50,60,70,80<br />

ST Var 1 (*Result is 30 *)<br />

Example in ST:<br />

Var1:=MUX(0,30,40,50,60,70,80); (* Result is 30 *);<br />

Note:<br />

Note that an expression occurring ahead of an input other than INK will not be processed to save run<br />

time ! Only in simulation mode all expressions will be executed.<br />

10.5 Comparison Operators...<br />

GT<br />

Greater than<br />

A Boolean operator which returns the value TRUE when the value of the first operand is greater than<br />

that of the second. The operands can be BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT,<br />

DINT, UDINT, REAL, LREAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME and STRING.<br />

Example in IL:<br />

LD 20<br />

GT 30<br />

ST Var 1 (* Result is FALSE *)<br />

Example in ST:<br />

VAR1 := 20 > 30 > 40 > 50 > 60 > 70;<br />

Example in FBD:<br />

CoDeSys V2.3 10-11

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

Saved successfully!

Ooh no, something went wrong!