WinCC TIA Portal V14 HMI Tags Reset to 0 After PLC Restart

David Krause22 min read
SiemensTIA PortalTroubleshooting
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

Problem: HMI Values Reset to Zero After PLC Restart in TIA Portal V14

When commissioning an S7-1200 CPU (in the field case, an S7-1215C) with a WinCC runtime panel or WinCC Professional PC station, engineers encounter a recurring symptom: numeric and bit values displayed on the HMI screens drop to 0 (or to the configured initial value) immediately after a PLC restart. The values are normally populated by a Modbus master (e.g. Modbus_Master from the Siemens MODBUS library, or the legacy MB_MASTER instruction) and written into a global data block such as DB43. The HMI screens are linked to DB43 tags as the "external value" source. After a CPU restart the operator sees 0 for one to two seconds, then the values come back. Some operators report that opening the HMI tag properties dialog and re-clicking "OK" "fixes" the screen – a misconception that has propagated across many commissioning reports.

The symptom is not a communication failure: the HMI shows the S7 connection as healthy, and the Modbus polling resumes within the configured timeout. The HMI is doing exactly what it has been told: read %DB43.DBW0 and display the result. The problem is that the source value on the PLC side has been wiped to 0 at startup, before the Modbus master has had a chance to write a fresh sample.

Engineering impact: every time the plant performs a controlled shutdown or an uncontrolled power-loss event, all operator-relevant values (production counters, last measured process values, calibration offsets) are wiped to zero and only reappear after the first Modbus poll completes. In a process plant this is unacceptable. It can also violate the requirement that the last good value remain visible until the next valid sample arrives.

This reference describes how to configure retentivity on the PLC tag side in TIA Portal V14 so that values written into DB43 by the Modbus master survive a CPU STOP→RUN transition, a power cycle, and a load-memory reload. The procedure is functionally identical in TIA Portal V13, V14, V15, V15.1, V16, V17, V18, V19 and V20; the navigation strings are nearly identical across versions, with minor cosmetic differences in the Properties dialog.

Root Cause: PLC Tag Retentivity Not Configured

S7-1200 data blocks have three retentivity states for each tag, set in the DB declaration table on the Retain column:

Retain setting Behavior across STOP→RUN, power cycle, MRES Typical use
Non-retain Tag is re-initialized to its initial value on every restart. HMI shows 0 until the next Modbus poll. Scratch variables, loop temporaries, status flags that should start clean.
Retain Tag keeps its last value across STOP→RUN and power cycle (loaded from load memory into work memory on startup). Reset to initial value on MRES only. Production counters, last-known setpoints, calibration data, Modbus-cached values.
Set in IDB (instance DBs only) Inherits the setting of the associated FB's Static section declaration. Compile-time cascaded. Function block instances, e.g. Modbus_Master instance DB.

The default setting when a new global DB is created in TIA Portal V14 is Non-retain. If the engineer drops the Modbus holding-register values into a freshly created DB43 and does not change this default, the DB is wiped on every CPU restart. The HMI then displays 0 because the source tag itself is 0; the HMI is doing exactly what it is configured to do.

The second contributor to the symptom is the order of operations on restart:

  1. CPU completes startup OB (OB100 for warm restart, OB101 for hot restart on S7-1500; S7-1200 only supports warm restart).
  2. User program executes; Modbus_Master (or MB_MASTER) is called for the first time in the cyclic OB (OB1).
  3. The first Modbus request is queued; the response is typically received 200–800 ms later (depends on baud rate, response timeout, slave turnaround, and poll cycle).
  4. HMI poll cycle (default 1 s on most WinCC Comfort/Advanced panels, 500 ms on WinCC Professional) reads DB43 while the values are still 0.
  5. Operator sees 0 on screen for 0.5–2 s, then values appear.

By setting Retain on the tags that hold the Modbus data, step 4 reads the last known good value from the load memory instead of the initial value, so the operator sees continuity. The screen no longer drops to zero on a power cycle; it briefly holds the last value, then updates with the new Modbus sample.

