Troubleshooting S5 to S7 Conversion XR.INI File and FC Block

David Krause12 min read
Other TopicSiemensTroubleshooting
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

Problem Overview

The Siemens S5 to S7 Converter is delivered with the optional S5-S7 Converting Blocks package in classic STEP 7 (part of SIMATIC Manager). When migrating an S5 program archive to a STEP 7 project, the converter requires three primary files in the working directory:

  • *.ST.S5D — the S5 program file (Symbol Table / Statement list)
  • *.XR.INI — the cross-reference initialization file describing block relationships and PLC type information
  • *.Z0.SEQ — the sequence file containing the block call order

Two failure modes are common during conversion:

  1. The converter reports "There is no .XR.INI file" even though the file is present in the project folder, often under a name like CERMST.INI.
  2. After the XR.INI is recognized, the STEP 7 compiler reports "No PLC type description found for called or addressed block FCx" and "No valid offline ASCII type description found for called or addressed block FCx" for FC2 through FC10 (and any other undeclared blocks).

This article documents the root cause of each failure, the verified fix, and the surrounding context for handling S5-specific OBs, FBs, and ASM statements during conversion.

Important: The S5-S7 Converter is a legacy tool. It is not part of TIA Portal. Migration paths from STEP 7 to TIA Portal are documented separately and require a fully compiled, error-free STEP 7 project as input.

Root Cause 1 — XR.INI File Not Detected

The converter does not scan the entire working directory for any file with an .INI extension. It expects the XR.INI filename to share the same 6-character prefix as the *.ST.S5D program file. The prefix is typically derived from the original S5 program name or the PG2000 archive label.

For example, if the program file is named CERM12ST.S5D, the converter looks for CERM12XR.INI — not CERMST.INI or CERM.XR.INI. The internal convention enforces a strict 6+6 character structure:

S5 File Role Required Naming Convention Example
Program (ST.S5D) XXXXXXST.S5D CERM12ST.S5D
Cross-reference (XR.INI) XXXXXXXR.INI CERM12XR.INI
Sequence (Z0.SEQ) XXXXXXZ0.SEQ CERM12Z0.SEQ

PG2000 sometimes writes the XR.INI with a non-matching prefix. Renaming the file in Windows Explorer resolves the detection issue, but the file contents must also be valid S5 cross-reference data. A truncated or corrupted XR.INI will pass the filename check but fail downstream with type-description errors.

Root Cause 2 — FC Block "No PLC Type Description" Errors

After the XR.INI is recognized, the STEP 7 compiler evaluates each block call. For every called block, it expects either:

  • An existing block (FB, FC, OB, DB, SFB, SFC) in the S7 program with matching number and parameter interface, or
  • A type description (offline ASCII source) compiled into the S7 project blocks folder.

If neither exists, two cascading errors appear:

  1. Error: "No PLC type description found for called or addressed block FCx"
  2. Warning: "No valid offline ASCII type description found for called or addressed block FCx"

The most common cause is that the FC numbers referenced in the S5 program (FC2 through FC10 in the reported case) do not exist as standalone S7 source files in the converted project. In S5, FCs were often called without strict declaration requirements. In S7, the declaration section (VAR_INPUT, VAR_OUTPUT, VAR_TEMP, VAR_IN_OUT) must precede the code section. Without the declaration, the compiler cannot generate the block interface, and the call site remains unresolved.

Field-proven constraint: In STEP 7, a function (FC) cannot be called successfully unless the declaration of the function's parameters is present in the source file before the code that calls it. This is a compile-time requirement, not a runtime error.

Solution 1 — Repair the XR.INI Naming

  1. Open the project folder containing the S5 archive files in Windows Explorer.
  2. Identify the *.ST.S5D filename and copy its first 6 characters (the prefix).
  3. Rename the XR.INI file so that its first 6 characters match, followed by XR.INI.
    ren CERMST.INI CERM12XR.INI
  4. Verify all three files share the same prefix:
    CERM12ST.S5D
    CERM12XR.INI
    CERM12Z0.SEQ
  5. Re-launch the S5-S7 Converter in SIMATIC Manager and open the *.ST.S5D file.

If the file rename does not resolve the issue, the XR.INI contents may be invalid. In that case, regenerate the cross-reference using STEP 5 (not PG2000) on a system with an S5 programming environment, then re-export the archive.

Solution 2 — Provide Missing FC Block Declarations

For each FC that produces a "No PLC type description" error, create the function in the S7 project and add it to the S7 program container before the calling block is compiled.

  1. In SIMATIC Manager, expand the S7 project and right-click the Blocks folder.
  2. Select Insert > New Object > Function.
  3. Assign the same number as the unresolved FC (for example, FC2).
  4. Open the new FC source in the STL/SCL editor and add a complete declaration block before the first network. A minimal template:
    FUNCTION FC2 : VOID
    VAR_INPUT
        // declare inputs from S5 interface
    END_VAR
    VAR_OUTPUT
        // declare outputs from S5 interface
    END_VAR
    VAR_TEMP
        // temporary variables
    END_VAR
    BEGIN
        // code body
    END_FUNCTION
  5. Save and compile the source. The "No PLC type description" error will clear on the next compile of the calling block.

