1. Overview
On SIMATIC S7-1200 and S7-1500 controllers, an unhandled fault at runtime typically forces the CPU into STOP. The traditional defense is to load error organization blocks (OBs) whose presence alone tells the operating system that the programmer has acknowledged the fault class. This reference catalogs the OBs available on S7-1200 and S7-1500 firmware, explains how TIA Portal handles them symbolically, and walks through a sample project in which two S7-1200 CPUs exchange data over Industrial Ethernet while every relevant error OB is loaded so that the CPU cannot drop out of RUN for a recoverable fault.
Engineers migrating from STEP 7 classic (S7-300/400) will notice two major differences:
- OBs are referenced symbolically (by name) inside TIA Portal; the underlying numeric identifier is generated by the system.
- Several OBs can coexist with the same number but different priorities (OB1 is the exception; it is single instance).
2. STOP Conditions and Why OBs Matter
An S7-1200/1500 CPU transitions from RUN to STOP when the firmware detects a class of event for which no matching OB is loaded. The diagnostic buffer records the cause; the user sees only a flashing ERROR LED and a SF fault LED on the CPU. The principal fault classes are:
| Fault Class | Numeric OB | STOP Without OB? | Typical Trigger |
|---|---|---|---|
| Time error | OB 80 | Yes | Cyclic OB overflow, two consecutive OB1 timeouts |
| Diagnostic interrupt | OB 82 | Yes (configurable in S7-1500) | Wire break on AI, channel fault on DQ |
| Remove/insert interrupt | OB 83 | Yes | Hot-swapping a module on S7-1500 |
| CPU redundancy error | OB 84 | Yes | S7-1500R/H loss of partner |
| Program execution error | OB 85 | Yes | Updating process image mismatch, OB start error |
| Rack/station failure | OB 86 | Yes | PROFINET device drops out, ET 200SP station failure |
| Communication error | OB 87 | Usually no | Frame error, IP conflict at startup |
| Programming error | OB 121 | Yes | Indirect addressing on DB outside range, type conflict |
| I/O access error | OB 122 | Yes | Read of missing/removed I/O module |
If the corresponding OB exists in the program, the CPU logs the fault and continues. If the OB is missing, the CPU stops. Note that OB 85 in S7-1200 can be selectively suppressed by setting "Report of OB85 to PG/PC" in the device configuration; in S7-1500 the behavior is hardware-firmware controlled.
3. S7-300/400 vs S7-1200/1500 OB Architecture
| Characteristic | S7-300/400 (STEP 7 classic) | S7-1200/1500 (TIA Portal) |
|---|---|---|
| OB identification | Numeric only (OB80, OB82, ...) | Symbolic name + numeric ID; the name is the engineering identifier |
| Multiple OBs of same number | No (fixed) | Yes (e.g., five OB35s with priority 12-16) |
| Priority assignment | Fixed by OB number | Editable in properties dialog (1-26) |
| Configuration path | Insert > S7 Block > Organization Block | Project tree > CPU > Program blocks > Add new block > Organization block |
| Startup OBs (OB100/101/102) | Available on most CPUs | OB 100 available on S7-1500 only; OB 101/102 not supported on either line |
| Time error (OB80) handling | Single instance, priority 26 | Multiple instances, configurable priority (recommended 25) |
| Diagnostic buffer | Limited entries | Up to 3200 entries on S7-1500; exportable via web server |
For the engineer migrating a STEP 7 classic project, the only practical change is that the OB appears in TIA Portal as a block with a generated icon and an editable name; the firmware still treats OB80 as OB80. You do not need to renumber anything, but you must explicitly insert the block: an empty program does not include any error OB by default.
4. Available Error OBs in S7-1200 and S7-1500
The list below covers the OBs that affect RUN-to-STOP transitions. "Available" reflects firmware support as published in the Siemens function manuals. Verify against the SIMATIC S7-1200 Programmable Controller System Manual and the S7-1500 System Manual.
| OB | Name (Symbolic) | S7-1200 (FW 4.4+) | S7-1500 (FW 2.9+) | Purpose |
|---|---|---|---|---|
| OB 1 | Main | Yes | Yes | Cyclic main; always present |
| OB 80 | Cyclic time fault | Yes | Yes | Two OB1 timeouts in a row; cyclic OB overrun |
| OB 82 | Diagnostic interrupt | Yes | Yes | Module diagnostic, channel diagnostic |
| OB 83 | Insert/remove interrupt | No (no hot-swap) | Yes | Module pulled/plugged on ET 200 stations |
| OB 84 | CPU redundancy error | No | Yes (S7-1500R/H only) | Loss of redundancy partner |
| OB 85 | Program execution error | Yes (limited) | Yes | Process image update mismatch, OB start failure |
| OB 86 | Rack/station failure | Yes (PROFINET) | Yes | PN device loss, ET 200SP station failure |
| OB 87 | Communication error | Yes | Yes | IP duplicate address, frame error |
| OB 100 | Warm restart | No | Yes | Startup sequence after power-on/STOP-RUN |
| OB 121 | Programming error | Yes | Yes | DB out of range, type conversion, BCD error |
| OB 122 | I/O access error | Yes | Yes | Read/write of non-existent I/O |
5. Adding OBs in TIA Portal
- Open the project in TIA Portal V17 or later (V18/V19 are recommended for the latest S7-1500 firmware compatibility).
- Expand the CPU in the project tree: PLC_1 > Program blocks.
- Double-click Add new block. The dialog shows an icon group "Organization block".
- Select the desired OB. The dialog filters to OBs that are valid for the CPU type and firmware.
- Set the symbolic name (e.g.,
OB_TimeFault), the programming language (LAD, FBD, SCL, or GRAPH for some OBs), and the priority (defaults are sensible). - Click OK. TIA Portal inserts the OB with a generated start information block
TEMPstructure. - Implement the fault response inside the OB. For an OB that simply acknowledges the fault and logs the cause, a few lines of SCL are sufficient.
6. Symbolic vs Numeric OB Handling
Inside any FB or FC on S7-1200/1500, you cannot call an OB. OBs are activated only by the operating system. The symbolic name in TIA Portal is shown in:
- Program blocks tree
- Watch tables (as a row indicating the OB number and last execution timestamp)
- Diagnostic buffer entries (mapped to the symbolic name in TIA Portal V16+)
- Cross-reference (used like any other block symbol)
For PLC-to-PLC communication the receiving CPU must know the OB numbers only if it triggers them via RT_INFO, RD_SINFO, or similar system calls. The classic "scan the OB1 on the partner" pattern is replaced by the cleaner approach of reading the partner's tag values directly.
7. Programming Error OBs - Code Examples
The following SCL snippets illustrate the minimum useful body for each error OB. They are intended to be added to an S7-1200/S7-1500 project to suppress the STOP transition and to retain diagnostic information.
OB 80 (Cyclic time fault)
// OB_TimeFault (OB 80) - SCL
#OB80_EV_CLASS := EV_CLASS;
#tempFaultTime := OB_DATE_TIME;
#tempPriority := OB_PRIORITY;
#tempOBNumber := OB_OB_NUMBER;
// Increment a non-retain counter for trending
"dbTimeFaults".cntTotalFaults := "dbTimeFaults".cntTotalFaults + 1;
"dbTimeFaults".lastFaultAt := #tempFaultTime;
// Optional: trigger a graceful degradation
IF "dbTimeFaults".cntTotalFaults > 10 THEN
"alarmBuffer".consecutiveFaults := TRUE;
END_IF;
OB 82 (Diagnostic interrupt)
// OB_DiagInt (OB 82) - SCL
#tempIOState := LADDR_STATE; // 0 = OK, 1 = fault cleared, 2 = fault present
#tempChannelFault := IO_STATE;
IF #tempIOState = 2 THEN
"dbDiag".pendingFaults := TRUE;
"dbDiag".faultedIOAddress := LADDR;
"dbDiag".faultDetectedAt := OB_DATE_TIME;
ELSE
"dbDiag".pendingFaults := FALSE;
END_IF;
OB 86 (Rack/station failure - PROFINET)
// OB_RackFault (OB 86) - SCL
IF EVENT_CLASS = 16#38 THEN // fault incoming
"dbPN".stationFailed[STATION_ID] := TRUE;
ELSIF EVENT_CLASS = 16#39 THEN // fault outgoing
"dbPN".stationFailed[STATION_ID] := FALSE;
END_IF;
OB 121 (Programming error)
// OB_ProgErr (OB 121) - SCL
// OB121_INFO_1 contains the block type that faulted
// OB121_INFO_2 contains the relative address
"dbProgErr".blkType := B#16#0; // fill from BLK_TYPE if needed
"dbProgErr".faultAddress := INT_TO_WORD(OB121_MEM_ADDRESS);
"dbProgErr".faultAt := OB_DATE_TIME;
OB 122 (I/O access error)
// OB_IOAccErr (OB 122) - SCL
"dbIOErr".laddr := OB122_IO_ADDR;
"dbIOErr".blkNum := OB122_BLK_NUM;
"dbIOErr".cause := OB122_IO_LEN; // zero-length access = slot empty
OB_DATE_TIME, LADDR, EVENT_CLASS, OB122_MEM_ADDRESS) are part of the OB's default start information and appear automatically when the OB is inserted. Do not rename them; the firmware writes them on every OB call.8. S7-1200 to S7-1200 Industrial Ethernet Sample Project
The following minimal project demonstrates two S7-1200 CPUs (firmware V4.5+) exchanging data over Industrial Ethernet (PROFINET) while running with all relevant error OBs loaded. The architecture is summarized below.
8.1 Configuration
- Insert two S7-1200 CPUs in the TIA Portal project. Use the same firmware major version (e.g., both V4.5).
- In Devices & Networks, connect the PROFINET interfaces of both CPUs. TIA Portal will create a PROFINET subnet automatically.
- Assign fixed IP addresses: PLC_1 = 192.168.0.10, PLC_2 = 192.168.0.11, subnet mask 255.255.255.0.
- Ensure the S7 connection is permitted. On S7-1200 V4.x the Permit access with PUT/GET option must be enabled in the CPU's protection properties, unless the connection is configured explicitly inside the project (TSEND_C / TRCV_C).
8.2 Data Exchange Block
// FB_Exchange (SCL) - call from OB1 on both PLCs
IF "dbConfig".partnerIP = '192.168.0.10' THEN
// PLC_2 sends, PLC_1 receives
iStatus := TRCV_C(
EN := TRUE,
ID := 1,
LEN := 20,
DATA := "dbShared".rxBuffer,
CONNECT := "dbConfig".cnRcv,
COM_RST := FALSE,
DONE => "dbShared".rxDone,
BUSY => "dbShared".rxBusy,
ERROR => "dbShared".rxError,
STATUS => "dbShared".rxStatus);
ELSE
iStatus := TSEND_C(
EN := TRUE,
ID := 1,
LEN := 20,
DATA := "dbShared".txBuffer,
CONNECT := "dbConfig".cnSnd,
COM_RST := FALSE,
DONE => "dbShared".txDone,
BUSY => "dbShared".txBusy,
ERROR => "dbShared".txError,
STATUS => "dbShared".txStatus);
END_IF;
8.3 OB Coverage Checklist
| OB | Loaded on PLC_1 | Loaded on PLC_2 | Effect |
|---|---|---|---|
| OB 80 | Yes | Yes | Cyclic overload tolerated (e.g., heavy TSEND_C burst) |
| OB 82 | Yes | Yes | PN cable fault no longer trips STOP |
| OB 86 | Yes | Yes | Loss of partner tolerated; OB86 sets bit for HMI alarm |
| OB 121 | Yes | Yes | Bad index into dbShared logged instead of stopping |
| OB 122 | Yes | Yes | Invalid I/O read (e.g., disconnected SM) tolerated |
9. Startup OBs (OB 100/101/102) Availability
A frequent confusion with engineers coming from S7-300/400: OB 100 is available on S7-1500 only. The S7-1200 does not support any of the classic startup OBs. On S7-1200, all startup-specific initialisation belongs in OB 1's first scan, which is detected with bit OB1_FIRST_SCAN (true on the first cycle after a STOP-to-RUN transition). On S7-1500, OB 100 runs before OB 1 on every restart and may initialise non-retentive tag values.
10. Verification and Diagnostics
After downloading the project to both CPUs, perform the following acceptance test:
-
Bring online. Right-click each CPU and select Go online. TIA Portal should report
RUNfor both, with the "Operating mode" diagnostic indicating "RUN, no faults". - Force the error class. Disconnect the PROFINET cable between the two CPUs while both are in RUN. The diagnostic buffer of each CPU should now contain entries "OB 86 Rack/station failure" with priority 16#1A. Because OB 86 is loaded, the CPUs remain in RUN.
-
Check the OB86 start information. In the project tree, expand the partner CPU, open the online block
OB_RackFault, and use Monitor / Modify to readSTATION_IDandLADDR. The values identify which PROFINET device dropped. -
Recover. Reconnect the PROFINET cable. OB 86 will fire again (event class 16#39 - fault outgoing) and the watchdog bits in
dbPNwill clear. -
Force OB 121. From OB 1, execute a temporary statement that reads
DB_ANY(99)while DB 99 does not exist. The CPU will call OB 121 instead of going to STOP. -
Inspect via web server. Open
https://192.168.0.10in a browser (S7-1200 firmware 4.4+) and navigate to Diagnostics > Diagnostic buffer. Each forced fault appears with timestamp, event ID, and OB number.
11. Troubleshooting Matrix
| Symptom | Likely Fault | Required OB | Action |
|---|---|---|---|
| CPU STOPs after powering a remote I/O station offline | OB 86 missing | OB 86 | Insert OB 86 from the TIA Portal "Add new block" dialog |
| CPU STOPs on a wire-break fault from AI module | OB 82 missing | OB 82 | Insert OB 82; verify "Channel diagnostics" is enabled in module properties |
| CPU STOPs on indirect DB read with bad index | OB 121 missing | OB 121 | Insert OB 121; in OB 121 capture BLK_TYPE and MEM_ADDRESS |
| CPU STOPs after hot-removing a module on ET 200SP | OB 83 missing | OB 83 | Insert OB 83 (S7-1500 only) |
| CPU STOPs when cyclic OB 35 overruns | OB 80 missing | OB 80 | Insert OB 80; raise OB 35 cycle time or reduce workload |
| CPU STOPs on S7-1500R after partner lost | OB 84 missing | OB 84 | Insert OB 84; review redundancy configuration |
| CPU STOPs reading a removed PN slot | OB 122 missing | OB 122 | Insert OB 122; in OB 122 mark the slot as "removed" in the process image |
| CPU STOPs with "Programming error, BCD conversion" | OB 121 missing | OB 121 | Insert OB 121; replace BCD conversion with INT_TO_WORD or fix data source |
| CPU STOPs when IP duplicate is detected | OB 87 missing | OB 87 | Insert OB 87; resolve IP conflict on subnet |
| CPU still STOPs after all OBs are loaded | Fault class not covered | Open diagnostic buffer | Verify the recorded OB number against the table in Section 4 |
12. Frequently Asked Questions
Which OBs are mandatory to prevent an S7-1200 CPU from going to STOP?
For a typical I/O-fault-tolerant S7-1200 application, load OB 80 (time error), OB 82 (diagnostic interrupt), OB 86 (rack/station failure), OB 87 (communication error), OB 121 (programming error), and OB 122 (I/O access error). S7-1200 firmware 4.4 or later supports all of these. Startup OBs (OB 100/101/102) and OB 83 are not supported on S7-1200.
Can the same error OB number be added multiple times in TIA Portal?
Yes. On S7-1200 and S7-1500 you can add multiple instances of OB 80, OB 82, OB 86, OB 121, OB 122 etc. with different priorities (1-26). The firmware calls the highest-priority matching instance. OB 1 is single-instance and cannot be duplicated.
Does loading OB 121 or OB 122 mask the underlying fault permanently?
No. The OB executes once per fault, the diagnostic buffer still records the event, and the LED indicators update. The OB only prevents the CPU from leaving RUN. You still need to correct the root cause (invalid pointer, missing I/O, type mismatch) inside the OB body or in OB 1.
Where do I find a working sample project for S7-1200 to S7-1200 Industrial Ethernet communication?
The Siemens Online Support portal at support.industry.siemens.com hosts the "S7-1200 Communication" entry list, including the application example "S7 Communication with PUT/GET" and "Open User Communication with TSEND_C/TRCV_C" for V4.x CPUs. Use those as starting points and add the OBs from Sections 4-7 of this reference.
Why does my S7-1500 CPU still go to STOP even after I loaded OB 80?
Two common causes: (1) The OB has a programming error itself, so OB 80 is never reached. Check the diagnostic buffer for an OB 80 entry followed by an OB 121 with the offending block. (2) The priority of the new OB 80 is too low (default priority 26 is acceptable). Lower the OB 1 maximum cycle time, or raise OB 80 priority to 25 to ensure it preempts an overflowing OB 35.
Is it safe to suppress STOP with error OBs in a SIL/PL safety application?
Only after reviewing the F-CPU diagnostic requirements. Loading OB 121/OB 122 on the standard program does not affect the F-runtime group, but masking a wiring fault on a non-safety signal module that is supposed to drive a safety function can violate IEC 61508 diagnostic coverage. Validate the OB strategy against the F-CPU manual (S7-1200F/S7-1500F) and the application's safety plan.