01 · Scan cycles and Boolean logic

Practice module 1 of 5 · Ladder + Siemens SCL

Think in values, then in scans.

Predict which value a later network reads. Translate series, parallel and negated contacts.

15–20 minutesWritten predictions + self-checkNo account required

01 / Logic you can prove

What you will be able to prove

  • Translate a verbal requirement into one unambiguous Boolean rule.
  • Use a counterexample and an exhaustive truth table to reject the wrong rule.
  • Distinguish a software contact test from sensor wiring.

Before this module: None. Start here if you can read a TRUE/FALSE value.
Core: 15–20 min · Applied lab: 20–30 min. These are planning estimates; work at your pace.

Your deliverable: A tag contract, a Ladder/SCL pair, an eight-row truth table, and a one-paragraph fault report.

Predict → trace → challenge → explain. The written labs are self-assessed. Use paper or your own compatible simulation. The browser workshop supports a limited training subset; these SCL excerpts are not import-ready or TIA-compiled blocks.

Your next step

Start small. Build from there.

New to this topic? Read the rule in words, then follow one input through the example. Start with Ladder or SCL, whichever feels clearer.

Optional hint: the idea in plain words

A contact checks a TRUE/FALSE value. Series means AND; parallel paths mean OR. You can reason on paper before opening an editor.

Work in one language first, then compare the other. After the prediction, open step 3 for guidance or step 4 for an independent challenge.

Before you reveal: write your answer and one sentence explaining it. Use a notebook or your own editor. These pages do not execute code, auto-grade answers, or save progress.

01 · WORKED EXAMPLE

Two requests. One condition.

A simulated conveyor may run when either station requests it, but only when a shared process permit is TRUE. Inputs RequestA, RequestB, Permit: BOOL. Output MotorCmd: BOOL. The permit is ordinary control logic, not a safety function.

Ladder

--[ Permit ]--+--[ RequestA ]--+--( MotorCmd )
              |                |
              +--[ RequestB ]--+
LAD network notation; contacts test Boolean values.

SCL

#MotorCmd := #Permit AND
             (#RequestA OR #RequestB);
SCL function-block body excerpt.

Evaluate the parentheses first: either request is enough. Then AND that result with Permit. With Permit=1, RequestA=0 and RequestB=1, the output is 1. Change only Permit to 0: the output becomes 0.

02 · PREDICT

Write the four missing outputs.

Prediction A: one evaluation per row
PermitRequestARequestBMotorCmd?
001?
100?
110?
111?

Prediction B: at the start of a scan, Memory=FALSE. Two networks execute in this order. What is Lamp at the end? What if you reverse the networks?

Network 1: Memory := TRUE;
Network 2: Lamp := Memory;
Pseudocode showing network order, not physical I/O timing.
Reveal the answer and why

Prediction A: 0, 0, 1, 1. The permit gates both requests. Prediction B: Lamp becomes TRUE because network 2 reads the newly written memory. Reverse the networks and Lamp is FALSE on that first scan, then TRUE on the next if Memory stays TRUE. Memory updates are visible within the program; an actual output terminal follows the configured I/O update timing.

03 · FINISH THE SOLUTIONAdd a blocked-sensor condition.

The conveyor must stop whenever Blocked=TRUE. Add a negated Blocked contact in series with the whole request branch. Complete the SCL line:

#MotorCmd := #Permit AND ______
             AND (#RequestA OR #RequestB);
Guided exercise: fill the missing condition.
Check the missing condition

Use NOT #Blocked. Ladder: [Permit], then [/Blocked], then the parallel RequestA/RequestB branch and MotorCmd coil. With Blocked=1, neither request can make the output TRUE. A contact that checks FALSE is not automatically a physically normally closed switch.

04 · INDEPENDENT VARIANTDesign a fan request.

A simulated fan runs if AutoDemand OR ManualRequest is TRUE, provided OverTemp is FALSE. Declare three BOOL inputs and a BOOL output FanCmd. Draw ladder and write SCL from the requirement, without looking above. Then test: no request; auto only; manual only; both requests; and OverTemp=TRUE with both requests.

Compare your independent solution

Ladder

--[/ OverTemp ]--+--[ AutoDemand ]----+--( FanCmd )
                 |                    |
                 +--[ ManualRequest ]-+
LAD network notation; contacts test Boolean values.

SCL

#FanCmd := NOT #OverTemp AND
           (#AutoDemand OR #ManualRequest);
SCL function-block body excerpt.

With OverTemp=0, outputs for no request / auto / manual / both are 0 / 1 / 1 / 1. With OverTemp=1, FanCmd is 0 regardless of requests. If your OR sits outside the gated parentheses, the manual branch may bypass the blocking condition.

05 · EXPLAIN THE BUGWhy is the manual path bypassing the permit?
#MotorCmd := (#Permit AND #RequestA)
             OR #RequestB;
Faulty expression for the original conveyor requirement.

Give one input combination that proves this expression is wrong. Fix it and explain which parentheses matter.

Reveal the answer and why

Set Permit=0, RequestA=0, RequestB=1. The faulty expression yields 1, but the requirement demands 0. Use #Permit AND (#RequestA OR #RequestB). A single counterexample disproves a proposed control rule.

APPLIED LAB / BUILD • INJECT • PROVE

Applied lab: two selections, exactly one valid

A virtual cell has two mode-selection bits. A run permit is valid only when Enable is TRUE and exactly one of SelectA and SelectB is TRUE. Both selected is a conflict; neither selected is not a valid selection. This is ordinary simulation logic, not a safety interlock.

  1. Create BOOL inputs Enable, SelectA, SelectB and BOOL output ModePermit. Write what TRUE means for every tag.
  2. Build two parallel paths: SelectA AND NOT SelectB, or SelectB AND NOT SelectA. Gate the entire branch with Enable.
  3. Write the equivalent SCL expression. Evaluate all eight input combinations, then run them in reverse order to expose unintended memory.
Reveal the reference rule and full acceptance matrix
#ModePermit := #Enable AND
 ((#SelectA AND NOT #SelectB) OR
  (#SelectB AND NOT #SelectA));
Required ModePermit for every input combination
EnableA/B = 0/00/11/01/1
00000
10110

The alternative #Enable AND NOT (#SelectA AND #SelectB) is wrong: it permits neither selection. XOR and “not both” have different truth tables.

Fault ticket: one branch never works

The A branch accidentally tests SelectA and NOT SelectA in series. Give the single test that isolates it: Enable=1, A=1, B=0 must produce 1. Before changing the code, compare the symbolic tags on both contacts, not just how the rung looks.

Evidence to keep: the failed input row, intended result, original expression, corrected expression and repeat-test results. You are done when all eight rows pass in both directions without a reset.

Move on when: you can solve the independent variant in both representations, explain the edge cases, and fix any error without copying. A correct guess is a review item.