LIMIT (Limiter / Clamp)
Clamps a value between minimum and maximum boundaries.
The LIMIT (Limiter/Clamp) function block restricts an input value to stay within defined minimum and maximum boundaries. If the input exceeds the maximum, the output is clamped to the maximum. If the input falls below the minimum, the output is clamped to the minimum. Otherwise, the output equals the input. LIMIT is a critical safety function used to prevent actuators from exceeding safe operating ranges, clamping PID outputs, protecting analog outputs, and ensuring setpoints stay within valid ranges.
Parameters
Inputs
| Name | Type | Description |
|---|---|---|
| MN | ANY_NUM | Minimum allowed value |
| IN | ANY_NUM | Input value to clamp |
| MX | ANY_NUM | Maximum allowed value |
Outputs
| Name | Type | Description |
|---|---|---|
| OUT | ANY_NUM | Clamped output: MN <= OUT <= MX |
Ladder Logic Example
// Ladder Logic - LIMIT (PID Output Clamping) // // |----[LIMIT]----| // | MN: 0.0 (minimum output) | // | IN: PID_Out (raw PID output) | // | MX: 100.0 (maximum output) | // | OUT: Safe_Out (clamped 0-100%) |
Structured Text Example
// Clamp PID output to 0-100%
Safe_Output := LIMIT(MN := 0.0, IN := PID_Output, MX := 100.0);
// Or manually:
IF PID_Output > 100.0 THEN
Safe_Output := 100.0;
ELSIF PID_Output < 0.0 THEN
Safe_Output := 0.0;
ELSE
Safe_Output := PID_Output;
END_IF;20 Production-Ready Ladder Logic Templates
Stop writing the same rungs from scratch. Get copy-paste-ready templates for motor control, PID loops, safety interlocks, conveyors, and more.
Platform-Specific Implementation
Siemens (TIA Portal)
Use LIMIT instruction in TIA Portal. Also available in SCL.
Allen-Bradley (Studio 5000)
No direct LIMIT; implement with GRT/LES comparisons and MOV instructions.
CODESYS
Use LIMIT() function in ST. Part of standard IEC 61131-3 library.
Common Applications
- PID output clamping
- Analog output protection
- Setpoint range validation
- Motor speed limiting
- Valve position limits
Frequently Asked Questions
What is LIMIT (Limiter / Clamp) in PLC programming?
Clamps a value between minimum and maximum boundaries. The LIMIT (Limiter/Clamp) function block restricts an input value to stay within defined minimum and maximum boundaries. If the input exceeds the maximum, the output is clamped to the maximum.
What are common applications of LIMIT (Limiter / Clamp)?
LIMIT (Limiter / Clamp) is commonly used for: PID output clamping, Analog output protection, Setpoint range validation, Motor speed limiting, Valve position limits.
How do I use LIMIT (Limiter / Clamp) in different PLC platforms?
Siemens: Use LIMIT instruction in TIA Portal. Also available in SCL. Allen-Bradley: No direct LIMIT; implement with GRT/LES comparisons and MOV instructions. CODESYS: Use LIMIT() function in ST. Part of standard IEC 61131-3 library.
Related Function Blocks
PID (Proportional-Integral-Derivative Controller)
Closed-loop feedback controller using proportional, integral, and derivative terms.
View Reference →RAMP (Ramp Function / Rate Limiter)
Limits rate of change to create smooth transitions between values.
View Reference →PWM (Pulse Width Modulation)
Converts analog percentage to pulsed digital output with proportional duty cycle.
View Reference →Stop Writing Ladder Logic From Scratch
Get 20 production-ready ladder logic templates for $29 -- download instantly and use them on your next project today.
Instant download - 30-day money-back guarantee - Use on unlimited projects