How TIA Portal V14 HMI Tag Pointers Behave on PLC Restart

It is important to understand that the HMI tag itself is not "lost" on a PLC restart. The HMI tag in WinCC is a client-side handle to a value fetched from the PLC on a configured acquisition cycle. The HMI does not need to be re-linked, and the "open properties and click OK" workaround does not actually re-establish anything – it simply forces the HMI to re-read the value at the next acquisition tick, by which time the Modbus master has already written fresh data.

What is actually happening on the wire:

  • HMI tag DB43_Tag_1 points to %DB43.DBW0 on the S7-1215C at 192.168.0.16.
  • Before the restart, the Modbus master wrote 16#1234 to DBW0. The HMI is displaying 0x1234.
  • The CPU is power-cycled. Work memory is re-initialized from load memory, but because DB43 is not retentive, the area is overwritten with the initial values from the DB's "Initial Value" column (typically 0).
  • Within ~50 ms of the first user program scan, the HMI's acquisition cycle reads 0 from DBW0 and updates the screen.
  • The Modbus master completes its first transaction, writes 0x1234 back, and the screen updates again.

The total visible "flicker to zero" is 0.5–2 s in most installations. The fix is to make DBW0 retentive so the value loaded into work memory at startup is the last value from the previous session, not the initial value.

For a more detailed explanation of how WinCC handles tag values across PLC connection events, see the WinCC help chapter on Screens and Screen Objects in the TIA Portal documentation.

HMI Tag Acquisition Modes and Why the Symptom Is Visible

WinCC supports three acquisition modes for an HMI tag. The mode determines how often the HMI polls the PLC and therefore how visible the "zero gap" is to the operator:

Mode Behavior When the symptom is most visible
Cyclic continuous Tag is polled continuously on a fixed cycle (default 1 s). Always; the screen update is bound to the cycle, so the zero is shown until the next cycle after the Modbus master has written the new value.
Cyclic on use Tag is polled only when a screen containing it is active. Visible only when the affected screen is the active screen at the moment of the restart; on-screen zeros for ~1–2 s.
On demand Tag is polled only when a script or animation forces a read. Generally not visible unless the operator triggers a manual refresh during the restart window.

The default for new HMI tags in TIA Portal V14 is Cyclic continuous. For process values that must remain visible across a restart, this is the correct mode; combined with PLC-side retentivity, the operator never sees a zero unless the Modbus slave itself is unreachable.

Prerequisites

Before applying the fix, verify the following:

  • TIA Portal V14 or later installed. The article was validated on V14 SP1 (V14.0.1.0); later updates up to V14 SP1 Upd 6 / HSP 0282 are drop-in compatible.
  • The S7-1200 CPU firmware on the target station is V4.x. The S7-1215C ships with V4.2 or V4.4 depending on the order number; V4.2 or later supports retentive DBs and the Modbus library V3.x/V4.x. CPU firmware is read in Online & diagnostics > Diagnostics > CPU.
  • The project on the engineering station is the active project, with offline-online consistency current (compile status "All up to date"). If there are pending compile errors, the retain change cannot be downloaded.
  • The user has write access to the PLC project and is able to download to the device. Retentive-tag changes require a full download of the data block, which forces the CPU into STOP for a few seconds.
  • For large projects, identify the exact set of tags that should be retained. Retentive memory is a finite resource; do not retain scratch arrays or transient buffers.
  • The PLC project is backed up (TIA Portal project archive or version control) before the change, so a rollback is possible if a downstream system depends on the old DB layout.
Important: changing the retain attribute of an existing DB and downloading the project causes a data block reload on the S7-1200. The CPU will request STOP, replace the DB with the new definition, and then restart. The actual values previously in the DB are lost at the moment of download; the next restart of the CPU will load the retained values from load memory. Plan the download window accordingly.

Step-by-Step: Set the Retain Attribute on the S7-1200 PLC Side

