A programmable logic controller is an industrial computer built to sit in a panel for twenty years and run the same loop without being restarted. What it does is simpler than it is usually made to sound.
The scan cycle
The PLC reads the state of every input, solves the program using that snapshot, then writes the results to its outputs. Then it does it again. A typical scan runs in a few milliseconds, so a machine is being re-evaluated a few hundred times a second.
Working on a snapshot rather than live signals is the part worth understanding. It is what makes behaviour repeatable, and it is why a signal shorter than the scan time can be missed entirely unless the input is configured to latch it.
Inputs
Discrete inputs answer yes or no: proximity and photoelectric sensors, limit switches, pressure switches, push buttons. Analogue inputs carry a measurement that moves: temperature, pressure, level, flow, speed. Between them they tell the controller what the machine is doing before it decides what to do next.
The program
The logic is where the engineering is. A single operation on a production line can depend on dozens of conditions: the machine enabled, safety satisfied, product present, the next station ready. Timers, counters, sequence steps, interlocks, calculations and alarm handling all sit in here.
This is the part that decides whether a machine recovers cleanly from a stop or needs someone to power it down and walk it back to a known state by hand.
Outputs
Outputs drive contactors, solenoid valves, relays, motor starters and indicator lights. On anything modern the PLC also talks to variable speed drives, servo drives, remote I/O and instruments over an industrial network rather than through hard-wired signals. The controller does not turn the conveyor. It tells the drive that turns the conveyor what to do.
Where it goes wrong
The logic rarely degrades. The hardware underneath it does, and eventually the platform stops being supported while the machine it runs is still perfectly serviceable. That is the point at which PLC upgrades and migration is a planned job rather than an emergency. For the programming itself, see PLC programming.
