How to Use a PLC: Wiring, Programming, and Setup

A programmable logic controller (PLC) is an industrial computer that reads inputs from sensors and switches, runs a logic program, and controls outputs like motors, valves, and lights. Using one involves understanding its hardware, writing a program in one of several standard languages, wiring field devices to its input and output modules, and downloading your logic so the PLC can execute it in a continuous loop. The whole process is more approachable than it looks, and the core workflow is the same regardless of manufacturer.

How a PLC Is Built

A PLC has a modular design. Individual modules slide into a mounting rack, which functions like a chassis connecting everything together. The three main sections on that rack are the power supply, the CPU, and the input/output (I/O) modules.

The power supply converts AC wall power into the DC voltage the CPU and I/O modules need. The CPU is the brain: it stores your program in memory, reads inputs, executes logic, and writes outputs. I/O modules are the PLC’s connection to the physical world. Input modules receive signals from sensors, push buttons, and limit switches. Output modules send signals to devices like motor starters, solenoid valves, and indicator lights. You choose which I/O modules to install based on the types of field devices in your system, such as digital on/off signals or analog signals like temperature and pressure readings.

The five largest PLC manufacturers globally are Siemens, Rockwell Automation, Schneider Electric, ABB, and Mitsubishi Electric. Together they account for roughly 60% of global PLC revenue. Each has its own programming software, but the underlying concepts are identical across all platforms.

The Scan Cycle: How a PLC Runs

Once powered on, a PLC doesn’t just sit and wait. It runs a continuous loop called the scan cycle, repeating three steps over and over, typically completing the entire loop in milliseconds.

  • Read inputs. The PLC takes a snapshot of every input and saves it as a binary image in memory. This snapshot is what the program works with during that scan.
  • Execute the program. The CPU runs through your logic from top to bottom, using the stored input image to make decisions about what outputs should be on or off.
  • Update outputs. After the program finishes, the PLC writes all output values to the output modules at once, turning real-world devices on or off.

Then it starts over. Because this cycle happens so fast, the PLC appears to respond to changes in real time. Understanding the scan cycle matters because it explains why your program doesn’t react to an input change mid-execution. The PLC only “sees” what was true at the moment it took the input snapshot. On the next scan, it picks up the new state.

Five Standard Programming Languages

PLC programming is governed by an international standard called IEC 61131-3, which defines five languages. Most PLC software supports at least two or three of them, and you can often mix languages within a single project.

Ladder Diagram

Ladder diagram is the most widely used PLC language, especially in North America. It originated from relay-based electrical schematics, so it looks like rungs of a ladder with contacts (inputs) on the left and coils (outputs) on the right. If you can read a basic wiring diagram, you can learn ladder logic quickly. It handles on/off control naturally and is the default starting point for most beginners.

Function Block Diagram

Function block diagram arranges logic as a chain of blocks connected by wires, with data flowing left to right. Each block performs a specific function, such as a timer, a counter, or a math operation. This language works well for process control applications where you’re dealing with analog signals and continuous regulation rather than simple on/off switching.

Structured Text

Structured text is a typed, text-based language that resembles Pascal or Basic. You write IF/THEN statements, loops, and variable assignments. It’s powerful for complex calculations, data manipulation, and recipe handling. Programmers with a software background often prefer it over graphical languages.

Sequential Function Chart

Sequential function chart breaks a process into discrete steps and transitions. Each step contains actions written in another language (like structured text or ladder), and a transition condition must be met before the program advances to the next step. This is ideal for batch processes or any machine that moves through a defined sequence of operations.

Instruction List

Instruction list is a low-level, text-based language similar to assembly code. Each line contains a single operation and an operand. It’s compact but harder to read and debug, and it has largely fallen out of favor in modern PLC projects.

Setting Up a New Project

Regardless of which manufacturer’s PLC you’re using, the workflow for starting a project follows the same general pattern. You work in the manufacturer’s programming software, installed on a laptop or desktop PC that connects to the PLC over Ethernet or USB.

First, you configure the hardware. This means building a digital replica of your physical PLC rack inside the software: selecting the CPU model, adding each I/O module in the correct slot, and assigning addresses so the program knows which terminal corresponds to which signal. This step ensures the software and hardware match exactly.

