S7-400 ET200M Module Diagnostics with OBs and FB126 PNIODiag

David Krause19 min read
S7-400SiemensTechnical 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

System Architecture Overview

The configuration discussed combines a fault-tolerant SIMATIC S7-400H station with distributed I/O over PROFIBUS DP, ring-redundant PROFINET, and optical PROFIBUS networking. Components in scope:

  • Two CPU 414-4H controllers (6ES7414-4HM14-0AB0, firmware V6/V7), each with X1/X2 MPI/DP and one or more PROFINET interfaces. The 414-4H provides X1 (MPI/DP master) and X2 (DP master) as PROFIBUS interfaces and an integrated PN interface on the CPU when the IF964-DP or PN/IE option is fitted.
  • Two PROFINET fibre links that carry the PROFINET ring between the H-CPUs and the SCALANCE switches. The H-system also uses a dedicated fibre pair for the H-sync interface when configured with the IF964-H sync module (6ES7964-0AA04-0AB0).
  • Three SCALANCE XC308-2 / X308-2 managed switches (e.g., 6GK5308-2FL00-2AA3) wired in a closed MRP ring. The X308-2 provides two fibre-optic ports (LC) and six RJ45 ports, supporting MRP, MRPD, PROFINET real-time (RT/IRT), and standard Ethernet traffic.
  • ET200M stations on PROFIBUS DP, each with an IM 153-2 High Feature (6ES7153-2BA10-0XB0) or IM 153-2BA02 (6ES7153-2BA02-0XB0) interface module. The IM 153-2 supports PROFIBUS DP V0/V1/V2 and offers fibre-optic ports for the DP ring; it also provides channel-level diagnostic data and module status bytes that the CPU can read.
  • An ET200M/Link (6ES7153-2BA00-0XB0) used as a PROFIBUS DP-to-PA or DP-to-DP bridge for the remote I/O segment.
  • 6ES7 321-1BH02 SM 321 digital-input module (16 DI, 24 V DC, source/sink) installed in the ET200M rack. The -1BH02 revision is a 16-point group-fault-reporting input, which signals module-level diagnostics but not individual channel diagnostics.
Why part numbers matter: the 1BH02 SM 321 reports module-level diagnostics only. The successor 6ES7321-1BH10-0AA0 and the 6ES7321-1BL00 (32 DI) modules add per-channel diagnostic interrupt capability. Verify the exact MLFB of the installed module by reading the IM 153-2 slot-status SZL 0x0131 to know which diagnostic flags are valid for the hardware in service.

ET200M Hardware Components and Order Numbers

Component Order number (typical) Role Diagnostic features
S7-400H CPU 414-4H 6ES7414-4HM14-0AB0 Redundant controller OB70 / OB72 H-specific OBs, dual PROFINET
SCALANCE X308-2 6GK5308-2FL00-2AA3 PROFINET ring switch MRP, RM, port diagnostics via WEB / SNMP
ET200M IM 153-2 High Feature 6ES7153-2BA10-0XB0 DP slave interface DS0/DS1, channel diagnostics, SZL 0x0131
SM 321 1BH02 (16 DI) 6ES7321-1BH02-0AA0 Digital input module Group fault only; no channel diagnostics
SM 321 7BH01 (16 DI w/ diag.) 6ES7321-7BH01-0AB0 Replacement for per-channel detection Channel diagnostic interrupt + value status
PS 307 (5A / 10A) 6ES7307-1EA01 / 6ES7307-1KA02 Rack power supply Power OK signal; OB81 on loss

Diagnostic OB Family in STEP 7 for PROFIBUS DP and ET200M

When a DP slave (the ET200M with IM 153) or a module within a DP slave changes state, the S7-400H operating system triggers an organisation block. The following OBs are central to ET200M diagnostics:

