SINUMERIK 840D PLC Alarm Generation via DB2.DBX190.0

David Krause13 min read
HMI ProgrammingSiemensTechnical Reference
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

SINUMERIK 840D PLC Alarm Generation via DB2.DBX190.0

On a SINUMERIK 840D / 840D sl control, PLC user alarms in the 700000–700999 range are the standard channel through which the PLC raises operator-visible messages on the HMI. The bit pattern DB2.DBX190.0 is one of the most common assignments used by machine builders (Deckel-Maho, DMG MORI, Gildemeister, and similar DMC-class machines) to trigger an alarm such as 700116. This reference explains how DB2 is structured, why STEP 7 cross-reference tools display DB?.DBX190.0 instead of the literal block name, and how to modify alarm logic in an existing program without corrupting the original PLC-NCK interface.

1. SINUMERIK 840D PLC Alarm Architecture

The SINUMERIK 840D integrates a SIMATIC S7 PLC (S7-300 in classic 840D, S7-1500 in 840D sl with newer PLC versions). The PLC and the NCK exchange information through a fixed set of interface data blocks. The HMI renders alarm messages that the PLC triggers by setting a single bit in a designated DB.

Alarm Range Origin Typical Trigger HMI Visibility
1000–9999 NCK standard NCK-internal condition Yes (red, clearable)
10000–59999 NCK extended NCK + cycles Yes (red, clearable)
60000–69999 Cycles / compile cycles Cycle runtime Yes (red)
400000–499999 HMI / PLC standard HMI bit (PLC drives it) Yes
700000–700999 PLC user alarms Bit set by PLC in DB2 Yes (red, requires PLC reset)
800000–900000+ OEM-defined Configured per machine Yes (per configuration)

The 7xxxxx series is reserved for PLC user alarms. Each alarm is bound to one bit in the user-alarm data block. By Siemens convention in the standard PLC program template (Basic Program Plus / Basic Program), DB2 is the central user-alarm image DB on classic 840D, and the bit pattern begins at DBX180.0 and extends byte-wise. A bit such as DB2.DBX190.0 therefore activates alarm 700016 if the mapping follows the default template.

Note: The exact bit-to-alarm mapping depends on the machine builder's PLC project. Always cross-check the configured alarm-text file (alm.txt / oem_alarms.xml) before assuming a specific alarm number. On a DMC machine the builder may renumber to keep customer-specific text strings.

2. DB2 as the User Alarm Interface

In the classic SINUMERIK 840D PLC program (Basic Program, STEP 7 V5.x), DB2 is the user-alarm interface data block. Its structure is byte-aligned:

Address Range Purpose Typical Alarm IDs
DBX180.0 – DBX187.7 First alarm group (8 bytes = 64 alarms) 700000 – 700063
DBX188.0 – DBX195.7 Second alarm group 700064 – 700127
DBX196.0 – DBX199.7 Third alarm group (partial) 700128 – 700159
DBX190.0 (within group 2) Bit offset 8 in second group 700072 (typical) / 700116 (machine-specific)

When the PLC sets DB2.DBX190.0 = 1, the HMI alarm handler polls the user-alarm image during each PLC cycle. The handler converts the bit position to the configured alarm number, retrieves the localized text string, and renders the message in the alarm line. The alarm remains active until the PLC clears the bit (or until power-off if the builder configured it as latching).

To activate the alarm the program can use any of the standard bit-assignment operations: S (Set), = (Assign), or conditional A / O followed by assignment. The simplest case is an unconditional latch:

// STL – Unconditional user alarm 700116
S   DB2.DBX190.0

More typically, the alarm is conditional on a process event:

// STL – Conditional user alarm
A   I 32.0          // e.g. door interlock open
S   DB2.DBX190.0    // raises alarm 700116

For a clearable alarm the PLC must reset the bit on a confirmation signal:

// STL – Reset on HMI Cancel
A   I 33.0          // HMI Cancel key (NCK->PLC bit mapped in DB10)
R   DB2.DBX190.0    // clears alarm 700116

3. Why the Cross-Reference Shows DB?.DBX190.0

STEP 7 cross-reference lists every address touched by the program. When the program writes the bit with an absolute block qualifier, the tool resolves the address to its literal DB number. When the program writes the bit with a relative qualifier, the tool cannot resolve the actual DB at compile time and prints DB?.

The STEP 7 instruction set allows two equivalent notations for DB-bit operations:

