Compare (input instruction)

LIM: Limit Test

Passes power while the test value sits between the low and high limits, inclusive.

Also called: within range, band check, in range.

LIM(low, test, high)

What it does

LIM is two comparisons in one instruction: low is less than or equal to test, and test is less than or equal to high. It reads better than the pair it replaces and it keeps both limits in one place, which matters when someone later has to change the band.

It is the natural instruction for a good-part window, an in-tolerance check, or a temperature band that a process must stay inside.

A rung you can run

A good-part weight window

[object Object]
LIM(980,Part_Weight,1020)XIC(Weigh_Complete)OTE(Part_Good)
XIO(Part_Good)XIC(Weigh_Complete)OTE(Reject_Push)

Anything from 980 to 1020 inclusive passes. Everything else is pushed off the line.

Run this rung in the simulator

What it is called on other controllers

PlatformEquivalent
Rockwell (Studio 5000)LIM
Siemens (TIA Portal)Two comparisons in series
CODESYS and IEC 61131-3Two comparisons, or LIMIT for clamping

Common mistakes

  • Writing the limits the wrong way round. The low argument comes first, and swapping them gives a test that is never true.
  • Using LIM on a value that has not been scaled yet. Compare engineering units against engineering-unit limits, not raw counts against numbers someone worked out for a different card.

Related instructions

All ladder logic instructions