The fix lives entirely in the PLC project, not in the HMI project. The HMI is innocent.

  1. In the TIA Portal project tree, expand the PLC station (e.g. PLC_1 [CPU 1215C DC/DC/DC]) and then Program blocks.
  2. Locate DB43. In the original project the name may differ; the value depends on the project convention. If the data block is named differently (e.g. ModbusData), open that block instead. Right-click the DB and select Properties.
  3. In the DB properties dialog, switch to the Attributes tab.
  4. For each tag that should survive a CPU restart, change the Retain column from Non-retain to Retain. To bulk-set a contiguous range, click the first tag, hold Shift, click the last tag, then right-click and choose Edit > Retain.
  5. Alternatively, if every tag in DB43 should be retained (common for a Modbus mirror DB), open the block editor, click the top-left corner of the declaration table to select all rows, right-click and choose Retain. This sets the property on every tag at once.
  6. Click OK to close the properties dialog. The DB now shows a small "R" icon next to each retained tag in the project tree (in TIA Portal V14 the icon is a small lock or "R" indicator depending on the view setting; you may need to enable View > Show Retain).
  7. Save the project. Compile the PLC station: right-click PLC_1 → Compile > Software (rebuild all blocks). Resolve any compile errors; a common one is "Retain area is exceeded" if the project over-allocates retentive memory.
  8. Download to the device: right-click PLC_1 → Download to device > Hardware and Software (only changes). The CPU will STOP, reload DB43, then RUN. The next power cycle or STOP→RUN will preserve the retained tags.
Tip: if you want the entire DB43 to be retained without touching individual tags, you can also set the DB-level "Optimized block access" property in combination with the Retain attribute. However, optimized blocks with the Modbus instruction require careful handling of the VARIANT pointer inputs; in most field cases the standard non-optimized DB with per-tag retain is simpler. Optimize the block only if you also need symbolic-only access from the HMI.

Step-by-Step: Verify and Re-Link the HMI Tag in WinCC

Although the HMI does not need a re-link, after applying the PLC fix you should verify the HMI connection is correct so that any future re-import of the PLC tags does not break the link. The discussion thread also raised a point about the HMI connection pointing to a different partner than expected; this is a real failure mode and worth verifying explicitly.

  1. In the TIA Portal project tree, expand the HMI station (e.g. HMI_1 [TP1200 Comfort]) and double-click Connections.
  2. Select the connection used to reach the PLC (e.g. Connection_2).
  3. In the Connection partners area, verify that the partner is the S7-1215C at 192.168.0.16 (or whatever the actual IP is). The partner must be reachable on the same subnet as the HMI. Wrong IP, wrong rack/slot, or a different station name are the most common mistakes here.
  4. Open HMI tags → the tag table you use for the Modbus data (e.g. Default tag table).
  5. For the affected tag, open Properties and confirm:
    • Connection: points to the S7-1215C connection (Connection_2 in this project).
    • PLC tag: bound to a tag that exists in the PLC (e.g. DB43.Modbus_Register_1).
    • Address: matches the PLC tag address (e.g. %DB43.DBW0 for a 16-bit word, %DB43.DBD0 for a 32-bit dword, %DB43.DBX0.0 for a bit, %DB43.DBR0 for a 32-bit real).
    • Acquisition mode: Cyclic continuous with a cycle appropriate to the process (1 s for a counter, 500 ms for a process value).
  6. Click OK. The tag is now re-bound to the same PLC tag, which is now retentive.
  7. Compile the HMI station and download to the panel.

Step-by-Step: Persist Modbus-Acquired Values Across Restarts

The Modbus master instruction (Modbus_Master in MODBUS V3.x / V4.x library, or MB_MASTER in the legacy V1.x library) writes the response payload into a data block. Two distinct DBs are in play:

  • Instance DB of the master (e.g. DB_Modbus_Master_Instance) – contains the instruction's static working area, request/response buffers, and the STATUS, DONE, ERROR outputs. This DB is automatically retentive for its Static section only if the FB declares it that way; for the legacy MB_MASTER V1.x, the Static section is non-retain by default. In most projects the instance DB does not need to be retentive.
  • Data area DB (e.g. DB43) – the user-defined mirror of the Modbus holding registers. This is the DB that must be retentive.

