WinCC HMI Visibility Control for 8-Bit Binary 0000 0000

David Krause18 min read
HMI ProgrammingSiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview: Why Multi-Bit Visibility Is Not Native in WinCC Comfort/Advanced

WinCC Comfort and WinCC Advanced — the engineering systems that back the TP 1500 Comfort, TP 700/900 Comfort, TP 1200 Comfort, and the WinCC Runtime Advanced on a PC — expose exactly two configurable triggers for the Visibility, Appearance, and Movement animations of a screen object: Single bit and Range. There is no third trigger that lets you specify a compound condition such as “visible when bit 0 AND bit 1 are both 1” or “visible when the 8-bit alarm code equals 0000 0000” using the configuration dialog alone. Any visibility rule that depends on more than one bit — or on a numeric value that is not a single equality match — must be reduced upstream. The two valid reduction paths are: (a) compute a derived boolean tag in the PLC and connect the HMI animation to that tag, or (b) override the visibility property at runtime with a VBScript scheduled task or value-change event.

This technical reference covers both reduction paths and shows the exact configuration steps, SCL code, ladder/FBD equivalents, and VBScript snippets for the common 8-bit alarm/status case (visibility on exact 0000 0000) and the more demanding 16-bit case (visibility on xxxx xxxx 0000 0000 — low byte = 0, high byte non-zero). All examples target TIA Portal V15 onward, the TP 1500 Comfort panel, and S7-1200/S7-1500 controllers, and are forward-compatible with TIA Portal V17, V18, V19, and V20.

Animation Trigger Types Available in WinCC Comfort/Advanced

When you right-click a screen object in the TIA Portal HMI editor and open Properties > Animations, the visibility, appearance, and movement animations each accept one and only one of two tag triggers. The choice is made in the “Configuration” column of the Animations table for the selected object.

Trigger Tag type accepted Evaluates as Typical use
Single bit BOOL, BYTE, WORD, DWORD, INT, DINT, REAL (one bit selected) Tag.BitX = TRUE Show object when a single boolean flag is on (motor running, alarm active)
Range BYTE, WORD, DWORD, INT, DINT, REAL, SINT, USINT, UINT, UDINT Low ≤ Tag ≤ High Show object when the tag falls inside a numeric range (tank level 40–60%, temperature < 80)

The critical constraint — and the source of most visibility tickets — is that the dialog cannot be configured to evaluate multiple bits of a single tag, combine several bits with AND/OR/NOT, or evaluate bit patterns that require masking. The animation system reduces the selected trigger to a single boolean expression, and that expression is hard-limited to “tag = value” (Range) or “tag.bitX = TRUE” (Single bit). Any compound logic is the responsibility of the PLC CPU or of a VBScript running in the HMI runtime.

Solution 1: Range Animation for an Exact Binary Match

For the simplest case — make an object visible when an 8-bit tag is exactly 0000 0000 — the Range animation is sufficient because 0000 0000 binary equals decimal 0. No masking, no PLC code, and no script is required. This is the fastest configuration path and is recommended whenever the visibility condition is a single-value equality match.

  1. In the TIA Portal project tree, open the HMI device (e.g., HMI_1 [TP1500 Comfort]) and double-click the screen that contains the target object.
  2. Right-click the screen object (rectangle, symbol, text field, etc.) and choose Properties.
  3. In the Properties inspector, switch to the Animations tab and click Add > Visibility.
  4. In the new animation row, change the trigger type from “No trigger” to Range.
  5. Click the tag selection field and pick the 8-bit tag (e.g., "AlarmByte" of data type BYTE, USINT, or SINT). The animation accepts any 1-byte numeric tag.
  6. Set the range to 0 - 0 (low value = 0, high value = 0). This fires only when the tag equals 0.
  7. Set the visibility behavior: map “In range” to Show and “Out of range” to Hide.
  8. Compile the HMI (right-click HMI device > Compile > Software) and download to the panel.

Verification: In the HMI simulation (Start > Simulation > WinCC Runtime Advanced) or on the live panel, set the tag to 0 in the watch table or via the value-force toolbar. The object appears. Force the tag to any non-zero value (1, 2, 128, 255) — the object disappears. The animation is one-cycle deterministic; there is no debounce or hysteresis.

