Skip to main content

LIMIT — Range Check

LIMIT

Low Limit

lowLimit

Test

test

High Limit

highLimit

Passes power when test is inside the inclusive range [lowLimit, highLimit]; bounds reverse to outside-the-band when lowLimit > highLimit.

Operands

NameType
lowLimitDINT | REAL
testDINT | REAL
highLimitDINT | REAL

How It Works

  • When lowLimithighLimit (the usual case): the rung passes when lowLimittesthighLimit. Bounds are inclusive.
  • When lowLimit > highLimit (wraparound): the rung passes when testlowLimit or testhighLimit. Useful for ranges that span a wrap boundary, e.g. an angle check across .
  • If any operand is NaN, the rung is blocked.

Example — Value in Range

Energize InRange while Pressure is between 20 and 100.

LIMIT(20,Pressure,100)OTE(InRange)

Equivalent to GE(Pressure, 20) LE(Pressure, 100) OTE(InRange) but in one instruction.

Example — Wraparound

Energize NearHome when a heading is within ±10° of 0°. Use the wraparound form:

LIMIT(350,Heading,10)OTE(NearHome)

Here lowLimit = 350 and highLimit = 10, so the rung passes when Heading ≥ 350 or Heading ≤ 10.

Example — Out of Range

Swap the bounds to get "outside the band". LIMIT(20, Sensor, 80) passes when Sensor is between 20 and 80; LIMIT(80, Sensor, 20) passes when it is below 20 or above 80.

LIMIT(20,Sensor,80)OTE(InRange);LIMIT(80,Sensor,20)OTE(OutOfRange)
Boundaries overlap

Both forms are inclusive, so at the exact bounds (Sensor = 20 or Sensor = 80) InRange and OutOfRange are both 1. If the two must be mutually exclusive, use GT / LT on one side instead of a second LIMIT.

Common Mistakes

  • Using LIMIT on a BOOL tag — numeric operands only. For boolean gating, use XIC / XIO.
  • Forgetting that a single-band check with low > high flips to wraparound semantics. If you just want "between", always pass low ≤ high.