LIMIT Function

LIMIT(Min, InVal, Max)

Limits InVal to the lower limit Min and the upper limit Max. If InVal falls between Min and Max, returns InVal.  If InVal is greater than Max, returns Max. If InVal is less than Min, returns Min.

Parameters

Min(REAL or DINT)

The lower limit.

InVal(REAL or DINT)

The input value to be limited.

Max(REAL or DINT)

The upper limit.

 

All three input parameters must have the same data type.

Return Value

Returns the same data type as the input parameters.

Examples

LIMIT(1, _Axis[0].ActPos,  10) returns the Axis 0 Actual Position if it the position is between 1 and 10. Returns 1 if the position is less than 1. Returns 10 if the position is greater than 10.

 

See Also

Standard Functions


Send comments on this topic.

Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion