How PLCs Work

Hardware and modules, memory and tags, the scan cycle, and a comparison of the common platforms.

What a PLC is

A programmable logic controller (PLC) is a rugged industrial computer built to run machines and processes. It reads inputs (buttons, sensors, transmitters), runs a stored program many times a second, and switches outputs (contactors, valves, lamps, drives). Unlike a general-purpose computer, it is designed for electrical noise, vibration, wide temperature ranges and long service life, it has isolated, protected I/O at industrial voltages, it runs the program with predictable timing, and it can be fixed by a maintenance technician with a laptop. A PLC changes behavior by changing the program, not by rewiring.

  • Discrete control: start/stop, interlocks, conveyors, sequences, packaging machines.
  • Process control: analog inputs and outputs, PID loops for temperature, pressure, flow and level.
  • Motion and drives: variable frequency drives, servos and stepper axes, often over a network.
  • Data and communications: talking to HMIs, SCADA, other PLCs, barcode readers and databases.

Hardware and modules

Field inputsField outputsThe PLC (rack or compact unit)Push buttons, switchesProximity, photo sensorsLimit switches, contacts4–20 mA transmittersThermocouples, RTDsContactors, motor startersSolenoid valvesLamps, hornsValves, drives (analog)VFDs, HMI, other PLCsPower supplymains to 24 V DC / 5 VCPUprogram, data, scanDigital in24 V DC inputsDigital outrelay / transistorAnalog in/out4–20 mA, 0–10 VCommunicationsEthernet, serial, busbackplane or internal bus connects the modulesProgramming PCUSB or EthernetHMI / SCADAEthernet, serialRemote I/O, drivesfieldbus, EthernetOther PLCsEthernet, serial
A PLC system: field inputs, the PLC rack or compact unit, field outputs, and the computers and networks that talk to it.
PartJobNotes
Power supplyConverts mains to the controller’s internal supplyField devices normally run from a separate fused 24 V DC supply
CPUStores the program and data, runs the scanChoose by memory, speed and the number of communications ports
Digital input moduleReads on/off signalsTypically 24 V DC (sinking or sourcing), or 120/230 V AC
Digital output moduleSwitches loadsRelay (any voltage, slow, limited life), transistor (24 V DC, fast), triac (AC)
Analog input moduleMeasures 4–20 mA, 0–10 V, thermocouples, RTDs12–16 bit; scaled in the program
Analog output moduleProduces 4–20 mA or 0–10 VValve positions, drive speed references
CommunicationsEthernet, serial, fieldbusSee Connecting PLCs, Drives and HMIs
Special modulesHigh-speed counters, motion, safety, weighingPlug into the rack or sit on a remote I/O network

Form factors

TypeDescriptionExamples (typical)
Nano / brick PLCFixed I/O in one box, 10–40 points, low costSiemens LOGO!, Unitronics V130, IDEC FC6A, Omron CP1E, AutomationDirect Click
CompactCPU with built-in I/O, expandable with modulesSiemens S7-1200, Allen-Bradley Micro800, Mitsubishi iQ-F (FX5), Omron CP2E
Modular rackSeparate CPU, power, I/O and communications modules in a rack, hundreds to thousands of pointsAllen-Bradley CompactLogix and ControlLogix, Siemens S7-1500, Mitsubishi iQ-R, Omron NX/NJ
PC-based / soft PLCThe PLC runtime runs on an industrial PC; I/O on EtherCAT or other networksBeckhoff TwinCAT, CODESYS runtimes, Siemens SIMATIC IPC
PLC with built-in HMIController and operator panel in one unitUnitronics Vision and UniStream, Siemens Unified Comfort, Mitsubishi GOT with PLC

Memory, tags and addresses

Everything the program reads or writes is a variable in memory. Older PLCs address memory by fixed locations (I:1/0, X0, 0.00); newer ones use named tags (Start_PB, Tank_Level) that the programmer creates and the software maps to addresses. Learn the memory areas, because they behave differently:

