Troubleshooting
Why an HMI button press dies in RUN mode on a shared input
Short answer
An HMI button fails in RUN when it writes a physical input address: the scan refreshes the input image from the field device every cycle and erases the write within one scan. Give each touchscreen command its own internally stored bit and wire the field contact and HMI contact in parallel; the press then works with the CPU running, stopped or on the bench.
On this page
- Why does my HMI button work in STOP but fail in RUN?
- What happens to an HMI write during the PLC scan?
- Why did the same button work on the office test PLC?
- Which addresses can an HMI button safely write?
- How do I parallel the field pushbutton and the HMI bit?
- Can an HMI button share an address with a maintained selector switch?
- How do I verify the fix in RUN mode?
- Questions asked
If a touchscreen button does nothing while the CPU runs but shows up the moment you stop the PLC, the button is almost certainly writing an input image address that a field device also owns. The scan refreshes that address from the wiring every cycle, so the released pushbutton's 0 erases the HMI's 1 before the logic can hold it. The fix is not a firmware update or a communications change: give every touchscreen command its own internally stored bit, put the field contact and the HMI contact in parallel in the logic, and download at a controlled stop. This article gives the scan arithmetic, the bench-test trap, the selector-switch rule and the RUN-mode acceptance test.
Why does my HMI button work in STOP but fail in RUN? #
The press is being erased, not ignored: your touchscreen button is aimed at an input image address a field device also owns, so in RUN the scan restores the wired state every cycle, while in STOP nothing refreshes the image and the write survives.
The symptom pattern pins it down:
| What you see | What it tells you |
|---|---|
| Screen press changes nothing in RUN | The write lands, then the input refresh erases it |
| Same press watched in a data monitor with the CPU in STOP | The address goes to 1, so tags and communications are good |
| The press seems to work while someone holds the real pushbutton | Both sources write 1, masking the conflict |
A press that appears in STOP proves the write reaches the controller; it proves nothing about the address. RUN is the state the machine actually runs in, so the address has to survive the scan, and a scanned input never will. Decision: keep the diagnosis, throw away the shared address — the fix is a logic change, not a driver, setting or firmware change.
What happens to an HMI write during the PLC scan? #
A write to a configured input address survives at most one scan, so on a 12 ms scan the HMI's 1 is erased within 12 ms while the refresh runs 1000 / 12 = 83 times per second and keeps restoring the wired 0.
Vendor documentation on every platform describes the same obligations: refresh the input image from the physical inputs, execute the logic once, write the results out, with communications serviced between those phases. The order varies; the refresh does not. An HMI write arrives during communications service, so it sits in the input image only until the next refresh. The input image is not memory you own — it is a copy of the wiring. Internally stored bits, the %M class in IEC 61131-3 addressing called internal relays or coil bits where platforms use other names, have no device behind them, which is exactly why a write to one stands.
Worked example, with illustrative numbers from a reported install of this failure:
- Physical momentary START pushbutton scanned into input %I161; released, so the wired state is 0.
- Touchscreen button configured to write %I161.
- Scan time read from the CPU's scan-time monitor: 12 ms.
- Operator holds the screen button for 250 ms.
The HMI's 1 survives at most 12 ms = 0.012 s. The refresh runs 1000 / 12 = 83.3, about 83 times per second, so across the 250 ms tap the wired 0 wins 250 / 12 = 20.8, about 21 times. The logic executes once per scan, so at best a rung sees the 1 for a single pass: a one-shot can fire, a seal-in cannot, because the contactor auxiliary that seals the rung needs roughly 20-50 ms to close — two to four scans at 12 ms — and the HMI contact is already gone. Decision: with 0 on the field side, a momentary write to a scanned input lands about 0 times out of 21, and even the lucky single pass depends on where communications service falls in the scan, which no design should rely on.
Why did the same button work on the office test PLC? #
The bench passed because its input address had nothing behind it: with no input module configured at that address, no refresh ever restores a physical state, so the write simply stays — a result that proves nothing about a production CPU where the address is scanned.
The refresh can only restore what the I/O configuration scans. On a bench CPU with no module at that address, nothing competes with the write, so every test passes; the bench validated the HMI tag, the cable and the protocol, none of which were broken, and said nothing about the address. Loading the project into the production CPU turned the address into a scanned input, and the behavior changed with it. A stopped production CPU mimics the bench for the same reason: STOP removes the refresh, not the conflict.
Decision: treat a bench pass on input image addresses as no evidence about production, and never carry an input address out of a bench project into a command. If you want bench work that transfers, validate it the way testing HMI simulation against a live PLC is done — against the real CPU and its I/O configuration, with commands on internal bits from the first rung.
Which addresses can an HMI button safely write? #
An HMI may write any internally stored bit nothing else controls and any address no scan refreshes; it must never write an input image address a configured module scans, a coil-controlled output, or one bit from two screens — that split is the whole rule.
- Safe: an internally stored bit no other writer touches — one per screen command.
- Unsafe: any input image address a configured input module scans; the refresh restores the wired state every cycle.
- Unsafe: any output address a logic coil controls; the coil evaluation and the output update erase the HMI write each scan.
- Deceptive: an input address with no hardware configured behind it. Writes stick there, which is why it feels right on the bench, and adding the module later silently kills every button pointed at it.
One bit per command also holds across screens: two buttons aimed at one command bit fight over a single value, for the same reason each add-on instruction instance needs its own tag rather than a shared one. Decision: if an address is scanned or coil-controlled, the HMI does not write it; if two writers need the same command, each gets its own bit and the logic resolves them.
How do I parallel the field pushbutton and the HMI bit? #
Put the scanned field contact and the HMI command bit in parallel feeding the same coil, so either source alone produces the command and neither can erase the other; make the change offline and download during a controlled stop.
- List every screen button and its target address; flag any target that matches a scanned input or a coil-controlled output.
- Leave the field device and its input address exactly as wired and scanned.
- Assign a fresh internally stored bit to each screen command; no reuse between buttons.
- Point each screen button at its new bit.
- Edit offline: put the field contact and the HMI contact in parallel into the rung that drives the coil, and branch a run-feedback seal contact into the same parallel group where the output seals.
- Download at a controlled stop, then test both sources in RUN.
// Illustrative logic - declare these in your own project; all BOOL, initial value FALSE:
// FIELD_PB : input image bit wired to the physical START pushbutton (0 at rest)
// HMI_START : internally stored bit written only by the touchscreen START button
// RUN_FB : input image bit from the contactor auxiliary contact (seal)
// START_CMD : the output coil that starts the machine
| FIELD_PB START_CMD
|----] [--------+------------------( )----
| |
| HMI_START |
|----] [--------+
| |
| RUN_FB |
|----] [--------+
Either contact alone completes the rung, so neither source can erase the other and both produce the identical command. The screen button now works with the CPU running, stopped or on a bench, because nothing scans an internally stored bit. Decision: this parallel structure is the entire fix — no setting, driver version or firmware level makes a shared scanned input hold an HMI write.
Can an HMI button share an address with a maintained selector switch? #
No: a maintained selector asserts a state in both positions, so even its rest position writes 0 over the HMI every scan — keep the switch as a monitored input, and give any HMI override its own command bit with priority defined in the logic.
A momentary pushbutton at least reads 0 at rest, which is why the momentary case can look intermittent; a selector has no rest value, so a shared address fails in both positions. The plausible argument — a normally open pushbutton sends no signal when released, so the HMI's 1 should survive — fails on one fact: an untouched input is still a scanned 0, and the refresh writes that 0 every cycle whether or not anyone touches the button.
Keep the selector as a read-only indicator on the screen showing its real input state, with the physical device deciding the machine state. Where the process genuinely needs an HMI override, give the screen its own command bit and write the priority into the logic explicitly, so the field switch and the screen command resolve in one place. A screen toggle switch fails on this same rule — an HMI toggle switch cannot write a physical PLC input — and it is fixed the same way: separate bit, resolved in logic. Keep the hardwired stop pushbutton and every safety function out of the touchscreen path; an HMI stop is a software command, not a safety function. Decision: the switch stays a monitored input, and the HMI never writes it.
How do I verify the fix in RUN mode? #
Prove the fix with both sources live in RUN: the HMI press changes its command bit and fires the output, the field pushbutton fires the same output, each release returns the command to 0, and all three repeat after the final download.
Watch the new command bit in the online data monitor during the test; unlike the old address it must hold its state for as long as the press lasts, because nothing scans it.
| Test, CPU in RUN | Expected result |
|---|---|
| Press and hold the screen button | Command bit goes 0 to 1 for the full press, output fires, both return to 0 on release |
| Press and hold the field pushbutton | Same output, same return |
| Hold both together | Identical result to either alone; no fight over a value |
| Repeat all three after the final download | Every result identical to the first pass |
Acceptance is that RUN-mode table, repeatable after the final download. A STOP-mode press, a bench pass or a simulator run is evidence about communications and tags, not acceptance. Decision: when both sources produce the same command in RUN and release cleanly, the failure is closed — add the shared-address check to your start-up review so the next machine never gets one.
Questions asked
Does a dead HMI button mean the write never reaches the PLC?
No. The communications layer usually accepts the write and lands it in the input image; the loss happens on the next input refresh, which restores the physical state within one scan. That is why the same press becomes visible in a data monitor the moment the CPU leaves RUN: nothing refreshes the image while the scan is stopped, so the write simply stays where it was put.
Can the HMI display field input states without owning them?
Yes. Reading an input image address never conflicts with the scan, so screen indicators that show pushbutton, selector or limit-switch states on their real input addresses are correct and should stay. Only writes create the conflict. Build the indicator from the same input address the logic uses, and keep every screen command on its own internally stored bit.
Is the same rule true for output addresses?
Yes. A write to an output address that a logic coil also controls is erased by the logic itself: each scan evaluates the coil and the output update writes the result to the output image. Give the screen its own command bit and let the logic, not the HMI, drive the coil. An output address is only safe for an HMI write if no rung controls it.
How do I tell an overwrite problem from a communications problem?
Stop the CPU and press the screen button while watching the address. If the value appears, communications work and the fault is the scan overwrite. If the value never appears even in STOP, the write path is the suspect: correct the device's write definition and endpoint before touching the logic. A passing read alone never proves the write path.
Why not just force the input instead of changing the logic?
A force overrides the scan and would make the write appear to work, but forces are a commissioning and maintenance tool: they bypass the real device, they must be found and removed before anyone trusts the I/O again, and an operator-reachable force on a machine input is an unsafe substitute for a designed command bit. Change the logic instead.