Work in a fixed order: CPU LEDs, diagnostic buffer, online block and cross reference, watch table, and force only as a last resort – then remove every force. A project built with one input mapping, one output mapping and a diagnostic DB makes each step faster, because every physical signal and every fault has exactly one place.
- LEDs, then the diagnostic buffer – always.
- An output that ignores its rung is a double write: use the cross reference.
- Modify is temporary, force is not: delete every force before leaving.
Work in This Order
| Step | Tool | What it tells you |
|---|---|---|
| 1 | CPU and module LEDs | RUN/STOP, ERROR, MAINT (forces) at a glance |
| 2 | Diagnostic buffer | Every event with timestamp, including why the CPU stopped |
| 3 | Online block + cross reference | Live logic and every place a tag is written |
| 4 | Watch table | Observe and modify values |
| 5 | Force (last resort) | Overrides the signal until deleted |
Lab Flow: A Project Built to Be Diagnosed
Every lesson in the Softwell PLC lab manual series follows the same six stages and the same address rule, so the code you write here plugs straight into the HMI lessons.
Stage 1Hardware and Channel Diagnostics
In device configuration enable wire break and overflow/underflow diagnostics on analog channels and no supply voltage on digital modules where available. These faults then appear in the diagnostic buffer with module and channel, and the ERROR LED shows them.
| PLC tag | Address | Type | Device / comment |
|---|---|---|---|
AI_Ch0 | %IW96 | Int | Analog channel with wire-break diagnostics |
B80_Door | %I8.0 | Bool | Door switch |
K80_Lamp | %Q4.1 | Bool | Indicator lamp |
Stage 2Input Mapping: One Place per Signal
With all physical addresses in FC_InputMapping and FC_OutputMapping, a watch table on DB_IO shows the whole machine, and the cross reference of any output has exactly one write. This is the structure used in the first lesson and every lesson since.
Stage 3Logic: DB_Diag for the Operator and the Engineer
// DB_Diag: CycleTime_ms, CycleMax_ms : Real; FirstOut : Int; AnyFault : Bool; ForceActive : Bool; // cycle time: see the scan cycle lesson; first-out: see the interlocks lesson "DB_Diag".AnyFault := "DB_Alarm".Alarm <> 16#0000;
Cycle time measurement is in the scan cycle lesson, first-out capture in PLC interlocks.
Stage 4Link PLC Tags to the HMI
| HMI tag | PLC member | Used by |
|---|---|---|
DB_Diag_CycleTime_ms / _CycleMax_ms | "DB_Diag".CycleTime_ms / CycleMax_ms | Diagnostics fields |
DB_Diag_FirstOut | "DB_Diag".FirstOut | First-out text |
DB_Alarm_Alarm | "DB_Alarm".Alarm | Alarm view |
Stage 5Link the Graphics: a Level 4 Diagnostics Screen
| # | Object | Properties | Tag / event |
|---|---|---|---|
| ① | System diagnostics view | Shows modules and their state from the CPU | System object |
| ② | Output fields cycle time | Current and maximum | DB_Diag_* |
| ③ | Symbolic field first-out | Text list of alarm texts | DB_Diag_FirstOut |
The Field_Status screen in HMI alarm configuration is a ready-made example of a Level 4 screen.
Stage 6Perform and Test: Diagnose Injected Faults
Inject the four classic faults and find each one with the right tool: CPU LEDs, diagnostic buffer, cross reference, watch table and force list.
Troubleshooting
| Symptom | Tool | Typical finding |
|---|---|---|
| ERROR LED flashing | Diagnostic buffer | Wire break on a channel |
| Output ignores its rung | Cross reference | Second write later in the program |
| MAINT LED on | Force table | A forgotten force |
| CPU in STOP | Diagnostic buffer | Cycle time exceeded, programming error |
Hands-On Lab: Diagnose Four Injected Faults
Hands-on- TIA Portal with an S7-1200 or PLCSIM (some module diagnostics need real hardware)
- Estimated time: 75 minutes
Enable channel diagnostics
In device configuration, enable wire-break diagnostics on analog channels and note module addresses.
Map I/O once
Keep every %I and %Q in the mapping FCs so cross references have one hit.
Create DB_Diag
Store cycle time, fault codes and first-out for the HMI.
Link HMI tags
Publish DB_Diag and the alarm word.
Build a diagnostics screen
Add system diagnostics view and DB_Diag fields on a Level 4 screen.
Diagnose injected faults
Inject a wire break, double write, force and cycle-time error and find each with the right tool.
You find each fault with the right tool in the right order, explain the diagnostic buffer entry, and leave the PLC with no forces active.
Frequently asked questions
Where do I start when a Siemens PLC faults?
The CPU LEDs, then the diagnostic buffer. It timestamps every event the CPU recorded, including the cause of a stop, and it is the step most often skipped.
What is the difference between modify and force?
Modify writes a value that the program can immediately overwrite. Force overrides the signal at the module so the program cannot change it, and it stays active until explicitly removed.
How do I find why an output ignores its logic?
Open cross references for that tag. The output is almost certainly written in a second place later in the program, and the later write wins.
Why does the CPU go to STOP under load?
Usually the cycle monitoring time is exceeded, often by a loop or a heavy calculation. The diagnostic buffer records the time error and its timestamp.
How does the IO mapping structure help troubleshooting?
Every physical signal appears once, in FC_InputMapping or FC_OutputMapping, so one watch table on DB_IO shows the whole machine and the cross reference of any %I or %Q address has exactly one hit.
Can the HMI show PLC diagnostics?
Yes. Comfort panels offer system diagnostics views, and your own DB_Diag values (cycle time, fault codes, first-out) can be shown on a Level 4 diagnostics screen.