Memory areaWhat it holdsRetentive?Typical addresses
Input imageA copy of the physical inputs, frozen for the scanNo: refreshed every scanLogix Local:1:I.Data[0].2; S7 %I0.2; Mitsubishi X2; Omron 0.02; IDEC I2; Click X003
Output imageThe values that will be written to the outputsUsually reset on stopLogix Local:2:O.Data[0].0; S7 %Q0.0; Mitsubishi Y0; Omron 100.00; IDEC Q0; Click Y001
Internal bits (flags)Program memory bits: states, flags, requestsDepends on the areaS7 %M0.0; Mitsubishi M0; Omron W0.00; IDEC M0; Click C1; Logix any BOOL tag
Data registersIntegers, reals, setpoints, recipesOften retentive (check)S7 %MW10 or a data block; Mitsubishi D0; Omron D0; IDEC D0; Click DS1; Logix INT/DINT/REAL tags
Timers and countersInstruction data (preset, accumulated, done)Counters often retentiveLogix TIMER tag with .PRE .ACC .DN; S7 timer instance data block; Mitsubishi T0, C0; Omron TIM 0000
System bitsFirst scan, always on, clock pulses, faultsn/aS7 FirstScan, Clock_1Hz; Mitsubishi SM400; Omron P_On; Logix S:FS or a first-scan routine
  • Use tags with real names. Conveyor1_Run says more than M0.1, and tags make a program readable by the person who maintains it five years later.
  • Learn your platform’s numbering. Mitsubishi FX/iQ-F inputs and outputs are numbered in octal (X0–X7, X10–X17, no X8 or X9); Omron uses channel.bit (0.00 to 0.15); Siemens uses byte.bit (%I0.0 to %I0.7).
  • Know what survives power loss. Most PLCs lose non-retentive memory at power-off or on a stop-to-run change; setpoints and counts you need must go in retentive memory.

The scan cycle and response time

A PLC does not react to an input the instant it changes. It works in a loop called the scan: read all inputs into the input image, solve the whole program once using that frozen snapshot, then write the output image to the outputs, then do housekeeping such as communications. That is why the order of rungs matters, and why a very short pulse can be missed.

1 Read inputsCopy field inputsinto the input image2 Run programSolve the logic once,top to bottom3 Write outputsCopy the output imageto the output modules4 HousekeepingCommunications,diagnostics, clockrepeats continuously: one pass is one scanTypical scan: a few milliseconds for small programs, longer as the program and I/O grow.
One scan. Inputs are read once at the start, and outputs are updated once after the program has run.

Scan time = input read + program execution + output write + housekeeping    Worst-case response ≈ filter delay + 2 × scan time + output delay

RProgramWOtherScan 1 (12 ms)RProgramWOtherScan 2 (12 ms)0 ms12 ms24 msInput changes just afterit was readOutput changesat the write20 ms: just under two scansR = read inputs, W = write outputs, Other = communications and housekeeping. Drawn to scale.
Worst-case timing for a 12 ms scan, drawn to scale. The input changes just after the read, so it is not seen until scan 2.

Worked example: how long until the output moves?

  • Scan: 1 ms input read + 7 ms program + 1 ms output write + 3 ms housekeeping = 12 ms. The input filter is 5 ms and the output switches in 1 ms.
  • Worst case: 5 + 2 × 12 + 1 = 30 ms. Best case: about 18 ms.
  • Shortest pulse that is reliably seen: one scan plus the filter, 12 + 5 = 17 ms. Counting both the on and off times, ordinary inputs top out near 1 000 ÷ (2 × 17) ≈ 29 pulses per second; faster signals need a high-speed counter input.
  • Watchdog. If one scan runs longer than the watchdog setting (for example because of a loop that never ends), the CPU faults and stops.
  • Tasks. Larger PLCs run several tasks: a continuous or cyclic main task, faster periodic tasks, and event or interrupt tasks. Put time-critical logic in a fast task and keep it short.
  • Rung order. A rung that depends on another rung’s result sees it in the same scan only if it comes later in the program.