Range single-value reliability: The Range trigger uses inclusive lower and upper bounds, so low=0, high=0 is well-defined and means “tag equals 0”. On all supported panel images (V13 SP1 through V20) the bound check is strict. If you observe inconsistent behavior in a particular build, prefer Solution 2 (derived boolean in PLC) for guaranteed, version-independent behavior.

Solution 2: Deriving a Visibility BOOL in the PLC (Recommended)

For compound conditions — including the 16-bit pattern xxxx xxxx 0000 0000 where the low byte is zero but the high byte is non-zero — derive a dedicated boolean tag in the PLC and connect the WinCC visibility animation to that tag using the Single bit trigger. This is the most reliable, scan-deterministic, and firmware-portable approach. It is also the pattern Siemens documentation recommends for any visibility rule that depends on more than one bit of a single tag, because the rule is then executed on the controller (which has the data, the cycle time budget, and the bitwise instruction set) rather than on the panel (which has neither the full tag context nor a free-form logic engine in the engineering dialog).

The pattern requires three steps:

  1. Define a new boolean tag in the PLC tag table, e.g., "Vis_AlarmLowByteZero" of type BOOL.
  2. In a cyclic OB (OB1 for free-running, OB35 for time-sliced), evaluate the source tag and write the result to the boolean tag using bitwise AND, equality, and a second comparison to enforce the non-zero high-byte requirement.
  3. On the HMI side, add the boolean tag to the HMI tag list, point the screen object’s visibility animation at it using the Single bit trigger (bit 0), and bind “In range” to Show.

The advantages over Range-only or script-only approaches: (a) the rule is auditable in the PLC watch table; (b) the rule does not consume HMI cycle time or VBScript scheduling slots; (c) the rule is identical across panels, PC runtime, and webUX; (d) the rule survives TIA Portal version upgrades because it is plain SCL.

SCL Bit-Masking Implementation

The PLC program snippet below runs in a cyclic OB (typically OB1) and produces a visibility flag for the 16-bit status word from the example. The code uses intermediate tags so the result is auditable in the watch table at every step.


// SCL — TIA Portal V15 onward, S7-1200/S7-1500
// Source: 16-bit WORD "StatusWord" (e.g., %MW100 or symbolic tag)
// Output: BOOL  "Vis_LowByteZero_HighByteNonZero"

// Step 1: Mask the low byte (bits 0..7)
"LowByte" := "StatusWord" AND 16#00FF;

// Step 2: Equality test — TRUE when the low byte is zero
"IsLowByteZero" := ("LowByte" = 0);

// Step 3: Inequality test — TRUE when the whole word is non-zero
//         (When the low byte is 0, this is equivalent to "high byte != 0")
"IsWordNonZero" := ("StatusWord" <> 0);

// Step 4: Combine
"Vis_LowByteZero_HighByteNonZero" := "IsLowByteZero" AND "IsWordNonZero";

Notes on the bit-mask syntax: TIA Portal SCL accepts the prefix 16# for hexadecimal literals and the underscore _ as a digit-group separator (e.g., 16#00FF is equivalent to 16#00ff and to 255). The mask 16#00FF zeros the high byte while preserving the low byte; the AND operation is performed bitwise on a 16-bit WORD. The TIA Portal Test Suite documentation on binary numbers confirms the value range of a 16-bit WORD is 16#0000_0000 to 16#FFFF_FFFF (when interpreted as a 32-bit pattern) or 0 to 65535 unsigned — both interpretations yield the same mask result here.

Compact equivalent (single line, no intermediates):


