S7-300 vs S7-1500 OB Priority Number Comparison Guide

David Krause18 min read
S7-300SiemensTechnical 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

Overview: OB Priority Concept Across SIMATIC Families

Organization blocks (OBs) are the program execution entry points in every Siemens SIMATIC controller. Whether the CPU is an S7-300, S7-400, S7-1200, or S7-1500, the operating system uses the OB priority class to arbitrate between blocks that become ready at the same time. When an OB is triggered (main scan, hardware interrupt, time-of-day, cyclic interrupt, time delay, error event, or startup), the operating system compares the new OB's priority with the priority of the OB currently active on the CPU. If the new priority is strictly higher, the current OB is suspended, its state is saved, and the higher-priority OB starts. Once the higher-priority OB completes, control returns to the suspended block at the point of interruption. If the new priority is equal or lower, the new OB is queued (or, in the case of cyclic interrupts, the event is dropped once the queue is full).

The rule is identical across all modern SIMATIC families: higher priority number equals higher priority. The official S7-1500 Comparison List for S7-300, S7-400, S7-1200, and S7-1500 from Siemens AG documents the common priority scheme, while the S7-1500 Cycle and Reaction Times Function Manual (Siemens entry ID 59193558) details the execution rules and configurability for the S7-1500 firmware. Three timing characteristics depend on OB priority: interrupt latency, preemption depth, and queue depth.

Quick Answer: Priority Direction Comparison

For the question "Does a higher OB number mean a higher priority?" the answer is the same for both S7-300 and S7-1500: yes. The two families differ in one important way: on the S7-300, the priority is encoded in firmware and cannot be changed; on the S7-1500, most OB priorities can be edited in TIA Portal hardware configuration.

Family Default OB1 priority Direction Configurable?
S7-300 1 Higher number = higher priority No (firmware-fixed)
S7-400 1 Higher number = higher priority No (firmware-fixed)
S7-1200 1 Higher number = higher priority Limited (cyclic and hardware)
S7-1500 1 Higher number = higher priority Yes (most OBs in TIA Portal)

S7-300/400 Fixed Priority Model

On the S7-300, every OB has a priority value that is hard-coded in the CPU firmware. STEP 7 V5.x does not expose a priority editor. The relationship between OB number and priority follows a strict pattern documented in the S7-300 CPU manuals:

  • OB1 (main cyclic program): priority 1
  • OB10-OB17 (time-of-day interrupts): priority 2 (each OB)
  • OB20 (time-delay interrupt 0): priority 3
  • OB21-OB23 (time-delay interrupts 1-3): priority 4-6
  • OB30 (cyclic interrupt 0): priority 7
  • OB31-OB38 (cyclic interrupts 1-8): priority 8-15
  • OB40 (hardware interrupt 0): priority 16
  • OB41-OB47 (hardware interrupts 1-7): priority 17-23
  • OB55 (status interrupt, DP): priority 2
  • OB56 (update interrupt, DP): priority 2
  • OB57 (profile-specific interrupt, DP): priority 2
  • OB60 (multicomputing / SFC 35 call): priority 9
  • OB70-OB72 (I/O redundancy error): S7-400 only, priority 25
  • OB80 (time error): priority 26 (fixed)
  • OB81 (power supply error): priority 26
  • OB82 (diagnostic interrupt): priority 26
  • OB83 (module removal/insertion): priority 26
  • OB84 (CPU hardware fault): priority 26
  • OB85 (program sequence error): priority 26
  • OB86 (rack/station failure): priority 26
  • OB87 (communication error): priority 26
  • OB90 (background OB): priority 29
  • OB100 (warm restart): priority 27
  • OB101 (hot restart): priority 27 (S7-400 only)
  • OB102 (cold restart): priority 27
  • OB121 (programming error): inherits the priority of the active OB
  • OB122 (I/O access error): inherits the priority of the active OB

