LIMIT
Function Name |
LIMIT |
---|---|
Description |
Outputs a value that is within the limits that are provided by the inputs:
|
Arguments |
MIN {ANY}. The MIN input defines the minimum value that can be used as the output. This is used as the output if the IN input is less than the MIN input. IN {ANY} The IN input defines the input that is to be used as the output. It is only used if it is greater than the MIN input and less than the MX input. MX {ANY} The MX input defines the maximum value that can be used as the output. This is used as the output if the IN input is greater than the MX input. For more information on the data types for the inputs and outputs, see Data Type Hierarchy. |
Returns |
Output {ANY} The data type is of the same type as the inputs. |
Example:
Function Block Diagram - LIMIT:
In this example, the inputs are constant values. The IN input is greater than the MIN input and less than the MX input and so is used as the output value. If the IN input was 1, it would be less than the MIN input and so the MIN input would be used as the output instead. Similarly, if the IN input was 10, it would be greater than the MX input and so the output would be 8 as the LIMIT function would use the MX input instead of the IN input.
ST Program - LIMIT:
The syntax for a LIMIT function in an ST Program is:
- Output := LIMIT (MIN, IN, MX);
Where Output, MIN, IN, and MX are defined as variables earlier in the ST program.
Alternatively, you can use the following syntax:
- Output := LIMIT (MIN:= 2, IN:= 5, MX:= 8);
Where the numbers are the input values (in this case, they are the same numbers as used in the Function Block Diagram example).