Creating an HMI Interface DB in TIA Portal: Step-by-Step Guide

David Krause11 min read
SiemensTIA PortalTutorial / How-to
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: What an HMI Interface DB Is and Why You Build One

In a SIMATIC project, the Human Machine Interface (HMI) panel and the S7 CPU exchange data through two distinct mechanisms: area pointers (used for date/time, screen number, user view, PLC job, project ID, etc.) and process tags (cyclically read/written inputs, outputs, and DB words). Although WinCC Unified and WinCC Comfort/Professional can connect to any DB number, field-proven machines almost always expose a single, well-named HMI interface DB that contains every value the panel needs. The DB becomes the documented contract between PLC engineering and HMI engineering: the HMI never reads random M bits or FB instances, it only consumes tags from this DB.

You typically see this DB named DB_HMI, DB100, DB10, or as an instance DB of an FB called FB_HMI or FB_Interface. The number is a convention, not a Siemens requirement. This article walks through designing, creating, populating, and verifying a non-optimized HMI interface DB in TIA Portal V17 / V18 / V19 and linking it to a Comfort Panel, Unified Comfort Panel, or WinCC Runtime.

Area Pointers vs. Process Tags: Two Different Data Channels

Before you build the DB, you must understand why area pointers are special. Unlike process tags (which WinCC polls from any memory area you specify), area pointers are configured once in the HMI connection and tell the panel where to find specific control structures in the PLC. Each pointer occupies a fixed-length block of bytes inside a single DB.

Area Pointer Length (bytes) Direction Purpose
Coordination 1 Bidirectional Coordination bits (life bit, user change, etc.)
Project ID 1 Bidirectional Verifies panel belongs to project
Date/Time 8 PLC → HMI Sets panel clock
PLC Job 4 PLC → HMI / HMI → PLC Triggers screen change, recipe view, etc.
Screen Number 4 PLC → HMI Forces panel to specific screen
User View 4 PLC ↔ HMI Drives recipe view selection
Tag Pointer 8 PLC ↔ HMI Raw pointer for script-based reads/writes
Diagnostics 4 PLC → HMI System diagnostics buffer reference
Key insight: If you activate an area pointer in the HMI connection, WinCC expects that area to exist at the configured offset inside the configured DB. If the DB is missing, optimized, or the offset is wrong, you get a yellow warning on the panel and zero data exchange for that pointer.

Prerequisites

  1. TIA Portal V17, V18, or V19 installed with the SIMATIC Comfort Panels or Unified Panels HSP/SSP files (Device Support Packages).
  2. An S7-1200 (FW ≥ 4.4) or S7-1500 (any FW) PLC project with an active online connection.
  3. HMI device added to the same project, networked to the PLC, with a configured HMI connection.
  4. Compiled PLC program with no blocking errors (the HMI cannot resolve tags from a non-compiled S7 program).
  5. Read access to DBs enabled on the PLC security settings (in the S7-1500, this is under PLC properties → Protection & Security → Read access to data blocks).

Plan the DB Structure Before You Click

Open a text editor and write the symbol table first. A clean HMI interface DB has the same shape across every machine on a production line, so engineers in service can recognize the layout without diving into code. Recommended layout, in fixed order, with absolute addresses shown:

Offset Symbol Type Used By
DBB0 Coord BYTE Coordination area pointer
DBB1 PrjID BYTE Project ID area pointer
DBW2 Job DWORD (as 4 BYTE) PLC job area pointer
DBW6 ScrNo DINT Screen number area pointer
DBD10 DateTime DTL (8 B) Date/Time area pointer
DBD18 UserView DINT User view area pointer
DBW22 MachineState INT Process tag – machine status
DBW24 SpindleRPM INT Process tag – live RPM
DBW26 PartCount INT Process tag – production counter
DBW28 TargetTemp INT Process tag – setpoint from HMI
DBW30 ActualTemp INT Process tag – sensor feedback
DBW32 Operator INT Process tag – logged-in user
DBW34 Spare INT Reserved for future expansion

Total size: 36 bytes, fits in a single DB. Reserve 8 to 16 bytes of Spare at the end so you can extend without breaking the area-pointer contract.

Step-by-Step: Build the HMI Interface DB in TIA Portal

Step 1 – Add the DB to the PLC Project Tree

In the project tree, right-click the Program blocks folder of your S7 CPU and choose Add new block → Data block. Name it DB_HMI (the number is automatically assigned, typically 100 if no DB100 exists). Choose type Global DB (not Instance DB). Click OK.

Step 2 – Disable Optimized Block Access

Open the new DB. In the properties pane under Attributes, uncheck Optimized block access. This is mandatory if you want the HMI to read symbols by absolute address (DBW22, etc.). For S7-1200 with FW 4.4 and later, non-optimized blocks can still be accessed symbolically from TIA-internal tags, but most HMI panels and third-party OPC servers still need the absolute offset.

Why this matters: Optimized DBs remove the fixed offset. When you later bind an HMI tag such as "HMI_DB".SpindleRPM, the symbol resolution works, but raw area-pointer configuration in the HMI connection will fail with "Invalid pointer address".