The common platforms

The ideas in this guide apply to every brand, but each has its own software, names and habits. The ones you are most likely to meet:

PlatformTypical productsSoftwareNotes
Allen-Bradley (Rockwell)CompactLogix 5380, ControlLogix 5580, Micro800 (Micro820/850); legacy SLC 500, MicroLogix, PLC-5Studio 5000 Logix Designer; Connected Components Workbench (CCW) for Micro800Dominant in North America. Tag-based; ladder, ST, FBD and SFC; EtherNet/IP native. Instruction names such as XIC, XIO, OTE, TON, CTU
SiemensS7-1200, S7-1500; LOGO!; older S7-300/400TIA Portal (STEP 7); LOGO!Soft ComfortDominant in Europe and widely used worldwide. Symbolic tags, data blocks, LAD, FBD, SCL (structured text), GRAPH; PROFINET native
Mitsubishi ElectriciQ-F (FX5), FX3U, iQ-R, Q seriesGX Works3, GX Works2Strong in Asia and in machine building. Device addressing (X, Y, M, D); ladder and ST; CC-Link, SLMP and Modbus
OmronCP1E, CP2E, CJ2, NX1P, NX/NJ seriesCX-Programmer, Sysmac StudioChannel.bit addressing on older models; IEC-style tags on NX/NJ; EtherNet/IP, EtherCAT and FINS
IDECFC6A MicroSmart, FT1A SmartAXIS, Opennet ControllerWindLDR, Automation OrganizerCompact PLCs with built-in Modbus; popular for small machines; ladder with a simple instruction set
UnitronicsVision (V130, V430…), UniStreamVisiLogic, UniApps/UniLogicPLC and HMI in one unit; economical; Modbus, CAN and Ethernet built in; ladder plus HMI screens in one project
AutomationDirectClick, Productivity series, Do-moreClick Programming Software, Productivity Suite, Do-more DesignerLow-cost, popular for small machines and learning; Modbus built in
CODESYS-basedWAGO PFC, Schneider M241/M262, Eaton, Beckhoff (TwinCAT is similar), many othersCODESYS Development SystemA vendor-independent IEC 61131-3 environment used inside many brands; OpenPLC is a free open-source relative for learning

The other brands (Schneider Electric, ABB, Delta, Fatek, Fuji, Panasonic, Keyence, Beckhoff and more) follow the same ideas.

The same rung on each platform

A motor start/stop rung with a seal-in: Start (normally open button), Stop (wired normally closed, so its input is on when healthy), and the motor output. The logic is identical; only the names and addresses change.

PlatformContacts and coilAs written
Allen-Bradley LogixXIC / XIO / OTEXIC Start_PB in parallel with XIC Motor_Run, then XIC Stop_OK, OTE Motor_Run
Siemens S7-1200 (LAD)contacts and coil%I0.0 (Start) or %Q0.0 (Motor), then %I0.1 (Stop), coil %Q0.0
Mitsubishi iQ-F / FXLD / OR / AND / OUTLD X0, OR Y0, AND X1, OUT Y0
Omron CP1LD / OR / AND / OUTLD 0.00, OR 100.00, AND 0.01, OUT 100.00
IDEC MicroSmart / FC6ALOD / OR / AND / OUTLOD I0, OR Q0, AND I1, OUT Q0
Unitronics VisionladderContact I 0 in parallel with O 0, then I 1, coil O 0
AutomationDirect ClickladderContact X001 in parallel with Y001, then X002, coil Y001
CODESYS (Structured Text)one lineMotor_Run := (Start_PB OR Motor_Run) AND Stop_OK;

See Ladder Logic in Practice for the circuit drawn out and for more patterns.

Choosing and sizing a PLC