OB Name Trigger Local-data of interest
OB 70 I/O redundancy error H-system: loss of I/O redundancy (e.g., one of two redundant DP slaves failed) OB70_EV_CLASS, OB70_FLT_ID, OB70_IO_FLAG, OB70_MDL_ADDR
OB 72 CPU redundancy error H-system: loss of CPU redundancy OB72_MDL_ADDR, OB72_INFO, OB72_PRIORITY
OB 81 Power supply error PS failure, backup battery fail, 24 V load supply fail on a module or rack OB81_FLTM, OB81_INFO, OB81_MDL_ADDR
OB 82 Diagnostic interrupt DP slave or module reports incoming/outgoing diagnostic event OB82_MDL_ADDR, OB82_MDL_DEFECT, OB82_IO_FLAG, OB82_FLT_ID, OB82_LOCAL_DIAG[4], OB82_IF[2], OB82_DATE_TIME
OB 83 Insert/remove module interrupt Module pulled or inserted in a centralised or distributed rack OB83_MDL_ADDR, OB83_IO_FLAG, OB83_FLT_ID, OB83_INFO, OB83_ERR
OB 85 Priority class error Program tries to update I/O whose OB is not loaded, or the OB is missing OB85_DKZ1, OB85_DKZ2, OB85_INFO, OB85_MDL_ADDR
OB 86 Rack / DP station failure Loss of a DP slave, failure of an expansion rack, or return of a previously failed slave OB86_FLT_ID, OB86_IO_FLAG, OB86_MDL_ADDR, OB86_LOCAL_DIAG[4], OB86_INFO, OB86_DATE_TIME
OB 121 Programming error Indirect access to missing DB, type-conversion error, range error OB121_SW_FLT, OB121_BLK_TYPE, OB121_BLK_NUM, OB121_FLT_REG, OB121_INFO1 / INFO2
OB 122 I/O access error Direct I/O access to a slot whose module has failed or is missing OB122_SW_FLT, OB122_BLK_TYPE, OB122_BLK_NUM, OB122_IO_ADDR, OB122_LEN
H-system note: on an S7-400H, OBs 70 and 72 are added to the standard set. OB 70 triggers when I/O redundancy is lost (e.g., one channel of a switched PROFIBUS DP slave fails); OB 72 triggers when CPU redundancy is lost. Both should be loaded in both H-CPUs to avoid a single-point failure of diagnostics.

OB 82 — Diagnostic Interrupt

OB 82 is the workhorse for ET200M module diagnostics. It fires in two cases: when a module reports an incoming diagnostic event (FLT_ID = 0x10, event entered) and when the event is outgoing (FLT_ID = 0x11, event cleared). The temporary local data OB82_LOCAL_DIAG contains the standard diagnostic data record format described in the PROFIBUS/IEC 61158 specification. The first byte (byte 0) is the station status, byte 1 is the station status 2, byte 2 is the station status 3, and byte 3 contains the master's PROFIBUS address. For ET200M, the more useful content is in the channel-related diagnostic bytes that follow.

To read the extended diagnostic data for a DP slave you must use SFC 13 (DPNRM_DG) for PROFIBUS DP and the corresponding PNIO blocks (SFB 52 / 53 / 54) for PROFINET. SFC 13 reads the standard diagnostic frame (6 bytes) plus any device-specific diagnostic record (DS0 / DS1) for the affected station.

Code Pattern: Reading Diagnostic Data in OB 82

// OB 82 temporary local-data references
#OB82_MDL_ADDR        // WORD  – logical base address of the module that raised the interrupt
#OB82_IO_FLAG         // BYTE  – 0 = input, 1 = output
#OB82_FLT_ID          // BYTE  – 0x10 incoming, 0x11 outgoing
#OB82_LOCAL_DIAG[4]   // standard PROFIBUS DP diagnostic bytes

// Read the full diagnostic record (DS0 and DS1) for the affected DP slave
CALL  "DPNRM_DG"           // SFC 13
  REQ    := TRUE
  LADDR  := #OB82_MDL_ADDR
  RETVAL := #iRetVal
  RECORD := P#DBX 0.0 BYTE 32
  BUSY   := #bBusy
  RECORD_LEN := #iRecLen

The first 6 bytes returned by SFC 13 are the standard diagnostic per IEC 61158-6, with the same meaning as OB82_LOCAL_DIAG but updated from the current DP slave state. Bytes 6+ contain the device-specific diagnostic. For the IM 153-2, byte 6 (identifier-related diagnostic) and bytes 7+ (channel-related diagnostic) hold the module and channel status; for the SM 321 1BH02, no channel-specific diagnostic is produced.

OB 83 — Insert / Remove Module Interrupt

OB 83 fires for central racks on S7-300/400 and for distributed modules under an IM 153 (ET200M). OB83_FLT_ID encodes the reason: 0x10 = operation, no fault; 0x11 = module parameterisation error; 0x12 / 0x13 / 0x14 = module pulled / inserted / both; 0x15 / 0x16 / 0x17 = module not OK / OK after error; 0x18 / 0x19 = module reconfigured; 0x1A = no parameterisation; 0x1B = module in wrong slot; 0x1C = module without parameter set; 0x1D = module substitution by fault-tolerant; 0x51 / 0x52 / 0x53 = return of submodule / module / submodule; 0x54 = submodule slot OK; 0x55 = submodule update.

For the operator-replacement scenario, OB 83 is the key event: a 1BH02 SM 321 pulled from a powered ET200M rack triggers OB 83 with FLT_ID = 0x13 ("module removed") and FLT_ID = 0x14 ("module inserted"). To know whether the replacement is "proper", compare the type identifier and the slot configuration read from SZL 0x0131 via SFC 51.

Code Pattern: Capturing OB 83 Events

// Each call to OB 83 must be quick; offload heavy work to a flag/byte that OB 1 polls
L     #OB83_MDL_ADDR        // logical base address
T     MW   100              // store in flag word for OB 1 to process
L     #OB83_FLT_ID
T     MB   102
L     B#16#1
S     M    103.0            // set "module event pending" flag for OB 1
BEU

Once M 103.0 is set, OB 1 calls SFC 51 with SZL ID 0x0131 (or 0x0091 / 0x0092) to enumerate the slot status of the affected ET200M and check whether a different module is now present than the configured one.

OB 86 — Rack / DP Station Failure

OB 86 fires for two main cases in a PROFIBUS DP environment: a DP slave enters or leaves the not reachable state (FLT_ID = 0x10 / 0x11), or an expansion rack (centralised) fails. The relevant locals for distributed I/O are:

  • OB86_FLT_ID = 0x10 (initial failure), 0x11 (return), 0x12 (differences in submodule), 0x13 / 0x14 (H-system: stand-by / master failure)
  • OB86_MDL_ADDR = logical base address of the DP slave / diagnostic repeater
  • OB86_IO_FLAG = 0x80 (input), 0x81 (output), 0x82 (input/output), 0xC0 (not assigned)
  • OB86_LOCAL_DIAG[4] = station status bytes + master PROFIBUS address (same layout as OB 82)

A complete loss of the ET200M rack power supply typically shows up as an OB 86 with FLT_ID = 0x10 because the entire DP slave disappears from the bus. A single SM 321 losing 24 V sensor power may not trigger OB 86 — the IM 153-2 remains responsive on the bus — instead you will see an OB 82 only if the SM 321 supports group diagnostics, which the 6ES7321-1BH02 does not by default for sensor-supply loss. A separate 24 V feed monitoring relay or the IM 153-2 diagnostic of the 1BH02 module's "sensor supply fail" bit (in DS0) is required.

Terminal-strip removal: removing the front connector of a 6ES7321-1BH02 does not produce a diagnostic interrupt on the SM 321 itself. The wiring diagram shows that the 24 V sensor supply is wired through the front connector. You will lose process input states and the input LEDs go off, but no OB 82 / OB 83 fires. To detect front-connector removal, use a SM 321 variant with channel diagnostics (e.g., 6ES7321-7BH01-0AB0) or add a 24 V monitoring relay wired to a separate DI.

OB 85 and OB 122 — I/O Update and Access Errors

OB 85 is the bouncer. If the user's OB 82 / OB 83 / OB 86 are not loaded, the S7-400H reports a priority-class error and the SF LED on the CPU lights up. If a program tries to read the I/O of a missing or failed module without going through process-image update rules, OB 122 fires synchronously in the calling block (e.g., in OB 1, OB 35, FB 126).

Recommended best practice for ET200M: load all of OB 82, OB 83, OB 85, OB 86, OB 121, and OB 122 in both H-CPUs. Each OB should be 1–2 bytes long, just setting a flag for OB 1 to poll, so that diagnostics remain responsive under H-by-pass conditions.

FB 126 / PNIODiag — Siemens Diagnostic Package

The PNIODiag package (FB 126 and supporting data types) is Siemens' library for evaluating PROFINET IO and PROFIBUS DP diagnostic data without writing all the SFC 13 / SZL calls by hand. The package is delivered as a STEP 7 add-on and is available on the Siemens Industry Online Support portal (see PNIODiag entry ID 1137083 and PNIODiag manual 14726363). It contains:

  • FB 126 PNIO_DIAG — collects the diagnostic data of a PROFINET IO device or PROFIBUS DP slave
  • FB 125 PNIO_CHECK_HF — high-frequency check of PNIO status
  • FB 127 PNIO_DIAG_BUF — buffers diagnostic events for HMI display
  • UDT 126 / UDT 127 — diagnostic data structures (PORT, INTERFACE, MODULE, CHANNEL, etc.)

