TIA Portal Snapshot to Start Value: DB Initial Value Workflow

David Krause11 min read
SiemensTechnical ReferenceTIA Portal
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 "Snapshot" and "Copy Snapshot to Start Value" Cannot Run on the HMI

The Snapshot and Copy snapshot as start value commands in TIA Portal are offline project engineering functions bound to the STEP 7 editor. They operate on the project database on the engineering workstation, not on the live PLC. Concretely, when an operator presses a button on a Comfort Panel or WinCC Runtime, the panel cannot:

  • Open the offline block on the engineering station.
  • Serialize the actual values of a DB back into the Start value column.
  • Recompile the block and download it.

This limitation is the reason your HMI cannot expose those two commands directly. The PLC CPU has no instruction called SNAPSHOT or SET_STARTVALUES; the editor manipulates the XML representation of the block in the TIA project tree. The only legitimate runtime alternatives are WR_DBL / WRITE_DBL (write data block in load memory), TIA Portal Openness automation scripts, and structured recipe/DB export patterns.

Engineering reality check: There is no firmware instruction, no SCL function, and no HMI tag that triggers "Copy snapshot to start value" on a live S7-1200/1500 CPU. Anyone who tells you otherwise is describing a non-Siemens mechanism or confusing it with recipe handling.

The Two Editor Commands: What They Actually Do

Before solving the problem, separate the two operations precisely. Engineers confuse them and then design the wrong HMI workflow.

Command Scope Effect on the Project Effect on the CPU
Snapshot (read actual values) One DB, offline editor Fills the Snapshot column in the data block view with current online values. No write back to project. None. Pure read of online blocks.
Copy snapshot as start value One DB, offline editor Copies the snapshot column into the Start value column and recompiles the block. Start values become the new initial values on the next download / reinitialization. None directly. Takes effect on next STOP→RUN transition that reinitializes the DB, or after download with "Reinitialize all data blocks".

Both commands require TIA Portal to be open, the project to be checked out, and the user to have engineering rights. None of those preconditions exist on a WinCC Comfort Panel or a WinCC Runtime Professional station running in production.

Three Field-Proven Alternatives to an HMI "Snapshot" Button

Depending on the goal - capture a recipe, version-control parameter sets, or restore defaults - one of the three patterns below is the right answer.

Alternative 1: Use the WR_DBL / WRITE_DBL Instruction at Runtime

The WRITE_DBL instruction (SCL: WR_DBL, classic: WRITE_DBL in the "Extended instructions" palette) writes the current actual values of a work DB back into the load memory image of the source DB. The next CPU restart then reinitializes that DB with the saved values. This is the closest functional equivalent to "Copy snapshot to start value" that runs on the PLC.

Function signature (SCL):

// Returns: STATUS = 0 on success, 80A1 hex on bad SRCBLK, 80B1 hex on no DB loaded,
// 80D0 / 80D1 / 80D2 for file/system errors, 80E1 / 80E2 for object access.
WR_DBL(SRCBLK  := "dbRecipeActual",
       RET_VAL := "iWrStatus",
       BUSY     := "bWrBusy");

Preconditions:

  • The CPU program card or load memory must support write access. S7-1200 firmware V4.0+ and all S7-1500 CPUs support WR_DBL with a SIMATIC memory card or internal remanence.
  • Maximum data block size per call: 64 KB on S7-1500, 16 KB on S7-1200. Split larger recipes.
  • Number of parallel WR_DBL calls is limited to 1 for S7-1500 and 1 for S7-1200. Queue them in a state machine.
  • The target DB must be in the offline project. WR_DBL cannot create a DB on the fly.

Error / status codes (hex):

STATUS (hex) Meaning Field Fix
0000 Success, finished Continue
7000 First call, BUSY = 1 Poll BUSY, call again with same inputs
80A1 SRCBLK not a DB or does not exist Verify DB number, check DB was downloaded
80B1 DB not loaded in work memory Download DB, then retry
80D0 / 80D1 / 80D2 File / system / I/O error Check memory card, format SIMATIC card if necessary
80E1 / 80E2 Object access conflict Reduce parallel WR_DBL calls to 1

Sample FB that wraps WR_DBL behind a single HMI button:

FUNCTION_BLOCK "fbSaveRecipeToStart"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
   VAR_INPUT
      iExecute : Bool;       // wired to HMI button "Save current as default"
      iRecipeDB : DB_ANY;
   END_VAR
   VAR_OUTPUT
      oDone : Bool;
      oBusy : Bool;
      oError : Bool;
      oStatus : Word;        // raw RET_VAL from WR_DBL
   END_VAR
   VAR
      sWr : Bool;            // internal rising-edge latch
      rtExec : R_TRIG;
   END_VAR