An S7-300 user who needs a different priority for a cyclic interrupt has only one option: select a different OB number. If the application requires a cyclic interrupt at priority 10, the only choice is OB33. There is no way to set OB30 to priority 10 on an S7-300 CPU. The fixed model has the advantage of being fully deterministic across all S7-300 CPU models and firmware versions.

S7-1500 Configurable Priority Model

The S7-1500 firmware preserves the S7-300 priority order but introduces two major enhancements:

  1. Configurable priority in TIA Portal hardware configuration. Many OB priority values can be edited from the CPU properties dialog.
  2. Priority 0 disables an OB. Setting an OB priority to 0 prevents the operating system from ever starting it, even if the trigger event fires. The OB source remains in the project.

Configurable OB priorities on S7-1500 (TIA Portal V13+, firmware V1.0+):

  • OB10-OB17 (time-of-day): 1-26, default 2
  • OB20-OB23 (time-delay): 1-26, default 3-6
  • OB30-OB38 (cyclic interrupt): 1-26, default 7-15
  • OB40-OB47 (hardware interrupt): 1-26, default 16-23
  • OB60 (multicomputing): 1-26, default 9
  • OB70-OB72 (I/O redundancy, S7-1500R/H only): 1-26, default 25
  • OB82 (diagnostic interrupt): 1-26, default 26 (firmware V2.6+)

Fixed OB priorities on S7-1500:

  • OB1: 1 (main cyclic)
  • OB55-OB57: 2 (status/update/profile-specific)
  • OB80, OB81, OB83-OB87: 26 (error OBs)
  • OB90: 29 (background)
  • OB100-OB102: 27 (startup OBs)
  • OB121/OB122: inherit (priority of the active OB)
Confirm the configurable priority range for your specific S7-1500 CPU firmware version in the S7-1500 Cycle and Reaction Times Function Manual. The configurable range for OB82 was introduced in firmware V2.6.

Default OB Priority Reference Table

OB Name S7-300 priority S7-1500 default S7-1500 range
OB1 Main cyclic 1 1 1 (fixed)
OB10-OB17 Time-of-day interrupts 2 2 1-26
OB20 Time-delay interrupt 0 3 3 1-26
OB21-OB23 Time-delay interrupts 1-3 4-6 4-6 1-26
OB30 Cyclic interrupt 0 7 7 1-26
OB31-OB38 Cyclic interrupts 1-8 8-15 8-15 1-26
OB40 Hardware interrupt 0 16 16 1-26
OB41-OB47 Hardware interrupts 1-7 17-23 17-23 1-26
OB55 Status interrupt 2 2 2 (fixed)
OB56 Update interrupt 2 2 2 (fixed)
OB57 Profile-specific interrupt 2 2 2 (fixed)
OB60 Multicomputing / SFC 35 9 9 1-26
OB70-OB72 Redundancy error (S7-1500R/H) not supported 25 1-26
OB80 Time error 26 26 26 (fixed)
OB81 Power supply error 26 26 26 (fixed)
OB82 Diagnostic interrupt 26 26 1-26 (V2.6+)
OB83 Module removal/insertion 26 26 26 (fixed)
OB84 CPU hardware fault 26 26 26 (fixed)
OB85 Program sequence error 26 26 26 (fixed)
OB86 Rack/station failure 26 26 26 (fixed)
OB87 Communication error 26 26 26 (fixed)
OB90 Background OB 29 29 29 (fixed)
OB100 Warm restart 27 27 27 (fixed)
OB101 Hot restart 27 (S7-400 only) 27 27 (fixed)
OB102 Cold restart 27 27 27 (fixed)
OB121 Programming error inherits inherits inherits (fixed)
OB122 I/O access error inherits inherits inherits (fixed)

OB Execution Rules and Preemption Behavior

