Resolving Siemens S5-95U Block Status ZYK Cycle Error

David Krause13 min read
PLC HardwareSiemensTroubleshooting
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

Resolving Siemens S5-95U Block Status ZYK Cycle Error: Diagnosis, OB31 Workaround, and Verification

The Siemens SIMATIC S5-95U compact PLC is a workhorse controller still running in thousands of machines installed in the 1990s. A classic field symptom that surfaces during commissioning or service work is this: the moment the engineer enables online Block Status (Bausteinanzeige / PB-Status) in STEP 5, the CPU drops to STOP, the red STOP LED illuminates, and the Interrupt Stack (ISTACK) reports ZYK as the active cause. This article documents the precise root cause, the affected CPU variants, the recommended Siemens workarounds (including OB31 call-injection), and a verification procedure you can run on the bench before returning the machine to production.

Engineer field-note: ZYK is not a programming bug. It is a scan-time watchdog trip. The block-status function extends OB1 execution enough to push the program past its scan-time limit. Treat it as a timing-budget problem, not a logic problem.

1. Problem Description

The reported failure mode is reproducible on every transition from offline to online block status:

  1. STEP 5 is connected to the S5-95U via the serial programming port (AS511 / TTY / current-loop).
  2. The operator opens a Program Block (PB), Function Block (FB), or Data Block (DB) and toggles Block Status (German: Bausteinanzeige).
  3. Within milliseconds, the CPU enters the STOP state.
  4. The ISTACK, when read with ISTACK in the STEP 5 Test menu, shows the ZYK (cycle time exceeded) flag set.
  5. Manual mode restart (MRES / RUN) clears the fault but the cycle repeats on every monitoring session.

The fault occurs even when the user program is "small," which is misleading to first-time S5 service engineers. The threshold for scan-time violation is fixed by the CPU firmware and is unrelated to program size; the program simply needs to be running close to the limit when monitoring is enabled.

2. Affected Siemens SIMATIC S5 Hardware

CPU Typical Order Number (MLFB) Scan Monitor Range Notes
S5-90U 6ES5 090-8MA01 / 8MB01 100 ms default (parameterizable) Same OB31 architecture
S5-95U 6ES5 095-8MA01 / 8MA02 / 8MB01 / 8MB02 100 ms default (parameterizable) Primary subject of this article
S5-95F 6ES5 095-8FC01 / 8FD01 100 ms default (parameterizable) Fail-safe variant
S5-100U CPU 100 6ES5 100-8MA01 100 ms default Identical scan-watchdog behavior
S5-100U CPU 102 6ES5 102-8MA01 200 ms default Same OB31 re-trigger mechanism
S5-100U CPU 103 6ES5 103-8MA01 200 ms default Same OB31 re-trigger mechanism

The default scan-monitoring time on the S5-95U is 100 ms. The CPU polls a hardware timer at the end of every OB1 cycle; if OB1 has not returned within the configured window, the firmware records ZYK in the ISTACK and forces the CPU into STOP. Online status functions inject additional interpreter cycles inside the OB1 scan, raising the effective execution time well above the user's static measurement.

3. Root Cause Analysis

3.1 What the ZYK flag means

ZYK (Zykluszeit) is the bit the S5 firmware sets in the Interrupt Stack when the scan-monitor watchdog expires before OB1 completes. It is not a user-accessible flag; it is visible only through the ISTACK diagnostic on the programming device. The associated error code in the ISTACK stack header is 0x0B / 0x0C family depending on the CPU version, and it indicates Cycle time exceeded.

3.2 Why block status pushes the scan over the limit

Block Status works by having the CPU echo every operand state to the programmer on each cycle. The interpreter walks the active block list at the rate of the scan, adds a status-recording wrapper to each instruction, and ships the resulting trace to the AS511 interface. Empirically, status monitoring adds 15 % to 40 % to the OB1 cycle time, depending on:

  • Number of blocks currently being monitored simultaneously.
  • Bit-instruction density (each A, O, S, R, =, UN, ON, UW, OW, XOW, etc. is wrapped).
  • Program-block nesting depth (PBs calling PBs, FB calls, formal-parameter marshalling).
  • Communication load on the AS511 channel (if a PG is also requesting forced-variable writes, the load rises further).

