Explain the parts of a PLC, how inputs and outputs are addressed, and how the scan cycle reads, solves and writes.
Why it matters
A programmable logic controller (PLC) is an industrial computer built to run machines reliably for years in heat, dust and electrical noise. It replaced walls of relays with software that can be changed in minutes. To troubleshoot or program one you need a clear picture of its hardware, its addressing and, most of all, the scan cycle, which explains behavior that otherwise looks strange.
Hardware
- Power supply: usually 24 V DC for the CPU and I/O.
- CPU (processor): stores and runs the program, holds data, and talks to other devices. It has modes such as RUN, PROGRAM (stopped, outputs off) and sometimes REMOTE.
- Input modules: take signals from field devices (push buttons, sensors, switches) and convert them to bits the CPU can read. Each input has a status LED.
- Output modules: switch field devices (contactors, solenoids, lamps) according to the program. Relay, transistor and triac types exist.
- Analog modules: read 4 to 20 mA or 0 to 10 V signals as numbers, and write analog outputs to drives and valves.
- Communication: Ethernet ports for programming software, HMIs and networks such as EtherNet/IP, PROFINET or Modbus TCP; remote I/O racks connect over the network.
- Chassis or rack (modular PLCs) or everything in one unit (compact PLCs).
Major vendors include Rockwell Automation (Allen-Bradley), Siemens, Mitsubishi, Omron, Schneider Electric and AutomationDirect. OpenPLC is a free, open-source option for learning (https://autonomylogic.com/). Checked on 2026-10-23.
Addressing
Every input and output has an address, and the format depends on the vendor:
- Siemens style:
I0.0(input byte 0, bit 0),Q0.1(output byte 0, bit 1). - Older Allen-Bradley style:
I:1/0(input slot 1, bit 0),O:2/3. - Modern Allen-Bradley (Logix) and many others use tags: named variables such as
Conveyor_Start_PBmapped to physical I/O.
Electrical drawings show which wire goes to which terminal and address. Good tag names and comments make a program readable.
The scan cycle
A PLC does not watch its inputs continuously while running logic. It repeats a fixed loop called the scan:
- Read inputs: copy the state of every physical input into memory (the input image table).
- Execute the program: solve the logic rung by rung, top to bottom, left to right, using the input image and internal memory. Results go into the output image table.
- Write outputs: copy the output image to the physical outputs.
- Housekeeping: communications, diagnostics, then start again.
A scan usually takes a few milliseconds up to a few tens of milliseconds, depending on program size and CPU. A watchdog timer faults the CPU if a scan takes too long.
What the scan explains
- Inputs are frozen during the scan. If a button changes halfway through, the program sees the new value on the next scan.
- Rung order matters. A bit set on rung 10 is already set when rung 11 runs in the same scan, but rung 9 only sees it next scan.
- The last write wins. If two rungs both write the same output coil, the lower rung decides the output. This "double coil" problem is a classic bug.
- Very short pulses can be missed. A sensor pulse shorter than one scan may fall between input reads. Fast events need high-speed counter inputs or interrupt routines.
Worked example. A program has a 20 ms scan. A photo-eye on a fast line produces a pulse 5 ms long for each part. Some parts will be missed, because the pulse can start and end between two input reads. The fix is a high-speed counter input, a pulse stretcher or a sensor with an off-delay setting, not a faster guess.
Programming languages
The IEC 61131-3 standard defines PLC languages:
- Ladder Diagram (LD): relay-style rungs, most common in North America and easiest for electricians to troubleshoot.
- Function Block Diagram (FBD): blocks wired together, common in process control.
- Structured Text (ST): a text language similar to Pascal, good for math and data handling.
- Sequential Function Chart (SFC): steps and transitions for sequences.
- Instruction List (IL): an older assembly-like language, now deprecated in the standard.
Online monitoring and forcing
Programming software can go online with a running PLC and show which contacts are true (often highlighted green). This is the main troubleshooting tool. Software can also force an input or output on or off regardless of the logic. Forcing can make a machine move unexpectedly, so sites restrict it to authorized people with the area cleared, and forces must be removed and logged.
Common mistakes
- Writing the same output coil in two places.
- Expecting a mid-scan input change to be seen immediately.
- Leaving forces installed.
- Editing a running program without a backup or a management-of-change process.
Safety
Control panels contain voltages that can kill, stored energy in drives and capacitors, and machines that can start unexpectedly. Everything in this course is practised on paper or in simulators. Working in real panels requires employer training, supervision by a qualified person, lockout/tagout and the arc-flash practices in NFPA 70E (https://www.nfpa.org/codes-and-standards/nfpa-70e-standard-development/70e), and for electricians a registered apprenticeship and state or local licence. Checked on 2026-10-23.
Recap
- PLC = power supply, CPU, input and output modules, communications.
- Scan: read inputs, solve logic top to bottom, write outputs, housekeeping, repeat.
- Rung order matters; the last write to an output wins; short pulses can be missed.
- Online monitoring is the main tool; forcing is restricted and dangerous.
Try it
Open the Do tab and take the quiz on PLC hardware and the scan cycle.