The priority class of an OB controls four behaviors in both S7-300 and S7-1500:

  1. Preemption by higher priority. When the operating system starts an OB, it compares the new OB's priority with the priority of the OB currently running. If the new priority is higher, the current OB is suspended. The state (accumulators, AR1/AR2, DB register, status word) is saved on the OB priority stack. When the higher-priority OB ends, the lower-priority OB resumes.
  2. Same-priority queueing. Cyclic interrupts (OB30-OB38) cannot be queued multiple times of the same OB; if the OB is still running when the next period elapses, the operating system reports OB80 with event identifier 0x0001 (cycle time exceeded). Hardware interrupts (OB40-OB47) can be queued to a depth defined per CPU; once full, additional events are lost and OB80 with identifier 0x0002 is reported.
  3. Error OB priority. OB80-OB87 run at fixed priority 26. They preempt OB1 (priority 1) and most user OBs. The startup OBs (OB100-OB102) run at priority 27, the highest in the user code, and can preempt error OBs.
  4. Inherited priority for synchronous errors. OB121 (programming error) and OB122 (I/O access error) execute at the same priority as the OB that caused the error. If the error occurs in OB1, OB121/OB122 run at priority 1. If the error occurs in OB35, they run at priority 7. OB121/OB122 cannot be preempted by an OB of the same or lower priority.
OB1 (Priority 1) OB40 (Priority 16) OB1 resumes t1: OB1 starts t2: OB40 fires t3: OB40 done OB1 is suspended at t2 because OB40 priority 16 > OB1 priority 1 OB1 state is saved; accumulators, AR1/AR2, DB register restored at t3

The background OB (OB90, priority 29) is special: it runs only when no other OB of priority 28 or higher is active. It is intended for low-priority housekeeping and self-test routines. The OB90 has no preemption relationship with the main cycle in the usual sense; it yields time only when the main cycle or any interrupt OB needs the CPU.

Process Image Partition Assignment and Priority

Both S7-300 and S7-1500 support process image partitions (PIP). Each PIP is updated when the OB assigned to it starts (inputs) and ends (outputs). The priority of the OB determines when the update occurs, and therefore the latency of input access. Common PIP assignments:

  • OB1 (priority 1): process image partition 0 is updated at OB1 start and refreshed at OB1 end.
  • OB35 (priority 12, 100 ms default): if PIP 1 is assigned to OB35, the inputs and outputs of PIP 1 are updated at OB35 start and end.
  • OB40 (priority 16): if PIP 2 is assigned to OB40, the inputs of PIP 2 are updated immediately when the hardware interrupt fires, before OB40 code runs.

This means that for time-critical inputs, the OB priority is closely tied to the latency of input access. High-priority OBs with assigned PIPs provide the fastest deterministic access to physical inputs. In STEP 7 V5.x, PIP assignment is set in HW Config by selecting the OB and opening Properties. In TIA Portal, the setting is in the CPU properties under System and clock memory.

Disabling Interrupts in Code: SFC 39/40 vs DISIRT/ENIRT

S7-300/400 code uses SFC 39 "DIS_IRT" to disable all interrupts and SFC 40 "EN_IRT" to re-enable them. S7-1500 code uses the equivalent TIA Portal instructions DISIRT and ENIRT:

// S7-1500 SCL example
"DISIRT"();            // disable all interrupts
"DB_Output".value := 100;  // atomic update
"ENIRT"();             // re-enable interrupts
// S7-300 STL example
CALL SFC 39             // disable all interrupts
L 100
T DB1.DBD0
CALL SFC 40             // re-enable interrupts

The S7-1500 also supports targeted interrupt disabling by passing a specific OB number to DISIRT, allowing a single OB to be suspended without affecting the rest of the interrupt tree. This is more granular than the SFC 39/40 behavior on the S7-300, which disables all interrupts globally. When interrupts are disabled, any OB that becomes active is queued (within queue depth) and not lost. Cyclic interrupts that fire while interrupts are disabled cause OB80 (cycle time exceeded) when the disable window ends, because the cyclic period has already been missed.

