1. Overview: Migrating a SIMATIC S5-100U to an S7-300
The SIMATIC S5-100U is an end-of-life controller from the 1980s/1990s. Migrating a running S5 program (.S5D source files) to a SIMATIC S7-300 requires the legacy S5-S7 Converter tool that ships with STEP 7 V5.x. The converter translates STEP 5 statement lists (AWL/STL) into STEP 7 AWL, renumbers blocks, and emits an ASCII source that must be re-imported into a STEP 7 project and recompiled.
Because the S5-100U and S7-300 CPUs use different operand areas, different timers/counters, and a different block model (PB/FB vs. FC/FB), no conversion is fully automatic. A typical migration of a machine program finishes with warnings on standard function blocks (FB240/241/242/243 = arithmetic) and errors on unsupported organization blocks (OB31) that must be manually resolved before the S7 program can be downloaded.
Reference: SIMATIC S5 to S7 Migration Manual (Siemens, PDF).
2. Prerequisites
- STEP 7 V5.4 SP5 or later (V5.5/V5.6 also work). The S5-S7 converter is bundled in the installation and registers itself under Windows Start → SIMATIC → STEP 7 → S5-S7 Converter.
- Windows XP/7/10 PC with admin rights (the converter requires registry access to map STEP 5 standard FB names).
- Source file
*.S5Dcreated with STEP 5 (S5-DOS, S5 for Windows, or the PG-685/PG-740 programming software). - An S7-300 station configuration in STEP 7 with the correct CPU (e.g., 314, 315-2 DP, 315-2 PN/DP, 317-2) and matching signal modules (SM321/SM322/SM331/SM332) wired to the field.
- A copy of the original S5 documentation, especially the cross-reference list and the I/O address assignment. The S5-100U default I/O area is
IB 0…IB 127andQB 0…QB 127; the S7-300 default isIB 0…IB 127in the process image, but slot addresses differ.
.S5D files, the S5 EPROM contents (if available), and the wiring diagrams before the conversion. The S5 program is the only authoritative machine recipe.3. Block Mapping Produced by the S5-S7 Converter
When you start the converter, the Preheader window shows a one-to-one block-number translation table. A typical S5-100U machine program maps as follows:
| S5 Block | S5 Name | Default (S5) | New (S7) | Notes |
|---|---|---|---|---|
| FB240 | CODE:B4 | Standard FB | FC81 | Arithmetic; uses S5 accumulator model |
| FB241 | CODE:16 | Standard FB | FC82 | Coded 16-bit operations |
| FB242 | MUL:16 | Standard FB | FC83 | 16-bit multiply |
| FB243 | DIV:16 | Standard FB | FC84 | 16-bit divide |
| FB250 | RLG:AE | Standard FB | FC0 | RLG → AE (result-of-logic → analog input) |
| FB251 | RLG:AA | Standard FB | FC1 | RLG → AA (result-of-logic → analog output) |
| OB1 | — | Cyclic main | OB1 | Direct match; S7 has richer startup/error OBs |
| OB31 | — | Time-of-day interrupt (S5) | No direct match | Must be replaced by S7 OB10…OB17 |
| PB1…PB7, PB12, PB13 | — | Program blocks | FC2…FC10 | Sequence-block call pattern changes |
| DB1 | — | Data block | DB1 | Structure preserved |
The exact FC numbers in the New column are assignable in the converter dialog; the numbers above are the default that STEP 7 picks to keep the legacy program order. Override them only if your machine documentation already references the new numbers.
4. Running the S5-S7 Converter
- Launch the converter from
Start → SIMATIC → STEP 7 → S5-S7 Converter. The executable path is\Program Files\Siemens\Automation\STEP7\S7U5C\s7u5capx.exe(also reported as\Program Files\Siemens\Step7\S7U5C\s7u5capx.exeon older installs). - Select File → Open and load the
*.S5Darchive. The tool reads the cross-reference and the block list. - Review the Preheader mapping table (see Section 3). Change the Default column to the New column only if the documentation requires it; otherwise accept the defaults.
- Click Start. The converter emits a STEP 7 ASCII source (
*.AWL) and a log file listing warnings and errors. - Locate the
*.AWLin the output folder (default:STEP7\S7U5C\OUTPUT).
A typical conversion of an S5-100U machine program finishes with 2 errors and 11 warnings, as in the source post. The next two sections explain each class.
5. Resolving "Preheader Does Not Exist" Warnings (FB240, FB242)
The S5 standard function blocks (FB240…FB243, FB250, FB251) do not have a STEP 7 preheader because the equivalent arithmetic is now expressed as native STEP 7 instructions. The converter therefore emits a warning for every call site of the old FB. Three resolution options exist:
-
Replace by intrinsic STEP 7 arithmetic. Open the S7 AWL source and replace
with the STEP 7 native equivalent:CALL FB240 // S5 standard function NAME:CODE:B4 L IW10 // 16-bit input T MW20 // 16-bit output
ForL IW10 T MW20FB242 (MUL:16)andFB243 (DIV:16), use* Iand/ Iinstructions directly. - Insert the S5 standard FB as a re-implementation in the S7 FC. Copy the algorithm from the S5 manual and rewrite it inside the new FC81…FC84. The official Siemens S5-S7 Migration Manual contains the AWL source of every standard FB.
- Suppress the warning. Accept the warning, recompile, and verify the test machine. Only valid if the FC call is never executed in the program (dead code) or if the block has been verified manually.
Invalid address at line 47) almost always mean the S5 program used area-internal addresses such as FY 200 (flag byte) or DW 200 (data word) that do not exist in the S7-300 process image. Replace FY 200 with MB 200 and DW 200 with DBW 200 inside the correct DB.6. Resolving the OB31 Error
The S5-100U OB31 is the time-of-day interrupt organization block. S5 triggers it once a day at the time programmed in OB31's header. The S7-300 family provides OB10 through OB17 for the same purpose, each with its own start time and periodicity. The error means the converter has no S7 target for the OB31 instance.
Resolution procedure:
- Open the original S5
OB31and note the scheduled time and the day mask. - In the S7-300 hardware configuration, double-click the CPU, open the Time-of-Day Interrupts tab, and enable OB10 (or OB11…OB17 if OB10 is already used).
- Set the Execution to Once daily and the Start time to the same value used in S5 (e.g.,
02:00:00). - Create a new
OB10source in the S7 project, copy the S5 OB31 body into it, and adjust the operand names (see Section 7). - Re-compile the S7 program. The OB31 error should disappear.
7. Operand Adjustments (S5 → S7)
Even after the converter runs successfully, you must scan the generated AWL for the following operand classes and edit them in STEP 7:
| S5 Operand | Meaning | S7 Replacement | Notes |
|---|---|---|---|
I 0.0…I 127.7 |
Digital input bit | Same syntax | Slot address may differ — verify with HW Config |
Q 0.0…Q 127.7 |
Digital output bit | Same syntax | Watch PQB 256+ for distributed I/O on PROFINET |
F 0.0…F 255.7 |
Flag / Merker bit | M 0.0…M 255.7 |
Direct rename |
FY 0…FY 255 |
Flag byte | MB 0…MB 255 |
Direct rename |
T 0…T 31 |
Timer (S5) | S7 timer 0…511 or IEC TP/TON/TOF in FB |
S5 timer word/word-LE always reinterpreted; convert to IEC for portability |
C 0…C 31 |
Counter (S5) | S7 counter or IEC CTU/CTD/CTUD
|
Counter word format differs (BCD vs. binary) |
DW 0…DW 255 |
Data word in current DB | DBW 0…DBW 255 |
DB must be open with OPN DB
|
PY 0…PY 127 |
Peripheral byte |
PIB/ PQB/ PID/ PQD or process image |
Direct slot access |
KS, KT, KC
|
S5 constants | STRING, S5TIME#xx, CHAR | Constant types do not exist in S7 |
Symbolic addressing: STEP 5 used a single global symbol table; STEP 7 separates the Symbol Table (project-wide) from the DB structures. Re-enter the machine symbols in the STEP 7 Symbols editor and assign them to the new FC/FB/DB numbers.
8. Importing the Converted AWL into STEP 7
- Open SIMATIC Manager and select (or create) the target S7-300 station.
- Open the S7 Program container and select the
Sourcesfolder. - Right-click → Insert New Object → External Source (German UI: Einfügen → Externer Quelltext). Name the source
Migration. - Double-click the new source to open the AWL editor.
- Copy the entire content of the converter's
*.AWLoutput into the editor and save (File → Save). - Right-click the source in SIMATIC Manager and choose Compile (or Generate S7 Program in older UI). STEP 7 now produces the blocks
FC0…FC84,OB1,DB1, and any new OBs (e.g.,OB10). - Open each newly created block and fix the warnings the converter reported (Section 5).
Sources folder of the S7 program. This is the most common reason migration engineers think the tool is missing.9. Verification and Commissioning
- Block-consistency check. In SIMATIC Manager choose Options → Check Block Consistency. The tool flags any block whose interface has changed since the call sites were compiled.
- Cross-reference. Open Options → Reference Data → Display and compare against the S5 cross-reference to ensure every operand is still used and every I/O is wired to the same physical terminal.
- PLC download to a stopped CPU. Use PLC → Download with the CPU in STOP. Watch the diagnostic buffer for "BLOCK<xxx> NOT FOUND" errors, which indicate missing FC/FB.
-
Single-scan test. In online mode, force
OB1to a single cycle and observe process-image consistency with the original S5 behavior. - I/O wiring check. Force each input and read each output on the S7-300 SM modules; confirm they match the S5 wiring diagram and that no terminal has been swapped.
- Time-of-day test. Set the CPU clock to one minute before the OB10 start time, enter RUN, and verify the OB10 body executes once and stops.
- Full production dry run with the machine in a safe state and the original S5 unit powered off but connected as a reference.
10. Common Errors and Troubleshooting Matrix
| Symptom | Root Cause | Fix |
|---|---|---|
| Preheader does not exist warning for FB240/FB242 | S5 standard FB has no S7 preheader | Replace call by native STEP 7 arithmetic (Section 5) |
| Invalid address at line N | Operand outside the S7 process image or wrong area | Replace FY/DW/PY with MB/DBW/PIB (Section 7) |
| OB31 conversion error | S5 time-of-day OB has no S7 default target | Map to OB10…OB17 and re-schedule (Section 6) |
| File → Import menu not present | Wrong import path; not a STEP 7 bug | Use Sources → External Source (Section 8) |
| Converter not found in Start menu | STEP 7 installed without S5-S7 option | Run Setup.exe → Modify → enable "S5/S7 Converter" |
| Download fails with "Block FC81 not found" | Source not compiled in SIMATIC Manager | Right-click source → Compile, then Download |
| Inputs read inverted vs. S5 | PNP vs. NPN wiring or inverted SM321 type | Insert NOT or change module variant |
| Counter reads 0 even though C0 was loaded | S5 counter word was BCD; S7 counters use binary | Convert with BCD_I/I_BCD or migrate to IEC counter |
| OB10 never triggers | Time-of-day interrupt not enabled in HW Config | CPU Properties → Time-of-Day Interrupts → Activate OB10 |
| 2 errors / 11 warnings stay after rebuild | Auto-generated FC/FB from S5 standard blocks still unhandled | Manually edit FC81…FC84 or accept warnings if dead code |
11. Field-Proven Caveats
-
No round-trip. S5-S7 is a one-way street. Do not attempt to feed the converted
*.AWLback into STEP 5. - Step 7 V5.5 / V5.6 are still maintained for legacy S7-300 support but require a valid license. TIA Portal V18+ also supports S7-300 import but cannot call the S5-S7 converter; you must run the legacy tool first and then import the AWL into a TIA Portal V18+ S7-300 station via Migration → Migrate S7-300 project.
-
FB/SFB/SFC equivalents. S5's integrated functions such as
FB250 RLG:AEandFB251 RLG:AAare obsolete on S7; use the analog input/outputs directly with theFC105 SCALEandFC106 UNSCALEstandard library functions included with STEP 7 V5.x. - Time base. S5-100U timer resolution is 10 ms. S7-300 timers can be configured for 10 ms, 100 ms, 1 s, or 10 s via HW Config → CPU → Timers. Mismatch causes timing drift on packaging and metering machines.
-
Process image update. S7-300 updates OB1 process image once per cycle. S5 updated per-byte. Long OB1 scan times on S7 may force you to call
OB1 "Update Process Image"partially withUPIB 0/UPQB 0to maintain identical behavior.
12. FAQ
Where is the S5-S7 converter installed on my PC?
Launch it from Start → SIMATIC → STEP 7 → S5-S7 Converter. The executable is s7u5capx.exe in \Siemens\Step7\S7U5C (or \Siemens\Automation\STEP7\S7U5C). If the shortcut is missing, re-run the STEP 7 Setup and enable the "S5/S7 Converter" option.
Why do I get "File → Import" missing in STEP 7 V5.4 SP5?
STEP 7 V5.x does not provide a top-level Import for AWL files. You must right-click the S7 Program's Sources folder, choose Insert New Object → External Source, paste the converted *.AWL, save, and then right-click the source → Compile.
What does "Preheader does not exist" mean for FB240/FB242?
FB240…FB243 are S5 standard arithmetic function blocks. S7 implements the same operations as native AWL instructions (+I, -I, *I, /I). The converter emits a warning because the S5 call cannot be mechanically translated; replace the call with the native instruction in the generated FC81…FC84.
How do I migrate the S5 OB31 time-of-day interrupt?
Create a new OB10 in the S7 project, copy the S5 OB31 body into it, and activate OB10 in HW Config → CPU → Time-of-Day Interrupts with the same start time and periodicity as the original S5 OB31 header. The converter's OB31 error will then disappear.
Can I import the converted AWL into TIA Portal instead of STEP 7 V5.x?
Yes. First complete the conversion with the legacy S5-S7 converter under STEP 7 V5.4/V5.5 to produce a working S7-300 project, then open TIA Portal V18+ and use Project → Migrate S7-300/400 project to bring the S7 station across. The S5-S7 converter itself does not run inside TIA Portal.