Skip to content
← ENGINEERING NOTES
PLC5 min read

Engineering a PLC Control System

Translating sensors and actuators into reliable control logic — scan cycles, structured text, and why industrial code is written differently.

BY ASHLIN DARIUS GOVINDASAMY

A PLC (Programmable Logic Controller) doesn't run code the way a server does. It runs a scan cycle: read every input, evaluate the entire logic program against those inputs, write every output, repeat — continuously, deterministically, at a fixed cycle time. That difference shapes how control logic has to be written.

The scan cycle

INPUTPLCLOGICOUTPUTMACHINE
Input → PLC → Logic → Output → Machine

Because every input is read at the start of the cycle and every output is written at the end, logic inside the cycle behaves like it's operating on a stable snapshot — which is what makes PLC programs predictable in a way that interrupt-driven code often isn't.

text
IF sensor_overtemp THEN
    motor_run := FALSE;
    fault_output := TRUE;
ELSIF start_button AND NOT stop_button THEN
    motor_run := TRUE;
    fault_output := FALSE;
END_IF;
Structured Text (IEC 61131-3) — simple motor interlock

What makes it different from application code

  • Failure modes have physical consequences — a bug can mean a motor stays on, not a 500 response.
  • Interlocks and safety logic take priority over feature logic, by convention and often by regulation.
  • Determinism matters more than throughput — the scan cycle time is a hard constraint, not a target.

Software engineering discipline — clear state machines, defensive logic, careful review — transfers directly here. What changes is the cost of getting it wrong.

NEWSLETTER

Get the engineering notes in your inbox.

Kernels, GPUs, networks, AI infrastructure — and the things we broke along the way. No spam, one click to leave.

We store only your email address, to send you new articles. See our privacy policy.

TAGS

PLCAutomationIndustrialControl Systems

RELATED

ENGINEERING NOTES

Things we built.Things we broke.Things we learned.