Resolving Missing Block Type Errors (FB24) During SIMATIC PCS 7 CFC Compilation

Resolving Missing Block Type Errors (FB24) During SIMATIC PCS 7 CFC Compilation

A compilation failure in SIMATIC PCS 7 reporting that a function block (e.g., FB24) is missing or cannot be found occurs when a CFC chart references a block type that exists neither in the target AS S7 Program's Chart Folder nor in its Offline Block Folder. To resolve this: (1) In SIMATIC Manager Component View, expand the AS CPU to S7 Program -> Blocks and verify whether FB24 is present; (2) If FB24 is in the block folder but missing from CFC, open any CFC chart, select Options -> Block Types, select FB24 in the left pane (Block folder), and click the right arrow (->) to import it into the Chart folder; and (3) If FB24 is entirely absent, copy it from your project Master Data Library (MDL) or source library into the S7 Program block folder, then import it into CFC.

Table of Contents

Executive Summary

During routine automation engineering, library migrations, or program modifications in SIMATIC PCS 7 V7.1 or V9.0, compiling CFC charts into executable controller machine code (Compile Charts as Program) can occasionally halt abruptly with an unspecific error message referencing a missing block number (such as FB24 or similar library functions). New automation engineers are frequently disoriented because the compiler summary does not immediately pinpoint the specific chart, sheet, or hierarchy path where the error occurred. This compilation fault originates from a broken synchronization between the CFC chart catalog and the underlying STEP 7 offline block container (bausteine). Understanding how CFC manages block types and imports ensures rapid resolution.

Architecture and Fundamental Mechanics

The block management and compilation pipeline of the CFC Editor operates through a two-tiered container architecture:

  1. The Offline Block Folder (bausteine) vs. Chart Folder (pläne):
    - Offline Block Folder: Resides in STEP 7 Component View under [AS] -> [CPU] -> S7 Program -> Blocks. This container holds compiled machine code headers for all Function Blocks (FBs), Functions (FCs), and Data Blocks (DBs).
    - Chart Folder / CFC Catalog: Resides under S7 Program -> Charts. For a block to be instantiated or compiled in a CFC chart, the block type must be formally registered in the Chart Folder catalog.

  2. Why Missing Block Errors Occur:
    - Case 1: Block Exists Offline but Not in Chart Folder: If an engineer copies a block into the S7 Program block folder or modifies an SCL source, CFC does not automatically register it. If a chart references the block, the compiler halts because the block type was not imported via Options -> Block Types.
    - Case 2: Accidental Block Deletion: An engineer might delete FB24 from the block folder, unaware that a legacy chart or an instantiated macro uses it. When the compiler traverses the charts, it detects the block instance in CFC but finds no matching compiled FB header in the block folder, triggering a fatal compile halt.
    - Case 3: Unmigrated Legacy Library Blocks: When migrating older projects (e.g., PCS 7 V7.1), legacy standard blocks (such as FB24 representing standard controller functions) may not exist in newer library versions unless explicitly copied from the Master Data Library or PCS 7 Legacy Library.

  3. The Role of Options -> Block Types: The Block Types dialog functions as the synchronization bridge: the left pane enumerates blocks residing in the offline folder, while the right pane enumerates blocks imported into the chart folder. Moving blocks across synchronizes compiler interface definitions.

Step-by-Step Implementation Procedure

Locate, restore, and synchronize the missing block type using the following procedure:

  1. Locate the Block in Component View:
    - In SIMATIC Manager, switch to Component View (View -> Component View).
    - Expand the multi-project tree: [AS Project] -> [SIMATIC 400 Station] -> [CPU] -> S7 Program -> Blocks.
    - Scroll through the block list to check if FB24 (or the flagged block) is present in the container.

  2. Restore Missing Block from Master Data Library:
    - If FB24 is missing from the block folder:

    • Open your project's Master Data Library (or File -> Open -> Libraries -> PCS 7 Standard Library).
    • Locate FB24 in the library's Blocks folder.
    • Right-click FB24, select Copy, return to your AS project's Blocks folder, and select Paste.
  3. Import Block Type into CFC Chart Folder:
    - Open any CFC chart within the target AS program.
    - In the CFC menu bar, select Options -> Block Types.
    - In the Block Types dialog:

    • Look at the left pane labeled Block folder.
    • Select FB24.
    • Click the right arrow button (->) to move FB24 into the right pane labeled Chart folder.
    • If FB24 already appears on the right, click the New Version or Clean Up button to refresh interface timestamps.
    • Click OK. CFC imports the block type and updates its internal catalog.
  4. Identify Errant Chart Instances if Block is Obsolete:
    - If FB24 is an obsolete block that should be removed rather than restored:

    • In CFC, select Options -> Block Types.
    • Select FB24 in the right pane and click Chart Reference List.
    • The list displays the exact chart name, sheet number, and block instance name referencing FB24.
    • Open that specific chart and delete or replace the obsolete block.
  5. Recompile CFC Charts:
    - In SIMATIC Manager, select PLC -> Compile -> Charts as Program.
    - Select Scope: Entire Program and compile. The compilation will complete with zero missing block errors.

Verification

Verify compilation success and program integrity:

  1. Compiler Log Verification: Inspect the CFC compiler log window. Confirm that compilation finishes with status 0 Errors, 0 Warnings.

  2. CFC Catalog Inspection: Open the CFC catalog pane. Expand the All blocks or S7 Program folder. Confirm that FB24 is listed with its proper symbolic name, author, and version.

  3. Online Download Test: Download the compiled program (Changes Only) to the AS controller. Confirm that the CPU remains in RUN mode without diagnostic buffer complaints.

Limitations and Operational Precautions

Never paste a block type into the S7 Program block folder that was compiled with a different version of the S7-SCL or CFC compiler without running 'Update Block Types'; mixing incompatible internal block header formats can corrupt the offline chart database. Always maintain authoritative block copies inside the multi-project Master Data Library.

Engineer FAQ

Why did CFC not tell me which chart contained the missing block?

The CFC compiler performs an initial global scan of registered block types before parsing individual chart sheets. If a registered type definition is missing, the compile aborts globally before evaluating chart specifics.

How do I find which chart is using a specific FB?

In the CFC Editor, select Options -> Block Types, select the FB in the right-hand list, and click the Chart Reference List button. It displays all charts and sheet coordinates where the block is instantiated.

What is the difference between Component View and Plant View in SIMATIC Manager?

Component View displays the physical hardware and S7 Program database structure (CPUs, block folders, charts). Plant View displays the technological plant hierarchy (Areas, Units, Equipment) used for WinCC and BATCH organization.

Can I delete a block from the S7 Program block folder if it is in a CFC chart?

No. Deleting an FB or FC from the block folder while an instance remains in a CFC chart causes compilation to fail with a missing block error.

What does the 'Clean Up' button do in the Block Types dialog?

It scans all CFC charts and un-registers any block types from the Chart Folder that are no longer used by any chart in the project.

Technical References

Related Articles

Related Tags

  • CFC Compilation
  • Block Types
  • FB24
  • Component View
  • Master Data Library
  • S7 Program
20 respuestas