Overview: Why a DB Shows 0 Online Even Though an Initial Value Was Defined
In SIMATIC STEP 7 V5.5 SP4 running against PLCSIM (or against a physical S7-300/S7-400 CPU), engineers routinely declare an initial value in a Data Block (DB), download the program, place the CPU online, and discover that the value read back from the DB is 0 instead of the declared initial. This is not a bug, nor a download fault, nor a PLCSIM defect. The STEP 7 DB editor exposes two distinct value columns — Initial Value and Actual Value — and the value used by user program logic is the Actual Value. The Initial Value is metadata that the editor stores in the offline project and that the CPU uses only under specific re-initialization conditions.
The behavior is documented in the Siemens Industry Online Support article Entry ID 837001 – "What is the significance of the initial and the actual values of a data block in STEP 7 V5.x?", which states explicitly that even when the initial value is also loaded onto the CPU and can be monitored there in online mode, this value is not used by the CPU for normal program execution.
L DB1.DBW0, L "MyDB".Setpoint, or via VAT/online monitor is the Actual Value. If you want that read to equal the declared initial, you must populate the Actual Value column — not just the Initial Value column — before downloading.Declaration View vs Data View: The Two Faces of the DB Editor
The STEP 7 V5.5 DB editor (offline block editor, opened by double-clicking a DB in SIMATIC Manager > S7 Program > Blocks) provides two views that are selected from the View menu of the editor window:
| View | Columns visible | Editable online? | Purpose |
|---|---|---|---|
| Declaration view (default) | Address, Name, Type, Initial Value, Comment | No | Offline authoring of the DB structure and default values shipped with the block |
| Data view | Address, Name, Type, Initial Value, Actual Value, Comment | Yes (Monitor/Modify) | Inspect and modify the runtime values that the CPU will use |
When a DB is opened for the first time after creation, STEP 7 defaults to Declaration view. Engineers see only the Initial Value column and assume that declaring a value of 20 in that column will produce 20 at runtime. It will not, unless the corresponding Actual Value is also 20 at the moment the CPU begins cyclic execution.
To switch views:
- Double-click the DB in SIMATIC Manager to open the editor.
- From the menu bar select View > Data View (or click the Data View toolbar toggle).
- The window now shows two adjacent value columns: Initial Value and Actual Value.
Ctrl+F4 cycles between declaration and data views in some installations; the explicit menu path is portable across SP levels and is the reliable choice on V5.5 SP4.Initial Values vs Actual Values: What Each One Means
Each declared element of a DB carries two numeric values, both stored in the offline block container (.AWL source / S7LB archive representation).
Initial Value
- Stored inside the offline DB as part of the block structure.
- Survives every Save, Save As, and recompile.
- Is downloaded to the CPU along with the DB (you can verify this by placing the CPU online and reading the DB in Declaration view — the Initial Value column is visible even online).
- Is not used by the user program during normal cyclic, time-of-day, or interrupt OB execution.
- Is used by the CPU when the DB is regenerated on the CPU itself (see "When Initial Values Are Actually Applied" below).
Actual Value
- The second numeric value associated with each element, written into the same DB.
- Modified by user program (e.g.
L 20 / T DB1.DBW0), by VAT (Variable Table) writes, by HMI tags, and by Monitor/Modify from the editor itself. - Is what the CPU returns to
L,==I,ITD,BTD, etc. - Defaults to
0for all elementary types (BOOL → FALSE, INT → 0, REAL → 0.0, STRING → empty) when the block is freshly created or freshly downloaded.
The most accurate mental model is:
Initial Value = the value the DB will have if the PLC is forced to re-initialize this DB.
Actual Value = the value the DB has right now, in this session of CPU operation.
Why Initial Values Appear as 0 in PLCSIM Online View
When you follow the canonical beginner workflow in PLCSIM V5.4 SP5 (or later), this is the actual sequence:
- Insert a new DB (SIMATIC Manager > right-click Blocks > Insert New Object > Data Block). Accept the default "DB with assigned FB" or choose "DB" for a shared/standalone DB.
- Declare
DBW0asWORDwith Initial ValueW#16#0014(decimal20) orINTwith Initial Value20. - Save and close the editor.
- Download the entire S7 program to PLCSIM (PLC > Download, or PLC > Download User Program to Memory Card for a cold download).
- Place PLCSIM in RUN or RUN-P.
- Open the DB from SIMATIC Manager, go online (View > Online or press
Ctrl+F5after selecting the Blocks folder), and switch to Data View.
What you observe:
- The Initial Value column reads
20(the editor shipped it correctly). - The Actual Value column reads
0(the CPU has not been told to populate it from the initial value).
This is correct behavior. If the user program never writes to DBW0, and no VAT forces it, the Actual Value stays at 0 indefinitely — even though the Initial Value metadata says 20.
How to Make Actual Values Equal the Initial Values After Download
There are four field-proven methods. Each is appropriate in a different commissioning scenario.
Method 1 — Populate Actual Values Manually Before Download (Most Explicit)
- Open the DB in Data view.
- For every element that should match its initial value at startup, manually type the value into the Actual Value column.
- Save the DB (
Ctrl+S). - Download the DB to the CPU.
This is verbose for large DBs but gives full control. For a DB with hundreds of tags this is impractical — use Method 2.
Method 2 — Copy Initial Values into Actual Values with One Keystroke
STEP 7 V5.5 ships a hidden-but-standard menu action that copies the entire Initial Value column into the Actual Value column for the currently open DB:
- Open the DB in Data view.
- Select Edit > Initialize Data Block (German UI: Bearbeiten > Datenbaustein initialisieren). The keyboard shortcut is
Ctrl+Iin some installs but is not guaranteed across SPs — use the menu. - STEP 7 prompts: "Do you want to overwrite the actual values with the initial values?" — confirm Yes.
- Every Actual Value is overwritten with its corresponding Initial Value.
- Save (
Ctrl+S) and download.
This is the canonical method for one-time commissioning of a project where every default value should also be the startup value. For 99% of beginner cases this is the right answer.
Method 3 — Force the Values at Runtime with a Variable Table (VAT)
Useful when the DB is already downloaded and the CPU is running:
- Open or create a VAT (SIMATIC Manager > Blocks > right-click > Insert New Object > Variable Table).
- Enter the address
DB1.DBW0(or symbolic name), formatDEC, control value20. - Tick Modify (not Monitor) and click the Force or Modify button.
Forcing via VAT overrides the actual value once per click and does not persist across a CPU restart unless the DB is downloaded again. Use this for live tuning, not for permanent defaults.
Method 4 — Let the User Program Initialize the DB on First Scan
For production code that must survive a download without manual editing, add an initialization routine in OB 100 (warm restart), OB 101 (hot restart), or OB 102 (cold restart), or use a first-scan flag in OB 1:
// OB 100 - Warm restart
// Initialize DB parameters every time the CPU restarts
L 20
T DB1.DBW0 // Setpoint word
L 100
T DB1.DBW2 // Max travel
SET
= DB1.DBX4.0 // Enable flag
For multi-instance or FB-tied DBs, the same approach works inside the FB's initialization section. Because OB 100 executes before OB 1, the values are in place by the time any user code reads them.
- S7-300: OB 100 only (warm restart). S7-300 does not support OB 101 or OB 102.
- S7-400: OB 100 (warm), OB 101 (hot), OB 102 (cold). Use the one matching the restart mode you need.
When Initial Values Are Actually Applied by the CPU
Initial values are not decorative. There are exactly four scenarios in which the CPU overwrites the Actual Value of a DB element with its Initial Value:
| Scenario | Trigger | Scope |
|---|---|---|
| DB generated by SFC 22 CREAT_DB | User program calls SFC 22 at runtime to create a new DB; the new DB inherits the Initial Values of its source template | Newly created DB only; existing DBs untouched |
| DB generated by SFC 122 CREAT_DBO (STEP 7 V5.5+) | Same semantics as SFC 22 with extended error reporting | Newly created DB only |
| DB regenerated by SFC 23 DEL_DB + SFC 22 | Delete-then-create sequence; new DB gets initial values | Re-created DB only |
| MRES (memory reset) on a physical S7-300/400 CPU | Operator toggles the mode switch to MRES, performs the two-position reset; on the next RUN, retained areas reload from load memory and non-retained areas re-initialize to the offline-block Initial Values | All non-retentive DBs and all non-retentive bits of retentive DBs |
PLCSIM honors the same rules, with the caveat that PLCSIM's Memory Reset (PLC > Clear/Reset) is the closest analogue to a real MRES.
Initial values are also written back during a STOP → RUN transition when the DB contains non-retentive areas (the default for any element not explicitly marked retentive in the DB editor's Retain column). For S7-300, non-retentive data is reset to the Initial Values on every STOP → RUN, including warm restarts. For S7-400, behavior depends on the configured restart type.
Retentivity and Its Interaction with Initial Values
In the DB editor's Declaration view you can mark individual elements as Retain (English UI: column heading "Retain"; German UI: Remanenz):
| Retain setting | Effect on Actual Value across STOP → RUN | Effect across power off / MRES |
|---|---|---|
| Non-retain (default) | Reset to Initial Value | Reset to Initial Value |
| Retain | Preserved from last RUN | Reset to Initial Value (for S7-300); preserved on S7-400 with battery-backed RAM or MMC |
This is the lever that most often surprises a beginner who has set a Retain flag and then performed an MRES, only to see the value revert to 0. The Initial Value of a Retain element is what MRES writes back; the "retained" content is gone because the power-fail buffer was wiped. Set Initial Values thoughtfully for any Retain element that matters across an MRES.
PLCSIM-Specific Quirks Worth Knowing
PLCSIM V5.4 SP5 (compatible with STEP 7 V5.5 SP4) is generally faithful to physical CPU behavior, but a few items generate tickets every quarter:
- Force from VAT persists across simulated STOP → RUN: unlike a physical CPU, PLCSIM keeps forced values in the simulated work memory until you explicitly unforce. Do not use force values as a stand-in for proper initialization.
- PLCSIM "Clear/Reset" behaves like an MRES: PLC > Clear/Reset in PLCSIM wipes the work memory and writes Initial Values back into non-retentive DBs. Use this when you want to test "what does the program do on a cold start?" without rebuilding the project.
-
Re-download does not reset DB Actual Values: if you download a changed program but the DB block identity is unchanged (no structural change), PLCSIM keeps the existing Actual Values. If you delete the DB from PLCSIM (PLC > Delete) and re-download, the DB reappears with Actual Values set to
0— not to the declared Initial Value. Use Method 2 ("Initialize Data Block") before re-downloading. -
Online vs Offline block consistency: when you watch the DB online and see
0, the project is fine — the discrepancy between Initial Value and Actual Value is normal. Do not chase this as a "synchronization error".
Verification Procedure After Initializing
Run this checklist before declaring a DB download commissioning complete:
- Open the DB from SIMATIC Manager in Data View.
- Confirm Initial Value column matches the design specification for every element.
- Confirm Actual Value column matches Initial Value for every element you need at startup (or confirm that OB 100 / OB 1 will set them before first read).
- Save (
Ctrl+S) and download the DB. - Place the CPU in RUN via PLCSIM (or physical mode switch).
- Open the same DB online in Data View. Verify Actual Values are as expected.
- Cross-check with a VAT: enter
DB1.DBW0in HEX, BIN, and DEC formats. All three must agree. - If the user program has a starter sequence in OB 100, set a breakpoint or single-scan, and confirm the values after one scan.
Troubleshooting Matrix
| Symptom | Most likely cause | Fix |
|---|---|---|
DB online shows Actual Value 0, Initial Value 20
|
Initial-only column populated; Actual never written | Edit > Initialize Data Block; save; download |
After download Actual Value reverts to 0
|
Block was deleted from PLCSIM before re-download | Use Edit > Initialize Data Block prior to download |
Actual Value correct online, but OB 1 logic sees 0
|
User program is reading the wrong DB number (e.g. DB2 opened with DB1 symbolic name) or address alias mismatch |
Cross-reference DB in References > Cross-References; verify OPN DB1 / OPN DI1 usage |
| MRES wipes a value that should persist | Element not marked Retain | Set Retain flag in Declaration view; save; download |
| Value persists across STOP → RUN even though it should reset | Element marked Retain but expected non-retain | Clear Retain flag |
| PLCSIM and offline DB disagree after force | Forced value was not unforced before save | Delete all forces via VAT before save; re-download |
| DB not visible online at all | DB was not included in the download, or DB number conflicts with an FB/DB tied to a UDT | Right-click Blocks > Download; check PLC > Accessible Nodes |
Comparison: STEP 7 V5.x vs TIA Portal DB Behavior
Engineers migrating from STEP 7 V5.5 to TIA Portal often expect identical DB semantics. They are similar but not identical:
| Aspect | STEP 7 V5.5 SP4 | TIA Portal V16+ |
|---|---|---|
| Initial value column | Yes (separate column) | Yes ("Start value" in DB editor) |
| Actual value column | Yes ("Actual Value" in Data View) | Yes ("Monitor value" in online mode) |
| Copy initial → actual action | Edit > Initialize Data Block | Right-click DB row > "Snapshot of actual values" / "Initialize with start values" (V17+) |
| Retain flag | Column "Retain" in Declaration view | "Retain" column on each tag |
| MRES re-initializes from Start values | Yes | Yes |
| Default value of fresh element |
0 / FALSE / empty |
Same |
If you are migrating an S7-300/400 project that relied on Initial-Value-only as runtime defaults, you must explicitly use the TIA Portal equivalent of Initialize Data Block after the migration; the migration tool does not do it automatically.
Edge Cases and Field-Proven Caveats
- UDT-based DBs: a DB whose structure is built from a User-Defined Type (UDT) inherits the UDT's initial values. Changing the UDT after the DB is created does not retroactively update the DB's Initial Values unless the DB is recompiled (right-click DB > Compile). After recompile, re-run Initialize Data Block.
- Instance DBs tied to FBs: when an FB has default initial values for its IN/OUT/STAT parameters, the instance DB created from that FB carries those defaults as Initial Values. Same rules apply: Actual Values are what the running program sees.
-
STRING initialization: STRING elements with an Initial Value of
'HELLO'show the correct string in Initial Value but Actual Value defaults to''after download unless initialized. - ARRAY of STRUCT with deep defaults: STEP 7 V5.5 will only populate one row's Initial Value visible at a time in Declaration view; Data View flattens the structure and lets you see all leaves. Use Data View for verification.
-
Symbolic vs absolute access:
L DB1.DBW0andL "MyDB".Setpointaccess the same Actual Value. The discrepancy you observe is never a side effect of access mode. -
Shared vs instance DBs in multi-instance code: a shared DB's Actual Values are independent of any FB instance DB. Both can have an element named
Setpointand they will not interfere.
FAQ
What is the difference between Initial Value and Actual Value in a STEP 7 V5.5 DB?
Initial Value is the offline-defined default that ships with the DB and is written back during a memory reset or when the DB is regenerated on the CPU. Actual Value is the runtime value the user program reads and writes. Normal program execution uses Actual Value only — not Initial Value.
Why does my DB show 0 online even though I declared Initial Value 20 in STEP 7 V5.5 SP4?
Because the Actual Value column was never populated. Open the DB in Data View (View > Data View) and use Edit > Initialize Data Block to copy Initial Values into Actual Values, then save and download. Alternatively, write the value from OB 100 at startup.
How do I make PLCSIM show the Initial Value after download?
In Data View, run Edit > Initialize Data Block (or press the menu path), confirm the overwrite prompt, save the DB, and download. PLCSIM will then carry the Initial Value as the Actual Value at the start of RUN.
When does the CPU actually use the Initial Value?
During memory reset (MRES), during STOP → RUN for non-retained elements, and when the DB is generated on the CPU itself via SFC 22 (CREAT_DB) or SFC 122 (CREAT_DBO). Outside of these cases, the Initial Value is informational.
Does this behavior change between PLCSIM and a physical S7-300/S7-400 CPU?
No. Both honor the same Initial-Value / Actual-Value split. The only practical difference is that PLCSIM's Clear/Reset acts as an MRES, and that PLCSIM does not have a real battery-backed retentive memory, so Retain behavior is best tested on physical hardware.
Is there a keyboard shortcut for copying Initial Values to Actual Values?
STEP 7 V5.5 does not guarantee a single shortcut across SPs. Use the menu path View > Data View, then Edit > Initialize Data Block. This is the portable method on V5.5 SP4.