Configuring OB Priorities in TIA Portal (Step-by-Step)

  1. Open the project in TIA Portal (V16 or later recommended for full configurability).
  2. Select the S7-1500 CPU in the project tree.
  3. Double-click the CPU to open the Device view.
  4. Open Properties → System and clock memory → Interrupts.
  5. Click the row of the desired OB (for example, OB35 cyclic interrupt).
  6. Enter the new priority value between 1 and 26 in the Priority column.
  7. Optionally adjust the Phase offset and Period (cyclic interrupts only).
  8. Compile the hardware configuration and download to the CPU.

The priority change is part of the hardware configuration and is stored in the CPU system data blocks (SDBs). It is not part of the OB source. To verify the change took effect, go to Online → Online & Diagnostics → Cycle / clock memory and confirm the active OB and its priority in the runtime statistics. If the change does not appear, recompile the hardware configuration and re-download the SDBs. Setting the priority to 0 disables the OB; the block remains in the project but the operating system does not start it.

STEP 7 V5.x OB Properties (S7-300 / S7-400)

To inspect the priority of an OB in an existing S7-300 program in STEP 7 V5.x (SIMATIC Manager):

  1. Open SIMATIC Manager and the S7 project.
  2. Navigate to the S7 station and select the Blocks folder.
  3. Right-click the OB (for example, OB35) and select Object Properties.
  4. The General – Part 1 tab shows the Priority field, the OB number, and the OB type.
  5. The General – Part 2 tab shows process image partition assignment, local data stack size, and programming language.

To "change" the priority on an S7-300, the only option is to use a different OB number. For example, to run a cyclic interrupt at priority 12, use OB35. To run at priority 9, use OB32. The OB period is also fixed per OB number on the S7-300; adjusting the period requires CPU-specific SFCs (SFC 28 to set the period, SFC 30 to read it on CPUs that support the change).

Migration from S7-300 to S7-1500

When converting an S7-300 program to an S7-1500 using the TIA Portal migration tool, OB priorities are preserved by default because the S7-1500 default priorities match the S7-300 firmware values. Engineers porting programs do not need to reassign priorities for functional equivalence. Common migration considerations:

  • OB30-OB38 default periods match. Verify each OB's period setting in the hardware configuration after migration; the S7-300 default for OB30 is 5 s, and the S7-1500 default for OB30 is also 5 s.
  • OB55-OB57 (status, update, profile-specific interrupts) are S7-1500 OBs that do not exist on the S7-300. They are introduced when the migration target uses PROFINET IO with isochronous mode or PROFenergy.
  • OB70-OB72 (redundancy error OBs) apply only to S7-1500R/H redundant CPUs and are not generated during a standard S7-300 to S7-1500 migration.
  • OB82 priority configurability (1-26 range, firmware V2.6+) is a new option. The S7-300 OB82 always runs at priority 26. Engineers can lower OB82 priority on the S7-1500 if needed, but this is generally not recommended because diagnostic events should be processed at the highest user priority.
  • OB101 hot restart is supported on S7-1500 CPUs from firmware V2.0. S7-1500 firmware V1.x does not support OB101; verify the target firmware version before migration.
  • OB122 behavior on the S7-1500 can be set to either return a substitute value (S7-300 default) or stop the CPU, configured in TIA Portal hardware configuration under System and clock memory → I/O access error.
  • OB80 time error reporting on the S7-1500 includes more event identifiers than the S7-300, particularly for PROFINET IO and Web server events. Update error handling code accordingly.

Verification and Diagnostics Procedures

