Try a PLC free — no signup
Process ControlBeginnerIEC 61131-3

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

NameTypeDescription
MNANY_NUMMinimum allowed value
INANY_NUMInput value to clamp
MXANY_NUMMaximum allowed value

Outputs

NameTypeDescription
OUTANY_NUMClamped 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;

Free · no signup to try

Run this block in your browser

Try the instruction on a live rung before you copy it into a project — nothing to install.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad

Platform-Specific Implementation

S

Siemens (TIA Portal)

Use LIMIT instruction in TIA Portal. Also available in SCL.

AB

Allen-Bradley (Studio 5000)

No direct LIMIT; implement with GRT/LES comparisons and MOV instructions.

C

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.

Free · no signup to try

Wire this block up and run it

Drop the instruction into a rung, press Run and watch it execute in your browser — then adapt it to your vendor tool.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad