IMDHMIControls LibraryShop main store

Explainer

PLC tags or a communication DB in TIA Portal for HMI data

PLC programming Published 7 min read By IMDHMI controls team

Short answer

TIA Portal assigns DB offsets itself: clear Optimized block access and the Offset column appears, but no documented control lets you type an offset. So keep I/O and global signals in PLC tags, put the HMI and SCADA exchange in one dedicated non-optimized communication DB, pad alarm bytes with spare Bool members, and snapshot values before every DB change.

On this page
  1. No field exists for typing a DB offset
  2. What PLC tags and a communication DB each buy you
  3. Give the HMI and SCADA one dedicated communication DB
  4. Packing two subprograms' alarm bits into the first two bytes of a communication DB
  5. Carry DB values across a download: snapshot, download, restore
  6. Pack alarm words only for a counted reason
  7. Questions asked

TIA Portal has no field where you type a DB offset. Clear Optimized block access on the data block, compile, and an Offset column appears with addresses the compiler chose — that column is an output, not an input. So the design decision is made for you: keep I/O and genuinely global signals in PLC tags, and give the HMI and SCADA exchange one dedicated non-optimized communication DB. You shape its layout with declaration order and declared spare bits, never by editing addresses, and you carry existing values across a DB download with the snapshot mechanism. Below: where each kind of data belongs, the alarm-byte layout worked end to end with the arithmetic shown, and the download procedure that keeps your values.

No field exists for typing a DB offset #

In a TIA Portal data block, the memory layout is the compiler's job. Clear Optimized block access in the block's properties, compile, and the Offset column lists where every member landed; engineers who go looking for a way to retype an address in that column find no edit field, because the assignment is automatic memory management. The DB editor's data and start-value views change which values the columns show, and neither turns the Offset column into an input. Optimized blocks show no offsets at all.

That settles the request to move an automatically assigned address somewhere else: there is nothing to move it with. The levers you hold are declaration order, member size, and declared spare members — the worked example below uses exactly those. Optimized blocks are the other half of the rule: the STEP 7 block-access documentation gives them a memory reserve by default, so you can expand their interfaces while the CPU runs. That reserve is worth having, but an absolute-address client gets no offset from an optimized block, which is why the communication DB stays non-optimized.

What PLC tags and a communication DB each buy you #

PLC tags are independent of one another: add a tag and no other tag moves or reinitializes. That makes them the right home for I/O and genuinely global signals — the convention that holds across control platforms is global names for I/O and shared signals, with program-internal data kept in blocks and locals.

A DB behaves differently: a change to its interface reinitializes the block's data at download, so commands, counters and latched alarms reset unless you carry them across. That cost buys a boundary the SCADA side can address as one object, which is the point of the dedicated communication DB in the next section.

Speed never justifies offsets. Symbolic access resolves when the project compiles, and the difference is not something you will see in an HMI or SCADA poll; choose a non-optimized DB because a client needs DB numbers and byte offsets, not because offsets would be faster.

Give the HMI and SCADA one dedicated communication DB #

Define the exchange first: the commands the operator station writes, the status and alarm data it reads. Put exactly that set in one non-optimized DB and nothing else — no working values, no intermediate results. Map in both directions, the program writing its results into the DB and reading commands out of it, so the DB stays an interface rather than a workspace. Name it by your own convention, for example Comm_HMI; the protocol never sees the name.

How the client holds the address decides what you maintain. An HMI configured inside TIA Portal references symbols, so a member you move or re-declare stays reachable from the operator side after the next compile. A client storing absolute addresses — a DB number with a byte and word — keeps pointing at the old location after a change, which is the failure behind why PLC symbol changes break SCADA tags in OFS, and it is why every download ends with a check of the addresses that client stores.

Two habits keep the boundary stable. Enable secure HMI communication on the connection, so the operator device authenticates the CPU by its PLC certificate instead of trusting the network. And when the change sits on the operator side, the same discipline applies: editing a Delta DOP HMI project without breaking PLC comms walks through keeping the controller link intact while the HMI project itself changes.

Packing two subprograms' alarm bits into the first two bytes of a communication DB #

The inputs come from the two subprograms' alarm lists: subprogram 1 raises two alarms and takes one reset command — three Bool members; subprogram 2 raises one alarm and takes one reset — two Bool members. The layout target, drawn for readability, is one byte per subprogram, alarm bits first, the rest of the byte reserved for later alarms. The DB is non-optimized, so absolute addressing applies.

The rule for absolute addressing in a DB: Bool members pack bit by bit, the first one starts at 0.0, a byte closes only when all eight of its bits are declared, and the member after a closed byte begins at the next byte. No offset can be typed, so a gap in the drawing exists only where you declare named spare Bools to fill it.