// Form A – absolute qualifier
OPN DB2             // open DB2 as the active data block
A   I 32.0
=   DB2.DBX190.0    // cross-reference shows DB2.DBX190.0

// Form B – relative qualifier
OPN DB2             // open DB2 as the active data block
A   I 32.0
=   DBX190.0        // cross-reference shows DB?.DBX190.0

Both forms write to the same memory location (DB2.DBX190.0). The difference is purely in how the program text is expressed. The compiler emits the same machine code for both. Cross-reference tools flag form B with DB? because they only track explicit DB references; they do not track the side-effect of OPN across statements.

Notation Cross-Reference Output Runtime Effect Maintenance Risk
= DB2.DBX190.0 DB2.DBX190.0 Always writes DB2.DBX190.0 Low – explicit
= DBX190.0 after OPN DB2 DB?.DBX190.0 Writes DB2.DBX190.0 if last OPN is DB2 High – implicit
= DBX190.0 after OPN DB31 DB?.DBX190.0 Writes DB31.DBX190.0 (WRONG for alarm!) Critical – silent corruption

4. STEP 7 OPN Statement Mechanics

The OPN (Open Data Block) instruction changes the active data block for all subsequent DBX / DBW / DBD references until another OPN DB, OPN DI, or block boundary resets it. The CPU maintains two internal registers: DB and DI. Most STEP 7 code uses the DB register; instance DBs use the DI register.

The hazard arises when an engineer inserts new code inside a network that already contains an OPN:

// Original program (before modification)
OPN DB31
A   I 32.0
=   DBX2.1       // writes DB31.DBX2.1
=   DBX21.1      // writes DB31.DBX21.1

// Engineer inserts new lines
OPN DB31
A   I 32.0
=   DBX2.1       // writes DB31.DBX2.1
A   I 32.1
=   DB2.DBX190.0 // absolute – writes DB2.DBX190.0 (correct)
=   DBX21.1      // writes DB2.DBX21.1 (BUG – should be DB31.DBX21.1)

The line = DB2.DBX190.0 does not change the active DB register; it is a one-shot absolute reference. The next relative reference = DBX21.1 still uses the previously opened DB2, not DB31. The original line = DBX21.1 silently changes its target from DB31 to DB2.

Critical: This silent re-targeting is one of the most common sources of regression bugs when retrofitting alarms into an existing DMC machine program. The original behavior is preserved in cross-reference (because the absolute reference is unchanged) but the actual runtime behavior changes because the OPN side-effect was assumed but not executed.

5. STL Code Examples for Alarm Generation

The following examples use standard STEP 7 STL (Statement List) syntax compatible with classic 840D projects in STEP 7 V5.x.

5.1 Basic Set / Reset Alarm

NETWORK 1   // Door interlock alarm
A   I 32.0          ; door contact
S   DB2.DBX190.0    ; set alarm 700116

NETWORK 2   // Reset on HMI Cancel
A   "HMI_Cancel_Key"
R   DB2.DBX190.0    ; reset alarm 700116

5.2 Edge-Triggered Alarm

NETWORK 3   // Latch on rising edge of fault
A   I 32.1
FP   M 200.0        ; positive edge flag
S   DB2.DBX190.0    ; latch alarm until reset

5.3 Grouped Alarm with Common Reset

NETWORK 4   // Spindle temperature alarm group
A   "SpindleTemp_High"
S   DB2.DBX190.0
A   "SpindleTemp_Critical"
S   DB2.DBX190.1

NETWORK 5   // Common reset
A   "HMI_Cancel_Key"
R   DB2.DBX190.0
R   DB2.DBX190.1

5.4 Alarm with Operator Acknowledgement (Quittierung)

SINUMERIK distinguishes clear (Cancel key) and acknowledge (Quittierung). Some user alarms require the operator to acknowledge the alarm before the bit clears. Implement this with a status handshake:

NETWORK 6   // Latch on fault
A   "DoorOpen"
S   DB2.DBX190.0

NETWORK 7   // Clear only after door closed AND ack received
A(   
O   "DoorClosed"
O   "DoorOpen_Ack"
)
A   "HMI_Cancel_Key"
R   DB2.DBX190.0

6. Ladder Logic Equivalents

In LAD/FBD the same operations are represented graphically. The key benefit of LAD/FBD is that OPN is implicit in the network's address notation; you always see the absolute DB qualifier:

|   I32.0    |   DB2.DBX190.0   |
|----| |-----|------(S)---------|     // Set alarm 700116

