Free Resource · Industrial Automation

The Complete PLC Troubleshooting Guide: Fault Codes, Protocols & AI Tools

Everything automation engineers need — Siemens S7 fault codes, Allen-Bradley errors, PROFIBUS vs PROFINET, Modbus RTU/TCP, ladder logic, IEC 61131-3 and how AI is changing the way engineers troubleshoot on the plant floor.

Siemens S7Allen-BradleyPROFIBUSPROFINETModbus RTULadder LogicEtherNet/IPIEC 61131-3AI AutomationFault Codes

1. PLC Fault Codes — How to Decode Them

A PLC fault code is an alphanumeric or numeric error generated by the PLC CPU, I/O module, or fieldbus interface when it detects an abnormal condition. Faults can originate from hardware failures, software logic errors, communication breakdowns or power supply issues. Knowing how to decode them fast is the difference between a 10-minute fix and a 4-hour outage.

Most PLCs store faults in a diagnostic buffer (Siemens) or fault log (Allen-Bradley) accessible via the programming software. The fault entry typically includes:

  • Fault code number or OB number
  • Timestamp of occurrence
  • Module rack/slot reference
  • Additional info bytes with sub-code detail
Quick Tip: Always check the diagnostic buffer before replacing hardware. 90% of apparent hardware faults are wiring, configuration or parameter errors — not failed modules.

2. Siemens S7 Error Codes & Common Fixes

Siemens S7 PLCs (S7-1200, S7-1500, S7-300, S7-400) use Organisation Blocks (OBs) to handle faults. The CPU calls a specific OB when a fault occurs — if the OB is not programmed, the CPU stops with a fault.

Most Common Siemens OB Error Codes

OB / CodeFault TypeMost Likely CauseFirst Fix
OB 122I/O Access ErrorLoose wiring / failed I/O moduleCheck module LEDs and wiring continuity
OB 82Diagnostic InterruptSensor or I/O fault (PROFIBUS slave)Check diagnostic buffer for sub-error
OB 85Program Cycle ErrorMissing OB (OB1 not loaded)Download complete program to CPU
OB 86Rack/Station FailureDP slave or PROFINET device offlineCheck fieldbus wiring and device power
OB 121Programming ErrorWrong data type / address overflowCheck DB access and pointer arithmetic
16#7002CPU Not in RUNMode switch in STOP or faultCheck mode switch; clear diagnostic buffer
16#0A00Password ProtectedWrong or missing passwordEnter correct password in TIA Portal

Siemens S7-1200 vs S7-1500 — Key Differences

The S7-1200 is designed for standalone machines and small automation cells. It supports PROFINET RT but not IRT — even the safety-rated S7-1200F variant does not support IRT (the F suffix means SIL-rated safety, not IRT capability). The S7-1200 has no onboard trace/trending — use HMI data logging for trend capture.

The S7-1500 supports PROFINET IRT, integrated motion control, trace/trending, OPC UA server, and provides significantly more processing power for complex applications.

Common Mistake: Using S5TIME format with S7-1200/1500. These use IEC timers only — write T#5S not S5T#5S. S5TIME is legacy S7-300/400 only.

3. Allen-Bradley / Rockwell Fault Codes

Allen-Bradley ControlLogix and CompactLogix PLCs store faults in the Major/Minor Fault log accessible via Studio 5000 Logix Designer. Faults are categorised as Major (CPU stops) or Minor (execution continues with flag set).

Common Allen-Bradley Fault Codes

Fault CodeTypeDescriptionResolution
Type 4, Code 20MajorWatchdog timer expiredCheck scan time; optimise heavy routines
Type 7, Code 83MajorTag subscript out of rangeCheck array index in logic
Type 1, Code 11MinorPower loss detectedCheck UPS / power supply
Type 10, Code 27MajorI/O module not respondingCheck EtherNet/IP connection and module
Type 6, Code 07MajorIllegal instructionFirmware mismatch — update controller

Allen-Bradley Analog Scaling

For AB ControlLogix/CompactLogix, 4 mA = 3277 and 20 mA = 16383 raw counts. Use the PIDE instruction for PID control — the legacy PID instruction is for SLC/PLC-5 only and should not be used in Logix-based controllers. Timers are always in milliseconds — a 5-second timer is set to 5000, not 5.

4. PROFIBUS vs PROFINET — Key Differences Explained

This is the most frequently confused topic in industrial networking. Here is a precise comparison:

FeaturePROFIBUS-DPPROFINET
Physical LayerRS-485 serial100 Mbps Ethernet (1 Gbps newer)
Max Speed12 Mbps100 Mbps / 1 Gbps
Max Nodes126 total (32 per segment)512 per CPU
Cycle Time1–10 ms @ 12 MbpsRT < 10 ms / IRT < 1 ms
TCP/IP StackNot usedBypassed for RT & IRT; used for Class TCP/IP only
Config FileGSD (NOT GSDML)GSDML (NOT GSD)
ConnectorD-Sub 9-pinRJ45
CablePurple, RS-485Standard Cat5e/Cat6
Termination120Ω both ends onlySwitch-managed
IRT MastersCP 443-5 / S7-400S7-1500, S7-300/400 + CP343-1 Advanced
S7-1200 SupportVia CM 1243-5RT only — NOT IRT (even S7-1200F)
Critical Fact: PROFINET RT and IRT do not run over TCP/IP. They bypass the TCP/IP stack entirely — that is how they achieve determinism. Only PROFINET Class TCP/IP (non-real-time configuration traffic) uses the standard IP stack.