Step 3 – Define the Data Structure Manually

Click Add row in the static section and enter each symbol from your planning table. For area pointers that span 8 bytes, declare a structure:

TYPE "stHmiAreaPointers"
  STRUCT
    Coord      : BYTE;   // DBB0
    PrjID      : BYTE;   // DBB1
    Job        : DWORD;  // DBW2 – 4 bytes, used as 4 BYTE
    ScrNo      : DINT;   // DBW6
    DateTime   : DTL;    // DBD10 – 8 bytes
    UserView   : DINT;   // DBD18
  END_STRUCT;
END_TYPE

Inside the global DB, declare:

DATA_BLOCK "DB_HMI"
{ S7_Optimized_Access := 'FALSE' }
VERSION : 0.1
NON_RETAIN
  STRUCT
    AreaPtr      : "stHmiAreaPointers";   // bytes 0..21
    MachineState : INT;                   // DBB22
    SpindleRPM   : INT;                   // DBB24
    PartCount    : INT;                   // DBB26
    TargetTemp   : INT;                   // DBB28
    ActualTemp   : INT;                   // DBB30
    Operator     : INT;                   // DBB32
    Spare        : INT;                   // DBB34
  END_STRUCT;
END_DATA_BLOCK

Compile the DB (right-click → Compile). TIA Portal will report 0 errors and you can now expand the DB in the project tree to see the absolute addresses beside each tag.

Step 4 – Configure Area Pointers in the HMI Connection

Open the Devices > HMI > Connections editor. Select your PLC connection and switch to the Area pointers tab. For each pointer, tick the box and select DB100 (or your DB number) and the matching offset:

Area Pointer DB Offset Length
Coordination DB100 0 1
Project ID DB100 1 1
Date/Time DB100 10 8
PLC Job DB100 2 4
Screen Number DB100 6 4
User View DB100 18 4

Compile the HMI. TIA Portal will validate that the offsets fit within the DB. A misaligned area-pointer configuration produces error ID 290025: "The configured area pointer exceeds the data block".

Step 5 – Create HMI Tags That Reference the DB

Open HMI tags. Add a new tag for each process value:

HMI Tag Name PLC Tag (Connection: PLC_1) Acquisition Cycle
MachineState %DB100.DBW22 1 s
SpindleRPM %DB100.DBW24 250 ms
PartCount %DB100.DBW26 500 ms
TargetTemp %DB100.DBW28 250 ms
ActualTemp %DB100.DBW30 250 ms
Operator %DB100.DBW32 1 s

Use absolute addressing for S7-300/400 panels, symbolic addressing (e.g. "DB_HMI".SpindleRPM) for Unified Comfort Panels and TIA-portal-integrated OPC servers.

Step 6 – Wire PLC Program Logic to the DB

In an OB1 network, copy your process values into the DB every scan. Example in SCL:

"DB_HMI".MachineState := "Machine".State;
"DB_HMI".SpindleRPM   := "Drive".ActualRPM;
"DB_HMI".PartCount    := "Counters".Produced;
"DB_HMI".ActualTemp   := "AnalogTemp".Raw;

For the area pointers, drive them from explicit events. Push the current date/time into the DTL field once per second:

IF "Clock_1Hz" THEN
  "DB_HMI".AreaPtr.DateTime := DT_TO_DTL(LOCAL_TIME());
END_IF;

Trigger screen changes from PLC code using the Screen Number pointer:

// Force panel to screen 42
"DB_HMI".AreaPtr.ScrNo := 42;

Step 7 – Compile, Download, and Start Runtime

Compile both the PLC and the HMI. Download to the PLC first (to instantiate the DB on the CPU), then start Runtime on the panel. The HMI status bar shows "Connection established" once the area pointers are alive.

Verification: How to Know It Actually Works

  1. On the HMI, open the Diagnostics → Connections view. Every area pointer must show status OK, not Error or Disabled.
  2. Force a value into DB_HMI.AreaPtr.ScrNo from the PLC watch table. The panel must jump to that screen within one acquisition cycle.
  3. Read DB_HMI.AreaPtr.DateTime online. The values must match the PLC clock within 1 second.
  4. In the HMI tag simulator, change an I/O field bound to TargetTemp. Confirm that %DB100.DBW28 in the PLC watch table reflects the new value within one update cycle.
  5. From the PLC, set Coord bit 0 (Coordination area pointer). The panel should drop the connection momentarily as a test; the life-bit toggling resumes when the bit resets.

Troubleshooting Matrix

