PLC Programming · Lab Manual

Ladder Logic vs SCL in TIA Portal: Lab Manual with One Machine in Both Languages

The question is not ladder or SCL – it is which block in which language. This lab manual builds one pump station through all six stages: the interlock in ladder, where maintenance can see the open contact, and the flow average and totaliser in SCL, where loops and maths stay readable – then compares both live.

2,500+ engineers trained 4.9/5 Google rating 21+ years, Chinchwad, Pune Next batch: contact for dates
Quick answer

Use ladder for mapping, interlocks, permissives and anything a technician will troubleshoot online, because live contact states make faults visible. Use SCL for calculations, loops, arrays, strings and complex state machines. Both compile to the same code and write the same DB members, so mix them per block.

  • Interlocks in LAD: the open contact is the diagnosis.
  • Maths, arrays and loops in SCL: ten lines instead of ten networks.
  • Choose per block – both feed the same DBs and HMI.

What Each Language Is Good At

CriterionLadder (LAD)SCL
Online troubleshootingExcellent – power flow visibleGood with monitoring, needs code reading
Interlocks and permissivesNaturalPossible, less visual
Maths and formulasClumsy boxesNatural
Loops and arraysNot practicalNatural
State machinesReadable up to a few stepsCASE statement scales well
Maintenance team skillsWidely knownGrowing

Lab Flow: One Pump Station, Two Languages

Every lesson in the Softwell PLC lab manual series follows the same six stages and the same address rule, so the code you write here plugs straight into the HMI lessons.

Lab manual flow: field input to tested HMI screenSix stages: field device and PLC tag, input mapping to DB_IO, PLC logic, HMI tags, graphics linking, and perform and test.1Field + tags%IW104 %I6.5flow, level2Input mappingFC_InputMapping→ DB_IO3LogicLAD + SCLper block4HMI tagsDB_Flow_*same for both5GraphicsPump screenlamp, flow6Perform + testSimulatorcompare onlineAddress rule for every lesson: %I only in FC_InputMapping, %Q only in FC_OutputMapping, symbolic DB members everywhere else – including the HMI.
Figure 1 – Six-stage lab flow for this lesson.

Stage 1Field Signals and PLC Tags

PLC tagAddressTypeDevice / comment
FT40_Raw%IW104IntFlow transmitter 4–20 mA = 0 – 20 m³/h
LS40_Water%I6.5BoolTank low-level switch, 1 = water present
P40_Fault%I6.6BoolPump MPCB trip, 1 = tripped
P40_Run%Q3.3BoolPump contactor

Stage 2Input Mapping (LAD or SCL – both fine)

// FC_InputMapping
"DB_IO".FT40_m3h  := SCALE_X(MIN := 0.0, MAX := 20.0, VALUE := NORM_X(MIN := 0, VALUE := "FT40_Raw", MAX := 27648));
"DB_IO".LS40_OK   := "LS40_Water";
"DB_IO".P40_Fault := "P40_Fault";

Stage 3Logic: Interlock in LAD, Calculation in SCL

BlockLanguageWhy
FC_PumpInterlockLADMaintenance sees the open contact online
FB_FlowCalc (OB30, 100 ms)SCLArray, loop and maths stay readable
FC_OutputMappingLAD or SCLOne line per output
// FC_PumpInterlock (LAD), one network:
//  --| "DB_Pump".Run_Req |--| "DB_IO".LS40_OK |--|/ "DB_IO".P40_Fault |--( "DB_Pump".P40_Run )

