PLCcheck

Converting Ladder Logic to Structured Text: Why and How

When and how to convert PLC ladder logic (LD/KOP/LAD) to Structured Text (ST/SCL). Covers the benefits, conversion patterns, what to keep in ladder, and practical examples.

·8 min read
Ladder LogicStructured TextconversionLDSTSCLKOPprogrammingIEC 61131-3

Converting Ladder Logic to Structured Text: Why and How

Ladder Logic (LD) has been the dominant PLC programming language for 50 years. Structured Text (ST) is becoming the preferred language for modern PLCs. This guide explains when conversion makes sense, when it does not, and how to do it effectively.

When to Convert to ST

Convert: Complex calculations, data processing, recipe management, string handling, communication protocols, state machines with many states, any code that is awkward in ladder.

Keep in Ladder: Simple Boolean logic, discrete interlocks, motor start/stop circuits, safety logic (easier to verify visually), any code where maintenance electricians need to troubleshoot.

Rule of thumb: If it takes more than 5 rungs to express what could be 3 lines of ST, convert it.

Common Conversion Patterns

Self-Holding Circuit

Ladder:

|--[Start]--+--[NOT Stop]--( Motor )--|
|           |                         |
|--[Motor]--+                         |

ST:

IF Start OR Motor THEN
    IF NOT Stop THEN Motor := TRUE;
    ELSE Motor := FALSE;
    END_IF;
ELSE Motor := FALSE;
END_IF;

Comparison and Math

Ladder: Requires separate comparison blocks, MOV instructions, and math blocks connected with intermediate bits.

ST:

IF Temperature > 85.0 THEN
    CoolingValve := TRUE;
    AlarmOutput := TRUE;
    FanSpeed := (Temperature - 85.0) * 10.0;  // Proportional control
END_IF;

Step Sequence

Ladder: Dozens of rungs with step counter comparisons and conditional jumps.

ST:

CASE Step OF
    0: // Idle
        IF StartButton THEN Step := 10; END_IF;
    10: // Fill
        FillValve := TRUE;
        IF LevelHigh THEN FillValve := FALSE; Step := 20; END_IF;
    20: // Heat
        Heater := TRUE;
        IF Temperature >= Setpoint THEN Heater := FALSE; Step := 30; END_IF;
    30: // Discharge
        DischargeValve := TRUE;
        IF LevelLow THEN DischargeValve := FALSE; Step := 0; END_IF;
END_CASE;

The Siemens Recommendation

The Siemens Programming Style Guide states: "The preferred programming language for standard blocks is SCL. It provides the most compact form and best readability of all programming languages." Siemens recommends SCL for all new FBs and FCs on S7-1500, with LAD/FBD reserved for call environments and simple binary logic.

How PLCcheck Pro Helps

PLCcheck Pro reads your existing AWL/STL/Ladder code and suggests SCL equivalents — showing the original and converted code side by side.

Upload code for LD→ST conversion suggestions →


Maintained by PLCcheck.ai.

Related Articles

Analyze your PLC code with AI

PLCcheck Pro explains, documents, optimizes, and migrates PLC code — automatically.

Try PLCcheck Pro →
← Back to Blog

Not affiliated with Siemens AG. S5, S7, STEP 5, STEP 7, and TIA Portal are trademarks of Siemens AG.