If the unguarded OB1 scan is already at, say, 90 ms, and block status adds 25 %, the effective scan becomes ~112 ms and the 100 ms watchdog fires.

3.3 Why this is the normal S5 behavior, not a defect

The S5-95U does not have any mechanism to suppress scan monitoring during online functions; the watchdog is hard-wired into the firmware. The behavior is by design, and Siemens documents the OB31 workaround explicitly in S5-95U Programming Manual (6ES5 998-8MA22), Section 9.

4. Diagnostic Procedure

Before applying any fix, gather hard numbers. The engineer who is guessing at scan time is the engineer who will apply the wrong workaround.

4.1 Read the ISTACK

  1. Connect STEP 5 to the CPU and enter the Test > ISTACK menu (or press F8 in the classic STEP 5 PG software).
  2. Confirm the active interrupt cause is ZYK and not QVZ, QVF, PEU, or any other class.
  3. Note the Last cycle time and Minimum cycle time the firmware has logged (this is a coarse but useful indicator).

4.2 Measure the actual scan time

Add a temporary diagnostic pair to the top and bottom of OB1 using the system clock word OB 1 scratch flags or, better, the time-of-day clock in DW 0 of a scratch DB:

// Top of OB1
      L   DB 100        // Scratch DB
      L   DW 0          // Last scan time (ms)
      T   FW 200        // Save previous value
      L   KH E000       // System time low word (free-running 10 ms)
      T   DW 1          // Stamp t0

// ... your program ...

// Bottom of OB1
      L   KH E000
      T   DW 2          // Stamp t1
      L   DW 2
      L   DW 1
      -D                // delta in 10 ms units
      SRW 1             // optional /2 for ms approx
      T   DW 0          // publish scan time for monitoring

Read DB100.DW0 in the Status Variable table to capture the live scan time.

4.3 Compute the margin

The S5-95U stores the configured scan-monitor time in system data word SD 5 (default 100 ms). Compare:

Measurement Healthy Warning Critical (will trip under status)
OB1 scan time, status OFF < 60 % of SD 5 60–85 % > 85 %
OB1 scan time, status ON (measured with OB31 in place) < 95 % 95–99 % ≥ 100 %

If your offline scan is already above 85 ms on a 100 ms monitor, status will always fault without intervention.

5. Solutions

Four field-proven options exist. Pick the one that matches your plant's change-control policy and downtime budget.

5.1 Solution A — Call OB31 mid-program (recommended, no firmware change)

OB31 is the Scan Time Trigger organization block on the S5-95U. Calling OB31 from anywhere inside OB1 re-arms the watchdog, which is exactly what status monitoring needs. Siemens describes this technique in the S5-95U programming manual (6ES5 998-8MA22), pages 9-5 to 9-7.

  1. Open OB1 in STEP 5.
  2. Place a single unconditional call at the geometric midpoint of the program:
      SPA FB 31        // or "JU OB 31" if FB31 alias is unavailable

If your OB31 block does not yet exist in the program file, copy it from the standard library disk supplied with STEP 5 (S5DOS.S5D → OB31.S5D). It contains nothing more than a BE in its default form, but its presence is what the firmware needs to reset the timer.

  1. Download the modified OB1 to the CPU.
  2. Restart the CPU in RUN.
  3. Re-enable block status. The CPU should remain in RUN with ZYK no longer asserted.
Field-proven caveat: Place the OB31 call at a position that represents at least 40–60 % of the program execution time. Putting it at the very top or very bottom defeats the purpose, because the watchdog sees only the residual time after the call.

5.2 Solution B — Raise the scan-monitor time in SD 5