For S5 standard library functions that have direct S7 equivalents, insert the S7 function from the S5-S7 Converting Blocks library instead of writing a new declaration. See the block mapping table below.

Handling ASM Statements and Special OBs

The S5 instruction set included an ASM directive for inline machine code, which STEP 7 cannot translate. The converter halts on any block containing ASM. The standard remediation workflow is:

  1. Open the S5 source file in a STEP 5 or PG2000 editor.
  2. Locate every ASM KH xxxx statement and comment it out (or replace with NOP 0).
  3. Remove any associated library number that referenced the S5 firmware function.
  4. Save the modified source, then re-run the converter.
  5. After conversion, manually rewrite the removed functionality in STEP 7 STL or SCL.

The reported archive contained three OBs that relied entirely on ASM calls and had no convertible code body:

S5 OB S5 Function S7 Equivalent
OB31 Scan Time Triggering OB35 (Cyclic interrupt, configurable interval)
OB160 Variable Time Loop OB35 + custom timer logic, or OB80/OB121 error handling
OB251 PID Control Algorithm FB41 (CONT_C) or PID control from Standard Library > PID Control Blocks

OB31, OB160, and OB251 in S5 were tied to S5 CPU firmware routines, not to user code. After conversion, replace them with the appropriate S7 standard blocks and tune the cycle / sampling parameters to match the original S5 timing constants.

Safety check: Before deleting any OB that contains an ASM call, confirm with the original S5 program documentation that the OB is not part of a safety shutdown sequence. S5 OBs were sometimes used to implement hardware-level interlocks that must be re-engineered in S7 with the appropriate F-runtime (F-CPU) blocks if the application is safety-relevant.

Mapping S5 Special FBs to S7 Equivalents

The S5 firmware blocks (FB238–FB251) were callable from user code and provided system-level services. STEP 7 does not have a direct one-to-one translation for all of them. The following table summarizes the FBs encountered in the reported archive and the recommended S7 substitute:

S5 Block S5 Function S7 Replacement Notes
FB238 COMPARE (block compare) User-written FC/FB using CMP == I / <, > No direct S7 standard block
FB239 DELETE (block delete from EPROM) No direct equivalent Runtime block deletion not supported in S7 user program
FB244 SEND (data send to another CPU) FC5 (AG_SEND) in Standard Library > Communication Blocks Used with configured S7 connection
FB245 RECEIVE (data receive from another CPU) FC6 (AG_RECEIVE) in Standard Library > Communication Blocks Pair with FC5 on opposite CPU
FB246 FETCH (read from remote CPU) FC7 (AG_LOCK) + FC8 (AG_UNLOCK) for read access, or SFB14 (GET) Configure S7 connection with read permission
FB247 CONTROL (control commands) SFB15 (PUT) or user-written FB Depends on S5 control function scope
FB248 RESET (initialization) OB100 (Restart) or user startup logic Map to S7 startup OBs
FB249 SYNCHRON (handshake coordination) User-written FC/FB with SEND/RECEIVE No direct S7 standard block
FB250 RLG:AE (read analog input) FC105 (SCALE) in Standard Library > TI-S7 Converting Blocks Pair with direct I/O read (e.g., PIW256)
FB251 RLG:AA (output analog value) FC106 (UNSCALE) in Standard Library > TI-S7 Converting Blocks Pair with direct I/O write (e.g., PQW256)

FB244 and FB245 are the most commonly converted blocks. The S7 equivalents (FC5/FC6) require an S7 connection configured in NetPro with the same partner ID, rack/slot, and connection type. The call interface differs — the S5 blocks used a parameter list; the S7 blocks use an ANY pointer for the source/destination area and a DONE/ERROR/NOTE status structure.

Verification Steps

  1. Open the converted S7 project in SIMATIC Manager and select the Blocks folder.
  2. Right-click and select Compile All (S7). The "No PLC type description" and "No valid offline ASCII type description" errors must not reappear.
  3. Open each FC referenced in the original S5 program and confirm:
    • The declaration section is present at the top of the source.
    • The interface matches the S5 call signature (input/output ordering, data types).
    • The code body executes the same logic, or that the S7 standard block replacement has been correctly parameterized.
  4. Open NetPro and verify that any AG_SEND/AG_RECEIVE pairs have a properly configured S7 connection (specified partner, connection resource, active/passive role).
  5. Download the compiled blocks to an S7 PLCSIM instance or a real S7-300/S7-400 CPU and run a test sequence that exercises each converted block.
  6. For analog I/O blocks (FC105/FC106), inject known input values and verify the scaled output matches expected engineering units within the configured tolerance.

Troubleshooting Matrix

