How-to
Why a lost release event leaves an HMI valve command stuck
Short answer
A press event and its release are two separate writes, so a communication loss while the button is held leaves the valve command stuck at 1. Configure the WinCC flexible area pointer Coordination, detect its life-bit transitions in the PLC, and when they stop, reset both command bits and deny output permission until the operator issues a fresh press.
On this page
A press event and its release reach the PLC as two separate writes, and the controller stores whatever arrived last. Lose the connection while the button is held and the release write never comes: the OPEN or CLOSE bit stays at 1 and a motorized valve keeps moving with nobody commanding it. The fix is a watchdog built on the HMI's own life signal. Configure the WinCC flexible area pointer "Coordination" on the connection, watch its life bit for transitions in the PLC, and when the transitions stop, reset both stored command bits and deny output permission until the operator presses again. The worked case below is an S7-315 with STEP 7 V5.5 and WinCC flexible 2008 Runtime on a PC over PROFINET; the mechanism fits any HMI connection that offers a life signal.
Why the release reset never arrives #
Two screen buttons, OPEN and CLOSE, each carry two events. Pressing sets its command bit, releasing resets it. While the bit is set the direction output is on and the valve travels; at release the output drops and the valve stops. That momentary behavior depends on two successful write transactions per movement, not one.
The PLC has no way to know a finger left the screen. It holds the result of the last completed write, which is why a frozen request looks exactly like a pressed button. The failure is not limited to a broken cable: Runtime can stop, hang, or lose its session while the Ethernet link stays healthy, so a link indication is not evidence that release events still flow. An HMI write that never lands in the controller has other causes too — Why an HMI Modbus TCP write leaves the S7-1200 DB unchanged covers the addressing side — but here the write is not misrouted, it is simply never sent, because Runtime is gone. Supervise the application signal that rides with the commands, not the network interface.
The life bit in the area pointer "Coordination" #
The WinCC flexible 2008 communication documentation defines the area pointer "Coordination" as a transfer of coordination data into a configured PLC word, used among other things for detecting the startup of the HMI device in the control program, and it defines the life bit that toggles while the panel is online. Map the bit position from the coordination layout of your connection before building logic on it: an ordinal description such as "third bit" is not a PLC address.
The bit changes on its own while the connection is alive and freezes at whatever it held when the connection stops, at 0 or at 1, so detect transitions, never a level. On one WinCC flexible 2008 installation the bit was seen toggling at roughly 1 Hz; treat that as a commissioning observation and measure your own installation before relying on it. A life bit is a heartbeat in the general sense — a signal that changes by itself while the peer is alive — and the watchdog is the partner's logic that declares the peer offline when the changes stop. The same pattern is used well beyond PLCs; how heartbeat alarms detect offline devices works it out from the device side.
Set the watchdog preset from two numbers #
Take the preset from measurements, not from a default. Measure the longest legitimate gap between life-bit transitions while everything is healthy, including the HMI update cycle and PLC scan variation. Decide separately how long the valve may travel uncommanded and still be acceptable; the preset has to sit below that limit.
Worked example: the life bit toggles at 1 Hz, one edge per second, so the longest normal gap between edges is about 1 s. With a factor of three for margin, the preset is 3 × 1 s = 3 s, which clears this valve's 5 s limit on tolerable uncommanded travel. Reverse the check too: if a 2 s measured gap demanded a 6 s preset against a 5 s limit, no preset satisfies both, and the cure is a faster HMI update cycle or a one-transaction command design, not a silently thinner margin.
Build the supervision in STEP 7 #
The ladder form of the same transition logic is in Write an S7-1200 heartbeat in ladder logic in TIA Portal; the list below does it in STEP 7.
- Configure the area pointer "Coordination" on the connection the valve buttons use, pointed at a spare word — the example below uses MW 100 — with no application data overlapping it.
- Map the life bit into the PLC from the coordination layout in the WinCC flexible 2008 communication documentation, and confirm the position online before wiring logic to it.
- Verify the toggling: with Runtime online the bit changes steadily; close Runtime and it freezes at its last value. Nothing else in the program may write that word.
- Add transition detection and the watchdog timer:
(* Illustrative logic - variable names are examples, not library calls.
hmi_life is the life bit read from the word assigned to the
area pointer "Coordination"; wd_timer is an on-delay timer. *)
VAR
hmi_life : BOOL := false; // life bit, example address from MW 100
hmi_life_prev : BOOL := false;
hmi_ok : BOOL := false; // communication permission
req_open : BOOL := false; // stored OPEN request written by the HMI
req_close : BOOL := false; // stored CLOSE request written by the HMI
out_open : BOOL := false; // final OPEN direction output
out_close : BOOL := false; // final CLOSE direction output
END_VAR
IF hmi_life <> hmi_life_prev THEN
hmi_life_prev := hmi_life;
wd_timer(IN := false); // every edge restarts the watchdog
hmi_ok := true;
ELSE
wd_timer(IN := true, PT := t#3s);
END_IF;
IF wd_timer.Q THEN
hmi_ok := false;
req_open := false; // clear the frozen request
req_close := false;
END_IF;
// final gate - the only place the direction outputs are written
out_open := req_open AND hmi_ok;
out_close := req_close AND hmi_ok;
- Clear both stored requests at expiry, inside the supervision itself, so a reconnect cannot reactivate an old press.
- Gate the final outputs with the permission bit in the logic that writes them, and combine it with your existing permissives there. If any other rung, mode, or command source writes the outputs later in the scan, it defeats the gate; audit manual mode, maintenance mode, and any second command origin.
- Rearm on fresh activity only: permission starts false at power-up and returns once transitions resume and both requests are 0, so the next movement needs a deliberate new press.
The logic is right when the watchdog output stays false while edges continue and turns true within one preset time after the last edge — which is exactly what the next section tests.
Acceptance checks #
Run every check with the valve isolated from the process or the machine otherwise made safe, because each fault test deliberately holds a direction command while communication is cut. Watch the life bit, the permission bit, both requests, both outputs, and the actuator.
- Healthy idle connection — the life bit toggles, permission is true, both outputs are off.
- Press and release with communication healthy — the chosen output runs only while the button is held; release resets its request and output.
- Communication loss during OPEN — cut the link or close Runtime while OPEN is held; edges stop, and within the watchdog preset both requests and both outputs are 0 and the valve stops.
- Communication loss during CLOSE — the same result in the other direction, with no surviving CLOSE request.
- Runtime stopped with the link intact — the watchdog still expires, even though the switch still shows a live port.
- Recovery — edges resume on reconnection, but nothing moves until both requests are 0 and a fresh press arrives.
Measure from the last seen edge to the outputs dropping and confirm at the actuator that the valve actually stops; output status alone does not prove the mechanics obeyed.
Why OB86 and SFC51 stay silent #
On an S7-300, OB86 is the station-failure interrupt: it is called when a station drops, for example a distributed station leaving PROFIBUS DP or PROFINET IO. In this fault the station never drops — the PC keeps its place on the network and only the HMI application stops, so OB86 never fires and the frozen bit survives untouched. SFC51 reads system status, which describes stations and their states, not whether an HMI application is alive. The diagnostic layer reports the network is fine, and it is telling the truth. That is why the watchdog has to ride in the application data on the life bit rather than in the diagnostics.
The decision for each case #
- Communication healthy: keep the momentary press-and-release design; the life bit toggles and permission stays on.
- Button held when communication fails: at watchdog expiry both stored requests reset and the output gate closes, so the valve stops within the preset instead of running until someone notices.
- Link alive but Runtime dead: the same outcome, because the decision rides on the life bit, not the link.
- Connection restored: nothing reactivates; permission returns only after edges resume and both requests are 0, and the next movement needs a new press.
- A different installation: scale the preset to three times your measured longest gap and keep it under the valve's tolerable travel time; the example's numbers bind the example.
Questions asked
Where is the life bit if the HMI is a panel rather than a PC runtime?
The coordination area pointer and its life bit exist across the HMI families in both the WinCC flexible and the WinCC TIA Portal communication manuals, so panels and RT variants all offer the signal. Configure it on your panel's connection, map the bit from the layout of that connection, and keep the same transition watchdog in the PLC; the controller-side logic does not change.
Does the watchdog time in the HMI connection settings solve this instead?
No. A watchdog time configured on the connection makes the HMI side notice a dead partner and report it, but the frozen bit lives in PLC memory and only PLC logic can clear it. Keep the life-bit watchdog in the controller; the HMI-side setting is useful for alarming on the panel, not for resetting command bits.
Can the button design avoid the two-transaction problem entirely?
Yes. A maintained command button with explicit open and close actions, or an incremental jog command paired with its own stop, needs no release event, so communication cannot strand a request mid-movement. If the process requires true momentary behavior, keep press and release and add the life-bit watchdog; otherwise the one-transaction design removes the failure mode altogether.
What should the PLC do in the first seconds after power-up?
Start with permission false. Until the first life-bit edges arrive, no HMI command can reach an output and the stored request bits stay reset. Once transitions begin, permission follows the watchdog as normal. A slow but legitimate update rate only moves the preset, and the brief startup inhibition removes the chance of driving the valve from stale data.