To persist the values, follow the procedure in the previous section on DB43. A common field pattern is to define DB43 as an array of words or dwords, one element per Modbus register, with the comment "Modbus mirror – retain". The retentive area on an S7-1215C is sized by the project; the maximum is limited by the CPU order number:

CPU order number Work memory Retain memory (data + bit memory) Typical max retentive DB size
6ES7215-1AG40-0XB0 125 KB 14 KB ~14 KB (set in CPU properties > Retentive memory)
6ES7215-1BG40-0XB0 150 KB 14 KB ~14 KB
6ES7215-1HG40-0XB0 200 KB 14 KB ~14 KB

For an S7-1215C with a 14 KB retain budget and a Modbus mirror DB of, say, 200 words (400 bytes), the entire mirror fits comfortably in retain. If the project has many other retentive DBs, run a PLC > Online & diagnostics > Memory check to see remaining retain headroom.

Verification Procedure and Acceptance Test

  1. With the new retain setting downloaded and the CPU in RUN, force a known value into one of the retentive tags using a watch table (Force or Modify). Example: force DB43.DBW0 = 16#1234.
  2. Verify the HMI displays the forced value.
  3. Power-cycle the S7-1215C: pull the 24 V supply, wait 5 s, restore power.
  4. After the CPU comes back to RUN (and the HMI completes its startup), observe the HMI. The forced value 0x1234 must still be visible within the first HMI acquisition cycle, before the Modbus master has had a chance to write fresh data.
  5. Wait for the Modbus poll to complete; the HMI value should now equal the live register value from the Modbus slave.
  6. Repeat with several tags of different data types (Bool, Int, DInt, Real) to ensure no type-conversion regressions.
  7. Perform an MRES of the CPU: Online & diagnostics > MRES. After MRES, the retain area is cleared and the values are reset to initial values. This is expected; document this in the operating manual so operators do not interpret the post-MRES state as a bug.

Pass criteria: tags display the last pre-restart value within one acquisition cycle (typically ≤1 s) and never display 0 for more than the acquisition cycle during a normal power cycle.

Retentivity Limits on the S7-1215C and Related CPUs

The S7-1200 family uses a non-removable, battery-free retentive mechanism: a portion of work memory is backed up to load memory on every STOP, and reloaded on the next RUN. The size of the retentive area is configured in CPU properties > Retain and is a hard limit per CPU order number. Forcing more data into retain than the configured area allows produces a compile warning ("Retain area is exceeded") and the download may fail or the CPU may drop the excess to non-retain at runtime.

For larger Modbus mirrors (> 10 KB) or a high tag count with mixed Boolean + Word + Real types, prefer the following pattern:

  • Allocate only the operationally critical values to the retentive area (e.g. last setpoint, last production count, calibration offset).
  • Keep transient, easily-recomputed values (e.g. instantaneous analog readings, status bits) as non-retain; they will be repopulated by the first Modbus poll.
  • If the slave is slow (e.g. 9600 baud, 1 s turnaround) and the operator screens cannot tolerate a 1–2 s gap, retain the last value and overwrite on next poll. This is the typical pattern.
  • For very large mirrors (> 50 KB), consider using the S7-1500 family instead of the S7-1200, where the retain budget is configurable up to the full work memory and the Modbus library supports multi-polling with larger payloads.

Edge Cases and Field-Proven Caveats

