What is a PLC (Programmable Logic Controller)?

PLCAutomationControllerIndustry 4.0Input/Output

A PLC (Programmable Logic Controller) is an industrial computer designed to control machines and production lines, ruggedised to run 24/7 through dust, vibration, electrical noise and a wide temperature range. It reads inputs from the field, makes decisions according to the user program and drives the outputs.

How does a PLC work: the scan cycle

A PLC program repeats continuously in a loop. One scan cycle consists of:

  1. Read inputs: all input states are copied into an image memory.
  2. Execute the program: the logic runs from top to bottom against that copy.
  3. Write outputs: the calculated outputs are transferred to the physical outputs.
  4. Communication and diagnostics: network traffic and internal checks are handled.

Programs are written in the languages of IEC 61131-3: Ladder Diagram (LD), Function Block Diagram (FBD), Structured Text (ST) and Sequential Function Chart (SFC). Instruction List (IL) was deprecated in the third edition of the standard.

Worked example: worst-case response time

If an input changes just after the PLC has read its inputs, it is not seen until the next scan, and the output is written at the end of that scan. The worst-case response time is therefore roughly:

Response ≈ Input filter delay + 2 × Scan time + Output delay

With a 10 ms scan, a 3 ms input filter and a 10 ms relay output: 3 + 2 × 10 + 10 = 33 ms. On a fast filling machine this delay can overshoot the target weight because flow continues; in such applications the decision is made in a device closer to the measurement, or the delay is compensated for.

Common mistakes

  • Word order of 32-bit values: Modbus registers are 16-bit, so a value like 125430 is carried in two registers (high word = 1, low word = 59894, because 1 × 65536 + 59894 = 125430). If the PLC reads the words swapped, the value shows as 59894 × 65536 + 1 = 3,925,213,185.
  • Wrong analog scaling: forgetting to subtract 4 mA as zero on a 4-20 mA input shifts every reading. See 4-20 mA Current Loop.
  • Not detecting a broken wire: current below 4 mA should be treated as a fault.
  • Not measuring scan time: as the program grows, the scan gets longer and fast signals can be missed.

Sensor integration

Modern PLCs read not only on/off signals but also smart sensor data over protocols such as Modbus or Profinet. The GDT Digital Transmitter sends loadcell weight directly to the PLC over Modbus RTU/TCP. Amazeng ZMA Data Acquisition Cards act as an interface (gateway) that lets PLCs read analog signals with high precision. We discuss moving from PLC-based panels to Linux-based interfaces in PLC to Linux Panel Transition.

Related Terms