"Vis_LowByteZero_HighByteNonZero" :=
    (("StatusWord" AND 16#00FF) = 0) AND ("StatusWord" <> 0);

Place the snippet in OB1 immediately after the code that updates "StatusWord", or in a dedicated FC (function) that is called once per cycle. Both placement options are equivalent for cycle determinism; the FC approach is preferred when the rule is reused across multiple status words.

Ladder and FBD Equivalents for S7-1200 and S7-1500

If the project is maintained in LAD (ladder) or FBD (function block diagram) rather than SCL, the bit-mask and equality combination is built from two CALCULATE boxes (or one CALCULATE plus one comparator) plus an AND gate. The CALCULATE box is in the “Bit logic” operations folder under “Math functions” in the TIA Portal instruction catalog.

Network 1 — mask and compare to zero:

  1. Insert a CALCULATE box (CALCULATE_1) on rung 1. Set OUT to "LowByte" (WORD).
  2. Define one input pin: IN1 = "StatusWord" (WORD).
  3. In the expression field, enter: IN1 AND 16#00FF
  4. Insert an EQ_W comparator on rung 2. Inputs: IN1 = "LowByte", IN2 = 0. Output: "IsLowByteZero".

Network 2 — combine:

  1. Insert an AND logic box. Inputs: "IsLowByteZero" and "IsWordNonZero". Output: "Vis_LowByteZero_HighByteNonZero".
  2. Insert an NE_W comparator to compute "IsWordNonZero": IN1 = "StatusWord", IN2 = 0, output = "IsWordNonZero".

Ladder is slightly more verbose than SCL but offers better online monitoring because each rung state is visible in the LAD editor with green power-rail indicators. For an S7-1500 with active trace recording, the trace can capture "StatusWord" and the derived boolean in the same trace window to confirm timing.

Word size warning: Do not use EQ_B or NE_B on a WORD-sized tag; the instruction set requires the size to match. Use EQ_W / NE_W for 16-bit WORD, EQ_I / NE_I for 16-bit INT, EQ_DW / NE_DW for DWORD. The instruction catalog in TIA Portal filters by data type once the tag is dragged to the input pin.

VBScript Runtime Override for TP 1500 Comfort

TP 1500 Comfort (and all Comfort panels from TP 700 onward) ship with a VBScript runtime. If a derived boolean in the PLC is not acceptable — for example, when the panel must react to a tag that is not on the same controller, or when a quick change is needed in commissioning without re-downloading the PLC — write a VBScript procedure and bind it to a value-change event on the source tag.

Open the HMI project, expand Scripts in the project tree, right-click VB Scripts, and choose Add new VB function. Name it Update_Vis_LowByteZero and paste the following code:


' VBScript — TIA Portal WinCC Comfort/Advanced
' Triggered on value change of the source tag
Function Update_Vis_LowByteZero()
    Dim srcWord
    Dim lowByte
    Dim visible

    srcWord = SmartTags("StatusWord")
    lowByte = srcWord And &H00FF       ' Bitwise AND with 0x00FF
    If (lowByte = 0) And (srcWord <> 0) Then
        visible = True
    Else
        visible = False
    End If
    SmartTags("Vis_LowByteZero_HighByteNonZero") = visible
End Function

Bind the function to the value-change event of StatusWord: in the HMI tag editor, open the tag properties, switch to the Events tab, and on the Value change row choose Update_Vis_LowByteZero as the function. The script runs synchronously on the panel’s main thread and writes the boolean tag, which the visibility animation then evaluates as a Single bit trigger.

Limitations of the script approach: VBScript on Comfort panels runs single-threaded with the rest of the runtime; heavy scripts starve the tag polling cycle. The function above executes in well under 1 ms on a TP 1500 Comfort and is safe. If the rule grows (e.g., eight status words, each with its own derived boolean), consolidate the logic into a single function and trigger it from a 100 ms scheduled task rather than from value-change events on every tag.

Tag Data Types and HMI Pointing

The PLC tag "StatusWord" in the examples above can be declared as WORD (unsigned 16-bit) or INT (signed 16-bit). Both yield the same bitwise mask result because the AND is performed on the bit pattern, not on the numeric interpretation. The HMI tag that points to the PLC tag must be of the matching type — declare the HMI tag as WORD for best clarity, since INT implies signed semantics in the HMI faceplate display.

PLC data type Size (bits) Value range (decimal) HMI tag type Visibility animation accepts
BOOL 1 0, 1 BOOL Single bit
BYTE / USINT 8 0 – 255 BYTE / USINT Single bit, Range
SINT 8 -128 – 127 SINT Single bit, Range
WORD / UINT 16 0 – 65535 WORD / UINT Single bit, Range
INT 16 -32768 – 32767 INT Single bit, Range
DWORD / UDINT 32 0 – 4294967295 DWORD / UDINT Single bit, Range
DINT 32 -2147483648 – 2147483647 DINT Single bit, Range
REAL / LREAL 32 / 64 floating point REAL / LREAL Range (with epsilon warning)

The TIA Portal Test Suite binary numbers reference documents the same ranges for the test framework. Use BYTE or WORD for alarm/status codes to keep the human-readable representation aligned with the bit pattern; INT or DINT introduce sign-extension noise that can confuse the operator when the HMI displays the value.

Pointing the HMI tag: in the HMI tag table (project tree > HMI device > HMI tags), add a tag of type WORD named StatusWord and set the connection to the PLC; TIA Portal auto-fills the address from the symbolic PLC tag if the project is integrated. For separated HMI and PLC projects, manually enter the absolute address (e.g., %DB5.DBW0) and the acquisition cycle (default 1 s is fine for visibility; lower to 100 ms if the visibility must react to fast-changing alarms).

TP 1500 Comfort and Firmware Constraints

The TP 1500 Comfort (Siemens catalog 6AV2 124-1QC02-0AX0 and successors) is a 15.4-inch widescreen TFT panel with a PROFINET interface, 16 million colors, and WinCC Comfort V15+ as its image. The visibility animation system, the Single bit and Range triggers, and the VBScript runtime have been present in the Comfort image since V13 SP1 and are unchanged in V14, V15, V15.1, V16, V17, V18, V19, and V20. There is no firmware-version-specific limit that would block either of the solutions in this article.

What does change between panel firmware versions is the supported TIA Portal engineering baseline:

Panel image / firmware Engineering TIA Portal VBScript Notes
V15.1 TIA V15.1 and later (read-only on V16+) Yes Minimum for projects built today
V16 TIA V16 and later Yes Adds Unified panel side-by-side projects
V17 TIA V17 and later Yes Performance trace improvements
V18 TIA V18 and later Yes MyDocumentation / MySupport hooks
V19 TIA V19 and later Yes Default for new projects in 2024
V20 TIA V20 Yes Default for new projects in 2025; pairs with S7-1200 firmware V4.6+ and S7-1500 firmware V3.1+

For most visibility work the choice of panel firmware does not matter. The constraint that does matter is on the controller side: TIA Portal V20 supports S7-1200 firmware V4.0 through V4.6 and S7-1500 firmware V1.8 through V3.1. If the S7-1200 is on firmware V3.x, you must build the project in TIA Portal V16 or earlier, which is also fine for the SCL snippet in this article because the syntax is unchanged. The PLC firmware compatibility is a project-planning concern, not a visibility-animation concern.

TIA Portal V15 to V20 Compatibility Notes

The Range and Single bit animation triggers, the bitwise AND / equality / AND combination in SCL, and the VBScript SmartTags object are stable across TIA Portal V13 SP1 through V20. The article’s examples compile and run identically on V15 (the version cited in the original project) and on V20 (the current shipping version). Differences that do exist are:

  • V16 onward: the project can contain a Unified Comfort panel alongside the TP 1500 Comfort. The Unified panel uses a different visibility scripting model (JavaScript and property binding), not the Single bit / Range triggers of the Comfort line. Do not copy animations from a TP 1500 Comfort into a Unified panel without rewriting them.
  • V17 onward: the SCL editor gains additional warnings for implicit type conversions. The snippet in this article compiles clean because the literals are explicitly typed (16#00FF is a hex WORD literal; 0 is an INT literal that the compiler widens).
  • V18 / V19 / V20: the project view adds a “Documentation” tab that auto-generates HTML documentation for each function, including the derived-visibility FC. This is useful for the project quality manual but does not change the code.

There is no TIA Portal version in which a Single bit + Range combination of multiple bits became possible in the configuration dialog. The dialog has been engineered around the two-trigger model since the Comfort line replaced the Multi Panel line in 2011, and the same constraint exists in V20 today.

Verification and Commissioning Procedure

  1. Force in the watch table. Open the PLC watch table, add StatusWord, LowByte, IsLowByteZero, IsWordNonZero, and Vis_LowByteZero_HighByteNonZero. Force StatusWord to 16#0100 (256). Confirm Vis_LowByteZero_HighByteNonZero is TRUE.
  2. Negative test. Force StatusWord to 16#00FF (255). Confirm Vis_LowByteZero_HighByteNonZero is FALSE. Force to 16#0000 (0). Confirm FALSE (high byte also zero).
  3. Boundary test. Force StatusWord to 16#FF00 (65280). Confirm TRUE. Force to 16#0101 (257). Confirm FALSE (low byte non-zero).
  4. Live PLC test. Place the SCL snippet in OB1, compile, and download. Set the actual alarm source to write the test values into StatusWord. Verify the boolean tag follows.
  5. HMI simulation. In TIA Portal, right-click the HMI device and start the simulation (WinCC RT Advanced starts in a window). Connect the simulation to PLCSIM (or a real controller). Observe the screen object: visible when 16#0100 is forced, hidden when 16#00FF is forced.
  6. On-panel test. Download the HMI project to the TP 1500 Comfort. From a second engineering station or a webUX client, force the boolean tag and confirm the panel updates within one acquisition cycle (default 1 s).
  7. Performance check. Open the HMI performance trace (Tools > Performance). Confirm the value-change event fires within 50 ms of the tag change and the visibility animation evaluates within one screen refresh.

Troubleshooting Matrix

Symptom Likely cause Fix
Object never appears, even with the tag forced to 0 Range animation low/high not set to 0/0; “Show”/“Hide” mapping is inverted Open Animations > Visibility > Range, set low=0 high=0, map “In range” to Show
Object appears at the wrong times (e.g., visible when tag is non-zero) “In range” mapped to Hide instead of Show Swap the visibility mapping; rename the two animation states for clarity
PLC boolean tag toggles, but the HMI object does not HMI tag not connected; acquisition cycle too long; HMI tag points to wrong address Verify HMI tag connection, lower acquisition cycle to 100 ms, recompile and redownload
Range animation 0-0 does not trigger reliably across panel images Boundary-check implementation varies by panel image revision Switch to Solution 2 (derived boolean in PLC) for guaranteed behavior
SCL snippet does not compile: “expression too complex” Compact form exceeds 256-character line limit in some V15 builds Break into the four-line form with intermediate tags
VBScript runs but the boolean tag does not update Value-change event not bound; SmartTag name typo; script scheduled on the wrong tag Open HMI tag > Events > Value change > confirm function name; check spelling
Visibility works in simulation but not on the panel Project on panel is older than the engineering build Recompile HMI, perform full download (not delta) to overwrite runtime DB
Object flickers on the panel Acquisition cycle is shorter than the PLC scan; tag oscillates around the boundary Raise the HMI acquisition cycle to 500 ms, or add a hysteresis rule in the PLC
Wrong bits evaluated (off-by-one) Bit numbering convention (S7 counts from 0, WinCC displays bit 0 as the LSB) Always use the symbolic tag and the symbolic bit name; never type “Bit16” by hand
“Invalid handle” runtime error in VBScript Source tag is not on the same connection as the script Move the tag to the same HMI connection as the script’s parent device

FAQ

Can I combine multiple bits of one tag directly in the WinCC Comfort/Advanced visibility animation dialog?

No. The dialog accepts exactly two trigger types — Single bit and Range — and neither evaluates more than one bit or more than one equality comparison. Multi-bit logic must be reduced in the PLC (recommended, via SCL or ladder) or evaluated in a VBScript.

What is the simplest way to make an object visible only when an 8-bit alarm tag is 0000 0000?

Use the Range animation trigger on the BYTE/USINT/SINT tag with low = 0, high = 0. The animation is one-cycle, scan-deterministic, and requires no PLC code, no script, and no extra tags.

How do I detect a 16-bit value where the low byte is 0 but the high byte is not (xxxx xxxx 0000 0000)?

Compute a boolean in the PLC: ("StatusWord" AND 16#00FF) = 0 AND "StatusWord" <> 0. Place the SCL in OB1 (or a dedicated FC called once per cycle) and connect the resulting boolean to a Single bit visibility animation on the HMI.

Does the same approach work on WinCC Unified Comfort panels?

Partially. Unified panels also support Range and Single bit triggers on screen objects, but they add a third option — Script (JavaScript) — for visibility. The PLC-side solution in this article is identical; if you prefer not to touch the PLC, write a JavaScript property binding that evaluates the same bit-mask logic and writes the result to the Visibility property of the target object.

My Range 0-0 animation does not trigger on TIA Portal V15 — what is wrong?

On a small number of V15 panel images the 0-0 range is interpreted inconsistently because the boundary check is implemented as a non-strict comparison. Switch to the derived-boolean approach (Solution 2) for guaranteed behavior across all panel firmware versions including V15, V16, V17, V18, V19, and V20.

Can I use a CALCULATE box in ladder to do the bit mask, or do I need SCL?

Both work. In ladder, a CALCULATE box with the expression IN1 AND 16#00FF produces the masked low byte; an EQ_W comparator checks it against 0; an AND box combines the result with the “non-zero whole” test. The SCL form is shorter but the ladder form is easier to debug online because each rung shows its state.

Back to blog