|  HMI_Cancel|   DB2.DBX190.0   |
|----| |-----|------(R)---------|     // Reset alarm 700116

If the existing PLC program uses STL with relative DB references, you can convert your alarm additions to LAD to remove the ambiguity. STEP 7 V5.x supports mixed STL/LAD/FBD blocks (single block source, mixed network types).

7. Risk Patterns When Modifying Existing Programs

When retrofitting a user alarm into an existing DMC-class machine PLC program, four patterns account for nearly all field regressions:

Pattern Symptom Detection
Inserting STL between OPN DBx and relative DBX reference Existing output silently changes target DB Compare cross-reference before/after change
Reordering STL networks Cross-reference still shows same lines, runtime differs Trace OPN state at each cycle
Using same bit in multiple alarms (e.g. DB2.DBX190.0 for both 700116 and 700118) Alarm appears but text does not match bit Search DBX190.0 across whole project
Alarm not cleared after FB returns Alarm latches after one-shot trigger Add explicit reset network

7.1 Recommended Insertion Pattern

To avoid breaking existing program flow, isolate alarm-setting logic in its own network block with absolute DB qualifiers:

NETWORK 100   // << ISOLATED ALARM INSERT >>
A   I 32.0
S   DB2.DBX190.0   // absolute – cannot leak DB state

Place this network at the end of the OB1 cycle, after all existing OPN statements have been resolved. The explicit qualifier protects against OPN side-effects from earlier networks.

8. Verification Procedures

After inserting alarm logic, perform the following four verifications before commissioning:

8.1 Static Cross-Reference Comparison

  1. Open the project in STEP 7 V5.x (or TIA Portal for 840D sl with S7-1500 PLC).
  2. Select Options → Reference Data → Display.
  3. Filter on DBX190.0 in the cross-reference list.
  4. Confirm every entry uses the absolute DB2.DBX190.0 notation, or trace each OPN statement preceding a relative reference.
  5. Save the reference data before and after the change for diff comparison.

8.2 Runtime PLC Trace

Use the STEP 7 Monitor / Modify function or a watch table to force DB2.DBX190.0 to 1, then verify the HMI renders the expected alarm text. Confirm:

  • Alarm number matches the configured 700116 identifier.
  • Alarm text matches the operator manual / OEM text file.
  • Alarm clears when the bit is reset from the watch table.
  • No spurious alarms appear (indicating a corrupted DB reference).

8.3 Bit-Coverage Audit

Scan the entire PLC program for any OPN statement that could affect the DB active when your alarm network executes:

// Find in STEP 7 cross-reference:
OPN DBxx  // any open DB statement
A   ...
=   DBX... // relative – audit risk

If your new alarm network is inserted between such patterns, verify with the PLC in RUN mode and a watch table that the bit changes target the correct DB2 byte.

8.4 HMI Alarm Log Verification

  1. Trigger the alarm from the PLC.
  2. Open Diagnostics → Alarm Log on the HMI.
  3. Confirm the entry shows alarm number 700116 with the expected text and clear time.
  4. Confirm the alarm history persists across NC reset.

9. TIA Portal and SINUMERIK 840D sl Considerations

On SINUMERIK 840D sl with the S7-1500-based PLC (Basic Program Plus), the alarm interface is no longer DB2 but is exposed via PLC tags and the HMI alarm configuration in TIA Portal. The legacy DB2.DBX190.0 notation only applies to classic 840D projects using STEP 7 V5.x and the Basic Program (S7-300 PLC).

Aspect Classic 840D (S7-300) 840D sl (S7-1500, Basic Program Plus)
PLC Engineering STEP 7 V5.x TIA Portal V16+
Alarm Interface DB2 byte image PLC tags + alarm text lists
Trigger Method Set bit in DB2 Set boolean tag (e.g. UserAlarm_700116)
OPN Statement Relevant — affects cross-reference Not used — tag-based addressing
Alarm Number Range 700000–700999 700000–700999 (same)

If the DMC machine is running TIA Portal Basic Program Plus, the DB?.DBX190.0 cross-reference artifact is replaced by tag-based cross-reference. The investigation described in this article applies to classic 840D projects only.

