Overview
The SIMATIC S7-1200 controller family does not compile or load programs written in Statement List (STL/"AWL") that were authored for the SIMATIC S7-300/S7-400 generation. STL is intentionally excluded from the S7-1200 instruction set; the supported languages are Ladder Diagram (LAD), Function Block Diagram (FBD), and Structured Control Language (SCL). Direct import of compiled STL blocks from STEP 7 V5.x into the S7-1200 controller is therefore impossible. Migration must follow one of two engineering paths:
- Manual/Assisted rewrite: re-author the original algorithm in LAD, FBD, or SCL inside TIA Portal.
- SCL conversion: port the STL logic to SCL, which is a textual, high-level Pascal-style language available on S7-1200 CPUs from firmware V4.0 onward. Earlier S7-1200 firmware versions required V2.2.0 for SCL activation.
This reference describes the technical boundary between S7-300 STL and S7-1200, the firmware and toolchain prerequisites, a deterministic conversion procedure, and the verification checks that confirm a ported FB/FC operates identically on the target CPU.
S7-1200 Programming Language Matrix
The following table summarizes language availability on each Siemens controller generation relevant to a migration. Items marked with an X are supported natively; items marked with a footnote indicate conditional support.
| Language | S7-300/400 (STEP 7 V5.x) | S7-1200 (TIA Portal, all FW) | S7-1500 (TIA Portal) |
|---|---|---|---|
| LAD | X | X | X |
| FBD | X | X | X |
| STL (AWL) | X | Not supported | X (limited subset) |
| SCL | X (optional package) | X (FW V2.2.0+) | X |
| GRAPH | X (optional package) | Not supported | X |
| CFC | X (optional package) | Not supported | Not supported |
Prerequisites for Migration
CPU Firmware Requirements
SCL on the S7-1200 first appeared in firmware version 2.2.0, released alongside STEP 7 (TIA Portal) V11 SP2. New features bundled with FW V2.2.0 include:
- SCL (Structured Control Language) compiler/runtime.
- Download in RUN (program changes while the CPU is in RUN mode).
- CM 1243-2 AS-i Master.
- CM 1241 RS422/485 communication module.
- SM 1222 DQ8 RLY Changeover.
Current S7-1200 CPUs in production ship with firmware V4.2.x or later. SCL is fully integrated; no optional authorization is required. Confirm the firmware level before rewriting blocks:
- Open the device configuration in TIA Portal.
- Right-click the CPU and select Online & Diagnostics.
- Read the firmware version from the device.
- If FW is below 2.2.0, perform a firmware update via Online > Accessible Devices using an SD card or directly over Ethernet.
Engineering Toolchain
| Component | Required Version |
|---|---|
| TIA Portal (STEP 7 in TIA) | V11 SP2 or newer (V13/V14/V15/V16/V17/V18/V19/V20 recommended) |
| STEP 7 V5.x (source review only) | V5.5 SP4 or V5.6 for reading legacy STL sources |
| S7-1200 CPU firmware | V2.2.0 minimum for SCL |
| S7-1200 CPU firmware (latest) | V4.2.x or V4.3.x as released for current hardware |
STL versus SCL: Conceptual Mapping
STL is a low-level, accumulator-based language. The CPU exposes two 32-bit accumulators (ACCU1, ACCU2) and a status word that drives conditional jumps. SCL is a high-level, structured-text language with explicit variable types, automatic code optimization, and a Pascal-like syntax. The mapping is not one-to-one and requires deliberate rework in three areas:
-
Operand handling: STL's accumulator-explicit moves (
L,T) collapse into SCL assignment expressions. -
Control flow: STL jump labels (
JU,JC,JN,JZ,JN,JP,JM,JZ,JO) are replaced with structuredIF,CASE,FOR,WHILE, andREPEATstatements. -
Indirect addressing: STL's memory-indirect and register-indirect addressing (see Indirect addressing in STL (S7-300, S7-400)) maps to SCL array index expressions or pointer-based access via
PEEK/POKEand AT notation.
Mnemonic Translation Table
| STL Construct | Effect | SCL Equivalent |
|---|---|---|
L MW 10 |
Load MW10 into ACCU1 | iTemp := "Tag_MW10"; |
L 5 |
Load constant 5 into ACCU1 | iTemp := 5; |
T MW 12 |
Transfer ACCU1 to MW12 | "Tag_MW12" := iTemp; |
U E 0.0 |
AND input I0.0 | IF "Tag_I0_0" THEN ... END_IF; |
O |
OR |
OR (operator) |
X |
Exclusive OR |
XOR (operator) |
+ IW 4
|
Add IW4 to ACCU1 | iTemp := iTemp + "Tag_IW4"; |
-I |
Subtract ACCU2 from ACCU1 (integer) | iTemp := iTemp - x; |
JU LBL1 |
Unconditional jump to LBL1 | Eliminate; use structured flow |
JC NEXT |
Conditional jump if RLO = 1 | IF bCond THEN ... ELSE ... END_IF; |
CALL FC 10 |
Call FC10 | MyFC10(iIn := ...); |
CALL SFB 0, DB1 |
Call SFB0 with instance DB1 | "DB_SFB0".SFBCall(...); |
Indirect Addressing Conversion
The S7-300 STL modes documented in Indirect addressing in STL (S7-300, S7-400) have three flavors:
-
Direct addressing:
L MW 10(always MW10). -
Memory-indirect:
L MW [MD 20](uses pointer in MD20). -
Register-indirect area-internal:
L MW [AR1, P#0.0](uses AR1 with displacement). -
Register-indirect area-crossing:
L W [AR1, P#0.0](data block and pointer both come from AR1).
SCL Patterns for Indirect Access
Convert each STL indirect pattern to one of these canonical SCL forms. Use a typed tag array so the compiler can validate indexes.
// STL: L DBW [MD 100] (memory-indirect via MD100)
// SCL: iValue := "Data".Word["MD100"]; // MD100 holds DWORD index
// STL: AUF DB 200
// L DBB [AR1, P#4.0]
// SCL: iValue := "MyDB200".Byte[BYTE#4]; // or via AT view
// Array-based loop replaces pointer arithmetic
FOR i := 0 TO 99 BY 1 DO
IF "RecipeDB".Temp[i] > 1000 THEN
"RecipeDB".Out[i] := TRUE;
END_IF;
END_FOR;
POINTER/ANY types. If your STL logic depends on side effects of register manipulation, the equivalent SCL loop will refactor the algorithm, not just translate it.Step-by-Step Conversion Procedure
Step 1 - Extract Source Blocks from STEP 7 V5.x
- Open the S7-300 project in STEP 7 V5.5 or V5.6.
- Expand Blocks and identify every OB, FB, FC, DB, UDT, and SFB call required.
- Right-click the block and choose Generate Source File to obtain
.STL/.SCLtext. - Cross-reference inputs and outputs against the hardware list to capture used I/O, markers (M), and DBs.
Step 2 - Inventory Migration Units
Before touching TIA Portal, build a migration register. Each row defines one block to be rewritten.
| Block # | Type | Number | Lines STL | Cycletime est. | Target Language | Status |
|---|---|---|---|---|---|---|
| 1 | FC | 10 | 78 | 0.4 ms | SCL | Open |
| 2 | FB | 20 | 142 | 1.1 ms | LAD + SCL | Open |
| 3 | DB | 200 | - | - | DB (TIA, optimized) | Open |
Step 3 - Build the S7-1200 Project Skeleton in TIA Portal
- Create a new project, Add New Device > SIMATIC S7-1200 > CPU 1214C DC/DC/DC (or your target MLFB such as 6ES7214-1AG40-0XB0).
- Configure the rack with the matching signal modules from the S7-300 hardware list.
- Define the PLC tags: PLC tags > Default tag table. Create I/O tags for
I,QB,IW,MWareas carried over from the legacy project. - Add the program blocks folder and create placeholders for each FB/FC listed in the inventory.
Step 4 - Rewrite Each Block to SCL
- Open the new block in SCL by selecting the language when creating it.
- Translate STL statement-by-statement using the mapping table above. Adhere to these conversion rules:
- Variable declarations move to the block interface (Input/Output/InOut/Static/Temp).
- Replace any
SAVEwith explicit assignment toENOwhen required. - Replace
SET/CLRwithTRUE/FALSEliterals. - Convert
AUF DB xto either an instance DB reference or a fully qualified tag like"MyDB".Field. - Replace unconditional jumps with structured control flow.
- Compile the block. Resolve every warning before proceeding. Errors commonly reported:
- Unknown identifier: missing interface declaration.
-
Type mismatch:
DWORDvsWORDwhen STL used overloaded 16/32-bit operations. -
Implicit pointer conversion: requires
DWORD_TO_INTetc.
Step 5 - Re-create Data Blocks
On the S7-1200, default DBs are optimized (symbolic only). Two migration choices:
- Keep DB structure compatible: set the DB to non-optimized (compatibility mode) and tick "Memory area must be retentive" only where legacy used retentivity. Symbolic addressing remains available.
-
Move to optimized: rewrite DB accesses as
"MyDB".Variableand rely on symbolic bound names. Faster access; no dual-fold image.
Time and Counter Objects
STL's SV, SE, SS, and SA timer commands and the legacy counter commands (CU, CD, C) execute on internal system functions that differ architecturally between S7-300 and S7-1200. The S7-1200 exposes the IEC timers TP, TON, TOF, TONR as multi-instance FBs inside the system library "TIMERS". Convert each legacy timer/counter as in the examples below.
// STL: L S5T#2s
// SE T 10
// SCL: "IEC_Timer_0".SE := FALSE;
// "IEC_Timer_0".TP(IN := bStart,
// PT := T#2s,
// Q => bQ,
// ET => tET);
// STL: CU Z 5
// SCL: "IEC_Counter_0".CU := bPulse;
// "IEC_Counter_0".CU_CNT := TRUE;
IEC_TIMER, use .TP, .TON etc. If the older data type TP or TON is used, you must declare each as its own instance (multi-instance usage differs slightly). Always check the version of the Templates library installed in TIA Portal.Diagnostics and Watch Tables
After rewriting, build a watch table to confirm the SCL implementation matches the legacy STL logic.
- Watch tables > Add new watch table.
- Insert every input byte (IBx), output byte (QBx), and intermediate marker (MWy) consumed by the block.
- Trigger force on a controlled input (e.g.,
"I0.0") and confirm expected MW changes. - Use a trace (CPU FW V4.0+) to capture cyclic execution of the rewritten SCL block and compare against stored traces from the original S7-300 if any.
Troubleshooting Matrix
| Symptom | Cause | Resolution |
|---|---|---|
| Block cannot be added in STL language | STL not selectable in S7-1200 project | Switch block language to LAD, FBD, or SCL. |
| SCL compile error: identifier undefined | Missing interface declaration | Add the identifier to the block interface (Input/Output/Static/Temp). |
| Indirect addressing fails | STL pointer logic translated too literally | Replace with array indexing or PEEK/POKE. |
| Timer output never comes true | IEC timer instance not updated (multi-instance rule) | Verify the timer instance is called every cycle and PT is non-zero. |
| CPU goes to STOP after download | Optimized DB mismatch or area-crossing pointer | Convert DB to non-optimized or refactor pointer access via AT view. |
| S7-300 STL 'A' mnemonic behaves differently after migration | AND vs OR precedence changed | Wrap explicit parentheses in SCL expressions. |
| Diagnostic buffer: 'IO access error' | Symbol I/O address mismatch | Recompile hardware configuration after tag rename. |
Verification Procedure
- Compile check: TIA Portal > Project tree > Program blocks > right-click > Compile all. Expect zero errors and zero warnings.
- Online compile consistency: connect online; right-click PLC > Compare online/offline. Differences must be empty.
- Single-step test: place the program in single-step via project properties (only available on certain FW variants) or insert breakpoint equivalents using monitor with test.
- Functional black-box test: simulate inputs, capture outputs, compare with stored S7-300 expected values.
- Long-term diagnostic buffer review: cycle the CPU for at least one production shift (or simulation equivalent). Inspect the diagnostic buffer for OB82 / OB121 / OB122 events.
Appendix - Data Type Compatibility
| S7-300 STL Type | S7-1200 SCL Equivalent | Notes |
|---|---|---|
| BOOL | BOOL | Direct |
| BYTE | BYTE | Direct |
| WORD | WORD | Direct |
| DWORD | DWORD | Direct |
| INT | INT | Direct |
| DINT | DINT | Direct |
| REAL | REAL | Direct |
| S5TIME | TIME / S5TIME | Use TIME in SCL; convert legacy S5T# literals. |
| TIME_OF_DAY (TOD) | TOD | Direct |
| DATE_AND_TIME (DT) | DTL | DTL is the S7-1500/1200 replacement for legacy DT. |
| STRING | STRING | Specify length, e.g., STRING[254]. |
| POINTER (48 bit) | POINTER / ANY | Limited; prefer symbolic tags. |
Frequently Asked Questions
Can I import S7-300 STL code directly into TIA Portal for an S7-1200?
No. The S7-1200 does not support the STL language at all, so you must rewrite the logic in LAD, FBD, or SCL. STEP 7 V5.x-generated STL sources cannot be loaded into an S7-1200 CPU.
Which firmware version adds SCL support to the S7-1200?
SCL became available on the S7-1200 in firmware V2.2.0, shipped together with STEP 7 (TIA Portal) V11 SP2. Any newer firmware keeps the SCL capability and adds incremental improvements.
How do I convert STL pointer arithmetic like 'L MW [MD 20]' to SCL?
Replace the indirect STL access with a typed array. If the original was loading a word at offset MD20 from a memory area, declare WordArray[0..99] OF WORD in a DB and use WordArray["MD20"] or a numeric index expression.
Are S7-300 SFB and SFC calls portable to S7-1200?
Only the SFB/SFCs that have an equivalent on the S7-1200 system are portable. Functions such as SFB0/SFB1 (PUT/GET for S7 communication) require re-implementation using the S7-1200 instruction set, Open User Communication, or PUT/GET via T-block calls.
Will existing I/O addresses (I0.0, MW10) still work on the S7-1200?
Yes, the input, output, and bit-memory address spaces keep the same numeric layout, but addresses should be expressed symbolically through PLC tags so TIA Portal can manage them as structures. Direct absolute addressing is still legal but is no longer the recommended practice.