1. Problem Description
After compiling a Siemens SIMATIC S7-1200 or S7-1500 data block (DB) in the TIA Portal, the editor window shows tag names (symbols) only. The right-hand Offset column is blank, and the Address column in watch tables, PLC tags, or cross-references displays only the symbolic name without a numeric address such as DB3.DBX0.0 or DB3.DBD4. The programmer is unable to determine where each tag is stored in the DB image and cannot generate the absolute addresses required by an HMI tag list, a third-party OPC server, a Modbus gateway, or any external device that does not support symbolic access.
This symptom appears even when the project is fully compiled, no errors are reported, and the PLC program is consistent. It is a configuration property of the block, not a compile fault or a missing-online connection. The user does not have to be online with the CPU to see addresses; the addresses are generated at compile time as soon as the block is set to non-optimized.
2. Root Cause: Optimized vs. Non-Optimized Data Blocks
The S7-1200 and S7-1500 CPUs default every new data block to Optimized block access. An optimized DB stores tag data in a symbolic-only, self-aligning layout managed by the compiler. Symbolic access is the only access method exposed to the program and to any consumer that supports it. Absolute addresses are intentionally hidden because the runtime may reorder the data for speed, packing efficiency, and to support download-without-reinitialize scenarios.
Concrete consequences of optimized block access:
- No Offset column is shown in the DB editor.
- No absolute address (e.g.,
DB3.DBX0.0) is visible in cross-references, watch tables, or the PLC tag table. - External devices that only consume absolute addressing (legacy HMIs, Modbus/TCP gateways, non-Siemens OPC clients, third-party SCADA) cannot subscribe to tags.
- Pointer-based access such as
P#DB3.DBX0.0 BYTE 10,PEEK/POKEinstructions, and any indirect Any-pointer logic is blocked at compile time. - The block does not comply with the standard S7-300/S7-400 byte layout, so it cannot be mapped 1:1 to a CPU-300 image.
A non-optimized DB (sometimes called a standard or absolute DB) restores the classic S7-300-style layout: every tag receives a fixed byte/bit offset that the compiler preserves across downloads. Non-optimized access is required whenever an external system needs the offset, including most HMI tag generators built before the symbolic-tag era.
3. Memory Layout Comparison
| Attribute | Optimized DB | Non-Optimized DB |
|---|---|---|
| Default for new S7-1200/1500 DB | Yes | No (must be unchecked) |
| Visible offsets in editor | Hidden | Visible |
| Access from SCL/ST/FBD/LAD | Symbolic only | Symbolic and absolute |
| Indirect / pointer access | Restricted to PEEK/POKE with symbolic area pointer |
Full P# pointer arithmetic allowed |
| HMI access (WinCC Unified, Comfort Panels with symbolic) | Supported | Supported |
| HMI access (legacy panels, third-party SCADA, Modbus gateway) | Not supported directly | Required |
| Download without re-initialize | Yes (preserves values across recompile) | No (layout changes can reset values) |
| Run-time performance (typical) | 10–30 % faster DB access; smaller image | Baseline; larger image |
| Retain / non-retain per tag | Yes (granular per tag) | Limited (granular only on S7-1500) |
| Compatible with PUT/GET (S7 communication) on absolute address | No (symbolic only) | Yes |
4. Solution: Two Configuration Changes
Two independent settings control whether absolute addresses are shown and whether the block stores data with a fixed offset. Apply both.
4.1 Change the Block Attribute
- In the TIA Portal project tree, expand Program blocks and select the data block (e.g.,
DB_HMI_Data). - Open the block by double-clicking it.
- Right-click the block title bar or open the Properties inspector.
- Navigate to Attributes.
- Uncheck the option Optimized block access.
- Confirm the warning dialog. The CPU's compiler will reserve the absolute memory layout and the block becomes a standard DB.
- Save (
Ctrl+S) and compile the project (Project → Compile → Software (rebuild all)).
4.2 Enable Absolute Representation in the Editor View
- Open the menu Options → Settings.
- Expand PLC programming → General.
- Select the View tab.
- Set Operand representation to Symbolic and absolute (or Absolute only, if that is the project convention).
- Click OK to apply.
After both steps, the DB editor will display the byte offset column, and the column will be populated once the project is recompiled. Every tag now resolves to a deterministic address, e.g. %DB3.DBX0.0 for a BOOL at byte 0 bit 0, %DB3.DBD4 for a DINT at byte 4, and %DB3.DBW12 for a WORD at byte 12.
5. HMI Integration Requirements
The original use case for needing addresses is HMI tag generation. Two scenarios exist:
| HMI / SCADA Platform | Recommended DB Access | Notes |
|---|---|---|
| SIMATIC Comfort Panel, WinCC Unified (TIA) | Symbolic (optimized DB OK) | Use HMI tag table with DB name — symbolic only. |
| SIMATIC WinCC flexible / older panels | Non-optimized DB required | Tags must be exposed with absolute addresses. |
| Non-Siemens HMI (Pro-face, Beijer, Red Lion, Wago) | Non-optimized DB required | Drivers expect fixed offsets; map to Modbus holding registers or DB absolute addresses. |
| Third-party SCADA (Ignition, Wonderware, iFIX) | Non-optimized DB preferred | OPC DA/UA drivers can use symbolic names if the driver supports S7-1200/1500 symbolic access; otherwise absolute is mandatory. |
| Modbus/TCP gateway (ProSoft, HMS Anybus, etc.) | Non-optimized DB required | Map DB blocks to 4x/3x register ranges by byte offset. |
| S7 PUT/GET partner (legacy S7-300/400) | Non-optimized DB required | PUT/GET uses absolute addresses only. |
For new projects targeting only modern Siemens HMIs, symbolic access on optimized DBs is the recommended path; performance and download-without-reinitialize are preserved. The moment a non-Siemens or older consumer enters the picture, switch the affected DBs to non-optimized and document the offset layout in the project HMI tag specification.
6. Performance Impact of Non-Optimized Access
On S7-1200 and S7-1500, the symbolic, self-aligning layout of an optimized DB allows the firmware to read and write complete structures in fewer bus cycles. Field measurements on S7-1500 (firmware V2.9 and later) show optimized DB access is approximately 10–30 % faster than non-optimized for typical tag mixes (mostly BOOL/INT/REAL with scattered use). For S7-1200 the gap is smaller but still measurable on byte- and word-level access patterns. The effect is most visible when:
- The DB contains more than 200 tags.
- The user program reads the DB more than once per OB1 cycle (e.g., in a fast FC called from a cyclic interrupt OB).
- Symbolic structures are passed as IN/OUT parameters to FBs.
If the application is cycle-time bound, keep machine-state DBs optimized and reserve non-optimized blocks strictly for HMI-visible data. Many programmers create two parallel DBs: an internal DB_Control (optimized, fast) and a mirrored DB_HMI (non-optimized, slow) updated once per scan.
7. Alternative: Symbolic Access Without Changing the DB
If the consuming HMI is a SIMATIC Comfort Panel or WinCC Unified (TIA V14 or later) and the project is compiled as a unified PC interface, the HMI tag table can bind to the symbolic name without a non-optimized DB. The TIA Portal translator exports the symbol table to the panel and the panel firmware resolves the names at run time.
Procedure for symbolic HMI tags on an optimized DB:
- Add an HMI connection that points to the S7-1200/1500 CPU.
- Open the HMI tag table.
- Add a tag. Set Connection to the S7 CPU, Name to the DB tag (e.g.,
"DB_HMI"."Motor_RPM"), and PLC tag to the same path. - Compile the HMI. No absolute address is required in the project.
8. Verification Procedure
- Open the affected DB in the TIA Portal editor.
- Confirm that the Offset column is populated and the addresses look like
0.0,2.0,4.0for BOOL/INT/REAL. - Right-click any tag and select Go to → Cross-references. The cross-reference list should now show the absolute address in the Address column.
- Open Watch and force tables and add the tag. The address line should show
%DB3.DBW4or similar. - Go online with the CPU (or simulate with PLCSIM) and verify that the value written from the HMI updates the correct byte offset in the DB.
- From the HMI side, perform a tag test (e.g., write a known value, then read it back from the DB in the PLC).
9. Common Pitfalls and Edge Cases
- Cannot uncheck Optimized access on a System Data Block (SDB) or instance DB of an FB. The attribute is configurable only on stand-alone global DBs and on instance DBs of FBs that are declared with non-optimized access. If the system refuses the change, the DB is system-generated or referenced by an FB that requires the optimized layout.
- Offset still empty after unchecking the box. Recompile the project. Some TIA Portal versions (V13, V14 SP1) require Project → Compile → Software (rebuild all) rather than the incremental compile.
- HMI tag still shows a question mark after switching. The HMI connection was bound to the symbolic name on the previous optimized build. Delete the HMI tag and re-add it with the absolute address, or perform a full HMI recompile.
- Values reset after switching. Non-optimized blocks treat any layout change as an initial-value download. To preserve values, write them to a retentive area (e.g., a separate retentive global DB) before the change, or use Download to device → Software (all) without re-initialization if the offsets have not moved.
- Modbus/TCP gateway sees wrong byte order. Modbus is big-endian; S7 is little-endian. The gateway must perform a word-swap on every 16-bit and 32-bit tag. Configure the swap on the gateway side; the DB layout itself is unchanged.
- S7-300 project opened in TIA Portal. S7-300 DBs are inherently non-optimized. The Optimized block access checkbox is disabled and greyed out. If a S7-300 DB is migrated into an S7-1500 project, the migration tool may import the DB as non-optimized; this is correct.
10. Migrating an Existing Project from Optimized to Non-Optimized
- Export the HMI tag list to a CSV file from the current (optimized) project. Capture the symbolic names only.
- Switch every HMI-facing DB to non-optimized access.
- Rebuild the software. Note the new absolute addresses from the DB editor.
- Re-create the HMI tags using the new absolute addresses. The PLC tag name in the HMI table is the absolute path (e.g.,
DB3.DBD4for theMotor_RPMREAL). - Compile the HMI and download to the panel.
- Verify in a loop-back test: write from HMI → read in PLC → verify with a watch table.
- Document the offset layout in the project specification. This is required for any future Modbus or non-Siemens SCADA integration.
11. Troubleshooting Matrix
| Symptom | Most Likely Cause | Remedy |
|---|---|---|
| Offset column empty, Optimized box is grey | Instance DB of an FB that is declared optimized | Recreate the FB without optimized access, or use a global DB |
| Offset column empty, Optimized box is unchecked | Project not recompiled | Project → Compile → Software (rebuild all) |
| Address shows %DB3.DBX0.0 but HMI cannot read | DB is not downloaded / wrong HMI connection | Download SW to PLC, verify HMI connection points to the same CPU |
| Pointer code rejected by compiler | DB is optimized; P# arithmetic disabled | Switch DB to non-optimized or refactor to symbolic PEEK/POKE
|
| Values reset after a recompile | Non-optimized DB lost layout identity | Mark values retentive or use a separate retentive DB |
| Modbus gateway reads wrong word order | Endian mismatch | Enable byte/word swap on the gateway for 16-bit and 32-bit tags |
| Cross-references show only symbolic name | View filter set to Symbolic only | Options → Settings → PLC programming → General → View → Symbolic and absolute |
12. Summary and Best Practice
The visibility of DB absolute addresses in TIA Portal is governed by two settings: the block attribute Optimized block access (must be unchecked for offsets to be allocated) and the editor view Operand representation (must include Absolute for the column to be displayed). The user does not need to be online with the CPU; the addresses are produced at compile time. Switch to non-optimized access only when an external consumer requires absolute addresses; keep machine-state DBs optimized to preserve S7-1200/1500 performance and the ability to download without re-initializing process values. For mixed projects, maintain a parallel DB_HMI block that mirrors the live data with a fixed offset layout, while the control DB remains optimized.
FAQ
Do I have to be online with the CPU to see DB addresses?
No. Absolute offsets are generated at compile time. Once the DB attribute Optimized block access is unchecked and the project is recompiled, the offsets appear in the editor regardless of the online state. A live CPU connection is needed only to monitor or force values.
Does switching to non-optimized access slow the PLC down?
Yes, slightly. Symbolic access on optimized S7-1200/1500 DBs is typically 10–30 % faster because the layout is packed and aligned. For cycle-time-critical code, keep the control DB optimized and create a separate non-optimized DB that the HMI reads once per scan.
Can a WinCC Comfort Panel read an optimized DB without offsets?
Yes, when the project is compiled in TIA Portal V14 or later with a unified HMI connection, the panel uses symbolic tag access and does not require a non-optimized DB. The non-optimized layout is only mandatory for older panels, third-party HMIs, and Modbus/TCP gateways.
Why are my DB values reset after switching from optimized to non-optimized?
Non-optimized blocks re-initialize any tag whose storage position changed during the switch. To retain values across the change, store them in a separate retentive global DB, or use Download to device → Software (all) without re-initialization when the offsets have not moved.
Can I use P# pointers on an optimized DB?
No. Classical P#DB3.DBX0.0 BYTE 10 pointer arithmetic is blocked by the compiler on optimized blocks. Use the symbolic PEEK and POKE instructions from the Extended instructions palette, or switch the DB to non-optimized access to regain full pointer support.