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
- CFC Compilation Architecture and SCL Compiler Invocation
- Root Causes of SCL Compilation Failures Across PCS 7 Versions
- SCL Compiler Error Diagnosis and Block Generation Workflow
- SCL Compilation Fault Comparison Matrix
- Step-by-Step Procedure to Diagnose and Resolve SCL Block Generation Errors
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
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
Sourcescontainer. - If the source passes compilation without syntax errors, the binary function (
FC) or function block (FB) is committed to the offlineBlockscontainer. 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
INTandWORD, orDWORDandREAL, 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:
- Standalone compilation generates an interactive error list at the bottom of the editor.
- Double-clicking an error jumps directly to the line of code responsible for the failure.
- 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:
INT_TO_WORD()).FUNCTION FCxxx.Step-by-Step Procedure to Diagnose and Resolve SCL Block Generation Errors
Method: Standalone SCL Source Debugging and Recompilation
- Open SIMATIC Manager on the Engineering Station.
- Expand the target CPU's S7 Program folder and select the Sources container.
- Inspect the SCL source files in the right pane. Open the source file containing the definition for
FC961(or search forFUNCTION FC961across source files). - Double-click the source file to launch the S7-SCL Editor.
- From the menu bar, select File > Compile (or press
Ctrl + K). - Inspect the Compiler Output pane at the bottom of the window.
- Double-click the first reported error to navigate directly to the offending line.
- Correct the syntax (e.g. replace implicit casting
wVal := iVal;with explicitwVal := INT_TO_WORD(iVal);). - Recompile the SCL source. Confirm that compilation finishes with 0 Errors and 0 Warnings.
- Verify that
FC961now appears in the offline Blocks container. - Return to the CFC Editor and execute Chart > Compile > Changes Only.
Verification
To verify that the SCL block and CFC charts compile properly:
- Offline Block Presence: Inspect the S7 Program's Blocks folder. Confirm that
FC961exists with a current timestamp. - CFC Clean Compilation: In the CFC Editor, compile the charts. Confirm that compilation finishes with 0 errors.
- 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
Sourcesfolder; 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
- Siemens AG: SIMATIC S7-SCL V5.6 for S7-300/400 User Manual (Doc No. A5E41221768)
- Siemens AG: SIMATIC Process Control System PCS 7 CFC for S7 / PCS 7 Manual (Doc No. A5E03415129)
- Siemens Industry Online Support Entry ID 109780813: SIMATIC PCS 7 Software Update and Block Migration Guide
Related Articles
- https://industrialautomation.net/search?query=pcs7+cfc+compilation+scl+compiler+error+fc+generation
- https://industrialautomation.net/search?query=s7-scl+syntax+errors+strict+type+checking+upgrade
- https://industrialautomation.net/search?query=simatic+manager+sources+folder+recompile+scl
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