Learning | Liam Bee

20 SCL Execution Order Questions

Twenty structured text questions with instant feedback, designed to train the part that really catches people out in SCL: execution order.

When people say they are struggling with SCL, the problem is often not the syntax itself. Most engineers can learn IF, CASE, assignments, timers, and function calls quickly enough. The harder part is learning to read the code in the same order the PLC executes it. That means understanding what gets solved first, what gets overwritten later, when a state change affects the next scan instead of the current one, and why a value that looks obvious on the screen can still be wrong once data types, feedbacks, and sequence timing come into play. In other words, the real skill is not just reading text. It is reading behaviour.

That is why this article is built around execution-order questions instead of passive explanation. Each problem forces the reader to decide what the PLC actually does, not what they vaguely expect it to do. Some questions look simple on purpose, because simple-looking code is exactly where bad assumptions slip through unnoticed. Others lean into timers, state logic, signal handling, and structure, because all of those areas become much easier once execution order is understood properly. If someone can work through these questions calmly and explain the answer in sequence, they are starting to read SCL the right way.

How to use this article: answer each question before you read the explanation. The goal is not to memorise tricks. The goal is to build the habit of reading SCL in execution order, scan by scan, line by line.

Try The Questions

0 of 20 answered. Score: 0/20.

Question 1

What is the final value of MotorRunCmd at the end of this scan?

Assume StartPB := TRUE, StopPB := FALSE, and FaultActive := TRUE.

IF StartPB THEN
    MotorRunCmd := TRUE;
END_IF;

IF StopPB OR FaultActive THEN
    MotorRunCmd := FALSE;
END_IF;
Question 2

How many times does this code increment BoxCount?

Assume BoxAtSensor stays TRUE for four consecutive scans.

IF BoxAtSensor THEN
    BoxCount := BoxCount + 1;
END_IF;
Question 3

Which branch runs when Temperature := 82.0?

IF Temperature > 60.0 THEN
    FanSpeed := 1;
ELSIF Temperature > 80.0 THEN
    FanSpeed := 2;
ELSE
    FanSpeed := 0;
END_IF;
Question 4

What value ends up in Ratio after this assignment?

GoodParts := 5;
RejectParts := 2;

Ratio := GoodParts / RejectParts;

Assume GoodParts and RejectParts are INT, and Ratio is REAL.

Question 5

What happens to ConveyorRun in this timer example?

Assume StartCmd is true for 2 seconds, then goes false. The timer preset is 3 seconds.

StartDelay(IN := StartCmd, PT := T#3s);

IF StartDelay.Q THEN
    ConveyorRun := TRUE;
ELSE
    ConveyorRun := FALSE;
END_IF;
Question 6

What is the final value of Step after this scan?

Assume Step := 0 before the code executes.

CASE Step OF
    0:
        Step := 1;
    1:
        Step := 2;
END_CASE;
Question 7

What value ends up in Percent?

Assume Raw is INT and Percent is REAL.

Raw := 13824;
Percent := Raw / 27648 * 100.0;
Question 8

How many counts does this code add while the sensor stays high for four scans?

PartEdge(CLK := PartSensor);

IF PartEdge.Q THEN
    PartCount := PartCount + 1;
END_IF;
Question 9

What happens to HighLevel when the tank sits at 77.0?

Assume HighLevel was already TRUE before this scan.

IF TankLevel >= 80.0 THEN
    HighLevel := TRUE;
ELSIF TankLevel <= 75.0 THEN
    HighLevel := FALSE;
END_IF;
Question 10

Which tag should the HMI use to show that the motor is actually running?

MotorCmd := StartReq;
MotorRunning := MotorRunFb;
MotorHealthy := MotorCmd AND MotorRunFb;

Assume the HMI label is meant to represent real field status, not just a requested command.

Question 11

What happens in this state machine when StartCmd is true?

Assume State := 0 before the scan starts.

CASE State OF
    0:
        IF StartCmd THEN
            State := 10;
        END_IF;
    10:
        MotorCmd := TRUE;
END_CASE;
Question 12

Does the pump command turn on in the same scan that the valve-open feedback arrives?

Assume State := 20 and ValveOpenFb := TRUE.

CASE State OF
    20:
        ValveOpenCmd := TRUE;
        IF ValveOpenFb THEN
            State := 30;
        END_IF;
    30:
        PumpCmd := TRUE;
END_CASE;
Question 13

What happens to HeaterCmd if a fault appears in state 30?

Assume State := 30 and FaultActive := TRUE.

CASE State OF
    30:
        IF FaultActive THEN
            State := 900;
        END_IF;
        HeaterCmd := TRUE;
    900:
        HeaterCmd := FALSE;
END_CASE;
Question 14

Does Ready turn on in the same scan that the fault resets?

Assume State := 900, ResetCmd := TRUE, and FaultActive := FALSE.

CASE State OF
    900:
        IF ResetCmd AND NOT FaultActive THEN
            State := 0;
        END_IF;
    0:
        Ready := TRUE;
END_CASE;
Question 15

Which transition condition is strongest for moving from Opening to Open?

Assume ValveOpenCmd is the PLC output request, ValveOpenFb is a real open-position feedback, OpenPB is an operator pushbutton, and OpenTimer.Q is just a timeout completion bit.

// State 20 = Opening
ValveOpenCmd := TRUE;
// What should decide the move to State 30 = Open?
Question 16

Which pattern is usually clearer for a final run command?

Question 17

For mutually exclusive operating modes, which representation is usually strongest?

Question 18

If a higher-level sequence wants the valve to open, which interface is better?

Question 19

Where should a reusable pump start timeout normally live?

Question 20

Which HMI binding is usually the strongest long-term choice for a stable “Pump Running” indicator?

Assume all four tags belong to the same pump object. The HMI needs one tag that other screens, summaries, and diagnostics can trust over time. TempRunLatch is an internal latch, Status.Running is a public status bit, StartButton is an operator input, and InternalSeqStep is an internal sequence state.

0% 0/20

Your Final Score

Answer all twenty questions above to reveal your completed score and weakest category.

Correct Wrong Unanswered
Recommended Next Read

Read the article

What These Questions Are Really Testing

Each question is simple on purpose. None of them asks you to memorise obscure Siemens syntax. They are testing something much more important.

  • Whether you understand that SCL executes in sequence, not all at once.
  • Whether you can read timers, edges, and one-scan behaviour the way the PLC actually solves them.
  • Whether you separate commands, feedbacks, and typed values clearly enough to trust the result.
  • Whether you understand how CASE-style state logic behaves across scans.
  • Whether you can recognise stronger structure, cleaner interfaces, and better ownership patterns in real code.

If you get some of these wrong, that is not a sign you are bad at programming. It usually means you are still reading the code through the wrong mental model. That is exactly the kind of gap these small exercises are designed to fix.

Learn More

Want More Practical PLC Learning Content?

If this style of explanation is useful, my PLC and HMI Development book goes much deeper into scan behaviour, language choice, troubleshooting, and writing logic that other engineers can actually maintain.

Get the Book

Leave a Reply

×