An increment/decrement object applies one step per push, so hold-to-repeat lives in the PLC. A momentary button bit drives a self-retriggering timer: one step per done pulse at 500 ms, stepping up to 100 ms once the hold passes the threshold, with the setpoint clamped and release clearing every timer and direction bit.
A setpoint that sits forty taps away from where it needs to be is a logic problem, not a patience problem. The common increment/decrement object applies one step per push. Generating more steps while the button stays down is a job for timer logic in the PLC. There the rate, the step size and the limits are yours to set. A momentary button hands the PLC a bit that stays true while the finger is down. A self-retriggering timer turns that bit into one step at a time. A second timer switches the pace from 500 ms to 100 ms once the hold passes the threshold. The rung ends with a clamp and a release reset. Below is the parts list, the build step by step, the starting numbers, and the tests to run before an operator leans on it.
Why does a setpoint change only once when you hold the button?
The increment/decrement object is built to apply one step per push: one tap, one step, done. Holding the button changes nothing. Once the object has written its single step it has no further action to fire, however long the touch stays down.
The popup keypad is the other tool on the panel, and it is the right tool for big moves; nobody keypads through forty single counts on a trim made every shift. What operators actually ask for is jog behavior: press the button, the value starts walking, let go when it is close. The object produces no stream of events while held. So the build below produces that stream where the rate can be controlled: a plain momentary button writing one bit, and timer logic in the PLC that turns the bit into steps.
What do you need before you write the repeat logic?
You need four things: a momentary button whose bit the PLC sees every scan, the setpoint tag with its data type and scaling, two on-delay timers, and the numbers that set the feel: 500 ms slow interval, a 2 s hold threshold, 100 ms fast interval, one step size.
- A momentary button. Configure the button object to set one BOOL while pressed and clear it on release, then watch it in monitor mode through a few press and release cycles: true the whole time the finger is down, false one scan after it lifts. If the object also pushes a value straight to the PLC on each press, check that write's timing first; the delayed write commit timer for HMI switch presses article covers that path, and this build wants the button carrying the bit only.
- The setpoint tag. Used as it stands, with its existing data type and scaling, so every event moves it in the units the operators already read.
- Two on-delay timers. A repeat timer whose preset switches between the slow and fast intervals, and a hold timer that measures how long the press has lasted.
- The limits and the step. Low and high clamp bounds from the process, and the engineering step per event. The names and types used below are illustrative; keep your project's own tags.
- One writer. If the old increment/decrement object stays on screen during commissioning, interlock it, so both controls never write the same tag in the same shift.
How do you build the repeat logic in the PLC?
Build one rung chain: press sets direction and fires the first step, a self-retriggering timer produces one step per done pulse, each pulse adds or subtracts the step through the clamp, and release resets both timers and clears direction.
- Capture the press. On the rising edge of the held bit, store the direction (+1 from the raise button, -1 from the lower button), reset the repeat timer's elapsed value, and apply one step immediately, so a short tap lands one step the way the old object did.
- Arm the self-retriggering timer. Feed the repeat timer's input from the held bit OR its own done bit. While the bit is held, every expiration re-arms the timer, so it emits one done pulse per interval for as long as the finger stays down.
- Write one step per pulse. On each done pulse, add direction times step to the setpoint in a single write, gated on the held bit so a pulse left standing at release cannot fire.
- Clamp on the same write. Bound the result to the process limits before it lands in the tag; the comparison is in the next section.
- Time the hold. The second timer's input follows the held bit with the threshold preset, and its done bit selects which preset the repeat timer takes next.
- Clear on release. On the falling edge, zero the direction and let both timers reset. On a standard on-delay timer, a false input resets the instance, so this costs no extra rungs once the step is gated as in step 3.
The same chain in structured text, with illustrative names:
// held_bit: BOOL from the momentary button; setpoint: DINT, 0 to 1000 counts
// step: DINT := 1; direction: DINT, +1 up and -1 down while held, 0 idle
// low_limit, high_limit: DINT clamp bounds from the process
// On the rising edge of held_bit: store direction, fire the first step
hold_t(IN := held_bit, PT := T#2s); // times the hold
repeat_t(IN := held_bit OR repeat_t.DN, // re-arms itself
PT := SEL(G := hold_t.DN, IN0 := T#500ms, IN1 := T#100ms));
IF repeat_t.DN AND held_bit THEN // one write per pulse
setpoint := MIN(MAX(setpoint + direction * step, low_limit), high_limit);
END_IF;
IF NOT held_bit THEN direction := 0; END_IF; // release clears
The trap to avoid is wiring the step straight off the held bit with no timer. Logic runs once per scan, so at a typical 10 ms scan time a held button writes 100 steps per second, 400 steps across the 4 s hold worked through below, and a 300-count trim is at its limit in 3 s. The timer is what turns the rate into a number you chose.
How do you make the repeat speed up on a longer hold?
A second on-delay timer times the hold, and its done bit switches the repeat preset: 500 ms per step until the 2 s threshold, then 100 ms per step for as long as the button stays down.
The hold timer's done bit drives a select on the repeat timer's preset: false takes the 500 ms preset, true takes the 100 ms preset. The change lands at the next re-arm, so the rate always switches on a step boundary, never in the middle of an interval.
The numbers set the feel, and here is what moves them. The first stretch of hold delivers at most 5 steps at a step size of 1, so corrections near the target stay small; every second past the threshold adds 10 steps. A wide range or a coarse trim takes a 1 s threshold. A fine instrument setpoint takes a 200 ms fast interval, 5 steps per second. A large mechanical move per step takes a 750 ms slow interval, so the first seconds stay gentle. Tune the three numbers and the step together while watching an operator use the button.
How do you clamp the value and clean up on release?
Clamp with a comparison on the same rung that writes the step, and reset on the falling edge of the held bit: clear the direction, reset both timer instances, and swallow any done pulse still standing so release stops the value within one scan.
Write the limit instead of overshooting it: when setpoint plus direction times step would cross a bound, the event writes the bound and every later pulse changes nothing. The comparison is the same one used to bound a value in the article on enforcing HMI increment and decrement value limits in PLC logic; what this build adds is an event source that keeps firing, so the clamp gets exercised on every pulse and the value parks exactly on the limit.
Release does three things on the falling edge of the held bit: direction goes to zero, both timer instances reset, and the gate from step 3 swallows any pulse left standing. Two edge cases deserve decisions written into the logic. If raise and lower can be held together, force both timer inputs false while both bits are true, so neither command runs; silence beats a coin flip. And if the value keeps walking with no finger down, a bit is stuck somewhere between panel and PLC; the article on why an HMI touch button bounces after release covers the release-side version of that symptom.
Scenario: how many steps land in a 4 second hold?
Twenty-five steps: one on the press, four more at 500 ms through the first 2 s, then twenty at 100 ms over the remaining 2 s, so a setpoint at 400 with a step size of 1 lands at 425 and freezes there the instant the finger lifts.
Take a 0 to 1000 count setpoint sitting at 400, step size 1, an operator who presses raise at t = 0 and lifts at t = 4 s.
| Phase | Window | Interval | Steps |
|---|---|---|---|
| First step | t = 0 s | on press | 1 |
| Slow repeat | 0 to 2 s | 500 ms | 4 |
| Fast repeat | 2.0 to 4.0 s | 100 ms | 20 |
The slow phase gives 2000 ms ÷ 500 ms = 4 events, at 0.5, 1.0, 1.5 and 2.0 s. The fast phase gives 2000 ms ÷ 100 ms = 20 events. Total 1 + 4 + 20 = 25. The pace doubles across the hold: 5 steps in the first 2 s is 2.5 per second, 20 in the next 2 s is 10 per second, and a fifth second of holding adds 10 more.
Set the same hold against the scan-rate trap: 4000 ms ÷ 10 ms = 400 steps, 16 times the writes, and on a 300-count trim that pace reaches its limit in 300 × 10 ms = 3 s, with a second of holding left to push it further.
How do you check the repeat works before operators use it?
Test against a scratch copy of the tag with the machine in a safe state, and watch four things in monitor mode: the held bit, both timer elapsed values, the done pulses, and the setpoint.
A repeat rate nobody has checked can walk a live actuator to its limit between two glances at the panel, which is why every test below runs on the scratch tag first.
- Tap. One press, one step, and the value holds still after the finger lifts.
- Timed hold. Hold for 3 s against a stopwatch: 5 steps by the threshold mark, 15 by 3 s, then nothing after release.
- Release at both rates. Lift during the slow phase and during the fast phase; updates stop within one scan either way, and the next press starts slow again, which shows both timers reset.
- Both ends. Walk the value to each limit; it parks on the limit with no overshoot and no wrap past it.
- Both buttons. Raise and lower held together produce the decided response, neither command.
- Write it down. Step size, both intervals, the threshold and both limits go in the project notes, because the next engineer tunes from what you recorded.
Recommendation: Drive the repeat from a self-retriggering on-delay timer in the PLC, one step per done pulse, with a 500 ms slow interval, a 2 s hold threshold and a 100 ms fast interval, clamp the setpoint in the same rung that writes the step, and reset both timers and the direction on release. Keep the build single-rate at 200 ms when operators only trim a narrow range, because the hold timer buys acceleration that job never uses.
Questions
Can the panel's own button repeat setting do this instead?
Where a panel offers a built-in repeat rate on a momentary button, that field holds one fixed rate from first repeat to last. The two-stage acceleration, the clamp and the release reset still belong in the PLC, and keeping the setpoint write there means one place owns the value. If the object and the PLC both add to the tag, the result depends on which write lands last, and that order can change between presses.
What step size fits a given setpoint range?
Pick the smallest change the process can mean. On a 0 to 1000 count trim where 5 counts is the smallest useful move, set the step to 5: the slow phase then moves about 10 counts per second, the fast phase 50, and a full sweep from one limit to the other takes about 22 s of hold, while a single tap still lands 5.
The value kept walking after my finger was up. What do I check first?
Look for a bit that never went false. A button object left in a latched or toggle style, a done pulse that was never gated on the held bit, or a direction register cleared on the press edge by mistake all keep the rung firing with no finger down. Watch the held bit while releasing after a long hold, then confirm the value stops within one scan.
Does PLC scan time change the repeat rate?
The timer presets set the rate, and scan time sets the jitter: with a 10 ms scan, each 100 ms event fires within 10 ms of the moment it is due, so the average stays one step per preset. Scan time only becomes the rate itself when the step is wired straight off the held bit with no timer, which is the trap the build above avoids.
Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.