Next, you define your tags or variables. A tag is a human-readable name (like “Start_Button” or “Conveyor_Motor”) that maps to a specific I/O address. Using descriptive tag names makes your program far easier to read and troubleshoot later.

Then you write the program itself, choosing whichever language fits the task. Most projects use ladder diagram for the bulk of machine control logic, with structured text or function blocks for sections that involve math or analog processing. The software provides an instruction library with timers, counters, comparison blocks, math functions, and other standard tools you drag into your program.

Finally, you download the program to the PLC’s CPU over your connection cable. The PLC stores the program in its memory and begins executing the scan cycle. You can monitor the program live, watching inputs and outputs change state in real time on your screen, which is invaluable for testing and commissioning.

Wiring Inputs and Outputs

Physically connecting field devices to the PLC requires understanding your I/O module type. For DC circuits, this comes down to two configurations: sinking and sourcing. These terms describe the direction current flows through the module.

A sinking circuit provides a path to the negative side of the power supply. A sourcing circuit provides a path to the positive side. In practical terms, if you have a sinking input module, you pair it with sourcing (PNP) sensors. If you have a sourcing input module, you pair it with sinking (NPN) sensors. The same logic applies to output modules and the loads they drive. Getting this pairing wrong means the circuit won’t complete and nothing will work, though it typically won’t cause damage.

AC input and output modules don’t use sinking and sourcing terminology because AC current alternates direction. With AC modules, wiring is more straightforward since polarity doesn’t matter. Most starter PLC kits use DC I/O, so understanding sinking and sourcing early saves a lot of confusion.

Communication Protocols

PLCs rarely work in isolation. They communicate with other PLCs, human-machine interfaces (HMIs), variable frequency drives, and supervisory systems. The protocol you use depends on your hardware and application.

Modbus RTU is one of the oldest and simplest protocols, running over serial connections. It’s common in smaller systems and is supported by nearly every PLC on the market. Modbus TCP/IP is its Ethernet-based successor, offering higher speed and the ability to connect more devices on a network.

In factory automation, EtherNet/IP and Profinet dominate. EtherNet/IP is the standard in Rockwell Automation ecosystems, while Profinet is Siemens’ primary protocol. Both run on standard Ethernet hardware and support real-time control, meaning they’re fast enough for time-critical applications like coordinated motion. Profibus and DeviceNet are older fieldbus protocols you’ll still encounter in legacy installations.

When selecting a protocol, the simplest approach is to match what your PLC and field devices already support. Mixing protocols is possible with gateway devices, but it adds cost and complexity.

Reading Diagnostic LEDs

Every PLC CPU has status LEDs on the front panel that give you immediate feedback about system health without connecting a laptop. Learning to read them is one of the fastest ways to diagnose problems in the field.

On a Siemens S7-1200, for example, a solid green RUN/STOP light means the CPU is running your program normally. A solid yellow light means the CPU is in STOP mode and not executing the program. An alternating flash of green and yellow indicates the CPU is in startup, transitioning between states. A flashing red ERROR light signals a fault, which could be an internal CPU error, a memory card issue, or a mismatch between the hardware configuration in your program and the physical modules installed. A brief three-second red flash indicates a temporary error, like the clock resetting after a power loss.

A MAINT (maintenance) light illuminated alongside the RUN light typically means at least one I/O point is being forced. Forcing is a diagnostic feature where you manually override an input or output value, which is useful for testing but dangerous if left active during normal operation.

Safety-Rated PLCs

Standard PLCs are not designed for safety-critical functions like emergency stops or light curtain monitoring. For those applications, you need a safety PLC or a safety-rated CPU that meets the IEC 61508 standard. This standard defines four Safety Integrity Levels (SIL 1 through SIL 4), with SIL 4 offering the highest level of protection against dangerous failures.

A safety PLC achieves its rating through redundant processors, self-diagnostic routines, and certified firmware that continuously checks for faults. SIL 3 is the most common requirement in industrial manufacturing, covering applications like robotic cell guarding and press safety systems. SIL 4 is reserved for extremely high-consequence scenarios, typically in nuclear or rail applications. The safety PLC runs alongside your standard PLC, handling only the safety-related logic, while the standard PLC manages normal machine operation.