FB 126 returns, among other things, the device status, the slot status for every submodule, the channel diagnostic bytes, and the maintenance / qualification status. The PNIODiag block can be instantiated once per DP slave or per PROFINET device. For ET200M with the 1BH02 SM 321, the channel-level UDT shows "no diagnostic" and the module-level UDT shows the operating state.

Code Pattern: FB 126 on a PROFIBUS DP Slave

// Instance for ET200M DP slave with diagnostic address 1023
CALL  "PNIO_DIAG"         // FB 126
  MODE       := 0          // 0 = PROFIBUS DP, 1 = PROFINET IO
  LADDR      := 1023       // diagnostic address of the DP slave
  RETVAL     := MW   200
  BUSY       := M    210.0
  DIAG_TYPE  := 0          // 0 = standard, 1 = extended
  DATA       := DB90.DIAG  // UDT 126 target

DB 90 is a shared DB of type UDT 126 that the HMI / WinCC project polls. With one FB 126 call per ET200M station, the engineer can display module status, slot status, channel status, and maintenance state in WinCC without writing a single SFC 13 call in the user code.

Visualisation interface: PNIODiag exports a data structure compatible with the WinCC / TIA Portal "Diagnostics Overview" and "Device States" faceplates. In WinCC V7.x, install the "PNIODiag" option on the WinCC project to obtain the standard diagnostic overview screen, and bind DB 90 fields to the faceplate tags.

Reading Module Status Words and Diagnostic Data

For an ET200M station the engineer can read the per-slot module status through the System State List (SZL) using SFC 51:

SZL ID Partial list Content
0x0091 0x0001 Module identification (all slots)
0x0092 0x0001 Module identification (only fitted slots)
0x0094 0x0001 Module status information (rack 0)
0x00B1 0x0004 Status of all DP slaves (16-bit "alive" bitmap)
0x0131 0x0001 Status of slots of a station (used to detect wrong module in slot)
0x0A91 0x0000 Module diagnostic information of a slot

To detect an "unauthorised module replacement" — i.e., a 6ES7321-1BH02 replaced by a 6ES7321-1BH10 — read SZL 0x0091 to capture the configured type identifier, then read SZL 0x0092 to capture the actually fitted module, and compare. SZL 0x0131 returns the slot status with the substituted-marker bit (bit 6) set when the IM 153-2 has detected a module other than the one in the STEP 7 configuration.

Code Pattern: Reading SZL 0x0091 via SFC 51

CALL  "RDSYSST"             // SFC 51
  SZL_ID    := W#16#91
  SZL_INDEX := W#16#0001
  RETVAL    := #iRetVal
  BUSY      := #bBusy
  SZL_HEADER:= P#DB100.DBX0.0 BYTE 4   // SZL header (length + number of records)
  SZL_DATA  := P#DB100.DBX4.0 BYTE 256 // payload area

PROFIBUS DP Standard Diagnostic Data Layout (DS0)

The first 6 bytes returned by SFC 13 follow the IEC 61158 standard diagnostic frame. For ET200M, the layout is:

Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 Diag. ext. (=1) reserved Diag.summary (=1) Diag. channel (=1) Diag. station (1=incoming) Diag. station (1=outgoing)
1 Prm fault Inv. response Reserved WD on Freeze mode Sync mode Reserved Deactivated
2 Reserved Master PROFIBUS address (0..127)
3 Diag.ext. overflow Master PROFIBUS address (0..127)
4 Identifier-related diagnostic (module number) Identifier-related diagnostic (slot)
5+ Channel-related diagnostic (channel 0..63, error type)

For the IM 153-2 with a 1BH02 SM 321 in slot 4, byte 4 contains the module identifier 0x44 ("input 16 bits") and byte 5+ shows zero unless a SM with channel diagnostics is present. When the SM 321 reports a sensor-supply failure, the bit pattern in the channel-related diagnostic bytes identifies the failed sensor-supply line.

Implementation Pattern for the H-System with Two ET200M Stations

