Enforce HMI increment decrement value limits in PLC logic

6 min read · Published November 5, 2026

The limit lives in the PLC. Put a clamp or wrap rung ahead of the first logic that reads the register, so a bad value lasts one scan. On a panel with battery-backed memory, keep the project file on a PC and treat every battery change as a re-download; flash storage ends that dependency.

An increment or decrement button with no minimum and maximum fields writes whatever the step produces, straight into the PLC register. The range belongs in the PLC: put a clamp or wrap rung ahead of the first logic that reads the register, and a bad value lasts one scan. The same panels often hold their project in battery-backed memory, so a battery change blanks the panel unless you plan for it. This page gives the rung placement, both limit actions, and the battery swap procedure.

Where the limit has to live

The increment or decrement object does one job: it adds or subtracts a set amount to the value of a tag and writes the result back. Nothing between the touch and the register checks a range. The only hard boundary is the data type: a 16-bit signed word holds -32768 to 32767, an unsigned word holds 0 to 65535, and your process limit sits somewhere inside those numbers.

Some editors do print minimum and maximum on the object. One documented example configures a numeric increment/decrement with a minimum of 2000 and a maximum of 2050. If your editor has the fields, set them, and keep the PLC clamp anyway. The fields only see writes that pass through the object; a forced write from the programming laptop or a recipe load skips it, and the clamp rung catches every write path. The numeric keypad on the same screen carries the same exposure, and its design deserves its own pass: check every keyed and object write against the same bounded register list you build below.

If the screens are still on paper, bound every writable register while you lay them out. That is the cheapest moment to catch a tag nobody clamped.

Fixes that do not enforce a limit

  • Hunting for a min/max field the object does not have. Check the object help once, in case a later software release added the fields. Then stop looking.
  • Labeling the allowed range on the screen. Operators overrun labels, and the write still lands in the register.
  • Shrinking the step. A step of 1 count instead of 5 slows the walk to the limit. It bounds nothing.
  • Swapping the battery and hoping. On battery-backed memory, an unplanned swap is a blank panel with the line down.

What you need before you start

  • The register address and its data type: signed or unsigned, 16-bit or 32-bit.
  • The working range in engineering units and in counts, and the step size in counts.
  • The first rung or instruction in the program that reads the register.
  • For a battery-backed panel: a current project file on a PC, dated.
  • A bench panel of the same model for the battery test.

Clamp or wrap the register, step by step

  1. Convert the range to the register's counts. Tenths of a degree multiply by 10: 60.0 °C becomes 600 counts, 85.0 °C becomes 850.
  2. Find the first logic that reads the register and place the limit rung ahead of it. In ladder that is a rung above the first consumer; in structured text, statements at the top of the task body. Every consumer then sees an in-range value.
  3. Stop at limit:
// Illustrative names; map them to your addresses.
VAR
    spValue : INT := 600;  // heater setpoint, tenths of a degree C
    spMin   : INT := 600;
    spMax   : INT := 850;
END_VAR

IF spValue > spMax THEN
    spValue := spMax;
END_IF
IF spValue < spMin THEN
    spValue := spMin;
END_IF
  1. Or wrap to the opposite limit:
IF spValue > spMax THEN
    spValue := spMin;
END_IF
IF spValue < spMin THEN
    spValue := spMax;
END_IF
  1. Pick one action per register and write only that one. Many instruction sets also ship a single limit or clamp instruction that does the compare-and-move pair in one box; use it if you have it.
  2. If the value drives an output, move the clamped value into a working register and let the output logic read the copy.
  3. Expect a one-scan overshoot on the panel: the button writes, the scan corrects, and the panel shows the corrected number on its next update of that tag. If the flicker matters, point the panel at a display-only register the program loads after the clamp.

The proof test for the rung: force spValue to 855 and run one scan; the rung writes 850. Force 595; it writes 600.

Example: a heater setpoint from 60.0 to 85.0 °C

The recipe allows 60.0 to 85.0 °C. Stored as tenths of a degree, that is 600 to 850 counts, and the buttons step 0.5 °C, which is 5 counts. Walking up from 845: 845 + 5 = 850, in range, and the rung leaves it. The next press writes 850 + 5 = 855; stop-at-limit compares 855 > 850 and writes 850, so the value holds at the top. Wrap writes 600 instead, a 25.0 °C jump the operator did not ask for, which is why wrap stays off setpoints. Walking down from 600: 600 - 5 = 595, and the low-side compare returns 600. The full walk is (850 - 600) / 5 = 50 steps each way, which is the hold test later on this page.