The S5-95U allows the scan-monitor time to be parameterized in system data word SD 5 via the STEP 5 System Data editor. The supported range is typically 10 ms to 2550 ms in 10 ms steps.

  1. Open the System Data editor (F8 in some builds; otherwise Edit > System Data).
  2. Locate SD 5 (Scan Time Monitoring Period).
  3. Set the new value, e.g., KH 01F4 (500 ms decimal) for headroom.
  4. Transfer system data to the CPU and cold-restart.
Safety warning: Raising the scan monitor beyond ~300 ms delays the CPU's reaction to a runaway OB1. On safety-relevant machinery, do not raise SD 5 above the value that matches the safety function's required fault-reaction time. The S5-95F (fail-safe) variant enforces tighter bounds; consult the F-manual before relaxing SD 5 on any F-system.

5.3 Solution C — Refactor the program to lower OB1 peak time

If the OB1 scan time is genuinely close to 100 ms because the program is doing too much per cycle, the correct long-term fix is to:

  • Move slow or rarely-changed logic into OB32 (time-of-day interrupt) or OB21/OB22 (warm/cold restart).
  • Split a long PB into two PBs and call the second from a slower task.
  • Replace time-wasting constructs (long DO/DI loops, table scans in bit logic) with PB calls gated by a 100 ms timer flag.

This is the only solution that survives a controller swap or a future engineer who is unaware of the workaround.

5.4 Solution D — Use a static variable watch instead of full block status

For most debugging tasks, Status Variable (Variable beobachten) plus a single Force window consumes far less CPU time than full block status. Use this technique when you only need to see a handful of flags or a data word.

6. Step-by-Step Implementation of Solution A (OB31 Re-trigger)

6.1 Prerequisites

  • STEP 5 (any version from PG 635 through PG 720/740, including the Windows-based STEP 5 V7.x).
  • Current offline backup of the S5 program on a working PG.
  • AS511 or MPI-to-RS232 converter cable appropriate to the CPU port.
  • Knowledge of the machine's safety state and the operator's permission to cycle the CPU.

6.2 Procedure

  1. Switch the controlled machine to its safe-state mode per local lock-out/tag-out.
  2. Place the CPU in STOP (key switch or remote STOP).
  3. Open the offline project in STEP 5 and load OB1.
  4. Identify the line of OB1 closest to the temporal midpoint of the program. Empirically this is the line where the cumulative instruction count is roughly half of OB1's total length, weighted by instruction type (load/transfer is cheap; arithmetic and word logic are expensive).
  5. Insert the unconditional OB31 call:
  6.       SPA FB 31
  7. If FB 31 is not in the program file, copy it from the STEP 5 library. The default OB31 body is just BE. Some sites prefer to replace the call with the literal JU OB 31 to remove the FB/DB parameterization overhead; both forms work.
  8. Document the change in the program header comment of OB1.
  9. Transfer OB1 to the CPU with PG > CPU File > Blocks.
  10. Cold-restart the CPU and bring the machine back to a controlled RUN state.
  11. Open PB status. Confirm RUN LED stays lit and ISTACK shows no ZYK.

6.3 Verification

  1. Enable Block Status on at least three PBs and one FB simultaneously.
  2. Watch the STOP LED: it must remain dark.
  3. Read the ISTACK again. ZYK must not be set.
  4. Read DB100.DW0 (your scan-time stamp) and confirm the live scan time stays below the SD 5 value with at least 10 % headroom.
  5. Force a worst-case load (cycle every digital input, run any high-speed counters, etc.) and repeat steps 1–4.
  6. Sign off the change in the machine logbook with date, firmware version of STEP 5, and SD 5 value.

7. ISTACK Error Code Reference

ISTACK code (mnemonic) Class Meaning Common cause
ZYK Cycle-time Scan monitor expired OB1 overrun; online status; hardware fault on bus
QVZ Peripheral Peripheral access timeout Failed I/O module; address mismatch; cable break
QVF Peripheral Peripheral parity/format error EMI; failed I/O; wrong slot
PEU Programming Programming error / substitution error Uninitialized operand; out-of-range DB
ASP Stop Manual STOP request Key switch; PG command
STS Startup Restart error Inconsistent EPROM/RAM; cold-restart fault
NAU Power Power failure Battery exhausted; supply brownout

