How-to
Show an HMI Button Only When a PLC Bit Is High
Short answer
Bind the button's visibility property to the Boolean PLC tag and map true/high to visible, false/low to hidden, then test both states on the panel in runtime. Combine several conditions into one tag in the PLC, and keep process permissives in the controller because a hidden button is only a display change.
On this page
Bind the button's visibility to a Boolean PLC tag and map the high state to visible. On a TP177 project built in WinCC Flexible, that means the object's Visibility property set to dynamic and connected to that tag; WinCC Comfort/Advanced exposes the same mechanism as the visibility animation on the object. The runtime re-evaluates the tag on every update, so a 1 shows the button and a 0 hides it. Test both states on the panel after download, and keep the real permissive in the controller, because a hidden button changes the screen, not the safety of the command.
What the visibility property controls #
Siemens documents dynamic control of the "Visibility" property: connect a tag to the property and the runtime shows or hides the object according to the tag's current value. In WinCC Comfort/Advanced this is configured as the visibility animation on the object. Two consequences follow, and both bite:
- The screen acts only on the value it receives. A correct condition cannot compensate for a stale tag, a wrongly addressed tag, or a connection that stopped updating.
- The editor picture is not the runtime. What you see while configuring proves nothing about the panel, because objects hidden in the graphics designer but visible in runtime are a real failure mode; only the compiled project running on the panel shows the truth.
Configure the visibility condition #
- Choose the Boolean PLC tag that means "this action is allowed now", and confirm in the PLC program what its 1 state means. Do not pick a bit just because it changes during the sequence you care about.
- Select the button in the screen editor and open its properties. In the group where animations and dynamic behavior live, find the property named Visibility.
- Set Visibility to dynamic and connect it to the tag from step 1.
- Map the states so the 1 (true, high) state shows the object and the 0 (false, low) state hides it. Editors word this differently, as a condition on the tag value or as a pair of enable checkboxes, but the target is the same: 1 renders the button, 0 does not.
- Compile the project and transfer it to the panel the way that project already transfers.
- Drive the tag to both states and watch the button appear and disappear on the panel. The editor view is not this test.
Worked example: two conditions, one button #
Say the button may appear only when the sequence is ready and the guard door is closed. The visibility input takes one tag, so do not try to watch both bits on the button. Build the combined bit in the PLC:
// Illustrative example, not from any specific project
Seq_Ready : Bool := 1; // sequence ready
Door_Closed : Bool := 0; // guard door closed
Btn_Permit : Bool := 0; // combined permissive, drives visibility
Btn_Permit := Seq_Ready AND Door_Closed;
The arithmetic is plain Boolean logic:
| Seq_Ready | Door_Closed | Btn_Permit | Button |
|---|---|---|---|
| 1 | 0 | 1 AND 0 = 0 | hidden |
| 1 | 1 | 1 AND 1 = 1 | visible |
| 0 | 1 | 0 AND 1 = 0 | hidden |
The test that proves the configuration: hold Seq_Ready at 1, force Door_Closed from 0 to 1, and the button must appear; force Seq_Ready to 0 and it must hide again. Read the PLC bit and the HMI tag in each state. They must agree, and the button must follow Btn_Permit, not either input on its own. The same two-state check works before download by testing HMI simulation against a live PLC.
Combining conditions when the PLC is frozen #
If the controller program cannot take the combined bit, compute it on the HMI side. WinCC Unified exposes object properties to JavaScript, so a script can compute the combined state there; other editors support multi-condition visibility directly, and building an A and not B visibility condition in EasyBuilder Pro shows that pattern in practice.
When the button ignores the bit #
With the compiled project confirmed on the panel, work this list in order:
- Inverted mapping: the button shows at 0 and hides at 1. Swap which state means visible.
- Wrong tag or address: read the bit online in the PLC and read the HMI tag at the same moment. Different values mean the tag is not pointed at the bit you think it is.
- Stale tag: the connection or driver stopped updating, and the screen renders the last value it received.
- Old runtime: the panel is still running the previous compile, so the condition does nothing until the runtime has it.
- Bit never set: if the button never appears at all, check first whether the PLC bit ever reaches 1. The HMI may already be right.
A hidden button is not permission #
Visibility is interface design. The function behind the button can still be triggered by another object, another client, or controller logic, so the decision to refuse an invalid command belongs in the controller, the same distinction that separates interlocks, trips and permissives as different actions. Hide the button to keep the screen clean; refuse the command in the PLC.
I/O field defaults after a PLC restart #
The vanishing I/O values are a controller data question, not a visibility question, and the fix is to give each value one owner:
- A field that reads or writes a PLC tag shows whatever the controller left there after restart. If the value must survive, put it in retentive controller memory and keep startup logic from overwriting it; if it should reset, write the default deliberately in the startup routine. Do not let the HMI and the PLC both write defaults, because two writers give an unpredictable result.
- A field that holds an HMI-internal value survives a panel power-down only if the project's retention option for internal tags covers it. Where it does not, move the value into the controller and treat it as the first case.
The test: record the value, stop and start the PLC, and read the tag immediately after restart. If the tag changed, the fix is retention or startup initialization in the controller. If the tag held but the field is blank, the fix is the HMI tag connection or the field configuration.
Questions asked
Why does the button stay visible when the PLC bit is low?
Three checks in order. Read the bit online in the PLC and the HMI tag at the same moment: if they differ, the tag address or connection is wrong. If both read 0 and the button still shows, the condition mapping is inverted, so swap which state means visible. If both are correct, confirm the compiled project actually reached the panel, because editor settings do nothing until the runtime has them.
Can one visibility condition watch two PLC bits?
No. The animation is driven by a single tag, so AND or OR the bits into one Boolean permissive in the PLC and connect the visibility to that. Where the HMI has scripting, a script can compute the same combined tag each cycle, but one tag still reaches the property.
Does hiding the button stop the command behind it?
No. Visibility changes only what the operator sees. The function can still be triggered by another object, another client, or controller logic, so the permissive that refuses an invalid command belongs in the controller. Hiding a button is interface design; refusing a command is interlocking.
How do I keep default values in I/O fields after a PLC stop and start?
Decide first whether each value should survive the restart or reset to its default, then read the tag immediately after a restart to confirm which behavior you actually got. Let exactly one side own the default: if the HMI and the PLC both write one, the result is unpredictable.
Is this configured differently on a TP177 with WinCC Flexible?
The mechanism is the same: the object's Visibility property, set dynamic, connected to one Boolean tag, with the high state mapped to visible. What differs between WinCC Flexible, Comfort/Advanced and Unified is where the property sits in the editor and what scripting surrounds it, not the tag and the mapping.