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
| Part | Job | Notes |
|---|---|---|
| Power supply | Converts mains to the controller’s internal supply | Field devices normally run from a separate fused 24 V DC supply |
| CPU | Stores the program and data, runs the scan | Choose by memory, speed and the number of communications ports |
| Digital input module | Reads on/off signals | Typically 24 V DC (sinking or sourcing), or 120/230 V AC |
| Digital output module | Switches loads | Relay (any voltage, slow, limited life), transistor (24 V DC, fast), triac (AC) |
| Analog input module | Measures 4–20 mA, 0–10 V, thermocouples, RTDs | 12–16 bit; scaled in the program |
| Analog output module | Produces 4–20 mA or 0–10 V | Valve positions, drive speed references |
| Communications | Ethernet, serial, fieldbus | See Connecting PLCs, Drives and HMIs |
| Special modules | High-speed counters, motion, safety, weighing | Plug into the rack or sit on a remote I/O network |
Form factors
| Type | Description | Examples (typical) |
|---|---|---|
| Nano / brick PLC | Fixed I/O in one box, 10–40 points, low cost | Siemens LOGO!, Unitronics V130, IDEC FC6A, Omron CP1E, AutomationDirect Click |
| Compact | CPU with built-in I/O, expandable with modules | Siemens S7-1200, Allen-Bradley Micro800, Mitsubishi iQ-F (FX5), Omron CP2E |
| Modular rack | Separate CPU, power, I/O and communications modules in a rack, hundreds to thousands of points | Allen-Bradley CompactLogix and ControlLogix, Siemens S7-1500, Mitsubishi iQ-R, Omron NX/NJ |
| PC-based / soft PLC | The PLC runtime runs on an industrial PC; I/O on EtherCAT or other networks | Beckhoff TwinCAT, CODESYS runtimes, Siemens SIMATIC IPC |
| PLC with built-in HMI | Controller and operator panel in one unit | Unitronics 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 area | What it holds | Retentive? | Typical addresses |
|---|---|---|---|
| Input image | A copy of the physical inputs, frozen for the scan | No: refreshed every scan | Logix Local:1:I.Data[0].2; S7 %I0.2; Mitsubishi X2; Omron 0.02; IDEC I2; Click X003 |
| Output image | The values that will be written to the outputs | Usually reset on stop | Logix 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, requests | Depends on the area | S7 %M0.0; Mitsubishi M0; Omron W0.00; IDEC M0; Click C1; Logix any BOOL tag |
| Data registers | Integers, reals, setpoints, recipes | Often retentive (check) | S7 %MW10 or a data block; Mitsubishi D0; Omron D0; IDEC D0; Click DS1; Logix INT/DINT/REAL tags |
| Timers and counters | Instruction data (preset, accumulated, done) | Counters often retentive | Logix TIMER tag with .PRE .ACC .DN; S7 timer instance data block; Mitsubishi T0, C0; Omron TIM 0000 |
| System bits | First scan, always on, clock pulses, faults | n/a | S7 FirstScan, Clock_1Hz; Mitsubishi SM400; Omron P_On; Logix S:FS or a first-scan routine |
- Use tags with real names.
Conveyor1_Runsays more thanM0.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.
Scan time = input read + program execution + output write + housekeeping Worst-case response ≈ filter delay + 2 × scan time + output delay
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:
| Platform | Typical products | Software | Notes |
|---|---|---|---|
| Allen-Bradley (Rockwell) | CompactLogix 5380, ControlLogix 5580, Micro800 (Micro820/850); legacy SLC 500, MicroLogix, PLC-5 | Studio 5000 Logix Designer; Connected Components Workbench (CCW) for Micro800 | Dominant in North America. Tag-based; ladder, ST, FBD and SFC; EtherNet/IP native. Instruction names such as XIC, XIO, OTE, TON, CTU |
| Siemens | S7-1200, S7-1500; LOGO!; older S7-300/400 | TIA Portal (STEP 7); LOGO!Soft Comfort | Dominant in Europe and widely used worldwide. Symbolic tags, data blocks, LAD, FBD, SCL (structured text), GRAPH; PROFINET native |
| Mitsubishi Electric | iQ-F (FX5), FX3U, iQ-R, Q series | GX Works3, GX Works2 | Strong in Asia and in machine building. Device addressing (X, Y, M, D); ladder and ST; CC-Link, SLMP and Modbus |
| Omron | CP1E, CP2E, CJ2, NX1P, NX/NJ series | CX-Programmer, Sysmac Studio | Channel.bit addressing on older models; IEC-style tags on NX/NJ; EtherNet/IP, EtherCAT and FINS |
| IDEC | FC6A MicroSmart, FT1A SmartAXIS, Opennet Controller | WindLDR, Automation Organizer | Compact PLCs with built-in Modbus; popular for small machines; ladder with a simple instruction set |
| Unitronics | Vision (V130, V430…), UniStream | VisiLogic, UniApps/UniLogic | PLC and HMI in one unit; economical; Modbus, CAN and Ethernet built in; ladder plus HMI screens in one project |
| AutomationDirect | Click, Productivity series, Do-more | Click Programming Software, Productivity Suite, Do-more Designer | Low-cost, popular for small machines and learning; Modbus built in |
| CODESYS-based | WAGO PFC, Schneider M241/M262, Eaton, Beckhoff (TwinCAT is similar), many others | CODESYS Development System | A 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.
| Platform | Contacts and coil | As written |
|---|---|---|
| Allen-Bradley Logix | XIC / XIO / OTE | XIC 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 / FX | LD / OR / AND / OUT | LD X0, OR Y0, AND X1, OUT Y0 |
| Omron CP1 | LD / OR / AND / OUT | LD 0.00, OR 100.00, AND 0.01, OUT 100.00 |
| IDEC MicroSmart / FC6A | LOD / OR / AND / OUT | LOD I0, OR Q0, AND I1, OUT Q0 |
| Unitronics Vision | ladder | Contact I 0 in parallel with O 0, then I 1, coil O 0 |
| AutomationDirect Click | ladder | Contact X001 in parallel with Y001, then X002, coil Y001 |
| CODESYS (Structured Text) | one line | Motor_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
| Question | Why 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
- PLC & Logic Control: the overview of this guide.
- Ladder Logic in Practice: reading and writing ladder logic.
- I/O Wiring and Signals: wiring field devices to the I/O.
- Industrial Communication: the protocols PLCs use to talk to devices.
- Sensors and System Integration.
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.