10. Best Practices for PLC Alarm Programming

  1. Always use absolute DB qualifiers when writing alarm bits. This makes cross-reference unambiguous and prevents OPN side-effect bugs.
  2. Group alarm logic in dedicated networks at the end of OB1 to avoid interleaving with existing OPN statements.
  3. Reserve a contiguous byte range (e.g. DBX180.0–DBX195.7) for user alarms and document the bit-to-alarm mapping in a project README.
  4. Latch alarms only when required by the safety case (ISO 13849-1 PL d/e functions). Unlatched alarms reset automatically when the trigger clears.
  5. Provide explicit reset networks driven by the HMI Cancel key (NCK → PLC interface in DB10.DBX0.0 / DBX0.1) or by a defined operator action.
  6. Avoid bit sharing: never write the same bit from two FBs or two networks — debug tracing becomes ambiguous.
  7. Use DB2 only for user alarms: do not mix alarm bits with other process signals in DB2; this prevents accidental reuse by future modifications.
  8. Document the alarm text source: alarm 700116's text comes from alm.txt (classic) or the HMI alarm list (TIA Portal). Cross-reference the alarm number with the text file before final commissioning.
  9. Cross-check the basic program version: the alarm interface structure varies between Basic Program versions. Verify against the specific PLC library version in your project.
  10. Capture reference data before each modification: STEP 7 reference data is the fastest way to detect unintended DB-state changes.

11. Troubleshooting Matrix

Symptom Likely Root Cause Diagnostic Step Fix
Cross-reference shows DB?.DBX190.0 Bit written via OPN DB2 + relative qualifier Locate preceding OPN statement Convert to absolute DB2.DBX190.0
Alarm 700116 appears but with wrong text Bit shared with another alarm, or text file mismatch Grep DBX190.0 in project; inspect alm.txt Assign unique bit; update alarm text file
Alarm does not clear after fault removed Latched S without R network Search for missing reset on DB2.DBX190.0 Add explicit reset network on HMI Cancel
Existing output stops working after alarm insert Inserted STL changed active DB for downstream relative reference Compare cross-reference diff before/after Use absolute qualifiers; move alarm to isolated network
Alarm appears on every power-up Bit initialized to 1 in DB2 startup values Open DB2 in STEP 7, check initial values Set initial value to 0 in DB2 declaration
Alarm shows correct number but wrong action (e.g. NC stop instead of feed hold) Alarm configured with wrong response class in alm.txt Inspect CANCEL, NCSTOP attributes Update alarm configuration; re-import text file
Alarm does not appear at all Wrong DB (e.g. user wrote to DB31.DBX190.0 instead of DB2.DBX190.0) Watch table on DB2.DBX190.0 vs DB31.DBX190.0 Insert isolated network with absolute DB2.DBX190.0

12. SINUMERIK Documentation and Standards References

The following manufacturer documentation is relevant for SINUMERIK 840D PLC alarm generation:

What does DB?.DBX190.0 mean in STEP 7 cross-reference?

The question mark indicates that the program wrote the bit using a relative qualifier (e.g. = DBX190.0) preceded by an OPN DB2 statement. The compiler emits the same code as = DB2.DBX190.0, but the cross-reference tool cannot statically resolve which DB is implied, so it marks it as DB?. Tracing the preceding OPN identifies the actual DB.

Can I use DB?.DBX190.0 reliably for alarm generation?

Yes, provided the most recent OPN statement before the alarm network is OPN DB2. To eliminate maintenance risk, always convert alarm-bit writes to the absolute form DB2.DBX190.0. Absolute qualifiers are immune to OPN side-effects from earlier networks.

Why does inserting an alarm network break an existing output?

Because the inserted line may have changed the implicit DB state for downstream relative references. For example, inserting = DB2.DBX190.0 between OPN DB31 and a subsequent = DBX21.1 does not alter the active DB register, so = DBX21.1 continues to write to DB2 (not DB31). The fix is to use absolute qualifiers everywhere or to insert an explicit OPN DB31 before the original relative reference.

How do I find which DB holds the user alarms on my DMC machine?

Open the STEP 7 project for the DMC machine, search the entire program for S DBX patterns, and check the preceding OPN statement. DB2 is the standard for classic 840D Basic Program. If the machine uses Basic Program Plus with TIA Portal, the alarm interface is exposed as PLC tags and configured in the HMI alarm list.

Does DB2.DBX190.0 always trigger alarm 700116?

No. The bit-to-alarm mapping depends on the Basic Program version and the machine builder's alm.txt configuration. In the default template, DB2.DBX180.0 corresponds to alarm 700000, so DB2.DBX190.0 maps to alarm 700016. On your DMC machine, the builder may have renumbered to 700116. Verify by reading the configured alarm text file or by triggering the bit and observing the HMI alarm number.

Back to blog