Troubleshooting
Why HMI Simulation Buttons Do Not Change PLC Tags
Short answer
A simulated HMI screen executes the interface only, so a button changes a PLC tag solely when its event targets an external tag on a connection to a running controller. Test the button on an internal tag first, then prove the HMI can read a changing PLC value before testing any write. A write that appears and reverts points to PLC logic overwriting the variable.
On this page
Pressing a button in a simulated HMI screen changes a PLC tag only when three things line up: the button's event fires, the event targets an external tag, and that tag's connection reaches a controller that is executing its program. HMI simulation runs the operator interface on the engineering computer and contains no PLC, so when the screen opens and the buttons do nothing, one of those three links is broken. Work through them in order: prove the button on an internal tag, prove the HMI can read a changing PLC value, and only then test a write. The Simulation and Runtime start controls change nothing about this; neither turns PLC communication on.
HMI simulation runs the panel, not the PLC #
Simulation executes the configured HMI application in a test environment on the engineering computer, standing in for the physical panel. Runtime is the execution environment that operates that application wherever it runs: in a panel, on a PC station or in the simulation window. The two start controls differ in the runtime arrangement they launch, and which one needs which installed package depends on the device configured in the project, so read the configured device and its help entry rather than guessing from the CPU type. For the tag question the choice is irrelevant: both display screens and execute object events, and neither switches PLC communication on or off. Access to controller data depends only on the configured connection and on a partner answering it.
PLC simulation is a separate function that executes the controller program without the physical CPU, and a running HMI simulation does not imply a running PLC. With nothing executing the program, every external tag is dead and every button press is discarded; the runtime logs the connection fault in its alarm or system-event view, which is the first place to look. When the test controller is itself simulated, the connection needs the documented path into the simulator, which is the subject of Why HMI simulation cannot talk to a simulated PLC.
Sort the symptom before touching anything #
Five observations cover nearly every case, and each one points at a different link:
- The button does not change an internal HMI tag. The event is not firing or not permitted; the fault is in the button's configuration, not the connection.
- An internal tag changes but the PLC tag never does. The event system works; the fault is the external tag mapping or the connection.
- The PLC tag changes briefly, then returns. Either the release event resets it or program logic overwrites it on the next scan.
- The PLC tag changes but the machine state does not. The HMI did its job; command permissives or output logic in the program are holding the state.
- The screen opens with a connection fault and frozen tags. No partner is executing or reachable; start or reach the controller first.
Prove the button on an internal tag #
An internal tag belongs to the HMI application; an external tag exchanges data with a controller through a configured connection. That difference makes the internal-tag test decisive: it exercises the event chain with no connection involved.
- Create a Boolean internal tag in the HMI tag table.
- Place an IO field or an indicator on the test screen and connect it to that tag.
- On a spare button, assign Invert bit to the press event with the internal tag as parameter, a maintained action so the result stays visible.
- Start the simulation and press the button several times.
Expected: the displayed value toggles on every press and holds. When it does, the event chain is proven and the fault is downstream, so move to the read test. When it does not, the fault is in the button itself, and the next section lists what to inspect. Do not change the connection before this test passes.
Inspect the press and release events #
A button writes a value only when its event invokes a function with a tag; the pressed graphic proves only that the object received the input. Open the button's events and check four things. The press event carries the intended function. The function's parameter is the intended tag. The release event does not undo the write unnoticed: Set bit on press with Reset bit on release makes a momentary command, while Invert bit on press alone makes a maintained one. And the function is not tied to a user authorization the current login lacks, in which case the press animates and nothing is written. Check also that no overlapping object sits above the button and takes the touch instead.
The momentary-press trap, worked through #
A tag value crosses the connection on the tag's configured update cycle, not at the instant the function runs. The documentation for Set bit while key pressed states the consequence: when the time between press and release is shorter than the tag's update time, the brief value may go unrecognized, in that function's case the release's false value, leaving the controller holding the bit set. The same sampling misses a short pulse in the other direction: a write that rises and falls inside one cycle can disappear before any transfer.
Worked example, with illustrative values: read the real cycle in the tag's properties, because the figure below is not a default. Assume a press-and-hold command whose tag updates on a cycle of 1 s and a test press held for 0.3 s, with press timing effectively random against the cycle. The runtime samples the tag once per cycle, so a sample lands inside the 300 ms active window with probability 300 ms divided by 1000 ms = 0.3: about 3 presses in 10 reach the PLC and 7 vanish. The ratio is the whole story. Halve the cycle to 500 ms and capture rises to 300 divided by 500 = 0.6, six presses in 10; hold the button for 1.5 s, longer than one full cycle, and every press contains a sample.
Decision: run diagnostics with a maintained action so the written value survives, and give a real press-and-hold command a cycle short enough that the press lasts several cycles, or accept that quick taps are unreliable by design.
Prove a read before a write #
A write test proves nothing while the connection is dead, because a dead connection swallows reads and writes alike. Put a PLC variable that changes while the program runs on the test screen, a counter the program increments works, and open the same variable in a watch table on the controller side. Expected: the screen value follows the controller with no connection fault in the event view.
If the value stays frozen:
- With a physical CPU, compare the address in the HMI connection with the controller's actual address, and confirm the controller is in RUN.
- With a simulated CPU, use the communication path documented for the installed simulator; it is not an ordinary network endpoint.
The bench arrangement for the physical-controller case is described in Testing HMI Simulation Against a Live PLC. Only when the read follows the controller does a write test mean anything.
Give the variable one owner #
The scan re-executes program logic continuously, so any instruction that assigns the same variable the HMI writes replaces the HMI value on the next execution. The symptom is a twitch or nothing at all at the monitoring rate, and it looks exactly like a communication fault. Open the variable's cross-reference and list every location that writes it.
The rule to commit to: one writer per variable. The HMI writes a dedicated command bit that nothing else writes; the program reads that bit, applies its interlocks and permissives, and alone owns the outputs and the status values the HMI displays back. A button wired straight to an output or to a calculated status word has two writers by construction and will always test intermittent. Never defeat an interlock or a safety function to make a test pass; run write tests on an isolated bench with test tags.
The decision for each case #
Commit to the link the evidence names:
- Connection fault on startup, tags frozen: nothing downstream matters yet. Start the real or simulated CPU and fix the path until a changing PLC value appears on screen.
- Internal-tag test fails: repair the button's event, function, tag parameter, authorization or screen overlap, and leave the connection alone.
- Internal-tag test passes, read test fails: correct the external tag's PLC variable reference, the data-type match, the connection address, or the variable's permitted HMI access in the controller project.
- Read works, and a maintained write never appears in the watch table: the external tag points at the wrong PLC variable or its data type does not match the PLC variable; fix the mapping before touching the program.
- Write appears and reverts within a scan: the program writes the same variable; move the HMI to a dedicated command bit with a single writer.
- Quick taps vanish or leave a press-and-hold bit stuck: the press or release fell inside the tag's update cycle; hold past the cycle or shorten that tag's cycle.
Questions asked
Does the simulated HMI reach a physical CPU through the engineering computer's network adapter?
Yes. The simulated runtime sends its connection requests through the engineering computer's own network adapter, so the CPU's address must be reachable from that adapter's subnet, and a host firewall that blocks the controller protocol blocks the simulated HMI exactly as it would a physical panel. Verify the adapter's address and the firewall rules before suspecting the project configuration.
Why does the watch table show the write but the screen never does?
The screen object samples its tag on a display update cycle, so a value that changes and is overwritten by program logic before the next refresh never appears on the HMI even though the controller briefly held it. Treat the watch table as the independent record for write tests, and use a maintained write so the value survives until the screen's next refresh.
Can the HMI and the S7-1200 both run in simulation on one computer?
Both simulations can run on the same engineering computer, but a simulated CPU sits outside the physical network, so the HMI connection needs the path the installed simulator documents: an adapter that forwards the controller connections into the simulation, or a virtual address the simulator exposes. Without that path the HMI starts normally and every external tag stays dead.
Should a start command use a maintained write or a press-and-hold function?
Use a maintained write for a start command, typically Set bit or Invert bit on press, and let the program reset the command bit once it has acted on it. Press-and-hold suits jog or enable signals whose false state on release matters. A start command that exists only while a finger holds the button is easily missed by the program scan and by the tag's update cycle.