The task on this machine runs every 10 ms, so the 855 lives 10 ms at most. If two button writes land inside one scan, the value can jump two steps. On the unsigned version of this register, a pile-up that runs past zero lands at 65535 (0 - 1 = 65535 on a 16-bit unsigned word), and the greater-than compare catches that in the same scan.

Choose stop or wrap per register

Register Action At the high end At the low end
Heater setpoint, 600 to 850 counts Stop at limit holds 850 holds 600
Recipe index, 1 to 12 Wrap 13 becomes 1 0 becomes 12

Stop at limit for anything a control loop or an actuator follows. Wrap for selectors and counters that must roll over.

Recommendation: run stop-at-limit on every setpoint register and wrap only on hand-stepped selectors and counters, place the rung ahead of the first reader, force-test both ends from the laptop, and keep a dated project file on the PC for any panel with battery-backed memory.

Keep the project through a battery change

On a panel whose project sits in battery-backed memory, the battery is the only hold-up when the power is off, and these models carry no capacitor to bridge a swap. Plan the swap as a project loss:

  1. Confirm a current project file on the PC. If there is none, upload or recreate it first. Do not open the battery door without a copy.
  2. Schedule the swap with the machine stopped, and treat the panel as blank afterward.
  3. Fit the battery type the panel manual specifies.
  4. Power up and download the project from the PC. Time the transfer once on the bench, so you know how long is normal for your project and can spot a transfer that runs long.
  5. Recheck every screen that leans on values retained in the panel: recipes, setpoints, counters.

The permanent fix is a panel that stores its project in flash; it holds the program with no battery fitted. Keep the PC copy anyway: flash ends the battery dependency, and the copy covers a failed panel. Whether a swap with panel power applied keeps the program is not documented for these models. Test it once on a bench unit, write the result into your procedure, and schedule every swap as a loss either way.

Confirm both fixes work

  • Hold increment through 50 steps and confirm the value stops at 850, or rolls to 600 under wrap.
  • Hold decrement through 50 steps and confirm the low end behaves the same way.
  • Force 855 from the laptop and confirm one scan returns 850. Force 595 and confirm 600.
  • Write 65535 into a test word and confirm the rung returns it to the range in one scan.
  • On the bench panel, pull the battery with power off, download the archived project, and confirm every screen and PLC link comes back.

Do the force tests and the limit walks on a stopped machine or the bench panel. A forced setpoint on a running process is a real command to the actuator.

When the second screen is only a status board

If the register you just bounded also feeds a big read-only number for the floor, that screen is a signage job, not an operator HMI. Keep the clamp in the PLC that owns the register either way, and put the board on its own display: our shop-floor displays take images and video as a status board and stay out of the control loop.

Questions

What if the increment object in my editor does have minimum and maximum fields?

Set them, and keep the clamp rung anyway. The fields only check writes that pass through that object. A forced write from the programming laptop, a recipe load or a restored project copy can put any value in the register, and the rung catches every one of those paths in one scan. Put the same two numbers in the object fields so the button itself refuses at the limit.

Does the order of the two compare rungs matter?

No. Each test reads the value as it stands when the rung executes. After both have run, the value is inside the range whichever fired first: 855 becomes 850, 595 becomes 600, and a 65535 from an unsigned underflow becomes the maximum under stop-at-limit or the minimum under wrap. Order only matters if you add hysteresis or alarm logic on top of the clamp.

When should a value wrap instead of stopping at the limit?

Wrap only on selectors and counters an operator steps by hand, such as a recipe index from 1 to 12. Stop at the limit on anything a control loop or actuator follows: a setpoint held at 850 counts is safe, and a wrap from 850 to 600 mid-batch is a surprise. Wrap also hides faults on counters fed by the process, because a wrapping counter still looks healthy.

Will the project survive a battery change if the panel stays powered?

That case is not documented for these panels, because the battery is the only hold-up when power is off and no capacitor bridges the swap. Until you have a documented answer, treat every swap as a blank panel. A panel that stores its project in flash ends the question.

Do increment buttons need the clamp if the screen also has a numeric keypad?

Yes, and the keypad makes the clamp more important, not less. A typed entry can land anywhere in the range in one write, so the one-step walk test never exercises it. Type a value far outside, such as 9999 on the 600 to 850 setpoint, and confirm the rung returns 850 in one scan.

Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.

Keep reading

Build your signAsk for a quote