5. Modbus RTU & Modbus TCP Explained

Modbus is the most widely deployed industrial protocol in the world — simple, open and supported by virtually every PLC, VFD, sensor and meter. Understanding its two variants prevents the most common commissioning errors.

Modbus RTU

  • Runs over RS-485 — max speed 115.2 kbps (not 12 Mbps — that is PROFIBUS)
  • Slave IDs: 1–247 (0 = broadcast, 248–255 = reserved)
  • Uses CRC for error checking
  • Half-duplex — only one device transmits at a time

Modbus Function Codes

FCFunctionData TypeAccess
FC01Read CoilsBit (output)Read
FC02Read Discrete InputsBit (input)Read
FC03Read Holding Registers16-bit wordRead/Write
FC04Read Input Registers16-bit wordRead only
FC05Write Single CoilBitWrite
FC06Write Single Register16-bit wordWrite
FC16Write Multiple RegistersMultiple 16-bit wordsWrite
#1 Commissioning Error: Registers are 0-based in the protocol but 1-based (40001) in documentation. Register 40001 in the datasheet = address 0 in your read command. Always subtract 1 when using documentation register numbers.

Modbus TCP

Modbus TCP wraps the same function codes over Ethernet on port 502. The CRC is dropped — TCP handles error checking. The slave ID is replaced by a Unit ID in the MBAP header. Maximum 247 simultaneous connections per server is a common vendor limit.

6. EtherNet/IP & OPC UA

EtherNet/IP

EtherNet/IP uses the Common Industrial Protocol (CIP) over standard Ethernet. Two connection types:

  • Class 1 (Implicit) — UDP cyclic I/O, port 2222. Used for real-time I/O data exchange.
  • Class 3 (Explicit) — TCP on-demand messaging, port 44818. Used for configuration and diagnostics.

OPC UA

OPC UA (Unified Architecture) is the preferred protocol for MES/SCADA-to-PLC communication and Industry 4.0 / IIoT integration. Default port is 4840. Security policies include None, Basic256Sha256, and Aes256Sha256RsaPss. Certificate-based authentication is recommended for production.

7. PLC Programming — IEC 61131-3 Languages

IEC 61131-3 defines five standard PLC programming languages supported by all modern platforms including Siemens TIA Portal, Rockwell Studio 5000, Beckhoff TwinCAT 3, Schneider EcoStruxure, and all Codesys-based controllers.

Ladder Diagram (LD)
Graphical relay-equivalent logic. Most widely used in discrete I/O control. Best for contacts, coils, and sequential logic.
🔷
Function Block Diagram (FBD)
Dataflow-based graphical language. Ideal for process control, PID loops and signal processing.
📝
Structured Text (ST)
High-level text language similar to Pascal. Best for complex calculations, string handling and algorithms.
📋
Instruction List (IL)
Low-level assembly-style language. Largely deprecated in modern platforms but still found in legacy systems.
🔄
Sequential Function Chart (SFC)
State-machine graphical language. Perfect for batch processes, sequential operations and recipe control.

Platform-Specific Notes

  • Siemens S7-1200/1500: LAD, FBD, SCL (Structured Control Language = ST), Siemens graph (SFC variant)
  • Allen-Bradley ControlLogix: LAD, FBD, ST, SFC, Phase (proprietary batch extension)
  • Beckhoff TwinCAT 3: All five IEC languages plus C++ and MATLAB Simulink integration
  • Mitsubishi iQ-R: LAD, ST, FBD, SFC — uses GX Works 3
  • Codesys-based (Wago, B&R, Pilz, Phoenix Contact): All five IEC languages, task-based execution model

8. 4-20mA Scaling & NAMUR Diagnostics

4-20mA Raw Count Reference

Platform4 mA (0%)20 mA (100%)Scaling Method
Siemens S7-1200/1500027648NORM_X + SCALE_X
Siemens S7-300/400691227648FC105 / FC106
Allen-Bradley ControlLogix327716383CPT or SCL instruction
Schneider M340/M580327716383SCALE function block
Beckhoff TwinCAT0 or 327727648 or 32767Depends on module type
Common Error: Siemens 4mA = 5530 is wrong. The correct value is 0 for S7-1200/1500 (bipolar input at 4mA maps to raw 0). Using 5530 will cause a 20% zero-point offset that passes factory acceptance but fails in the field.

NAMUR NE43 Fault Detection

NAMUR NE43 defines fault states outside the normal 4-20mA operating range:

  • 3.8 mA or below — wire break / under-range fault. Check sensor wiring before scaling.
  • 20.5 mA or above — sensor saturation / over-range fault.
  • 3.6–3.8 mA — low warning band (sensor near fault)
  • 20.5–21.0 mA — high warning band