If you see anything other than ZYK, the symptom is not what this article addresses. Resolve that primary cause first.

8. Troubleshooting Matrix

Symptom Likely cause First check Action
CPU stops when block status enabled; ISTACK shows ZYK Scan monitor exceeded Read SD 5; measure scan time Call OB31 mid-OB1 or raise SD 5
CPU stops immediately on RUN, ISTACK shows QVZ I/O expansion failure Check ET 100/200 bus termination Replace I/O module; reseat connector
CPU stops, ISTACK shows PEU Programming error Compare cross-reference; check DB length Fix offending operand reference
CPU stops only when status is open on a specific PB That PB contains a long loop or table scan Time that PB in isolation Refactor; move logic to interrupt OB
CPU stops under status even after OB31 inserted OB31 placed too late or too early Reposition OB31 call to ~50 % Move call to temporal midpoint
Status works in cold morning, fails by afternoon Thermal degradation; battery low Check battery voltage > 3.0 V; inspect capacitor ESR Replace lithium backup battery; clean heatsinks

9. Safety and Lifecycle Considerations

The S5-95U has been formally Discontinued by Siemens for many years, but spare-part service continues in selected regions. Any modification you make to OB1 today must survive the next engineer who services the machine without access to your notes. Apply these rules:

  • Always write the rationale as a comment in OB1's header section.
  • Keep a paper copy of the original OB1 alongside the modified one in the machine documentation binder.
  • Never raise SD 5 above the value the safety analysis (EN ISO 13849-1) tolerates.
  • When replacing the CPU with a modern S7-1200 or ET 200S controller (typical migration path), remove the OB31 call before generating the migration project — the workaround has no equivalent and is not required on any current Siemens platform.

10. Related Siemens Documentation

FAQ

What does the ZYK entry in the ISTACK mean on an S5-95U?

ZYK (Zykluszeit) means the OB1 cycle exceeded the configured scan-monitor time stored in SD 5. The default is 100 ms. The CPU forces a STOP and sets ZYK in the Interrupt Stack; it is the S5-95U's hard-wired watchdog trip and is unrelated to program content.

Is calling OB31 safe to leave in production code permanently?

Yes. OB31 is a standard Siemens organization block whose default body is a single BE instruction. Calling it from OB1 only re-arms the scan-monitor timer; it does not alter I/O, communication, or program logic. Many S5 service shops keep the OB31 call as a permanent fixture because it also hardens the program against occasional bus-load spikes that would otherwise fault the CPU.

Why does block status monitoring slow the scan so dramatically?

Block status requires the CPU interpreter to record the state of every operand after each instruction and ship the trace over the AS511 port on every cycle. Empirically, this adds 15 % to 40 % to the OB1 scan time, depending on the number of monitored blocks and the bit-instruction density. If the unguarded scan is at 90 ms, the monitored scan can easily exceed the 100 ms default watchdog window.

Where exactly should I place the OB31 call inside OB1?

At the temporal midpoint of the program. Count instructions weighted by execution cost (load/transfer ≈ 1 unit; bit logic ≈ 2 units; arithmetic and word logic ≈ 4 units) and place the OB31 call where the cumulative cost is roughly half the total. Placing it at the top or bottom provides no benefit because the watchdog still trips on the residual half-cycle.

Can I just raise SD 5 to 1 second and forget about block status?

Raising SD 5 to ~1000 ms removes the symptom but degrades the CPU's reaction to a runaway OB1. Do not use this approach on safety-relevant machinery (EN ISO 13849-1 PL ≥ c) without re-running the safety validation, because the slower scan monitor may exceed the fault-detection time budget. The OB31 re-trigger technique is always preferable because it preserves the watchdog's reaction time on the post-call portion of the cycle.

Back to blog