Best practice in an S7-400H with redundant PROFIBUS DP is to read each IM 153-2's status through FB 126 and to wire OB 82 / OB 86 outputs to a shared tag on the HMI. The recommended pattern:

  1. Load OB 82, OB 83, OB 85, OB 86, OB 121, OB 122, OB 70, OB 72 in both H-CPUs. Each OB should be a 1–2 line routine that stores the address and the FLT_ID in a DB and sets a "diagnostic pending" flag.
  2. Use OB 1 (slow OB) to call FB 126 per ET200M station once per cycle or once per second from OB 35. Avoid calling FB 126 from high-priority OBs (OB 40–47) — diagnostic data can be lengthy and blocks other interrupts.
  3. Use DB 90 of type UDT 126 to share diagnostic data with the HMI. Do not directly pass SFC 13 result bytes to the HMI; let FB 126 normalise them.
  4. For each ET200M station, declare a separate instance: DB_ET200M_A_PNIO for the first station, DB_ET200M_B_PNIO for the second.
  5. Subscribe to the same data on the HMI in a "Device States" faceplate (WinCC V7) or use TIA Portal's "Diagnostics" control (TIA V15+).

SVG Flow Diagram — OB 82 / OB 83 / OB 86 Routing

ET200M physical event (power loss, pull, swap) IM 153-2 detects DS0/DS1 update OB 86 (rack/slave) FLT_ID 0x10/0x11 OB 82 (diagnostic) LOCAL_DIAG bytes OB 83 (ins/rm) FLT_ID 0x13/0x14 DB 90 (UDT 126) normalised record FB 126 (PNIODiag) cyclic, OB 1 / OB 35 WinCC / TIA Portal Device States faceplate

Detection Coverage Matrix — What Each Event Can Tell You

Physical event OB / source What you can detect What you cannot
Whole rack power loss (PS 307 fail) OB 86, FLT_ID 0x10 DP slave unreachable; timestamp Distinguish PS fail from cable break
IM 153-2 24 V failure OB 81 (PS error) or OB 82 (DS0) IM153 internal PS diagnostic None — clear signal
SM 321 1BH02 removed (powered) OB 83, FLT_ID 0x13 Module pulled, address Whether same part number re-inserted
SM 321 swapped for different MLFB OB 82 + SZL 0x0091 vs 0x0092 Type identifier mismatch If the swapped module is functional but with wrong MLFB
Front connector pulled on 1BH02 None from module — No diagnostic; need hardware interlock or 7BH01
One channel wire broken None from 1BH02 — Module does not report per-channel
DP master CP443-5 ext. failure OB 86 / OB 70 (H) Slave unreachable; redundancy status Physical reason
Backplane bus fault on ET200M OB 82, DS0 byte 0 bit 2 Module-station status bit None — clear signal
SM 321 sensor supply fail (24 V) OB 82 (DS0) if module reports it; otherwise process image to 0 Channel status if module supports it Locate which wire without channel-diag module
Engineering recommendation: for terminal-strip / connector removal detection, replace the 6ES7321-1BH02 with a 6ES7321-7BH01-0AB0 (16 DI, 24 V DC, source, with channel diagnostic interrupt + value status) or add a 24 V monitoring relay wired to a spare DI. The 7BH01 supports the Channel Fault / Channel OK event in the channel-related diagnostic bytes that fire OB 82 with the channel identifier in the upper 3 bits of byte 7.

Verification and Commissioning Steps

  1. After loading all OBs, plug a single SM 321 1BH02 into slot 4 of the ET200M. Power down the rack's PS 307: confirm OB 86 fires in both H-CPUs, the SF LED lights, and DB 90 records the address with state = 0x10.
  2. Restore power, watch for OB 86 with FLT_ID = 0x11 (return).
  3. Pull the SM 321 under power, confirm OB 83 with FLT_ID = 0x13, then re-insert and confirm 0x14.
  4. Insert a different MLFB in the same slot (e.g., 6ES7321-1BL00). Confirm OB 82 fires with channel-related diagnostic showing "substitute module"; confirm SZL 0x0131 has the substitution bit set.
  5. Pull the front connector of the 1BH02 with the rack powered and 24 V sensor supply active. Confirm that no OB 82 / OB 83 fires and that the process image goes to 0. Document this limitation and add hardware mitigation.
  6. In WinCC, open the PNIODiag "Device States" faceplate and verify that the green status changes to yellow / red and the slot icon flips to "module missing".
  7. Run the S7-400H link-up check (LINK-UP) on the ET200M DP segment to ensure the redundant DP master does not cross-flood diagnostic events during failover.
  8. Cycle the IM 153-2 24 V supply to verify OB 81 behaviour and that DB 90 records a power-supply error with the IM 153-2's diagnostic address.