Always check for NAMUR fault states before scaling. Scaling a 3.8mA wire-break signal will produce a negative engineering value that looks like a valid reading.

9. How AI is Changing Industrial Automation

For decades, automation knowledge lived in people — senior engineers who had memorised hundreds of fault codes, knew exactly which termination resistor to check on a PROFIBUS segment, and could write a production-ready function block from memory. When those engineers retire or are unavailable at 2am, production stops.

AI tools trained on verified automation knowledge are beginning to fill that gap — not by replacing engineers, but by making expert-level knowledge instantly accessible to everyone on the team:

🔍
Instant Fault Diagnosis
Paste any fault code — get the most likely cause and fix immediately, without manual lookup.
⚙️
Code Generation
Describe your logic in plain English — get verified ladder logic or structured text for your specific PLC.
📡
Protocol Expertise
PROFIBUS, PROFINET, Modbus, EtherNet/IP — get accurate commissioning guidance on any protocol.
🎓
Knowledge Transfer
Junior engineers get senior-level guidance on demand, closing the experience gap faster.

10. Using PLCpilot — Free AI Co-Engineer

PLCpilot is an AI assistant built specifically for industrial automation engineers. Unlike general-purpose AI, PLCpilot is trained on verified automation knowledge — correct Siemens raw counts, proper PROFIBUS termination rules, Allen-Bradley fault codes, and platform-specific programming patterns.

🔴
Fault Explainer
Paste any PLC error code or fault message. Get an instant explanation and the most likely fix first — no manual required.
🟢
Code Designer
Describe your automation logic in plain English. Get production-ready ladder logic, FBD or structured text for Siemens, Allen-Bradley, Schneider and more.
🟡
Expert Tutor
Ask anything about PLC programming, industrial protocols, or automation standards. Get expert answers tailored to your platform and experience level.
Try PLCpilot Free →See Demo

Free plan · 10 messages/day · No credit card required

11. FAQ — People Also Ask

What is a PLC and how does it work? +

A Programmable Logic Controller (PLC) is an industrial computer that controls machinery and processes by reading inputs (sensors, switches), executing a user program (ladder logic, structured text etc.), and writing outputs (actuators, valves, motors). The CPU executes the program in a continuous scan cycle — typically 1–50ms depending on program size and complexity.

What is the difference between PROFIBUS and PROFINET? +

PROFIBUS-DP is a serial RS-485 fieldbus at up to 12 Mbps with max 126 nodes. PROFINET is Ethernet-based at 100 Mbps with RT (<10ms) and IRT (<1ms) modes that bypass the TCP/IP stack. PROFIBUS uses GSD files; PROFINET uses GSDML. S7-1200 supports PROFINET RT only — not IRT.

How do I decode a Siemens S7 fault code? +

Open TIA Portal and navigate to Online & Diagnostics > Diagnostic Buffer for the CPU. Each fault entry shows the OB number, timestamp, and additional info bytes. Common ones: OB122 = I/O access error (check wiring), OB86 = station failure (check fieldbus), OB121 = programming error (check data types). You can also paste the code directly into PLCpilot for an instant plain-English explanation.

What is 4-20mA and how do I scale it in a PLC? +

4-20mA is the standard current loop signal for process instruments. 4mA = 0% of range, 20mA = 100%. In Siemens S7-1200/1500, raw counts are 0 (4mA) to 27648 (20mA) — use NORM_X then SCALE_X. In Allen-Bradley ControlLogix, 4mA = 3277 and 20mA = 16383. Always check for NAMUR NE43 fault states (below 3.8mA or above 20.5mA) before scaling.

What is IEC 61131-3? +

IEC 61131-3 is the international standard defining five PLC programming languages: Ladder Diagram (LD), Function Block Diagram (FBD), Structured Text (ST), Instruction List (IL, now deprecated), and Sequential Function Chart (SFC). All modern PLC platforms — Siemens, Allen-Bradley, Beckhoff, Schneider, Codesys — support these languages.

How does Modbus RTU addressing work? +

Modbus registers are 0-based in the protocol but 1-based in most documentation. Register 40001 in a datasheet = address 0 in your read command. Slave IDs run from 1-247 (0 = broadcast). Max RS-485 baud rate is 115.2 kbps — not 12 Mbps, which is PROFIBUS.

What PLC platforms does PLCpilot support? +

PLCpilot supports Siemens S7-1200, S7-1500, S7-300/400; Allen-Bradley ControlLogix, CompactLogix, MicroLogix; Schneider M340, M580; Beckhoff TwinCAT 3; Mitsubishi FX, iQ-R; Omron NX/NJ, CJ series; and all Codesys-based platforms (Wago, B&R, Phoenix Contact, Pilz, Bosch Rexroth).

Is PLCpilot free? +

Yes. PLCpilot has a free plan with 10 messages per day — no credit card required. The Pro plan at €29/month provides 150 messages/month with access to more powerful AI models for deeper troubleshooting and code generation.

Stop guessing. Start diagnosing.

Free to try. No credit card. No setup. Just paste your fault code and get an answer.

Start Free — 10 Messages/Day →