After changing OB priorities, verify the running behavior with these steps:

  1. Online OB monitor. In TIA Portal, go to Online & Diagnostics for the CPU → Cycle / clock memory. The current active OB and its priority appear in real time.
  2. Diagnostic buffer. TIA Portal → Online & Diagnostics → Diagnostic buffer. Filter on OB80-OB87 events. Each entry shows the priority (always 26 for OB80-OB87), the event identifier, and the timestamp.
  3. OB80 event identifiers (most common):
    • 0x0001: cycle time exceeded (cyclic OB overrun)
    • 0x0002: hardware interrupt queue overflow
    • 0x0003: time-delay interrupt queue overflow
    • 0x0005: local data stack overflow
    • 0x0007: OB not loaded (e.g., OB80 missing from project)
  4. Trace recording. TIA Portal Trace can record the OB system tag over time. Configure a 10-second trace, download, and trigger the OB transition. The trace confirms whether the configured priority is taking effect.
  5. Cross-reference of priority override. TIA Portal → Show Cross-references on the OB block lists references including the SDB priority override value.

For S7-300 verification in STEP 7 V5.x, use PLC → Monitor/Modify with a VAT (variable table) for the OB priority tags, and PLC → Diagnostic buffer to read OB80-OB87 events. S7-300 does not expose the OB name in the online monitor; the active OB must be inferred from the priority class in the SZL partial list extract.

Troubleshooting Matrix

Symptom Likely cause Diagnostic step Resolution
OB80 "cycle time exceeded" with identifier 0x0001 Cyclic OB period shorter than execution time Read diagnostic buffer; check OB30-OB38 period settings Increase the OB period or shorten the OB code
OB80 "hardware interrupt queue overflow" with identifier 0x0002 Hardware interrupt fires faster than OB can process Check OB40-OB47 priority and queue depth Raise OB priority, reduce event source rate, or shorten OB execution
OB40 does not preempt OB1 OB40 priority set to 0, or interrupt source not configured Inspect TIA Portal OB40 properties; check device configuration Set OB40 priority ≥ 2; ensure module channel is assigned to OB40
OB35 runs at unexpected priority on S7-1500 Priority override not downloaded; SDB not refreshed Compare offline priority in TIA Portal with online SDB Re-download hardware configuration; verify SDB timestamp in diagnostic buffer
OB90 background not running Higher-priority OBs occupy all CPU time Monitor CPU scan time vs. available idle time; check OB30-OB38 periods Reduce cyclic OB period or optimize main scan; verify OB90 local data size
OB1 suspended by unexpected interrupt Misconfigured hardware interrupt source Check I/O assignment in device configuration; read diagnostic buffer Reassign module channels to the intended OB
Migrated S7-300 program shows different OB ordering on S7-1500 OB priorities not re-evaluated after migration Cross-reference OB priority table; compare with original S7-300 program Reassign priorities in TIA Portal to match original intent
OB1 runs to completion before interrupts fire All interrupts globally disabled (DISIRT active) Search program for DISIRT or SFC 39 calls Remove or scope the disable instruction to specific code regions
OB82 does not fire on PROFINET diagnostics OB82 priority not downloaded, or PROFINET diagnostics not enabled Check device configuration → PROFINET IO → diagnostics enable Re-enable PROFINET diagnostics and re-download configuration
OB122 returns no substitute value on S7-1500 OB122 behavior changed to "stop CPU" in TIA Portal Check CPU properties → System and clock memory → I/O access error Set OB122 behavior to "substitute value" or update program to handle the error
S7-1500 OB30-OB38 periods not editable CPU firmware does not support period configurability Check CPU firmware version in TIA Portal → Online & Diagnostics → Identification Update CPU firmware to V2.0+ for full period configurability

Safety OBs on F-CPUs (S7-300F / S7-1500F)