// FB_FlowCalc (SCL) in OB30 – STAT: Idx : Int;  TEMP: i : Int; sum : Real;
"DB_Flow".Buf[#Idx] := "DB_IO".FT40_m3h;
#Idx := (#Idx + 1) MOD 10;
#sum := 0.0;
FOR #i := 0 TO 9 DO
    #sum := #sum + "DB_Flow".Buf[#i];
END_FOR;
"DB_Flow".Avg   := #sum / 10.0;
"DB_Flow".Total := "DB_Flow".Total + "DB_Flow".Avg * 0.1 / 3600.0;   // 100 ms in hours

The averaging and totaliser run in a cyclic interrupt OB so the time base is constant – see the scan cycle lesson.

Stage 4Link PLC Tags to the HMI

HMI tagPLC memberUsed by
DB_Pump_P40_Run"DB_Pump".P40_RunRun lamp
DB_Flow_Avg"DB_Flow".AvgFlow field
DB_Flow_Total"DB_Flow".TotalTotal field

Stage 5Link the Graphics

#ObjectPropertiesTag / event
①Pump lampAppearance from P40_Run (or feedback)DB_Pump_P40_Run
②Output field average flowFormat 99.9 m³/hDB_Flow_Avg
③Output field totalFormat 99999.999 m³; consider logging it – see the trends lessonDB_Flow_Total

Logging the average flow is shown in HMI trends and data logs.

Stage 6Perform and Test: the Same Machine in LAD and SCL

The pump interlock runs as ladder, the flow averaging and totalising as SCL – exactly the split recommended above. Toggle the signals and compare how each language shows what is happening.

Ladder part (online)
SCL part and HMI values
FB_FlowCalc (SCL)OB30, 100 ms
Flow (raw)m³/h
Flow (avg of 10)m³/h
Totalm³

Troubleshooting

SymptomLikely causeFirst check
Average jumps every 10 samplesIndex not wrappedMOD 10 on the index
Total grows with scan timeTotaliser in OB1Move to a cyclic interrupt OB
Technician cannot find why pump stopsInterlock buried in SCLMove interlocks to LAD

Hands-On Lab: One Pump Station in LAD and SCL

Hands-on
Before you start
  • TIA Portal with an S7-1200 or PLCSIM
  • Estimated time: 60 minutes
1

Wire and declare the pump signals

Declare FT40_Raw, LS40_Water, P40_Fault and P40_Run.

The four pump signals are declared.
2

Map and scale into DB_IO

Scale the flow to m³/h and copy the switches in FC_InputMapping.

DB_IO.FT40_m3h reads in m³/h.
3

Write the interlock in LAD and the calculation in SCL

FC_PumpInterlock in LAD; FB_FlowCalc in SCL in OB30 with a 10-sample array and a totaliser.

The rung shows the open contact; the SCL average is smooth.
4

Link HMI tags

Drag DB_Pump and DB_Flow into the HMI tag table.

HMI tags match the DB members.
5

Build the pump screen

Add the run lamp, raw and average flow and the total.

Lamp, average and total update.
6

Compare online

Toggle the signals, watch the LAD rung and monitor the SCL block online.

You can explain why each block uses its language.
Checkpoint—how to know you did it right

The interlock is readable online in ladder, the calculation is clean in SCL, and both feed the same DBs and HMI.

Frequently asked questions

Is SCL faster than ladder logic on Siemens PLCs?

No meaningful difference. Both compile to the same machine code on S7-1200 and S7-1500. Choose on readability and maintainability, not speed.

Can I mix ladder and SCL in one project?

Yes, and you should. The language is chosen per block, so a single machine can have ladder interlocks calling SCL function blocks.

Which should a beginner learn first?

Ladder, because it maps onto the electrical drawing and makes online troubleshooting visual. Add SCL once you meet maths, loops or long sequences.

Why do OEMs often insist on ladder?

Because the end customer's maintenance team has to fault-find at night without the OEM present, and ladder shows the open contact on screen without any code reading.

Where should the language split be in a typical machine?

Mapping, interlocks and simple motor logic in LAD; calculations, arrays, loops, string handling and complex state machines in SCL; one block per job so each can be read in its best language.

Can the HMI tell which language produced a value?

No, and it does not need to. Both write the same DB members, so the HMI tags and screens are identical whichever language you choose.

Reviewed by Bhawesh Kumar SinghIndustrial Automation Trainer and Industry 4.0 Consultant · Softwell Automation · 21+ years industry experience

Get the full syllabus + free demo class

Share your details—a Softwell training advisor will contact you with batch dates, fees and hardware-practice options.

No spam. Used only to share course details for this enquiry.

Learn with practical industrial examples

Join live online, Pune classroom or corporate in-plant automation training.

Request Course Details
Verified learning pathway

Discuss Ladder Logic vs SCL

Explore practical curriculum, software, hardware and batch options for this technology.

Content reviewed: 16 October 2026

Siemens PLC & TIA Portal Learning Path

Continue with the related Siemens PLC tutorials in this practical learning series.

  1. SCL vs Ladder Logic
  2. Upload PLC Program
  3. TIA Selection Tool
  4. Analog Input Scaling
  5. PLC Counters
  6. PLC Timers
  7. Addressing & Data Types
  8. Hardware & PLC Tags
  9. OB, FB, FC & DB
☎ Call WhatsApp ✉ Email Enquire Now