Some legacy S7-1200 code uses the MB_HOLD_REG UDT from the older Modbus library; the same retain principle applies. In newer projects using the MODBUS V4.x library (available in TIA Portal V14 SP1 and later), the instance DB and the user data area are separate concepts. If your code uses a pointer DB that is built dynamically (e.g. with P#DB43.DBX0.0 BYTE 200 passed to Modbus_Master), the actual storage DB is the one you created (e.g. DB43), so the retain setting must be applied there.

Edge cases seen in the field:

  • HMI only shows zero on the first screen, not on others. This is an HMI refresh ordering issue, not a PLC retain issue. Check Connections > Connection_2 > Properties > Update of the HMI tags; for the affected screen, lower the acquisition cycle or set the tags to Cyclic continuous rather than On demand.
  • All retentive values are wiped after a project download. This is expected; the new DB definition overwrites the load-memory image. It is not a bug. If you must preserve values across a project download, write the values to a recipe or use the recipe view on the HMI to back them up first.
  • Some tags still go to zero even after the retain fix. Usually this means the tag is in an instance DB (e.g. an FB's Static section) and the FB was compiled with the wrong retain attribute. Open the FB, switch to the Static interface, and set the relevant tag's Retain column to Retain; recompile the FB and the instance DB will inherit the new setting.
  • Tags in a function block accessed via multi-instance are not retained. Multi-instance DBs share the parent's retain setting. If the parent is non-retain, all multi-instances are non-retain regardless of the FB's declaration. Either set the parent's Static tags to Retain or refactor to single-instance DBs.
  • Modbus master instance DB grows in size after a TIA Portal update. The MODBUS V3.x to V4.x library migration added fields to the Static section. After migration, the instance DB is re-initialized, which can drop retained values from the data area DB if the order of operations is wrong. Always back up recipes before a major library migration.
  • HMI shows dashes "----" instead of 0 after a long network outage. This is an acquisition error: the connection is down or the address is out of range. Check the WinCC diagnostics view and the PLC's diagnostic buffer for the connection state. It is unrelated to the retain fix.
  • The HMI tag table is read-only and shows the PLC tags greyed out. The HMI project is not connected to the PLC station in the project navigator. Use Devices & networks > Network view > drag a connection from the HMI to the PLC, then re-import the PLC tags via the HMI tag table's "Add new > PLC tag" dialog.

Troubleshooting Matrix

Symptom Probable cause Diagnostic Fix
HMI shows 0 for 1–2 s after PLC restart, then correct value PLC tag not retentive Open DB43 properties > Attributes; check Retain column Set Retain on the affected tags in DB43; download to PLC
HMI shows 0 permanently after PLC restart HMI tag is not bound to the PLC tag, or the connection partner is wrong HMI > Connections > Connection_2; verify IP and rack/slot Re-bind the HMI tag to the correct PLC tag; correct the connection partner
HMI shows last value briefly, then jumps to a different value Modbus master is writing a new sample over the retained value, but the value is from a different register mapping Watch table on DB43; compare with expected Modbus map Correct the Modbus address mapping in Modbus_Master call
Retain setting "greyed out" in DB properties Block is an instance DB and inherits from the FB; the FB's Static section has no retain Open the FB; check the Static interface Retain column Set Retain on the relevant FB Static tags; recompile
Compile warning "Retain memory exceeded" Configured retain area is smaller than the sum of retentive tags PLC properties > Retain; check the configured area size Increase the retain area up to the CPU max, or move some tags to non-retain
After TIA Portal V14 SP1 update, retain behavior changed DB default changed to "Non-retain" in the new version, or the upgrade tool did not preserve custom settings Cross-check DB attributes after upgrade Re-apply the Retain setting on every DB that previously relied on a non-default retain
HMI tag shows dashes "----" instead of 0 Acquisition error: connection down, or address out of range WinCC diagnostics; PLC online > Diagnostic buffer Check connection, subnet, and DB number consistency
Only some tags show 0; others retain correctly Retain was set tag-by-tag and a row was missed DB43 declaration table; check the Retain column row by row Bulk-set the entire DB to Retain if appropriate
After upgrading from TIA V12, the HMI project fails to open a screen Known V12 issue with the screen object editor; see TIA V12 screen open/creation issue Open the project in TIA V14 SP1 or later and recompile Migrate to V14 SP1 minimum

Best Practices to Prevent the Symptom on Future Projects

  • Convention for Modbus mirror DBs. Adopt a project-wide convention: every DB that is written by a Modbus master has Retain on all tags, and the first line of the DB header comment is "Modbus mirror – retentive, do not change without consulting the commissioning engineer".
  • Naming. Use a name suffix like _R for retentive tags in the HMI tag table, so operators reviewing the project can see the intent at a glance.
  • Default the retain setting at the project level. In TIA Portal V14, the default for new global DBs is non-retain. For new projects that will be heavily Modbus-based, instruct the team to change the DB template's default before creating the DB. A project-wide master data library (ML) can lock the default.
  • Retention budget. In PLC properties > Retain, set the retentive memory size to a value that matches the design, not the default. A 2 KB default on a CPU that supports 14 KB wastes retain headroom; setting it to 14 KB upfront avoids compile warnings later.
  • Validate on first download. As part of the Site Acceptance Test (SAT), include a power-cycle test in the punch list. A 30-second test of "pull 24 V, restore, verify HMI" catches retain issues before the plant is handed over.
  • Document the MRES behavior. Operators must know that a CPU memory reset clears all retentive values. Add a row to the operator manual: "After MRES, all Modbus-mirror values are zeroed until the next poll completes. This is normal; no action required."
  • Version control. Keep the TIA Portal project in a version-controlled repository (SVN, Git, TIA Project Server). A change to a DB's retain attribute is a single-line diff that the reviewer can see clearly; a missing change in this area is the most common cause of "the screen broke after the last software update".
  • Use the HMI recipe view as a backup mechanism. For values that must survive a project download, write them to a recipe in the HMI's flash storage and restore on next start. Recipes are user-actionable and survive the HMI restart, even if the PLC retain area is overwritten.
  • Watch the diagnostic buffer on every restart. Online & diagnostics > Diagnostic buffer shows the retain-load event with timestamp; use it to confirm the retain mechanism is actually firing. A missing entry indicates the retain setting is not being honored.

Frequently Asked Questions

Why does the WinCC screen show 0 only after a PLC restart, not while the PLC is running?

While the PLC is running, the Modbus master continuously writes fresh values into DB43, so the HMI always sees a non-zero value. On a CPU restart, the work memory is re-initialized from the load memory; if the tags in DB43 are not retentive, the load memory image contains the initial value (0), and the HMI displays 0 until the first Modbus poll completes. The fix is to set the Retain attribute to Retain on the affected tags in DB43 and download to the PLC.

Do I need to re-link the HMI tag to fix the issue?

No. The "open the HMI tag properties and click OK" workaround does not fix the underlying problem; it only forces a one-time re-read of the value, which happens to coincide with the first successful Modbus poll after the restart. The actual fix is in the PLC project on the DB's Retain attribute. After applying the PLC fix, verify the HMI tag is still correctly bound (HMI > Tags > the affected tag > Properties > PLC tag), but a re-link is not required.

Is the HMI connection pointer to DB43 the right place to look?

Yes, but only as a verification step. The HMI connection (Connection_2 in the example) must point to the correct S7-1200 station, and the HMI tag's address must match the PLC tag's address in DB43 (e.g. %DB43.DBW0 for a 16-bit word, %DB43.DBD0 for a 32-bit dword, %DB43.DBX0.0 for a bit). If the HMI shows 0 permanently rather than for 1–2 s, the issue is the connection or the address, not the retain setting.

How much retain memory does an S7-1215C have, and will my Modbus mirror fit?

An S7-1215C (order numbers 6ES7215-1AG40-0XB0, -1BG40-0XB0, -1HG40-0XB0) has approximately 14 KB of retentive memory for data blocks and bit memory combined. A typical Modbus mirror of 200 words is 400 bytes, which fits well within the budget. You can see the configured retain area and remaining headroom under PLC > Online & diagnostics > Memory or by reading CPU properties > Retentive memory offline.

Will the retained values survive a TIA Portal project download?

No. Downloading a new DB definition to the S7-1200 overwrites the load-memory image, so any previously retained values are lost on the next restart. If the project download must be performed on a live plant, back up the current values to a recipe on the HMI first, perform the download, and then restore the recipe. This is expected behavior and is not a bug in the retain mechanism.

Back to blog