Both S7-300F and S7-1500F CPUs add safety-related OBs that run at fixed priorities. These OBs are part of the F-runtime and are not user-configurable. S7-300F safety OBs include OB35 (F cyclic interrupt, priority 12, 100 ms default) and the F-error OBs at priority 26. S7-1500F safety OBs include OB30 and OB35 (F cyclic interrupts, configurable priority 1-26), OB80-OB87 (F error, priority 26), and OB123 (F programming error, inherits from the active F-OB). When migrating a safety program from S7-300F to S7-1500F, the TIA Portal safety migration tool automatically remaps the F-OBs. Verify the F-OB priorities match the S7-1500F default values in the TIA Portal safety administration editor. The F-shutdown OBs (OB82 safety variant) on the S7-1500F run at the maximum priority and cannot be modified.

Recommendations

Based on the comparison above, the following recommendations apply when designing or migrating a SIMATIC program:

  1. Keep OB1 at priority 1 for both S7-300 and S7-1500. The main cyclic program is the lowest-priority user code; interrupt OBs should preempt it.
  2. Use the firmware default OB numbers for the priority you need. On the S7-300, choose OB30 for priority 7, OB33 for priority 10, OB35 for priority 12, and so on. There is no need to edit priorities on the S7-300.
  3. On the S7-1500, leverage the configurable range for performance tuning. If a cyclic interrupt handles a time-critical task, raise its priority to 20-25 to ensure it preempts most user OBs.
  4. Use priority 0 to disable an OB on the S7-1500 instead of deleting the OB source. This preserves the code and the trigger event association in the hardware configuration.
  5. Never modify the fixed-priority OBs (OB80-OB87, OB100-OB102, OB90). The operating system relies on these values for error handling and startup sequencing.
  6. For safety programs on F-CPUs, do not modify F-OB priorities. The safety integrity level depends on the certified F-runtime behavior.
  7. During migration from S7-300 to S7-1500, re-evaluate the priority scheme. The S7-1500 configurability is an opportunity to optimize interrupt handling that did not exist on the S7-300.

FAQ

Does a higher OB number mean a higher priority on the S7-300?

Yes. The S7-300 firmware assigns a fixed priority to each OB number. OB1 runs at priority 1, OB10 at priority 2, OB35 at priority 12, and OB100 at priority 27. Higher numbers always win, and the priority is not editable in STEP 7 V5.x.

Is the OB priority rule the same for the S7-1500?

Yes. The S7-1500 preserves the rule: higher number means higher priority. The S7-1500 additionally allows most OB priorities to be edited in TIA Portal hardware configuration, a feature not available on the S7-300.

Can I change OB35's priority to 5 on an S7-300?

No. STEP 7 V5.x does not allow editing OB priorities on the S7-300. To use priority 5 you must choose a different OB number (for example, OB22 for a time-delay interrupt at priority 5, or OB32 for a cyclic interrupt at priority 9). On the S7-1500, OB35 can be set to any priority from 1 to 26 in TIA Portal.

What happens if I set an OB priority to 0 on the S7-1500?

The OB is registered in the project but the operating system will never start it. The OB block remains in the program; setting the priority back to a value between 1 and 26 and re-downloading the hardware configuration re-enables it. This is a clean way to disable an interrupt source without deleting the source code.

Why does my error OB (OB82) interrupt my main OB1 on the S7-1500 but not on the S7-300?

Both families assign OB82 priority 26, well above OB1's priority 1. If OB82 is not preempting OB1, verify that the diagnostic interrupt source is enabled in the device configuration, that the channel is assigned to OB82, and that OB82 is not set to priority 0 on the S7-1500 (TIA Portal hardware configuration).

Do S7-1200 CPUs use the same OB priority rule?

Yes. The S7-1200 follows the same rule: higher number means higher priority. The S7-1200 supports OB1, OB30-OB38 (cyclic interrupt, priority 7-15), OB40-OB47 (hardware interrupt, priority 16-23), OB80-OB87 (error OBs at priority 26), OB100-OB102 (startup at priority 27), and OB121/OB122 (inherit). Time-of-day interrupts (OB10-OB17) were added in firmware V4.4.

Back to blog