PLC CPU Goes to STOP With a Red Error LED: Reading the Diagnostics

The machine stops, the CPU shows STOP and ERROR. Before downloading anything, read what the controller already told you.

The symptom

The machine halts. The CPU's RUN LED is off, STOP is on, and ERROR (or SF) is red. Restarting the CPU works for an hour, then it stops again.

Read the fault before you reset anything

The controller records why it stopped, and a power cycle or a fresh download often clears that evidence. Connect with the programming software first and look here:

  • Siemens S7-1200/1500: Online & diagnostics → Diagnostic buffer. The newest entry is at the top, and the cause is usually the entry just before Transition to STOP.
  • Rockwell Logix: Controller Properties → Major Faults, which gives the type, the code and the routine/rung where the fault happened.
  • CODESYS / TwinCAT: the PLC log and the exception information shown when you log in.
  • Write down the exact text and, if it is shown, the block and instruction address.

    Common causes

    Cycle time exceeded (watchdog)

    A scan took longer than the maximum cycle time. The usual culprits are a WHILE loop that never ends, a FOR loop over a very large array, or heavy communication inside the cyclic task. Fix the loop exit condition, and move slow work into a lower-priority task or spread it over several scans.

    Array index out of range

    The code reads Data[Index] with Index outside the declared bounds. Siemens may go to STOP if no error OB or local error handling is present; Logix raises major fault type 4, code 20. Clamp or check indices before you use them:

    IF Index >= 1 AND Index <= 100 THEN
        Value := Data[Index];
    END_IF;
    

    Division by zero and invalid REAL

    This usually produces an invalid value rather than a STOP. The trouble comes later, when downstream code indexes an array with that value. Guard your divisions.

    Missing or failed hardware

    If a rack module has been removed or has failed and the configuration requires it, the CPU can stop on startup. Check the module LEDs and the hardware diagnostics view.

    Missing error-handling blocks

    Older Siemens CPUs go to STOP when an event occurs and its organisation block (for example OB82 diagnostic interrupt, OB86 rack failure, OB121 programming error) is not loaded. Adding the OB stops the CPU from halting, but you still have to handle the fault inside it. An empty OB just hides the problem.

    Intermittent stops

    Note the time of every stop. If the stops line up with a shift start, a recipe change or a specific product, look at the code path that runs then. If they line up with a large motor starting, suspect the power supply; finding 24 V supply dips covers how to measure that.

    Afterwards

    Record the cause and the fix in the machine log. If the CPU keeps stopping with the same diagnostic entry, the root cause was not fixed. You can practise writing loops that always exit in the Structured Text reference.

    Frequently asked questions

    Where do I find why my PLC went to STOP?

    In the diagnostic buffer (Siemens), Major Faults in Controller Properties (Rockwell) or the PLC log (CODESYS/TwinCAT). Read it before resetting or downloading.

    What causes a PLC cycle time exceeded fault?

    A scan that runs longer than the watchdog time, usually from an endless WHILE loop, a very large FOR loop or slow work in the cyclic task.