Mechatronics · Module 9 of 10

PLCs and Ladder Logic

Factories run on programmable logic controllers, programmed in ladder logic that reads like a relay diagram. The rules are simple: contacts in series are AND, contacts in parallel are OR, and a coil is the output.

01

Readiness check

This module is industrial control logic. Tick only what you can do closed-notes.

  • Evaluate an AND and an OR of two true-false values.
  • Recall that a switch is either on or off.
  • Divide a count by a rate to get a time.
  • Recall that a controller reads inputs then sets outputs.
  • Read a simple two-rail diagram.
0 or 1 weak itemsContinue with this module.
2 weak itemsRevisit Boolean logic in Programming and Computation.
3 or more weak itemsRevisit controllers in Module 8.
02

The core idea

A PLC repeatedly reads its inputs, runs its ladder program, and updates its outputs. In ladder logic, contacts in series form an AND, contacts in parallel form an OR, and the rung drives an output coil. So a rung with A and B in series, paralleled by C, gives Y = (A AND B) OR C.

series contacts → AND (A · B)parallel contacts → OR (A + C)coil Y = (A · B) + C

A programmable logic controller is a rugged industrial computer built to run control logic reliably in a factory. It works on a fixed scan cycle: read all inputs into memory, execute the program once from top to bottom, then write all outputs, and repeat, thousands of times a second. The program is usually ladder logic, a graphical language descended from relay wiring diagrams so that electricians could read it. Two vertical rails carry power, and each horizontal rung has input contacts on the left driving an output coil on the right. The logic follows the wiring: contacts in series carry current only if all are closed, which is a logical AND; contacts in parallel carry current if any is closed, which is a logical OR. A normally open contact passes its input, a normally closed contact inverts it. Combining these builds any Boolean function, so a rung with A and B in series, in parallel with C, energises its coil when Y = (A AND B) OR C. Standard timer and counter blocks add delays and counts, and a seal-in contact latches an output, the classic start-stop motor circuit.

The skill works when: you read series as AND and parallel as OR and evaluate the rung to the coil.
The skill breaks down when: series is treated as OR, or a normally closed contact is read without inverting.
The concept. The rung energises coil Y when A and B are both closed, or when C is closed. Series is AND, parallel is OR, exactly as the current would flow.
03

The skills, taught in order

Five skills let you read and write ladder logic for a PLC.

9.1 What a PLC is

A PLC is a hardened controller with rugged I/O modules, designed to run one control program reliably for years in industrial conditions. It trades the flexibility of a general computer for robustness, standard I/O, and easy field maintenance.

9.2 Ladder basics

Two power rails bound each rung; input contacts on the left drive an output coil on the right. A normally open contact passes its signal true; a normally closed contact passes it inverted. The rung is true when a path of true contacts reaches the coil.

9.3 Series is AND, parallel is OR

Because current needs every series contact closed, series is a logical AND; because any parallel branch suffices, parallel is a logical OR. Nesting these builds any Boolean expression, such as Y = (A AND B) OR C.

WiringLogicTrue when
Contacts in seriesANDall are closed
Contacts in parallelORany is closed
Normally closed contactNOTits input is false

The three wiring patterns and the Boolean operation each performs on a rung.

9.4 Timers and counters

An on-delay timer energises its output only after its input stays true for a set time; a counter increments on each pulse and acts when it reaches a preset. A counter reaching a preset at a known rate takes preset divided by rate in time.

9.5 The scan cycle and latching

Each scan reads inputs, solves the ladder, then writes outputs, so an output changes only at the end of the scan. A seal-in contact of the output placed in parallel with a start button latches the output on until a stop contact breaks it.

Engineering connection: a conveyor start-stop station uses a normally open start, a normally closed stop, and a seal-in contact, the most common rung in industry.

04

Worked example 1: evaluating a rung

A rung has contacts A and B in series, in parallel with contact C, driving coil Y. Evaluate the coil when A = 1, B = 0, and C = 1.

Figure 1. The series branch A AND B is false because B is open, but the parallel branch C is closed, so the coil energises.
  1. ProblemEvaluate coil Y for the rung in Figure 1 at A = 1, B = 0, C = 1.
  2. Given / findA = 1, B = 0, C = 1. Find Y.
  3. AssumptionsAll contacts normally open, so each passes its own value.
  4. ModelSeries is AND, parallel is OR: Y = (A AND B) OR C.
  5. EquationsA · B = 1 · 0 = 0Y = (A · B) + C = 0 + 1
  6. SolveY = (1 AND 0) OR 1 = 0 OR 1 = 1.
  7. CheckC alone provides a closed path to the coil, so Y is true regardless of the failed series branch.
  8. ConclusionThe coil is energised through the parallel C branch, showing how an OR provides an alternate path.
Result. Y = 1.
05

Worked example 2: a counter preset

A PLC counter is preset to 24 and counts parts arriving at 40 per minute. How long until it reaches the preset?

Figure 2. At 40 counts per minute the counter needs 24 counts, so it reaches its preset in 24/40 of a minute, namely 36 seconds.
  1. ProblemFind the time for the counter in Figure 2 to reach its preset.
  2. Given / findPreset 24 counts, rate 40 per minute. Find the time.
  3. AssumptionsParts arrive at a steady rate, one count each, no missed counts.
  4. Modeltime = preset / rate.
  5. Equationst = 24 / 40 mint = 0.6 × 60 s
  6. Solvet = 0.6 min = 36 s.
  7. Check40 per minute is one count every 1.5 s; 24 × 1.5 = 36 s, matching.
  8. ConclusionThe counter output fires 36 s after counting begins, timing a batch of 24 parts.
Result. 36 seconds to reach the preset.
06

Misconceptions and diagnostics

MistakeSymptomDiagnostic questionCorrection
Series read as ORCoil on when it should be off"Do all series contacts need to close?"Series is AND; all must be closed.
Ignoring a normally closed contactLogic inverted from intent"Does this contact invert?"A normally closed contact passes false input as true.
Expecting mid-scan output changeTiming that assumes instant output"When are outputs written?"Outputs update at the end of the scan.
Confusing counter and timerCounting time instead of events"Counts or seconds?"Counters count events; timers count time.
07

Practice ladder

Level 1 · Direct skill

A rung has A and B in parallel driving Y. Evaluate Y when A = 0 and B = 1.

Show answer

Parallel is OR: Y = 0 OR 1 = 1.

Level 2 · Mixed concept

A rung is Y = A AND (B OR C). Evaluate it for A = 1, B = 0, C = 1.

Show answer

B OR C = 1; Y = 1 AND 1 = 1.

Level 3 · Independent problem

A counter preset to 50 counts parts at 20 per minute. How long to reach the preset?

Show answer

t = 50/20 = 2.5 min = 150 s.

Transfer task | Real engineering

Write a rung for a motor that starts on a normally open start button, stops on a normally closed stop button, and stays running after the start button is released.

What good work looks like

Start in parallel with a seal-in contact of the motor output, that pair in series with the normally closed stop, driving the motor coil: (Start OR Motor) AND Stop. The seal-in latches the motor on until Stop opens.

08

Working with AI, and proving it yourself

Use AI as an examiner, not a solver

"Check that I read series as AND and parallel as OR on this rung."
"Give me three rungs with input values; I will evaluate each coil."
"Write my whole ladder program." Building the logic is the skill.
"Is my rung right?" Evaluate it against a truth table yourself.

Portfolio task

Take one simple machine sequence and write it as ladder rungs, including a latch and a timer or counter.

Must include: a series-AND, a parallel-OR, a seal-in latch, and one timer or counter with its preset.
09

Retrieval and spaced review

Closed notes. Answer out loud, then reveal.

1. What logic is series wiring?

AND: all contacts must be closed.

2. What logic is parallel wiring?

OR: any branch closing energises the rung.

3. Describe the PLC scan cycle.

Read inputs, execute the ladder, update outputs, repeat.

4. What does a seal-in contact do?

Latches an output on until a stop contact breaks the rung.

5. Counter time to preset at a steady rate?

Preset divided by the count rate.

TodayFinish this quiz and Levels 1 and 2 of the ladder.
+1 dayEvaluate two new rungs from truth values.
+3 daysWrite a start-stop latch from memory.
+7 daysMove on to system integration in Module 10.
+30 daysReuse series-AND and parallel-OR on any ladder.
10

Textbook mapping

This module follows William Bolton, Mechatronics, 6th edition. Use these references to read further.

Topic in this moduleWhere to read more
PLCs and the scan cycleBolton, Chapter 19, Programmable logic controllers
Ladder logic and functionsBolton, Chapter 19, Ladder programming
Digital logic foundationsBolton, Chapter 5, Digital logic

Chapter numbers refer to Bolton's Mechatronics, 6th edition. Any edition with the same chapter titles is equivalent for study.