Troubleshooting Quick Matrix

Symptom Likely cause First check
SF LED on CPU, no OB firing OB 82/83/85/86 missing STEP 7: PLC → Module Information → OB list
OB 86 floods every 1 s DP slave cycling (intermittent cable or ring broken) Check MRP ring status, FO link budget, X308-2 diagnostics
OB 83 fires but slot-status SZL 0x0131 shows 0xFF IM 153-2 firmware < V4 indicates slot 0 only Update IM 153-2 to at least V8.x for full slot info
Front-connector pull undetected 1BH02 has no per-channel diagnostic Replace with 6ES7321-7BH01-0AB0 or add 24 V monitoring
PNIODiag shows "no diagnostic" but OB 86 fired FB 126 LADDR points to input area, not diagnostic address Use the H-system diagnostic address, not the I/O address
SF on both H-CPUs at the same instant Synchronisation cable break; both CPUs see DP fail Check IF964-H sync modules, FO connectors
WinCC faceplate never updates DB 90 not refreshed; FB 126 BUSY stuck Monitor RETVAL of FB 126; check call interval (≥500 ms recommended)
OB 85 instead of OB 86 OB 86 not loaded, or process-image access to missing slot Load OB 86; review direct I/O accesses in user code

Alternate Platforms — S7-300 and S7-1500 Footnote

On an S7-300 station with an IM 153 (no H-system), OB 70 and OB 72 are not loaded. OB 82, OB 83, OB 85, and OB 86 are still required for full ET200M diagnostics. On an S7-1500 with PROFINET-based ET200MP (IM 155-5 PN), the diagnostics concept uses PNIO blocks (SFB 52 RDREC / SFB 53 WRREC / SFB 54 RALRM) and the standard PROFINET channel / slot / submodule alarms that are not directly compatible with PROFIBUS DP DS0/DS1 frames. The OB numbers, however, are analogous: OB 82 maps to PROFINET diagnostic interrupt, OB 83 to plug/pull, and OB 86 to PROFINET device failure. PNIODiag FB 126 supports PROFINET mode with MODE = 1.

Frequently Asked Questions

Which OB fires when I lose 24 V to the SM 321 1BH02 but the IM 153-2 remains powered?

On the 6ES7321-1BH02-0AA0, loss of the 24 V sensor supply is not reported as a channel diagnostic. The IM 153-2 will still be reachable on PROFIBUS, so OB 86 does not fire, and OB 82 only fires if the module reports a group fault. The practical signal is the input image going to 0 and the diagnostic data record (read via SFC 13) showing the SM 321 "sensor supply fail" bit. Use a 6ES7321-7BH01-0AB0 if per-channel fault detection is required.

Why is my CPU throwing an OB 85 instead of OB 86 when a DP slave fails?

OB 85 fires for priority class errors when a slot referenced by the process-image update no longer has a valid module. If OB 86 is not loaded, the system falls back to OB 85. Load OB 86 in both H-CPUs, and ensure that the calling OBs (e.g., OB 1) reference the I/O via the process image rather than via direct P-/PIQ access to avoid synchronously accessing failed modules.

How do I tell whether the operator replaced the SM 321 with the same part number or a different one?

Read SZL 0x0091 (configured module) and SZL 0x0092 (actually fitted) via SFC 51, and compare the module type identifier (bytes 8–11 of the SZL record). If they differ, the IM 153-2 marks the slot with the substitution bit in SZL 0x0131 (bit 6 of byte 4). FB 126 (PNIODiag) returns this in the UDT 126 MODULE field, which can be displayed on the WinCC faceplate.

Can FB 126 (PNIODiag) handle PROFIBUS DP, or only PROFINET IO?

PNIODiag handles both. Set the MODE input to 0 for PROFIBUS DP and 1 for PROFINET IO. The UDT structures are reused; only the channel-level diagnostic data layout differs. The package reads SFC 13 DPNRM_DG for DP and SFB 52 / 53 / 54 for PROFINET.

What happens on the standby CPU in the S7-400H — does the OB fire on both?

On an S7-400H both CPUs run the user program independently. The diagnostic OBs fire on whichever CPU is the active DP master for the affected segment. If both H-CPUs are master on the same DP ring (PROFIBUS DP H-mode), OB 86 will fire on both, but only the standby's instance is used during the role switch. The H-system runtime synchronises the diagnostic state across both CPUs automatically, so DB 90 contents are identical on both sides.

Back to blog