Symptom Likely Cause Fix
"There is no .XR.INI file" XR.INI filename prefix does not match the ST.S5D prefix Rename to match the 6-character prefix: XXXXXXXR.INI
Same error persists after rename XR.INI contents are corrupt or empty Regenerate with STEP 5 instead of PG2000
"No PLC type description found for called or addressed block FCx" FCx does not exist in the S7 blocks container Insert new FC from S5-S7 Converting Blocks library or create a stub with full declaration
"No valid offline ASCII type description found for called or addressed block FCx" FCx source is missing the VAR_INPUT/VAR_OUTPUT declarations Add the declaration block before the code section and recompile
Converter halts on a block containing ASM S5 machine code directive not supported in STEP 7 Comment out ASM lines, remove library numbers, rewrite logic in S7 STL/SCL
OB31/OB160/OB251 produce empty S7 blocks These were S5 firmware-backed OBs with no convertible code Map to OB35 (cyclic interrupt) and FB41 (PID) per the table above
Compile error after inserting AG_SEND/AG_RECEIVE S7 connection not configured in NetPro Create a configured S7 connection with matching partner parameters and recompile
Analog value scaling incorrect after conversion FC105/FC106 limits (HI_LIM, LO_LIM) differ from S5 RLG block parameters Match bipolar/unipolar range and integer type to the S5 configuration

Preventive Measures for Future Conversions

  • Validate the S5 archive before conversion. Open the archive in STEP 5 (or PG2000) and regenerate the cross-reference data. A fresh XR.INI reduces downstream errors significantly.
  • Document all S5 standard block calls before conversion. List every FB/FC number and its purpose. The S5-S7 Converting Blocks library covers the common cases but not all firmware blocks.
  • Convert in stages. Process the main program first, then handle communication blocks (FB244/FB245), then analog blocks (FB250/FB251). This isolates errors and reduces the block count visible during each compile cycle.
  • Keep the declaration-before-call rule. In the S7 program, always insert and compile all called blocks (FCs, FBs) before compiling any block that calls them. The STEP 7 compiler performs a single-pass type resolution.
  • Use S7-S7 comparison tools. After conversion, run the STEP 7 program comparator against a reference program (if available) to identify missing or mismatched block interfaces.
  • Plan a safety review for any OB that contained ASM. The original ASM code may have implemented interlocks, diagnostics, or fault handling that has no direct S7 equivalent and must be re-engineered with proper validation.

Reference — Official Siemens Documentation

  • STEP 7 — From S5 to S7 (Siemens Industry Online Support, PDF) — Primary Siemens reference for the S5 to S7 conversion workflow, project setup in SIMATIC Manager, and block mapping guidance.
  • Siemens Industry Online Support — Product Support — Search for "S5-S7 Converter", "AG_SEND", "AG_RECEIVE", and "S5-S7 Converting Blocks" to retrieve application examples, function manuals, and firmware-specific notes.
  • STEP 7 Standard Library — Communication Blocks (FC5 AG_SEND, FC6 AG_RECEIVE, FC7 AG_LOCK, FC8 AG_UNLOCK) and TI-S7 Converting Blocks (FC105 SCALE, FC106 UNSCALE) — included in the STEP 7 installation under the libraries directory.

FAQ

Why does the S5 to S7 Converter say there is no .XR.INI file when the file exists in the folder?

The converter requires the XR.INI file to share the same 6-character prefix as the .ST.S5D program file. If the prefix does not match, the file is invisible to the converter. Rename the file to XXXXXXXR.INI where XXXXXX matches the first six characters of the .ST.S5D filename. If the contents are also invalid, regenerate the cross-reference using STEP 5 rather than PG2000.

How do I fix the "No PLC type description found for called or addressed block FCx" error in STEP 7?

Insert the missing FC into the S7 Blocks container (Insert > New Object > Function) with the same number, then add a complete declaration section (VAR_INPUT, VAR_OUTPUT, VAR_TEMP) before the code body. For standard S5 library functions, import the S7 equivalent from the S5-S7 Converting Blocks library. Recompile the calling block and the error clears.

What replaces S5 FB244 (SEND) and FB245 (RECEIVE) in STEP 7?

Use FC5 (AG_SEND) and FC6 (AG_RECEIVE) from the Standard Library > Communication Blocks. The call interface requires an S7 connection configured in NetPro with matching partner ID, rack, and slot. The S5 parameter list must be restructured into the S7 ANY pointer and status output format expected by AG_SEND/AG_RECEIVE.

What replaces S5 FB250 (RLG:AE) and FB251 (RLG:AA) for analog I/O?

Use FC105 (SCALE) for analog input and FC106 (UNSCALE) for analog output from the Standard Library > TI-S7 Converting Blocks. Configure the bipolar/unipolar mode, HI_LIM, LO_LIM, and integer type parameters to match the S5 RLG block configuration. The input/output address (e.g., PIW256, PQW256) is read or written directly before and after the call.

How should S5 OB31, OB160, and OB251 be handled in a converted STEP 7 program?

These OBs were backed by S5 CPU firmware routines and contain only ASM calls. Map OB31 (Scan Time Triggering) to OB35 (Cyclic Interrupt) with a configured scan interval, OB160 (Variable Time Loop) to OB35 plus custom timer logic, and OB251 (PID Control Algorithm) to FB41 (CONT_C) from the Standard Library > PID Control Blocks. Verify timing and tuning parameters against the original S5 application before commissioning.

Back to blog