Troubleshooting
Why a migrated WinCC RT button fails on while-key-pressed
Short answer
If the new TIA Portal WinCC RT writes set-bit, reset-bit and timer tags fine, communication is proven and the fault is in the migrated button action. Rebuild all the project, read every compile warning, and replace the while-key-pressed action with set bit on press plus reset bit on release, backed by a PLC-side maximum-time reset.

On this page
A new TIA Portal WinCC RT that writes set-bit, reset-bit and timer tags is already communicating with the PLC, so a failed SetBitWhileKeyPressed after migrating from WinCC flexible 2008 RT is a migrated-button problem, not a link problem. Fix it at the button: rebuild all the project, read the compile messages, and configure the momentary behavior as set bit on press plus reset bit on release, with a PLC-side maximum-time reset behind it.
Separate the button action from the communication fault #
You already have the discriminating evidence. Timer changes and ordinary set and reset buttons work on the new runtime, alone or alongside the old one, so the HMI connection, the tag addressing and the PLC's willingness to accept writes from the replacement are all demonstrated. "It is as if the PLC is still linked to the old RT" does not fit that pattern: a PLC does not accept one write type from a device and refuse another from the same connection.
What does fit is a migration fault in one compiled action. The compiler in TIA Portal translates WinCC flexible event actions differently, and a while-key-pressed action can come across as unavailable, mistranslated or silently dropped even though the screen looks identical. Work through this list in order:
- Operate a known-working set-bit button and confirm its tag changes, then watch the exact tag the problem button targets while pressing it. Judge by the tag, not by the machine response; a PLC rung can clear the bit faster than the machine shows it.
- Open the problem button's event properties and check which action is actually assigned to the press-and-hold behavior, and which PLC tag it references. Similar tag names are not proof of the same address.
- Compare it against a working control in the same project, action for action and tag for tag.
- Read the complete compile message list, not just errors, for anything naming that button or its action.
- Run Compile Rebuild all and retest with the tag in a watch view.
- If the action is still missing or flagged, delete the button and recreate it with the intended tag, then compile again.
The button's label on screen proves nothing about its configured action. The event assignment in the project and the observed tag change are the only decisive evidence.
Run Compile Rebuild all before anything else #
A full rebuild regenerates the project data and surfaces migration warnings that an incremental compile does not report. This is exactly the case for it: one migrated action fails while everything else in the same project runs. In TIA Portal, compile the HMI station with the rebuild-all option, then read every warning and error, including any that name the button, its event or the action type. Compiler handling changed between WinCC flexible and TIA Portal, and a warning is often the only trace the migration leaves. Correct what the list names, compile again, download to the runtime, and retest with the target tag visible.
Keep the old WinCC flexible RT disconnected during this retest. Two runtimes writing the same momentary bit can set and reset it against each other, and you want the new project's result clean. A working new-runtime timer button already tells you the PLC accepts this client, so a clean failure on the problem tag points back at the button's action, never at general communications.
Replace while-key-pressed with press and release actions #
A momentary command is two transitions: set the bit when the operator presses, reset it when the operator releases. If the migrated while-key-pressed action is flagged or unreliable, configure the same behavior with explicit actions that the compiler handles as ordinary set and reset, which your working buttons already prove run fine:
- Assign a set-bit action to the button's press event, targeting the exact tag the old project used.
- Assign a reset-bit action to the button's release event, same tag.
- Assign a reset-bit action to the screen's leave event, so a screen change or lost focus while the button is held cannot leave the bit set. The pattern of clearing a bit when a screen is left is the same one used to set a PLC bit on screen exit, just with reset instead of set.
Test a brief tap, a normal hold-and-release, and a screen change while holding. The release event can be missed if the runtime stops or the operator navigates away, which is why the screen-leave reset and the PLC-side protection below are not optional extras.
Worked example: momentary start bit with a PLC maximum-time reset #
The inputs, all example values for this case: a momentary start command bit at M10.0 in the PLC, driven by the recreated button with set bit on press and reset bit on release; an on-delay timer in the PLC monitoring that bit; and a maximum hold time of 2 seconds, chosen here because the start command only needs to latch a sequence that then holds itself. The rule: the HMI events are a command source, not a safety mechanism, so the PLC resets the bit if it stays set longer than the command needs.
The logic in words: if M10.0 is set, start the on-delay timer; when the timer reaches its preset, reset M10.0. The arithmetic is a single comparison: a normal press of 0.3 seconds is well below the 2 second preset, so the timer never expires; a stuck button or a missed release holds the bit for 2.0 seconds, the timer expires, and the PLC clears the bit on its own at t plus 2.0 s regardless of what the HMI does.
Result: the command works with a press-and-release pair, and the longest possible spurious command is bounded at 2 seconds, the timer preset, instead of lasting until the operator notices. The decision: any momentary bit the HMI writes gets this timer, sized to the longest legitimate command plus margin; if a command needs to stay held while pressed for longer, that is a maintained bit with a real stop path, not a momentary one, and it should be engineered as such. This is a command-path protection, not a substitute for the machine's own safety functions, which stop the machine independently of any HMI bit.
The decision for each case #
- Working set and reset buttons, failed while-key-pressed on the new RT alone: migration fault. Rebuild all, fix the compile warnings for that button, then reconfigure as set on press and reset on release.
- Compile list names the action as unsupported or invalid: do not fight it. Recreate the button with the press and release actions from the start.
- Problem tag does not change even after recreation, while other controls write fine: check that the recreated button references the same address the machine logic actually reads, then trace that bit through the PLC program for a rung that overwrites it.
- Failure only when both runtimes are connected: contention between two clients on the same bit. Run the new RT alone; if it then works, retire the old runtime rather than debugging the pair.
- New runtime cannot operate any control at all: that is a connection or startup problem, not this fault. Put a message view with buffered system messages on the screen and read why the runtime is not going online, as covered in the article on HMI remote access failing while PLC access still works.
WinCC flexible 2008 projects, especially those integrated in STEP 7 V5.x, migrate to TIA Portal through a documented procedure with prerequisites worth checking before you blame the project; if the migration itself aborts with an error, the fix is in the migration tooling, not the button.
Questions asked
Why does only SetBitWhileKeyPressed fail while set bit, reset bit and timer buttons work on the new WinCC RT?
The working buttons prove the new runtime reaches the PLC and writes tags, so the connection and the PLC are not the problem. The while-key-pressed action is a single migrated function that the TIA Portal compiler may have translated differently from WinCC flexible 2008. Rebuild all, read the compile messages for that button, or recreate the button and configure set bit on press plus reset bit on release instead.
Can I keep the old WinCC flexible RT connected as a fallback while testing the new TIA Portal RT?
You can, but not during the decisive test. Two HMI runtimes writing the same momentary bit can set and reset it against each other, so a tag you watch may show contention rather than a clean result. Pull the old runtime offline, watch the exact tag the button targets, and let the new runtime be the only client for that test.
How do I protect a momentary HMI bit in the PLC if the operator walks away with the button held?
Monitor the bit in the PLC with an on-delay timer and reset it if it stays set longer than the command needs; for example, reset after 2 seconds for a momentary start command. Also assign a reset-bit action to the screen-leave event so a screen change or lost focus while held clears the bit. The PLC timer is the authoritative protection, because an HMI release event can be missed when the runtime stops.
Does Compile Rebuild all fix a migrated WinCC button on its own?
Not always. Rebuild all regenerates the project data and forces the compiler to report problems that an incremental compile hides, but you still have to read the whole message list and fix what it names for that button. If the while-key-pressed action is unsupported or mistranslated, rebuilding alone will not make it work; reconfigure the button with separate press and release actions.


