6 - 53 6 - 53
6 IEC FUNCTIONS
6.8.4 Limiter LIMIT
LIMIT_E
The output value is controlled depending on whether the specified data is within the upper/lower limit value
(minimum/maximum output limit value) range or not.
Function definition
ANY_SIMPLE LIMIT( ANY_SIMPLE MIN, ANY_SIMPLE S1, ANY_SIMPLE MAX );
Argument
Argument Name
IN/OUT
Description
MIN
IN
Minimum output limit value
S1 IN
Input
value
MAX
IN
Maximum output limit value
Return value
Return Value
Description
ANY_SIMPLE Output
value
When MIN (lower limit value) > S1 (input value)
.............................................................................. Return value = MIN (lower limit value)
When MAX (upper limit value) < S1 (input value)
............................................................................ Return value = MAX (upper limit value)
When MIN (lower limit value) S1 (input value) MAX (upper limit value)
........................................................................................ Return value = S1 (input value)
Example of use
Argument Type
ST Program
Conversion Result
Used Instruction
REAL Real4:=
LIMIT( Real1,Real2,Real3 );
LDE>= Real2
Real1
ANDE<= Real2 Real3
EMOV Real2
Real4
LDE< Real2
Real1
EMOV Real1
Real4
LDE> Real2
Real3
EMOV Real3
Real4
LDE>=,ANDE<=,EMOV,
LDE<,LDE>
INT Int4:=
LIMIT( Int1,Int2,Int3);
LD SM400
LIMIT Int1 Int3
Int2
Int4
LD,LIMIT
DINT Dint4:=
LIMIT( Dint1,Dint2,Dint3);
LD SM400
DLIMIT Dint1 Dint3
Dint2
Dint4
LD,DLIMIT
BOOL bBit4:=
LIMIT(bBit1,bBit2,bBit3);
LD bBit2
OR bBit1
AND bBit3
OUT bBit4
LD,OR,AND,OUT
STRING Str4:=
LIMIT(Str1,Str2,Str3);
LD$>= Str2
Str1
AND$<= Str2 Str3
$MOV Str2
Str4
LD$< Str2
Str1
$MOV Str1
Str4
LD$> Str2
Str3
$MOV Str3
Str4
LD$>=,AND$<=,$MOV,
LD$<,LD$>
Summary of Contents for MELSEC L series
Page 1: ...Programming Manual Structured Text ...
Page 2: ......
Page 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Page 297: ......