The arithmetic. Byte 0: the three subprogram-1 members land at 0.0, 0.1 and 0.2, then 8 - 3 = 5 spare Bools close the byte at 0.3 through 0.7. Byte 1: the two subprogram-2 members land at 1.0 and 1.1, then 8 - 2 = 6 spare Bools close it at 1.2 through 1.7. The next member, a Word of status, begins at the next free byte, 2.0.

Result: 0.0 to 0.2 carry subprogram 1's alarms and reset with 0.3 to 0.7 reserved; 1.0 and 1.1 carry subprogram 2's bits with 1.2 to 1.7 reserved; the status word sits at 2.0. Declaration order alone produced the drawn layout. Decision: whenever a group must own a whole byte, declare 8 minus its bit count of spare Bools — three named bits need five spares — and let the compiler place them; never build the interface around retyping an address, because the column has no edit field.

Carry DB values across a download: snapshot, download, restore #

A change to the DB interface reinitializes the block at download: members return to their start values, and the operator's command bits, counts and latched alarms reset. TIA Portal documents the way across: in the DB editor, Monitor all tags, capture a snapshot of the online values, download the changed block, then restore the snapshot so members take their previous values. The commands live in the DB editor, so plan the restore block by block — several changed DBs means several snapshot-and-restore passes, not one batch job.

Where a value must wake at a chosen number on every download, set it as the member's start value in the start-value view instead of relying on a snapshot; the start value is what a reinitialized member receives.

Run the download and restore with the machine in a safe state: a reinitialized interlock or a reset alarm bit can release a running drive or hide a fault the operator can no longer see.

Pack alarm words only for a counted reason #

The SCADA-side pattern that pays: one structure with a command word, a status word and alarm words, read whole from one DB, the client moving its word offset per device. One reported application read twenty devices' structures this way and its SCADA counted twenty bytes of license against them, instead of a link per device; reading by address also serves clients with no symbolic access at all. Reading an alarm word at an absolute address is what an HMI alarm Modbus address maps to in the PLC, and it is why the bit positions get frozen.

Then commit: pack and freeze. Write the layout down — which byte belongs to which subprogram, which bit is which alarm — because inserting one member into the DB shifts every address behind it and silently re-maps the client's alarms. Treat the communication DB's layout as a versioned interface: change it only in the same sitting that updates the SCADA tags, and record the new offsets when you do.

Questions asked

Can two operator stations share one communication DB?

Yes. Both read the same status and alarm bits without conflict. Give each station its own command bits, one byte per station, so they never write the same bit at the same time. If both stations may reset the same alarm, handle the reset in the PLC so a request from either station clears it for both, and latch which station asked.

Can I use an optimized DB for the HMI and skip offsets entirely?

Yes when the client is an HMI connected inside TIA Portal: it reaches the members by symbol, so offsets never come into play, and the block's memory reserve even lets you add members during operation. Choose a non-optimized communication DB when a client stores absolute addresses, a DB number with a byte and word, because an optimized block exposes no offset for it to read.

Can I rename a member of the communication DB without breaking the operator screens?

With a symbolic HMI connection, the tag references the member by name, so after a rename you recompile the PLC and HMI projects and the compiler flags any screen tag whose name no longer exists instead of letting it read the wrong address silently. With a client holding absolute addresses, a rename alone changes nothing because the client never sees the name; a change that shifts the offset breaks it silently, which is the failure to design against.

Keep reading

  • How-to

    ControlLogix tag layout that keeps Citect SCADA reads light

    Give Citect one controller-scoped exchange area in the ControlLogix: DINT arrays for packed status and command bits, REAL arrays for analog values, and UDTs where named members help. The layout lets the driver fetch related words in a few block reads, splits fast points from slow trends, and keeps control logic independent of the display.

    PLC programming

  • Troubleshooting

    RF180C on an S7-300: hardware address, not hardware identifier

    An ET200S IM151-8 has no hardware identifier for the RF180C, only the configured hardware address, which the Ident block takes from the compiled device configuration. For an MDS D100's user memory range 0000 to 006F inclusive, ADR_TAG is 0 and LEN_DATA is 112 decimal; 111 leaves the last byte out. STATUS 16#DF80_B00A on a write is the transaction's status code, not a presence problem.

    PLC programming

  • How-to

    Write an S7-1200 heartbeat in ladder logic in TIA Portal

    Tie the light to a detector, not to the heartbeat level: time the on half with one TON and the off half with a second TON, both at three times the measured state time, and OR the two done bits into one communication-fault coil. With a PC heartbeat that changes once per second, PT is 3 s and the fault trips 3 s after the last change; add TCON and TDIAG supervision when the PLC owns the TCP connection.

    PLC programming