1. Problem Definition: OB80 Triggered by OB35 PID Execution
A SIMATIC S7-300/S7-400 CPU programmed with TIA Portal V13 SP1 Update 5 enters STOP (or remains running but logs an unacknowledged "System fault") the instant the operator attempts to switch a process PID controller to manual mode or pulse a reset input. The S7 diagnostic buffer records OB80, OB82, and OB122 as the error OBs being requested. The PID block is called inside OB35, the default 100 ms cyclic interrupt. While the loop runs untouched, control is normal. The fault only appears on the mode transition. This is a classic signature of a cyclic interrupt overrun, not a hardware failure.
The combination of OB80 + OB82 + OB122 is informative. OB80 is the time-error OB. OB82 is a diagnostic interrupt from a signal module (e.g. an SM 331/SM 332 analog module reporting wire break, channel fault, or overrange). OB122 is the programming-error OB fired when the program accesses an operand that does not exist at runtime (typically an out-of-range DB access triggered by corrupted data after the CPU was knocked into an inconsistent state). If only OB80 was present, the issue would be pure cycle-time. The presence of OB82 and OB122 indicates the OB80 STOP condition has cascaded into module diagnostics and pointer faults, and the operator must address all three layers.
2. Understanding OB80, OB82, and OB122 in S7
| OB | Name | Trigger Condition | Priority Class (S7-300/400) |
|---|---|---|---|
| OB80 | Time error | Cyclic interrupt overrun, cycle time exceeded, OB missing, time-of-day jump | 26 (F-run class) |
| OB82 | Diagnostic interrupt | An I/O module with diagnostic capability reports an event (wire break, overrange, undervoltage) | 26 |
| OB122 | Programming error | Direct access to non-existent DB/DI byte/word, area-length violation | Same priority as the OB that caused it |
Reference: Siemens Industry Online Support entry "Organization blocks (OB) for SIMATIC S7-300/400" — the official OB list and priority class assignments.
When a CPU is configured with an error OB of a given number, the CPU calls that OB instead of going to STOP. If OB80 is loaded and configured in the CPU properties, the time error is "swallowed" and the CPU remains in RUN, which is exactly the symptom reported: the program keeps running but the diagnostic buffer shows "System fault". If OB80 is NOT loaded, the same overrun forces a STOP-to-RUN failure. The fact that the user has OB80 loaded means the CPU is surviving the time error, but the underlying overrun is still real and will eventually corrupt the PID state.
3. Root Cause: Cycle Time Overrun in OB35
OB35 is a cyclic interrupt OB with a configurable period (default 100 ms) and priority class 12. Every period, the CPU suspends OB1 and runs OB35. If OB35 has not finished executing by the time the next period begins, the CPU requests OB80 with OB80_FLT_ID = 16#0002 (OB request error: requested OB is still active). The most common triggers in a PID context are:
- PID block execution time > OB35 period. A standard CONT_C / PID_CP block in TIA V13 typically executes in 1-3 ms on an S7-315/317. Multiple PIDs back-to-back, or a heavy custom PID FB, can easily push total OB35 time over 100 ms.
- Mode-transition logic expands execution time. On a switch from "automatic" to "manual" or on a reset edge, the FB must (1) freeze the integral component, (2) initialize the manual value, (3) ramp the output to track PV, (4) update status bits, (5) clear internal flags. This extra work happens inside the same OB35 tick and can push execution over the configured period.
- OB35 priority is too low for the task. OB1, OB40 (hardware interrupt), and OB1-based FCs that share the same I/O can preempt OB35 indirectly by stealing CPU time slices. A periodic OB1 with high scan time (e.g. 80 ms) leaves only 20 ms of headroom for OB35.
-
Process image update inside OB35. If the PID FB forces an I/O update with
L PEW / T PAWdirect-access calls, each access adds 0.5-1 ms. With 8-16 PIDs, this dominates.
4. Reading the S7 Diagnostic Buffer
- In TIA Portal: Project tree → PLC → "Go online" → "Online & Diagnostics" → "Diagnostics buffer".
- Click the most recent OB80 entry. The buffer shows the time, the OB number requested, the priority class, and a detailed event ID.
- Open OB80 in online view. The temporary (TEMP) variables
OB80_FLT_ID,OB80_ERROR_INFO,OB80_OB_NUMBER, andOB80_PRIORITYreveal the exact reason.
Sample diagnostic buffer entry you should look for:
Event 1 of 25: Time error OB (OB80) - Priority class: 12
OB requested: OB35
FLT_ID: W#16#0002 - OB request error
ERROR_INFO: W#16#00C8 - OB35 period (200 dec)
Event 2 of 25: Diagnostic interrupt OB (OB82) - Logical base: 256
FLT_ID 16#0002 confirms the cyclic OB is being requested again before the previous instance completed. ERROR_INFO high byte gives the configured period; low byte gives the priority. Use this to confirm that OB35 was the offender and that the period was the value you expected.
5. OB80 Local Variable Reference (FLT_ID Codes)
| OB80_FLT_ID (hex) | Meaning | Typical Cause |
|---|---|---|
| 16#0001 | Cycle time of OB1 exceeded | OB1 scan longer than max cycle time (CPU properties → Cycle/Maximum cycle time) |
| 16#0002 | OB request error: requested OB still active | OB35 still running when next tick fires |
| 16#0004 | Time-of-day interrupt time error | OB10-OB17 missed its time window |
| 16#0005 | Time error due to STOP command | Operator STOP, watchdog, or a deeper OB1xx error |
| 16#0006 | OB not loaded | A higher-priority OB was called but is missing in CPU |
| 16#0007 | OB priority class error | OB called at wrong priority (rare) |
| 16#0009 | Interrupt loss | OB40 hardware interrupt burst exceeded OB40 capacity |
Reference: Siemens Industry Online Support — search "OB80_FLT_ID" for the official mapping table in the SIMATIC S7-300/400 system and standard functions manual.
6. Solution 1: Increase OB35 Cycle Time
- Project tree → PLC → Properties → "Cyclic Interrupts".
- Select the
OB35row. - Change "Cycle time (ms)" from 100 to a value 30-50% above the worst measured OB35 execution. For most PID-heavy projects, 200 ms is a safe starting point.
- Optional: enable "Phase offset" (e.g. 50 ms) to desynchronize OB35 from the OB1 tick and reduce mutual preemption.
- Recompile (Project → Compile all) and download to the CPU.
To measure the current worst-case OB35 time, add the following watch table entries under "Diagnostics / Profiling" or enable the "Cycle Time" measurement in the CPU web server. Alternatively, write a small FB that records OB35_BEGIN_TIME (SFC64 "TIME_TCK" at OB35 start) and computes delta at end. Persistent values > 80% of the period mean you are at risk.
7. Solution 2: Distribute PIDs Across Multiple Cyclic Interrupts
S7-300/400 CPUs provide 8 cyclic interrupt OBs (OB30 through OB38) with fixed priorities and independently configurable periods. The PCS7-recommended distribution strategy is to assign each PID to its own OB, with a small phase offset, so they run sequentially rather than all at once. Practical mapping on an S7-315-2 PN/DP with TIA V13 SP1:
| OB | Priority | Suggested period | PID slot |
|---|---|---|---|
| OB30 | 8 | 1000 ms | Slow temperature loop |
| OB31 | 9 | 500 ms | Level loop |
| OB32 | 10 | 200 ms | Flow loop |
| OB35 | 12 | 100 ms | Primary PID (control loop) |
| OB36 | 13 | 50 ms | Fast pressure loop |
| OB37 | 14 | 20 ms | High-dynamics cascade inner loop |
| OB38 | 15 | 10 ms | Servo / position trim (only if required) |
Procedure in TIA Portal V13 SP1:
- Project tree → PLC → Program blocks → "Add new block" → "Organization block" → OB36.
- Set the period in the new OB's properties (PLC → Cyclic Interrupts).
- Move one PID_FB call from OB35 into OB36. Configure the inputs to the same PV / SP / I/O addresses.
- Repeat for as many PIDs as needed. Keep OB35 for the primary loop and a "hot spare" PID slot.
- Compile, download, restart in RUN.
With the spread, total worst-case PID execution is still ~3 ms × N, but it is no longer accumulated into a single 100 ms bucket. This is the PCS7 "Reduction Ratio" pattern: each cyclic interrupt runs its own subset of blocks, none of them saturate, and OB80 stays quiet.
8. Solution 3: Reduce PID Execution Time
Code-level optimization that compounds with Solutions 1 and 2:
-
Switch from direct I/O to process image. Replace
L PEW 288with symbolic access to the I-tag from the process image. Symbolic inputs are read from the IPI (input process image) at the start of OB1 and re-used by OB35 with zero extra cost. Symbolic I/O is enabled by default in TIA V13 SP1 when the symbol table is consistent. - Disable the I/O update in OB35. If the PID block exposes a "Update_Process_Image" input, drive it FALSE except for the first OB35 tick after a mode change. This cuts the update from every tick to once per transition.
-
Avoid DB accesses inside the PID loop body. Wrap DB calls in conditional code.
IF ManualMode THEN ... END_IF;ensures manual logic only runs when needed. - Profile with SFC87 "C_DIAG" or the Webserver cycle-time graph to identify which FB consumes the most time. Common offenders: FB186 (PID_CP auto-tuning), FB41 (CONT_C) with derivative action enabled, or any FC that calls a biquad filter per tick.
9. Solution 4: Address OB82 and OB122 Sources
OB82 fires when a diagnostic-capable I/O module (typically an SM 331 analog input or SM 332 analog output, e.g. 6ES7331-1KF02-0AB0) detects wire break, overrange, undervoltage, or a similar event. During an OB80 time error, the CPU may delay the I/O update long enough that the module's internal watchdog trips and reports the channel as faulty. Two-step fix:
- Open the device view of the affected module, "Module parameters" → "Diagnostics" → confirm wire-break and overflow diagnostic are enabled for the channels in use.
- In OB82, read
OB82_MDL_DEFECT,OB82_IO_FLAG, and the structured local variableOB82_Z1 / Z2 / Z3(channel status word) to identify the failing channel. Replace the wiring or add a 250 Ω shunt on a 4-wire RTD channel that is currently configured as 2-wire.
OB122 is a programming error: a direct access to a non-existent byte/word. After the OB80 time error leaves the PID in a transient state, a subsequent access (e.g. L DB100.DBW 200 when DB100 only has 100 bytes) fires OB122. In OB122, inspect OB122_SW_FLT (the type of error), OB122_BLK_TYPE, OB122_BLK_NUM, OB122_PRG_ADDR, and OB122_MEM_AREA to identify the access. In TIA V13, the structured "Program info" view jumps to the offending line. Wrap that access with a IF DB100.ActLength > 200 THEN ... END_IF; guard, or expand the DB to its maximum possible footprint.
10. PID Mode Switching Best Practices
The mode transition from "automatic" to "manual" is the moment where the FB carries the heaviest logic. To make it deterministic and OB80-safe:
-
Edge-trigger the mode change. Use a one-shot in OB1 (e.g.
IF ManReq AND NOT ManReqOld THEN ManualMode := TRUE; END_IF; ManReqOld := ManReq;). The edge fires once, executes the manual init, and the next OB35 tick handles the steady-state. - Anti-windup before manual switch. Set the PID FB's "I_ITVAL_ON" (or the equivalent "I-ITVAL" on CONT_C) to FALSE before the mode flip. This freezes the integrator and prevents an integral bump on the next automatic switch-back.
- Ramp the manual value. Instead of jumping the output to the manual setpoint, ramp it with the FB's built-in rate limiter. This smooths the transition and avoids a derivative spike on re-engagement.
- Sequence the reset. Tie the reset input to an edge in OB1, not to a level. The level-held reset keeps the integrator dead and forces the FB to clear outputs every tick, expanding execution time.
11. Verification Procedure
- After download, force the operator to switch the PID to manual in the HMI. Confirm the diagnostic buffer does not add a new OB80 entry.
- Open a watch table in TIA V13:
OB80_FLT_ID(read from a marker block in OB80's local data, copied at first call),OB80_CALLS(system-side counter in CPU system data),OB82_ENTRIES,OB122_ENTRIES. All three counters must remain flat across at least 50 mode transitions. - Run the worst-case scenario: toggle manual/auto every 200 ms for 10 minutes. OB80 must not fire.
- Check the S7-300/400 web server: "Diagnostics" → "Cycle time" must show OB35 max < 70% of period. If max > 80%, distribute PIDs across more OBs.
- Confirm the analog input quality byte in the IPI. The SM 331 channel status must show 0x00 (no fault) under all operating conditions.
12. TIA Portal V13 SP1 Configuration Notes
TIA V13 SP1 Update 5 is the last cumulative update for the V13 generation and supports both S7-300/400 (legacy) and S7-1200/1500 projects. A few items that often catch engineers upgrading from STEP 7 classic:
- Block compatibility. FB41 (CONT_C) imported from STEP 7 V5.5 is supported as-is. FB58 / FB186 (PID_CP) require the "PID Control Blocks" library under "Libraries → SIMATIC → Standard Library → PID Control". Confirm the library is installed in the TIA V13 SP1 setup (Options → Global libraries).
- Process image partition. TIA V13 SP1 introduces "Process image partitions" (PIP). Assign the PID I/O to PIP 1, automatically updated by OB35. This is the cleanest way to keep OB35's I/O deterministic.
- OB35 phase offset. Set this in the CPU properties, not inside the block. A 50 ms offset prevents OB35 from starting at the same instant as OB1's IPI update.
- Watch table v13 quirk. The online view of local data of OB80 was unstable in V13 SP1 prior to Update 4. If the watch table shows "Invalid handle", install Update 5 (which the user already has) and re-establish the online connection.
- Project size limit. The user's project is 5 MB. TIA V13 SP1 has a documented limit of 6 MB per project file; this is not the fault cause but is approaching the limit and explains why the upload was rejected on the source thread.
13. Field-Proven Quick Reference Table
| Symptom | OB fired | FLT_ID / local var | Most likely fix |
|---|---|---|---|
| OB80 only on mode change | OB80 | 16#0002 | Increase OB35 period to 200 ms; distribute PIDs |
| OB80 only on reset edge | OB80 | 16#0002 | Edge-trigger reset in OB1, not level-held |
| OB82 on first warm restart | OB82 | Channel status non-zero | Wait for analog input settling time; enable channel diagnostic |
| OB122 only after OB80 fires | OB122 | OB122_MEM_AREA = DB | Expand DB or guard access |
| CPU goes to STOP on mode change | none (OB80 missing) | — | Load OB80 first, then distribute PIDs |
What does the OB80 "System fault" message mean on a Siemens S7-300/S7-400?
It means the CPU detected a time error (cyclic interrupt overrun, exceeded OB1 max cycle time, missing OB, or time-of-day jump) and called OB80 because it was loaded. The CPU continues to run, but the diagnostic buffer logs every occurrence under FLT_ID codes 16#0001 through 16#0009. The most common code, 16#0002, indicates a cyclic interrupt OB (typically OB35) was requested before the previous execution finished.
How do I check what triggered OB80 in TIA Portal V13 SP1?
Go online to the PLC, open "Online & Diagnostics" → "Diagnostics buffer", and click the OB80 entry. The detail page shows OB80_FLT_ID (the reason code), OB80_ERROR_INFO (period or priority), OB80_OB_NUMBER (the cyclic OB that overran), and OB80_PRIORITY. In a watch table you can also monitor OB80_CALLS in the CPU system data for a long-term count of time errors.
Should I increase the OB35 cycle time or distribute PIDs across multiple OBs?
For temperature, level, and slow flow loops, increase OB35 to 200 ms and keep all PIDs in OB35. For fast pressure, cascade, or motion loops, keep OB35 at 100 ms and move inner-loop PIDs to OB36/OB37/OB38 with shorter periods and phase offsets. The PCS7 "Reduction Ratio" pattern of one PID per cyclic interrupt is the safest scaling strategy for projects with more than 4 PIDs.
Why does OB82 fire only when I switch the PID to manual?
During the mode change, the PID block expands its execution time and delays the IPI update. The SM 331/SM 332 module's channel watchdog (default 1.0 s, configurable in HW config) expires during the delay and reports a wire-break or overrange event. Either widen the module's watchdog in the device configuration, or shorten the PID transition logic so the IPI update happens within the watchdog window.
Can a STOP-causing OB80 be cleared without restarting the CPU?
No. A time error that brings the CPU to STOP requires an operator STOP-to-RUN transition (or power cycle) once OB80 is loaded and the offending code is fixed. The diagnostic buffer is preserved across the restart, so the new "Mode transition to RUN" entry will sit directly above the OB80 entries and confirm the cause. Add a permanent breakpoint in OB80 to count future occurrences in RUN.