BEGIN
   rtExec(CLK := iExecute);
   IF rtExec.Q AND NOT oBusy THEN
      sWr := TRUE;
      oError := FALSE;
   END_IF;

   IF sWr THEN
      WR_DBL(SRCBLK := iRecipeDB,
             RET_VAL := oStatus,
             BUSY    := oBusy);
      IF NOT oBusy THEN
         sWr := FALSE;
         IF oStatus = 0 THEN
            oDone := TRUE;
         ELSE
            oError := TRUE;
         END_IF;
      END_IF;
   END_IF;
END_FUNCTION_BLOCK

Alternative 2: TIA Portal Openness Script on the Engineering Station

If the goal is to capture actual values for version control (archiving the recipe, comparing against the engineering baseline), the engineering workstation is the right place - and TIA Portal Openness is the official automation API. The Openness API exposes PlcBlock with a ReadFromPlc() method that returns the actual values, and a SetStartValue(...) call that updates the offline block.

Workflow (PowerShell + TIA Openness):

  1. Open the project in TIA Portal V17+ with Openness enabled (Options > Settings > TIA Portal Openness).
  2. Grant the engineering user the Openness right under Project > Security settings > User & roles.
  3. Run a PowerShell or C# script that enumerates the target DB, calls PlcBlock.ReadFromPlc(), and writes the result into a CSV. This is the "snapshot" leg.
  4. A second script then iterates the actual values and pushes them into the StartValue collection, recompiles, and archives. This is the "copy snapshot to start value" leg.
  5. Commit the resulting CSV into Git/SVN/TFS with a timestamped comment.
# PowerShell pseudo-code (TiaPortal.Openness.dll must be loaded first)
$project = $portal.Projects.Open("C:\Projects\Line07.ap17")
$plc     = $project.Devices.Item("PLC_1")
$db      = $plc.DeviceItems.Item("DB_Recipe").GetService([Siemens.Engineering.SW.Blocks.PlcBlock])

# 1. Capture actual values from the online CPU
$snapshot = $db.ReadFromPlc()
$snapshot | Export-Csv "C:\Archive\DB_Recipe_$((Get-Date).ToString('yyyyMMdd_HHmmss')).csv" -NoType

# 2. Push them back as the new start values
foreach ($member in $db.Members) {
    if ($snapshot.ContainsKey($member.Name)) {
        $member.StartValue = $snapshot[$member.Name]
    }
}
$db.Compiler.Compile()
$project.Save()
$portal.Projects.Close($project)
Traceability: Rename the project file (e.g. add a date stamp) before opening it for the snapshot, so the operator is forced to consciously capture the as-running values. The "snapshot" keyword in the project name is the workflow reminder; pair it with initials in the file name for audit.

Alternative 3: Recipe / Data-Log Export from WinCC Runtime

If the HMI is a Comfort Panel or a WinCC Runtime Professional PC, recipes already exist as a first-class feature. Use them. The export produces a CSV on the panel's storage medium (SMC card on a Comfort Panel, hard drive on a PC) that you can archive automatically.

Variant Trigger Output When to use
WinCC Comfort recipe view Operator button "Save set" CSV on SMC card, paths like /media/simatic/HMI_Recipes/Recipe_001.csv Up to 1000 entries, no SCADA needed
WinCC Professional recipe Operator button or VBS script SQL Server, CSV, or XML Central recipe database, audit trail
User-defined recipe FB + WR_DBL Operator button wired to FB Values written back to load memory When you also need the values to survive STOP/RUN, restart, or reinit

Step-by-step: Configure a Comfort Panel recipe that mirrors your DB

  1. In the HMI project tree, right-click Recipes → Add new recipe. Name it Recipe_OperatingParams.
  2. Add one element per DB tag. For a DB_Recipe tag Recipe.SpindleSpeed of type Real, the recipe element is the same name with format 999.9.
  3. Wire the recipe elements to the PLC tags using direct tag connections. HMI tag name = PLC tag name (e.g. DB_Recipe.SpindleSpeed).
  4. Insert a Recipe view on a screen, enable the toolbar buttons Save, Save as, and Export to file.
  5. Set the storage path on the panel: Runtime settings > Recipes > Storage location. For a Comfort Panel this is forced to the SMC card.
  6. Test offline with the simulator: change values, press Save, restart the simulator, press Load - the saved set must come back.

End-to-End HMI Workflow: "Save Current Parameters as Default"

The realistic production workflow combines the recipe pattern (operator UI), the WR_DBL instruction (PLC write-back), and a confirmation step. Wire it like this:

  1. HMI button "Save current as default" sets a bit in the PLC, e.g. HMI.SaveDefaultRequest (Bool).
  2. PLC FB fbSaveDefault detects the rising edge, validates the operator is logged in at the right level (compare HMI.CurrentUserLevel with required level), and arms a 5-second confirmation prompt by setting HMI.SaveDefaultArmed = TRUE and HMI.SaveDefaultDeadline = actual time + 5 s.
  3. Operator presses "Confirm" within 5 s → HMI.SaveDefaultConfirm = TRUE.
  4. FB triggers WR_DBL on the recipe DB, monitoring BUSY and RET_VAL.
  5. On success, the FB logs a DataLog entry with timestamp, user, and a checksum of the saved values. The data log is a separate DB whose entries you can review on the panel.
  6. On any non-zero STATUS, the FB raises a visible alarm (HMI.AlarmSaveDefaultFailed) and writes STATUS into HMI.LastSaveError as a Word tag for the diagnostics screen.
