ABB PLC Lab Manual · Lab 18 of 20 · Ladder Programming for Machines

ABB AC500 Structured Text (ST) Programming for Beginners

Write the same conveyor logic in Structured Text. Learn the ST syntax you actually need, convert ladder rungs line by line, call timers in ST and wrap logic in a reusable function block that ladder can call.

2,500+ engineers trained 4.9/5 Google rating 21+ years, Chinchwad, Pune Real AC500-eco + ACS580 trainer kits
Lab 18 of 20 · 60 minutes · Level: Intermediate
Quick answer

Structured Text (ST) is the IEC 61131-3 text language supported by Automation Builder. Assignments use :=, every statement ends with a semicolon, decisions use IF … THEN … ELSIF … END_IF and CASE … OF … END_CASE, and timer instances are called like functions: T_Warn(IN := Start_Req, PT := T#3s). ST suits calculations, sequences and reusable function blocks; ladder suits simple interlocks that maintenance staff read online.

  • Use := for assignment and = for comparison
  • Call each timer/counter instance once per scan, then read its outputs
  • CASE on an integer step is the cleanest way to write sequences
  • Package reusable logic as an ST function block and call it from ladder
HardwareKit (optional)
SoftwareLabs 7–17 logic
Time60 minutes

You already wrote small ST snippets in earlier labs. This lab makes them systematic so you can choose the right language for each POU. For a deeper course, see Softwell's SCL/ST programming training.

Step 1: ST Syntax You Need

Reference 15 minutes
ConstructSTNotes
AssignmentDO_Lamp := TRUE;Semicolon ends every statement
Boolean logicA := B AND NOT C OR D;AND binds stronger than OR; use brackets
ComparisonIF Step = 30 THEN= compares, := assigns
IFIF … THEN … ELSIF … ELSE … END_IF;First true branch only
CASECASE Step OF 10: …; 20: …; END_CASE;Integer selector
FORFOR i := 0 TO 7 DO … END_FOR;Keep loops short in a cyclic task
Timer callT1(IN := X, PT := T#2s);Then use T1.Q / T1.ET
Comment(* comment *)Also // in V3 editors

Step 2: Convert Ladder to ST

Side by side 15 minutes
Ladder rungStructured Text
Start/stop seal-in (Lab 7)DO_Motor_Run := (DI_Start_PB OR DO_Motor_Run) AND DI_Stop_PB AND DI_EStop_OK;
SET / RESET alarm (Lab 13)IF NOT DI_MPCB_OK THEN Alm_MPCB := TRUE; END_IF;
IF DI_Reset_PB AND DI_MPCB_OK THEN Alm_MPCB := FALSE; END_IF;
TON warning (Lab 11)T_Warn(IN := Start_Req, PT := T#3s);
DO_Buzzer := Start_Req AND NOT T_Warn.Q;
Interlocked jog (Lab 16)DO_Motor_Rev := Manual AND DI_Jog_Rev_PB AND NOT DI_Jog_Fwd_PB AND NOT DO_Motor_Run;

ST execution demo

This simulator runs the ST below each 100 ms scan. Press Start, wait for the warning, then press Stop.

Inputs (click / hold)
Outputs
DO_Buzzer
DO_Motor_Run
Start_Req: 0T_Warn.ET: 0
ST
Start_Req := (DI_Start_PB OR Start_Req) AND DI_Stop_PB AND DI_EStop_OK;
T_Warn(IN := Start_Req, PT := T#3s);
DO_Buzzer    := Start_Req AND NOT T_Warn.Q;
DO_Motor_Run := T_Warn.Q;

Step 3: Build a Reusable Motor Function Block in ST

FB_Motor 20 minutes
ST
FUNCTION_BLOCK FB_Motor
VAR_INPUT
    Start, Stop_OK, Permissive, Feedback, Reset : BOOL;
    FB_Time : TIME := T#2s;
END_VAR
VAR_OUTPUT
    Run, Fault : BOOL;
END_VAR
VAR
    T_FB : TON;
END_VAR

Run := (Start OR Run) AND Stop_OK AND Permissive AND NOT Fault;
T_FB(IN := Run AND NOT Feedback, PT := FB_Time);
IF T_FB.Q THEN Fault := TRUE; END_IF;
IF Reset AND NOT T_FB.Q THEN Fault := FALSE; END_IF;
  1. Add a POU of type Function Block, language ST, name FB_Motor, and paste the code.
  2. Declare an instance in Motor_Logic: M1 : FB_Motor;
  3. In a ladder network, insert the block M1, connect inputs to your tags and Run to Cmd_Motor_Run.
  4. Add a second conveyor later with M2 : FB_Motor;: same tested logic, one more line.

Step 4: Choose the Right Language

Guideline 10 minutes
TaskBest choiceWhy
Interlocks, E-stop monitoring, simple outputsLadderMaintenance reads it online at a glance
Sequences with many stepsST (CASE) or SFCCompact, easy to extend
Scaling, maths, data handling, loopsSTLadder becomes huge
Reusable device logicST function block called from LDBest of both
Communication blocks (Modbus)ST or FBDMany parameters

Practice Exercise

Exercise

Rewrite the Lab 14 tower lamp logic in ST in a POU called Tower_Lamp_ST. Run it alongside the ladder version with different output tags and prove both give the same result.

Troubleshooting

SymptomLikely causeFix
Syntax error: expected ;Missing semicolon or END_IFCheck the line above the error
Assignment does nothingUsed = instead of :=Use := for assignment
Timer never runsInstance not called every scanCall the instance unconditionally, then read Q
Logic works in LD, not in STOperator precedenceAdd brackets around OR terms

Frequently asked questions

Does ABB Automation Builder support Structured Text?

Yes. ST is one of the IEC 61131-3 languages supported for AC500 and AC500-eco, alongside LD, FBD, IL, SFC and CFC.

Is SCL the same as Structured Text?

SCL is Siemens' name for its IEC 61131-3 ST implementation. The syntax is very close, so skills transfer between ABB and Siemens.

Can I mix ladder and ST in one project?

Yes. Each POU has its own language, and a ladder network can call a function block written in ST.

Should beginners learn ladder or ST first?

Ladder first for basic I/O logic, then ST for sequences, calculations and reusable blocks.

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

Get the full ABB PLC syllabus + free demo class

Share your details. A Softwell training advisor will call you within 24 hours with batch dates, fees and AC500 hardware access options.

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

Practise every lab on real ABB hardware

AC500-eco PLC, ACS580 drive and HMI trainer kits: live online, Pune classroom or corporate in-plant training.

Request Course Details
Verified learning pathway

Discuss This Technical Course

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

Content reviewed: 14 October 2026

ABB PLC & Automation Builder Learning Path

Follow the full 20-lab ABB AC500-eco practical series in order, or start from the ABB PLC Lab Manual hub.

  1. Lab 1: Automation Builder Installation & AC500-eco Setup
  2. Lab 2: Connect AC500-eco PLC via Ethernet
  3. Lab 3: Create a New Automation Builder Project
  4. Lab 4: AC500-eco IO Configuration
  5. Lab 5: Digital Input Mapping
  6. Lab 6: Digital Output Mapping
  7. Lab 7: First Ladder Program: Start/Stop
  8. Lab 8: Download a Program to AC500-eco
  9. Lab 9: Upload a Program from AC500-eco
  10. Lab 10: Online Monitoring, Force & Write
  11. Lab 11: Timers & Counters in Ladder
  12. Lab 12: Network & Tag Mapping
  13. Lab 13: Alarm Mapping & Fault Latching
  14. Lab 14: Tower Lamp Logic
  15. Lab 15: Emergency Stop & Interlocks
  16. Lab 16: Manual Mode Logic
  17. Lab 17: Auto Mode Sequence Logic
  18. Lab 18: Structured Text (ST) Programming
  19. Lab 19: AC500-eco to ACS580 Modbus RTU Setup
  20. Lab 20: Control ACS580 via Modbus RTU
  21. ABB AC500 PLC Selection Guide
☎ Call WhatsApp ✉ Email Enquire Now