Problem Description
When a SIMATIC S7-300 CPU is stopped, switched to STOP mode, or the Industrial Ethernet / PROFIBUS cable between the PLC and the WinCC 7.0 station is unplugged, the HMI screens continue to display the last successfully acquired value of the bound process tag. Standard objects (circles, rectangles, polygons, block icons) configured for a flashing animation driven by the tag value keep flashing; I/O fields continue to show the last read value. The display only refreshes when the operator navigates to a different picture and returns.
This behaviour is independent of the physical CPU state and is the same whether the failure is caused by:
- CPU STOP toggle on the S7-300
- Power removed from the PLC
- PROFINET / PROFIBUS cable physically disconnected
- CP 343-1 / CP 343-1 Advanced losing the network
- WinCC server side channel diagnostics disabled
The expected HMI behaviour is that the affected tag indicator should become visually flagged (grey background, yellow warning triangle, or configurable state) and the flashing animation should stop. The cause of the discrepancy is the way the dynamic is wired to the process tag in the Graphics Designer.
Root Cause Analysis
WinCC 7.0 distinguishes between the process value of a tag and the quality code (OPC quality stamp) that is returned with every read request. The quality code carries the actual health of the data path: 0xC0 (Good), 0x40 (Uncertain), 0x00 (Bad), 0x18 (BadNoCommunication), 0x1C (BadOutOfService).
When you bind a tag directly to an object attribute (for example, the Flashing property of a circle bound to a Boolean output), the Graphics Designer reads the value only. The internal quality code is discarded by the rendering engine, so the last known good value keeps driving the animation. The display will not turn grey and the flashing will not stop until the picture is reloaded, which forces a fresh tag read and quality evaluation.
The connection status itself is updated in the WinCC channel DLL and the alarm logging system, but the Graphics Designer by default does not propagate the quality state to standard object attributes. The fix is to use a mechanism that does read the quality code: a Dynamic Dialog with the quality-code option enabled, or a Smart Object I/O field (which is built-in to display a grey field on bad quality).
WinCC Tag Quality Codes
The following OPC quality codes are relevant to a WinCC 7.0 / S7-300 connection. These values are returned by the SIMATIC S7 Protocol Suite channel (channel DLL SIMATIC S7 Protocol Suite, unit S7-300/400 or S7-1200/1500) on each polling cycle.
| Hex Code | OPC Quality | Meaning | Typical Trigger |
|---|---|---|---|
| 0xC0 | Good | Communication OK, value is current | Normal operation |
| 0x40 | Uncertain | Value may be stale (substituted, sensor disconnected) | Substitute value used |
| 0x00 | Bad | General failure | Generic channel error |
| 0x08 | BadNotConnected | No connection to server | WinCC channel not started |
| 0x0C | BadDeviceFailure | Hardware fault | CP failure |
| 0x14 | BadOutOfService | Resource is disabled | Tag disabled in tag management |
| 0x18 | BadNoCommunication | Last value, no update | PLC stopped / cable unplugged |
| 0x1C | BadWaitingForInitialData | Initial read not yet completed | Start-up phase |
The codes 0x18 (BadNoCommunication) and 0x0C (BadDeviceFailure) are the values returned by the S7 channel when the S7-300 transitions to STOP or the TCP connection is broken. They are the codes you must handle in the dynamic configuration.
Solution 1 - Smart Object I/O Field (Built-in Behaviour)
If you use a Smart Object I/O Field instead of a Standard Object, WinCC 7.0 already handles the connection-failure display automatically. When the underlying tag transitions to a Bad quality code, the I/O field is rendered with a grey background and a yellow warning triangle in the corner.
- Open the Graphics Designer and load the picture containing the problem object.
- Delete the Standard Object that is latching the value.
- From Smart Objects on the Object Palette, drag an I/O Field onto the picture.
- In the I/O Field Configuration dialog, set the tag to the PLC output you want to monitor.
- Confirm with OK. The I/O field will now automatically turn grey and show the yellow triangle on PLC stop or network loss. No C-script or Dynamic Dialog is required.
Solution 2 - Dynamic Dialog with Quality Code Evaluation
The Dynamic Dialog is the recommended mechanism when you need to apply a connection-failure appearance to a Standard Object attribute (for example, the fill colour, flashing rate, or visibility of a circle).
- Right-click the Standard Object on the picture (e.g. the flashing circle) and choose Properties.
- Select the attribute to be animated (for example
FlashingorFill Color). - In the attribute column, click the small light bulb icon. From the menu select Dynamic Dialog.
- In the Dynamic Dialog editor, set the Expression/Formula field to your PLC tag (e.g.
'Output_Tag_1'). - Enable the check box Quality Code. This adds a second column in the result table.
- For each row, enter a value range in the left column and a result in the right column. For the Quality Code column, enter the OPC hex value (e.g.
0xC0for Good,0x18for BadNoCommunication) and map it to the desired result (e.g. stop flashing, grey). - Click Apply and close the dialog.
Example Dynamic Dialog configuration for a Boolean output driving the Flashing property of a circle:
| Expression Range | Result (Flashing) | Quality Code | Notes |
|---|---|---|---|
| 0 | No | 0xC0 | Output 0, comms OK |
| 1 | Yes | 0xC0 | Output 1, comms OK |
| (otherwise) | No | 0x18 | Any value when comms failed - force stop flashing |
The (otherwise) row covers all non-Good qualities. With this configuration the circle stops flashing the moment the S7-300 transitions to STOP and the channel DLL reports 0x18 BadNoCommunication.
Solution 3 - C-Script with GetTagQuality
For complex screens, a C-action is more flexible than the Dynamic Dialog table editor. The WinCC global function GetTagQuality() returns the OPC quality code of any tag, allowing you to script the property assignment.
// C-Action on the Flashing property of a circle
{
DWORD q = GetTagQuality("Output_Tag_1");
if (q == 0xC0) // Good
{
return GetTagBit("Output_Tag_1");
}
else // 0x00 / 0x18 / 0x0C / any Bad / Uncertain
{
return 0; // Stop flashing
}
}
For multi-state animations, branch on the actual code value:
// C-Action on the BackColor property
{
DWORD q = GetTagQuality("Level_Tag");
if (q == 0xC0) return CO_RED; // Good - normal alarm colour
if (q == 0x40) return CO_YELLOW; // Uncertain - warning
return CO_GREY; // Bad - hide / grey out
}
The trigger for the C-action should be set to On Change of the tag or to a cyclic 1-second timer so the script re-evaluates the quality code frequently enough to react to a CPU STOP within the channel timeout (default 5 s).
WinCC 7.0 Channel Diagnostics Settings
To make the quality codes change promptly when the S7-300 is stopped, the SIMATIC S7 Protocol Suite connection parameters must be tuned. Open Tag Management > SIMATIC S7 Protocol Suite > [your channel unit, e.g. PROFIBUS or TCP/IP] > [connection name] and confirm the following parameters.
| Parameter | Recommended | Effect |
|---|---|---|
| Connection timeout | 3000 ms | Detect lost TCP within 3 s |
| Keep-alive / Polling interval | 1000 ms | Faster detection of CPU STOP |
| Recovery interval | 5000 ms | Re-attempt after failure |
| Substitute value use | Disabled | Force Bad quality instead of substitute |
| Write/read priority | High | Reserved for critical HMI tags |
If the substitute value is enabled, the channel may report 0x40 Uncertain instead of 0x18 Bad when the CPU goes to STOP, which can mask the connection failure from the Graphics Designer if the substitute equals the last good value.
WinCC Unified Equivalent (TIA Portal)
If the project is migrated to WinCC Unified (TIA Portal V17 or later) running against an S7-1200/1500, the behaviour is governed by the unified runtime. When Runtime starts, the connection is established; if the connection cannot be established, Runtime issues a system alarm. Refer to the official Siemens documentation for the exact procedure:
Procedure if there is no connection (RT Unified) - WinCC Unified
The Unified faceplate model exposes the Quality property of every HMI tag as a native binding target. Bind the Visible, Flashing, or FillColor property of a Unified object directly to {Tag.Quality} and the object will reflect the connection health without scripting.
Verification Procedure
- Open the WinCC 7.0 project, start Runtime, and load the modified picture.
- Confirm the object is animating correctly when the PLC output toggles in RUN.
- In STEP 7 (or TIA Portal), switch the S7-300 CPU to STOP.
- Wait for the channel timeout (3 s with the values above) plus one polling interval (1 s). The object must stop flashing / turn grey within approximately 4 seconds.
- Optionally, unplug the PROFINET / PROFIBUS cable to simulate a physical loss. The same transition must occur.
- Open the WinCC Channel Diagnosis tool (Start > SIMATIC > WinCC > Channel Diagnosis) and confirm the connection shows Disconnected with the expected error code.
- Switch the CPU back to RUN, restore the cable, and confirm the animation resumes within the recovery interval.
Troubleshooting Matrix
| Symptom | Likely Cause | Fix |
|---|---|---|
| Standard object still flashes after CPU STOP | Direct tag binding - quality code discarded | Apply Solution 2 (Dynamic Dialog) or Solution 3 (C-Action) |
| I/O field does not turn grey on PLC stop | Substitute value enabled on channel, or tag quality forced Good | Disable substitute value; check tag > Properties > Quality |
| Quality code never leaves 0xC0 even when cable unplugged | Channel timeout too long or keep-alive disabled | Set connection timeout to 3000 ms, keep-alive to 1 s |
| Picture shows correct value, only latches on animation | Animation trigger set to OnChange of value but value never changes | Trigger on cyclic 1 s or bind to quality code directly |
| Behaviour correct on one client, wrong on second | Multi-client project with inconsistent picture revision | Re-deploy the picture to all clients; restart Runtime |
| Channel Diagnosis shows OK but display still latched | Graphics Designer cache holds old attribute assignment | Right-click picture > Reset Picture; or close/reopen Runtime |
| C-Action never fires on quality change | Trigger set to value change only, not cyclic | Set trigger to a 1 s cyclic timer or to OnChange of the quality tag |
| Unified faceplate does not grey on PLC stop | Property bound to value, not to .Quality | Bind Visible/FillColor to {Tag.Quality}
|
Field-Proven Caveats
- The Dynamic Dialog result table is re-evaluated only when the trigger fires. If you trigger it on the value change of the tag, and the CPU stops, the value does not change, and the script never runs. Add a cyclic trigger or bind the trigger to the same tag with a forced re-evaluation.
- WinCC 7.0 SP3 introduced the yellow warning triangle for the I/O field. On older SP0/SP1 installations, update to at least SP3 Update 5 for the cleanest behaviour.
- If you are running WinCC 7.0 with the SIMATIC S7 Protocol Suite channel unit
TCP/IP, the keep-alive is the TCP socket itself, not an application-layer poll. A switch port that does not honour TCP keep-alives can keep the connection open even when the CPU is in STOP. In that case the S7 channel reports0x40 Uncertainrather than0x18. Force a faster application-layer timeout by enabling the Connection Monitoring option in the channel properties. - Do not bind a flashing animation directly to a Boolean tag with a 100 ms cycle if the channel polls at 1 s - the animation will appear to stutter. Either lower the cycle, raise the polling, or accept the visible lag.
FAQ
Why does WinCC 7.0 keep showing the last value when the S7-300 is in STOP?
WinCC caches the last successful read of every tag. When the CPU goes to STOP the channel reports OPC quality code 0x18 (BadNoCommunication) but a Standard Object bound only to the tag value ignores the quality code and continues to display the cached value. Bind the object's dynamic to a Dynamic Dialog or C-Action that evaluates the quality code, or use a Smart Object I/O Field which handles the bad-quality state automatically.
How do I make a circle stop flashing when the PLC is disconnected?
Open the circle's Flashing property, switch it to Dynamic Dialog, enable the Quality Code column, and add an (otherwise) row that maps any non-0xC0 quality to the result "No". This forces the flashing to stop whenever the S7 channel reports a Bad or Uncertain quality.
What is the OPC quality code for a lost TCP connection to a S7-300?
The SIMATIC S7 Protocol Suite returns 0x18 (BadNoCommunication) for a lost TCP socket and 0x0C (BadDeviceFailure) for an active CP fault. If a substitute value is enabled the channel may instead return 0x40 (Uncertain); disable the substitute value if you want the Graphics Designer to flag a clear failure.
Does WinCC Unified fix this out of the box?
Yes. In WinCC Unified (TIA Portal V17 or later) every HMI tag exposes a .Quality property that can be bound directly to object attributes such as Visible or Flashing. If the S7-1200/1500 connection is lost, Runtime issues a system alarm and the bound quality property drives the object to the configured failure state. See the official Siemens TIA Portal documentation: Procedure if there is no connection (RT Unified).
Why does the display only refresh when I change pictures?
Picture change forces a fresh read of all bound tags and a re-evaluation of every dynamic, including the quality code. While the picture is on screen, the dynamic is only re-evaluated when its trigger fires - and a tag value bound without quality code never fires on a CPU STOP because the value itself does not change. Trigger the dynamic on a cyclic 1 s timer or on the quality code to force a continuous evaluation.