Why a confirmation step matters: Without it, a single button press from a maintenance mechanic (or a vibration-induced spurious contact on a button) writes the current random values to load memory and they become the new defaults forever - including the next machine state. Five seconds is a typical compromise: long enough to cancel, short enough not to annoy.

What "Snapshot" Is Not

Three common misuses to avoid in project documentation:

  • Snapshot is not a backup. It only fills an in-editor column. It does not archive anything on disk by itself.
  • Copy snapshot to start value is not a runtime action. The CPU keeps running with its existing actual values until a STOP→RUN transition or a reinitialize download. SNAPSHOT does not flush values to remanent memory.
  • The "Copy snapshot to start value" command does not change online values. It edits the project. The new start values only matter when the DB is reinitialized.

Comparison Matrix: Which Method When

Requirement Best method Why
Operator must save current parameters with one button HMI button + WR_DBL FB Runs entirely on the PLC, no engineering station required
Engineering must audit changes over time Openness script + Git Version control, diffing, and CI integration
Operators load different recipes per product WinCC recipe view Native HMI feature, no PLC changes
Reuse same parameter set on multiple machines Recipe CSV export + USB stick Portable across panels and machines
Restore last-known-good values after a fault Recipe + automatic load on startup Survives STOP/RUN and full power cycle

Commissioning Checklist for the HMI Save-Default Workflow

  1. Compile and download the project with the FB present. Do not delete the existing recipe DB before download - the FB references it.
  2. Open a watch table and force SaveDefaultRequest = 1 for 1 second. Verify STATUS = 16#0000 within 2 seconds.
  3. Power-cycle the CPU (not just STOP/RUN). Confirm the saved values are present after restart.
  4. Stress-test with the largest legitimate DB. If STATUS returns 80D0/80D1, split the DB or move to internal load memory on the SIMATIC card.
  5. Test the cancel path: arm, do not confirm, wait 6 seconds. The FB must clear SaveDefaultArmed without calling WR_DBL.
  6. Test the error path: temporarily rename the DB offline, press save, confirm an alarm appears with the correct hex status.

Troubleshooting Matrix

Symptom on the HMI Likely STATUS (hex) Root cause Fix
"Save failed -0000" or alarm never clears 7000 stuck FB polled WR_DBL before BUSY cleared, or two calls in parallel Sequence calls with a single instance, only one WR_DBL active at a time
"Save failed -80A1" 80A1 SRCBLK wrong - typicall a non-DB or instance-DB confusion Pass the DB number, not the symbol; use DB_ANY input
Values look correct on HMI but disappear after power cycle WR_DBL returned 0 but no remanence DB declared non-remanent, or no memory card on S7-1200 Set DB to Remanent, install a SIMATIC memory card
Operator button does nothing N/A Bit not transferred to PLC; PLC tag connection missing Check HMI tag connection in WinCC tag administration
Save works, restart works, but second save fails 80D0 Card full or fragmented Reformat the SIMATIC card offline, archive old logs

Frequently Asked Questions

Can I trigger "Copy snapshot to start value" from an HMI button?

No. The command is a TIA Portal editor function that modifies the offline project XML. The CPU has no instruction for it. Use the WR_DBL instruction with an HMI-triggered FB to write current values back to load memory, then restart the CPU to apply them as new start values.

What is the difference between Snapshot and Copy snapshot to start value?

Snapshot reads the online actual values into a temporary column in the editor. Copy snapshot to start value then copies that column into the project's Start value column and recompiles the block. Neither modifies the live CPU. The new start values take effect after a download with reinitialization or a STOP→RUN transition that reinitializes the DB.

Which CPUs support WR_DBL and what are the size limits?

All S7-1200 (firmware V4.0 and later) and all S7-1500 CPUs support WR_DBL. The maximum block size per call is 16 KB on S7-1200 and 64 KB on S7-1500. Only one WR_DBL call may be active at a time per CPU. A SIMATIC memory card is required for the write to be persistent across power cycles on S7-1200.

Why do my saved values disappear after a power cycle?

Three typical reasons: the DB is configured as non-remanent in TIA Portal, there is no SIMATIC memory card installed in the S7-1200, or the WR_DBL call did not complete (RET_VAL non-zero). Check the status word, enable DB remanence, and confirm the memory card is recognized in the CPU's online diagnostics.

Is there a way to script the snapshot workflow?

Yes, use the TIA Portal Openness API (TIA V17 or later). Load the project via the Openness DLL, call PlcBlock.ReadFromPlc() to capture actual values, set StartValue on each member, recompile, and save. PowerShell and C# examples are documented in the Siemens Openness online help. Combine with a Git repository for full traceability of every snapshot.

Back to blog