High/Low Limit (HLL)
The High/Low Limit (HLL) instruction limits an analog input between two values. You can
select high/low, high, or low limits.
Available Languages
Ladder Diagram
This instruction is not available in ladder diagram logic.
Function Block

Structured Text
HLL(HLL_tag);
Operands
Function Block
Operand | Type | Format | Description |
HLL tag | HL_LIMIT | structure | HLL structure |
HL_LIMIT Structure
Input Parameter | Data Type | Description |
EnableIn | BOOL | Enable input. If false, the instruction does not execute and outputs are not updated.
Default is true. |
In | REAL | The analog signal input to the instruction.
Valid = any float
Default = 0.0 |
HighLimit | REAL | The high limit for the Input. If SelectLimit = 0 and HighLimit LowLimit, the instruction sets the appropriate bit in Status and sets Out = LowLimit.
Valid = HighLimit > LowLimit
Default = 0.0 |
LowLimit | REAL | The low limit for the Input. If SelectLimit = 0 and LowLimit HighLimit, the instruction sets the appropriate bit in Status and sets Out = LowLimit.
Valid = LowLimit < HighLimit
Default = 0.0 |
SelectLimit | DINT | Select limit input. This input has three settings: 0 = Use both limits 1= Use high limit 2 = Use low limit If SelectLimit is invalid, the instruction assumes SelectLimit = 0 and sets the appropriate bit in Status.
Valid = 0 to 2
Default = 0 |
Output Parameter | Data Type | Description |
EnableOut | BOOL | Indicates if instruction is enabled. Cleared to false if Out overflows. |
Out | REAL | The calculated output of the algorithm. |
HighAlarm | BOOL | The high alarm indicator. Set to true when In HighLimit. The HighAlarm is disabled when SelectLimit is set to 2. |
LowAlarm | BOOL | The low alarm indicator. Set to true when In LowLimit. The LowAlarm is disabled when SelectLimit is set to 1. |
Status | DINT | Status of the function block. |
InstructFault (Status.0) | BOOL | The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred. |
LimitsInv (Status.1) | BOOL | HighLimit LowLimit. |
SelectLimitInv (Status.2) | BOOL | The value of SelectLimit is not a 0, 1, or 2. |
Structured Text
Operand | Type | Format | Description |
HLL tag | HL_LIMIT | structure | HLL structure |
See Structured Text Syntax for more information on the syntax of expressions within structured text.
Description
The HLL instruction determines the value of the Out using these rules:
Selection | Condition | Action |
SelectLimit = 0
(use high and low limits) | In < HighLimit and
In > LowLimit | Out = In |
In HighLimit | Out = HighLimit | |
In LowLimit | Out = LowLimit | |
HighLimit LowLimit | Out = LowLimit | |
SelectLimit = 1
(use high limit only) | In < HighLimit | Out = In |
In HighLimit | Out = HighLimit | |
SelectLimit = 2
(use low limit only) | In > LowLimit | Out = In |
In LowLimit | Out = LowLimit |
Affects Math Status Flags
No
Major/Minor Faults
A minor fault will occur if the feature is enabled and overflow is detected (Fault Type: 4,
Fault Code: 4).
Execution
Function Block
Condition/State | Action Taken |
Prescan | EnableIn and EnableOut bits are cleared to false. |
Tag.EnableIn is false | EnableIn and EnableOut bits are cleared to false. |
Tag.EnableIn is true | EnableIn and EnableOut bits are set to true. The instruction executes. |
Instruction first run | N/A |
Instruction first scan | N/A |
Postscan | EnableIn and EnableOut bits are cleared to false. |
Structured Text
Condition/State | Action Taken |
Prescan | See Prescan in the Function Block table. |
Normal Execution | See Tag.EnableIn is true in the Function Block table. |
Postscan | See Postscan in the Function Block table. |
Example
This HLL instruction limits In between two values and sets HighAlarm or LowAlarm, if needed when In is outside the limits. The instruction sets Out = limited value of In.
Function Block

Structured Text
HLL_01.In := value;
HLL_01.HighLimit := high_limit;
HLL_01.LowLimit := low_limit;
HLL(HLL_01);
limited_value := HLL_01.Out;
high_alarm := HLL_01.HighAlarm;
low_alarm := HLL_01.LowAlarm;
Provide Feedback
LowLimit, the instruction sets the appropriate bit in Status and sets Out = LowLimit.
HighLimit, the instruction sets the appropriate bit in Status and sets Out = LowLimit.