QuestionWhy it matters
How many I/O points, and of what type?Count digital inputs, digital outputs, analog inputs and outputs, then add 20 % spare
What speed and memory does the program need?Motion control, fast counting and big recipes need more than simple on/off logic
What communications does it need?Ethernet ports, serial ports, Modbus, EtherNet/IP, PROFINET: match the HMI and drives you will use
What does the software cost and who will support it?Some brands have free software; others charge per seat; local distributors and spare-parts availability matter
What does the customer or plant already use?A plant that stocks one brand usually wants the same brand
What environment?Temperature, vibration, hazardous areas and conformal coating decide the model
Safety?Emergency stops and guarding may need a safety-rated PLC or safety relays

Worked example: sizing a small machine

  • The machine has 24 digital inputs (buttons, sensors, limit switches), 16 digital outputs (valves, contactors, lamps), 4 analog inputs (two pressure transmitters and two temperatures) and 1 analog output (a drive speed).
  • Add 20 % spare: 24 × 1.2 = 29 inputs and 16 × 1.2 = 20 outputs. A compact PLC with 24 DI + 16 DO built in is too tight, so choose a unit with expansion, or a 32 DI + 20 DO model.
  • A drive and an HMI both want Ethernet or Modbus, so a model with two communication ports is worth the small extra cost.

Getting started

  • Learn on a small PLC or a simulator. Siemens PLCSIM, Studio 5000 Emulate, Click and Do-more simulators, CODESYS soft PLC and OpenPLC all run without hardware. A used compact PLC and a few buttons is cheap practice.
  • Start with ladder logic and the start/stop rung, then timers and counters, then analog scaling, then structured text. See the next pages in this guide.
  • Download the manual for your platform: instruction names and numbering differ, and the manual is the authority.
  • Practice safe habits early: back up before changing, test offline first, and keep safety functions outside the PLC program. See PLC Troubleshooting, Safety and Documentation.

Related

FAQ

What is the difference between a PLC and a microcontroller such as an Arduino?

A microcontroller is a chip you program for any job. A PLC is a complete industrial product built around one: it has isolated, protected I/O at industrial voltages, a rugged enclosure, a deterministic scan, standard programming languages and long-term support. For hobby and prototype work an Arduino is fine; for machines others must maintain, a PLC is usually the better choice.

Which PLC brand should I learn?

Learn the ideas first, because they carry over. For a career in North America, Allen-Bradley (Studio 5000) and Siemens (TIA Portal) are the most useful. For learning at low cost, Click, Do-more, CODESYS or OpenPLC need no expensive hardware.

Why does my PLC scan time matter?

It sets how quickly the machine reacts and how short a pulse can be and still be seen. If the scan is too long for the process, use a faster task, a high-speed input, or a smaller program.

Can one PLC mix digital and analog I/O?

Yes. Most PLCs accept digital and analog modules in the same rack, and compact units often have both built in.

What is a soft PLC?

A PLC runtime that runs on an industrial PC under a real-time operating system, using the same IEC 61131-3 languages. It suits motion-heavy and data-heavy applications.

References

  • IEC 61131-1, -2 and -3, Programmable controllers: general information, equipment requirements, programming languages.
  • Rockwell Automation, Logix 5000 Controllers General Instructions Reference Manual (1756-RM003) and Micro800 documentation.
  • Siemens, S7-1200 System Manual and S7-1500 System Manual.
  • Mitsubishi Electric, MELSEC iQ-F FX5 User’s Manual; Omron, CP1 Operation Manual; IDEC, FC6A Series User’s Manual; Unitronics, Vision Series Hardware and Software Manuals.
  • CODESYS Group, CODESYS Online Help; PLCopen, plcopen.org (IEC 61131-3 overview).

Last reviewed: October 2026. Instruction names, addresses and data sizes differ by manufacturer: confirm against your controller’s manual, and keep safety functions independent of standard PLC logic.