Symptom Likely Root Cause Action
HMI shows "Invalid pointer address" at startup Area pointer offset outside the DB or DB is optimized Disable optimized access, recompile, verify offsets
Date/Time area pointer stays at 1970-01-01 PLC never writes DTL field, or wrong endian Ensure DT_TO_DTL conversion runs every cycle; check byte order in HMI
Screen number pointer ignored by panel PLC writes value too quickly, panel reads old value, or HMI job mailbox has priority Hold the value for ≥ 2 panel cycles; verify Acquisition mode = Cyclic continuous
HMI tags show "Quality: Bad" PLC security blocks read access to the DB Open PLC properties → Protection & Security → permit read access for HMI connection
Compile error 290025 on HMI Area pointer offset + length exceeds DB size Recompute offsets; ensure Spare region is large enough
Symbol resolution fails after firmware update on S7-1200 Optimized access re-enabled by default after TIA upgrade Re-open DB properties and uncheck Optimized block access
HMI logs "No connection to PLC" intermittently Coordination bit not toggling, panel thinks PLC dead Toggle bit 7 of Coord every 100 ms in PLC scan
Operator cannot write to TargetTemp DB declared read-only at connection level In HMI connection properties, allow read/write on this DB
Tags mapped correctly but show last value after PLC stop WinCC shows "Last value" fallback when connection drops Set update strategy to "Stop update on communication error" or add timeout
DB number collision with another block Two DBs numbered identically Reassign DB number under Properties → Number; recompile

Best Practices From the Field

  • Keep the DB non-optimized. Optimized access breaks absolute-address area pointers and complicates third-party OPC UA or Modbus gateways. If you need the symbolic comfort of optimized blocks for the PLC program, build a separate FB_HMI with instance DB and use MOVE to copy each tag into the non-optimized DB_HMI at the end of OB1.
  • Reserve 10 % spare bytes. Recipe data, alarm counters, and new screen selectors are added later. Spare bytes prevent a structural change that invalidates all panel tags.
  • Document each tag in the DB. Use the TIA Portal comment column. Service engineers do not always have the HMI source; they have the PLC program.
  • Pin acquisition cycles to physical limits. 250 ms for analog values, 500 ms for counters, 1 s for status words. Faster acquisition burns the HMI connection throughput without benefit.
  • Initialize the DTL pointer in OB100 (startup OB) so the panel clock is set on cold restart, not only on warm restart.
  • Mirror the structure in a library master copy. Promote the DB to a TIA global library so every new machine in the line uses identical offsets and identical HMI tag mappings.

Integration With WinCC Unified and OPC UA

If you later migrate to WinCC Unified Comfort Panels or to a PC-based Runtime, the same DB_HMI continues to work as the data source. Unified tags accept either symbolic (S7-1500 only) or absolute addressing. For OPC UA, expose the DB as an OPC UA companion specification by enabling OPC UA Server → Data access on the S7-1500 and adding the DB to the server interface. Third-party HMIs, SCADA, and historians can then browse the same names without needing a TIA project.

Working Code: FB That Populates the DB

For repeatability across machines, encapsulate the population logic in an FB:

FUNCTION_BLOCK "FB_HMI_Interface"
VAR
  tPoll : TON;
END_VAR
BEGIN
  // Life-bit toggle for Coordination area pointer
  tPoll(IN := NOT tPoll.Q, PT := T#100MS);
  "DB_HMI".AreaPtr.Coord := tPoll.Q;

  // Date/Time push every second
  IF tPoll.Q THEN
    "DB_HMI".AreaPtr.DateTime := DT_TO_DTL(LOCAL_TIME());
  END_IF;

  // Copy process values
  "DB_HMI".MachineState := "StateMachine".CurrentState;
  "DB_HMI".SpindleRPM   := "Drive_1".ActualRPM;
  "DB_HMI".PartCount    := "Counter_1".Actual;
  "DB_HMI".ActualTemp   := "AI_Temp".ScaledValue;
END_FUNCTION_BLOCK

Call this FB from OB1 with a single instance DB. The HMI-facing DB_HMI stays a clean data structure, the FB handles the freshness, and your code is reviewable by service.

FAQ

Why does TIA Portal say "invalid pointer" when I bind the Date/Time area pointer?

The Date/Time area pointer needs exactly 8 contiguous bytes. If the DB is optimized, the pointer has no fixed offset; TIA rejects the binding. Disable optimized access on the DB and reserve 8 bytes at the configured offset, then recompile both the PLC and the HMI.

Can I use an instance DB of an FB as the HMI interface DB?

Yes, provided the instance DB is non-optimized and the FB exposes every symbol the HMI needs with stable offsets. The instance DB must be uniquely numbered and listed in the HMI connection's area-pointer configuration. Many engineers prefer a global DB for clarity, but instance DBs work equally well.

What acquisition cycle should I use for process values in DB_HMI?

Match the cycle to the physical change rate. Use 250 ms for fast analog values such as temperature or RPM, 500 ms for counters and status words, and 1 s for user IDs and modes. Cycles faster than 100 ms on a Comfort Panel saturate the HMI connection without giving the operator visible benefit.

How do I migrate an HMI interface DB to a Unified Comfort Panel?

Re-compile the HMI after changing the device type. The DB number and offsets are unchanged. Switch HMI tags from absolute addressing (%DB100.DBW22) to symbolic addressing ("DB_HMI".MachineState) if the CPU is an S7-1500 with optimized-access compatibility enabled on the DB side.

What happens if I change the DB number after commissioning?

Every HMI tag that referenced the old number breaks with Quality: Bad. Update the DB number in the PLC program, recompile the PLC, then update the area-pointer DB selection and every absolute HMI tag, recompile the HMI, and download both. Document the new number in the project revision history to keep service engineers aligned.

Back to blog