Resolving SCL Compiler Errors During Block Generation (FC961) in SIMATIC PCS 7 CFC

Resolving SCL Compiler Errors During Block Generation (FC961) in SIMATIC PCS 7 CFC

When migrating a SIMATIC PCS 7 project from V8.0 to V8.1 and CFC compilation fails with 'Error messages from the SCL compiler during generation of the FC961 block', the failure occurs because an underlying Structured Control Language (SCL) source in the S7 Program's Sources folder contains syntax errors, obsolete type casting, or unresolved symbol references under the newer SCL compiler version. Because the compilation aborted, FC961 was never generated in the offline block folder. To resolve it, open the S7 Program's Sources folder in SIMATIC Manager, locate the SCL source file designated to produce FC961, and compile it directly (Ctrl + K) in the SCL Editor to view the exact error line and corrective syntax requirements.

Table of Contents

Executive Summary

Continuous Function Chart (CFC) compilation in SIMATIC PCS 7 is an automated multi-pass process. While engineers design interconnections graphically, the compiler frequently invokes the native Structured Control Language (SCL) compiler in the background to compile user-written algorithmic functions, custom technological blocks, or complex mathematical expressions. When upgrading a project from PCS 7 V8.0 SP4 to V8.1, engineers frequently encounter compilation aborts stating: 'Error messages from the SCL compiler during generation of the FC961 block'. Inspecting the offline block folder reveals that block FC961 is completely missing, creating confusion. Understanding that FC961 was never generated because its source failed SCL compilation allows engineers to navigate directly to the SCL source code and rectify syntax mismatches.

CFC Compilation Architecture and SCL Compiler Invocation

When executing Chart > Compile > Charts as Program in PCS 7:

  • The CFC editor verifies chart interconnections and generates intermediate code.
  • If the project utilizes custom technological blocks authored in SCL or blocks compiled from text sources, CFC triggers the command-line SCL compiler (s7sclapp.exe).
  • The compiler parses the SCL text file located in the Sources container.
  • If the source passes compilation without syntax errors, the binary function (FC) or function block (FB) is committed to the offline Blocks container. If any syntax or type rule fails, block generation aborts immediately.

Root Causes of SCL Compilation Failures Across PCS 7 Versions

Upgrading PCS 7 versions introduces stricter compiler validation rules in SIMATIC SCL:

  • Strict Type Checking: SCL V8.1 enforces rigorous type checking rules compared to older releases. Implicit conversions between INT and WORD, or DWORD and REAL, that compiled with warnings in V8.0 trigger hard compilation errors in V8.1.
  • Symbol Table Discrepancies: If global symbols referenced inside the SCL source are missing or have altered data types in the project's Symbol Table, compilation fails.
  • Changed System Functions: References to standard system functions (SFCs / SFBs) whose interface definitions changed between library versions cause interface mismatch errors.

SCL Compiler Error Diagnosis and Block Generation Workflow

Because CFC's compilation summary window displays only the generic abort message, diagnosing the underlying problem requires compiling the source file standalone in the S7-SCL Editor:

  1. Standalone compilation generates an interactive error list at the bottom of the editor.
  2. Double-clicking an error jumps directly to the line of code responsible for the failure.
  3. Standard compiler output identifies whether the issue is an undeclared identifier, data type incompatibility, or missing semicolon.

SCL Compilation Fault Comparison Matrix

The following table categorizes common SCL compiler errors encountered during PCS 7 upgrades:

Error Symptom in SCL EditorRoot CauseImpact on CFC CompileCorrective Engineering ActionE: Data type mismatchImplicit conversion not permitted in SCL V8.1Aborts block generationUse explicit conversion functions (e.g. INT_TO_WORD()).E: Identifier not foundVariable missing from Symbol Table or DBAborts block generationAdd missing global symbol to Symbol Table.E: Block number conflictTarget FC/FB number already occupiedAborts block generationAssign an unused FC number in SCL header: FUNCTION FCxxx.W: Variable not initializedLocal variable read before assignmentCompiles with warningInitialize temporary variable explicitly in code.E: Interface changeCalled FB/FC has newer timestampAborts block generationUpdate block call in SCL source; recompile.

Step-by-Step Procedure to Diagnose and Resolve SCL Block Generation Errors

Method: Standalone SCL Source Debugging and Recompilation

  1. Open SIMATIC Manager on the Engineering Station.
  2. Expand the target CPU's S7 Program folder and select the Sources container.
  3. Inspect the SCL source files in the right pane. Open the source file containing the definition for FC961 (or search for FUNCTION FC961 across source files).
  4. Double-click the source file to launch the S7-SCL Editor.
  5. From the menu bar, select File > Compile (or press Ctrl + K).
  6. Inspect the Compiler Output pane at the bottom of the window.
  7. Double-click the first reported error to navigate directly to the offending line.
  8. Correct the syntax (e.g. replace implicit casting wVal := iVal; with explicit wVal := INT_TO_WORD(iVal);).
  9. Recompile the SCL source. Confirm that compilation finishes with 0 Errors and 0 Warnings.
  10. Verify that FC961 now appears in the offline Blocks container.
  11. Return to the CFC Editor and execute Chart > Compile > Changes Only.

Verification

To verify that the SCL block and CFC charts compile properly:

  1. Offline Block Presence: Inspect the S7 Program's Blocks folder. Confirm that FC961 exists with a current timestamp.
  2. CFC Clean Compilation: In the CFC Editor, compile the charts. Confirm that compilation finishes with 0 errors.
  3. Online Download Test: Perform a delta download to S7-PLCSIM or the physical AS controller in RUN. Confirm that the CPU accepts the newly generated block without calling error OBs.

Limitations and Operational Precautions

  • Source Code Preservation: Always preserve original SCL source files in the project's Sources folder; without the source text, SCL blocks cannot be edited or adapted during future PCS 7 version upgrades.
  • FC Numbering Rules: When assigning FC numbers in SCL headers, avoid numbers reserved by Siemens standard libraries (FC0 to FC59 and FC60 to FC99 are typically utilized by standard mathematical and conversion libraries).
  • Master Data Library Synchronization: If the block is used across multiple controllers, copy the corrected SCL source and compiled FC into the Master Data Library (MDL).

Engineer FAQ

Why was FC961 missing from the block folder when the error mentioned it?

The error occurred during compilation of the source text; because compilation aborted, the binary block was never generated.

Can SCL blocks be decompiled back into source text from controller memory?

No. The controller stores only raw MC7 bytecode; comments, variable names, and high-level SCL structures exist only in the offline source.

Does S7-SCL require a separate engineering license in PCS 7?

In SIMATIC PCS 7 Engineering Station packages, the S7-SCL license is included as part of the standard engineering toolset.

Technical References

Related Articles

Related Tags

  • https://industrialautomation.net/search?query=simatic-pcs7
  • https://industrialautomation.net/search?query=cfc-editor
  • https://industrialautomation.net/search?query=s7-scl
  • https://industrialautomation.net/search?query=compilation-error
6 respuestas