Automatic Generation of OB80 and System Blocks via Driver Generation in PCS 7
In SIMATIC PCS 7, Organization Blocks such as OB80 (Time Error), OB82 (Diagnostic Alarm), and OB86 (Rack Failure) should not be manually created in the S7 Program's Blocks folder because the CFC Module Driver Generator automatically creates and deletes them during chart compilation. If S7-PLCSIM or an AS controller halts due to a missing OB80, it indicates that the program contains no active driver blocks. Inserting at least one standard PCS 7 channel driver block (such as Pcs7DiIn or Pcs7AnIn) connected to a valid symbolic hardware address and compiling CFC with 'Generate Module Drivers' checked automatically instantiates @CPU_RT and generates OB80 alongside all required diagnostic organization blocks.
Table of Contents
- PCS 7 System Block Management vs Classic STEP 7 Programming
- The Role of the CFC Module Driver Generator and @CPU_RT
- System Organization Blocks and Driver Generation Matrix
- Step-by-Step Procedure to Generate OB80 and System Charts
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
PCS 7 System Block Management vs Classic STEP 7 Programming
In traditional STEP 7 programming, software engineers manually create Organization Blocks (OB80, OB82, OB85, OB86, OB121, OB122) in the Blocks folder to handle processor interrupts, cycle overruns, and hardware faults. If an unhandled interrupt occurs and the corresponding error OB is missing, the CPU transitions immediately to STOP mode.
In SIMATIC PCS 7, manual management of system blocks is strictly prohibited and actively counteracted by the compiler. PCS 7 relies on a fully automated system generation concept: during CFC compilation, the Module Driver Generator evaluates the hardware configuration, determines what diagnostic handlers are required, and automatically writes the appropriate OBs into the Blocks folder while generating the internal system charts (@CPU_RT, @STW4_...). If an engineer manually inserts OB80, the compiler treats it as unmanaged code and deletes or overwrites it during the next compile.
The Role of the CFC Module Driver Generator and @CPU_RT
The core engine responsible for system stability in PCS 7 is the Module Driver Generator (s7jcfcax.exe). Its operation depends on technological channel drivers:
-
Triggering Driver Generation: Driver generation is triggered when CFC charts contain standard APL or Basis Library channel driver blocks (
Pcs7DiIn,Pcs7DiOu,Pcs7AnIn,Pcs7AnOu) whose hardware inputs are interconnected to symbols in the hardware configuration. -
Instantiating
@CPU_RT: When channel drivers are detected, the compiler generates a dedicated hidden system chart named@CPU_RT. Inside@CPU_RT, the blockCPU_RTmonitors cyclic execution times and cycle overflows. -
Generating System OBs: To support
CPU_RTand hardware monitoring, the compiler automatically generatesOB80(Cycle time exceeded),OB82(Diagnostic interrupt),OB83(Insert/remove module),OB85(Priority class error),OB86(Rack failure),OB100(Warm restart), andOB121/OB122(Programming/access errors).
System Organization Blocks and Driver Generation Matrix
The following table summarizes the system Organization Blocks generated automatically by PCS 7:
CPU_RT in @CPU_RTMOD_D1, MOD_HA, MOD_SWMOD_D1, MOD_HACPU_RT / OB_DIAG1RACK, MOD_D1Step-by-Step Procedure to Generate OB80 and System Charts
To correctly generate OB80 and eliminate S7-PLCSIM or controller halt errors:
-
Insert a Standard Channel Driver Block:
- In your CFC chart folder, open any chart (or create a temporary test chart).
- From the PCS 7 Advanced Process Library (APL), drag a channel driver block—such asPcs7DiIn(FB1871) orPcs7AnIn(FB1869)—into the chart. -
Interconnect to a Hardware Symbol:
- In HW Config, configure at least one digital or analog I/O module.
- In the Symbol Table, assign a symbolic name (e.g.,Spare_DI_1) to an input address (e.g.,I 0.0).
- In CFC, connect thePV_Inpin ofPcs7DiInto the symbolic addressSpare_DI_1. -
Compile CFC with Generate Module Drivers Enabled:
- In CFC, select Chart -> Compile -> Chart as Program.
- Ensure the checkbox Generate module drivers is checked.
- Select Scope: Entire program and click OK. -
Inspect Generated Blocks:
- Open the S7 Program's Blocks folder in SIMATIC Manager.
- Confirm thatOB80,OB82,OB85, andOB86are now present.
- In the CFC chart tree, verify that system charts@CPU_RTand@STW4_...have been generated. -
Download to PLCSIM or Controller:
- Download the program to S7-PLCSIM or the physical CPU. The CPU will now run continuously without stopping on time errors.
Verification
Verify system block operation:
1. Open S7-PLCSIM or connect online to the S7-400 CPU.
2. Open the CPU Diagnostic Buffer (PLC -> Module Information -> Diagnostic Buffer).
3. If a temporary cycle time overrun occurs, verify that the diagnostic buffer records 'Cycle time exceeded' but the CPU remains in RUN because OB80 executed and prevented a CPU halt.
4. In CFC, open the @CPU_RT chart online and observe live cycle execution time measurements on CPU_RT.
Limitations and Operational Precautions
- Never Manually Insert OBs in PCS 7: Manually copying OBs into the Blocks folder corrupts compiler metadata and can cause unpredictable driver generation failures.
- Cycle Time Limits: While
OB80prevents immediate CPU stoppage during occasional cycle overruns, recurring cycle overruns indicate CPU overload; adjust cyclic interrupt intervals (e.g., increase OB35 from 100 ms to 200 ms). - Advanced Process Functions (APF): When using APF or industry-specific add-ons, always ensure the underlying baseline PCS 7 APL hardware drivers are compiled before downloading APF blocks.
Engineer FAQ
Why does the CFC compiler delete OB80 after I manually insert it?
PCS 7 enforces strict automated lifecycle management of system blocks. If an OB is inserted manually without corresponding driver blocks, the Module Driver Generator deletes unmanaged blocks to prevent address conflicts.
What happens if OB80 is called twice in the same cycle?
If the CPU cycle time exceeds the configured maximum cycle time twice within the same cycle period, the CPU enters STOP mode regardless of OB80 presence to protect the process.
Can I edit the code inside OB80 in PCS 7?
No. The code inside OB80 is generated automatically by PCS 7 to invoke the @CPU_RT handler. Any manual edits will be overwritten during the next compile.
Where is the maximum scan cycle time configured?
In HW Config, double-click the S7-400 CPU, open the 'Cycle/Clock Memory' tab, and adjust the 'Scan cycle monitoring time' parameter (default: 6000 ms in PCS 7).
Technical References
- SIMATIC Process Control System PCS 7 Basis Library (V9.0 SP1) Function Manual (A5E39140304-AB)
- SIMATIC S7-400 CPU Data: Reference Manual (A5E00850741-08)
- Siemens Industry Online Support: Automatic Generation of Module Drivers in PCS 7 (Entry ID: 109756832)
Related Articles
- Resolving Module Driver Compilation Error S7JS7CAX When Migrating Charts to PCS 7 V9.0
- Resolving ET 200SP HA Module Driver QMODF Faults in PCS 7 V9.0 SP1
- Diagnosing S7-400 CPU STOP Events via Diagnostic Buffer Event Codes
Related Tags
- OB80
- Module Drivers
- @CPU_RT
- S7-PLCSIM
- Time Error