SACA PLC Programming and Troubleshooting 2 — Questions and Answers
Question 1: What does 'online editing' mean in PLC programming, and what precautions are necessary?
- Editing a PLC program while the PLC is in RUN mode, with changes taking effect immediately — requiring careful review since incorrect logic can immediately affect the controlled machine (Correct answer)
- Downloading a new program to the PLC from a remote engineering workstation over the internet
- Editing a program in simulation mode before downloading; no machine risk involved
- Making program changes that only take effect after the next scheduled maintenance shutdown
Correct answer: Editing a PLC program while the PLC is in RUN mode, with changes taking effect immediately — requiring careful review since incorrect logic can immediately affect the controlled machine
Online editing (make changes while the PLC scans) allows modifying a running production program without halting the process. Changes take effect in the next scan — requiring thorough review, proper change management, and awareness that incorrect rungs can immediately command machine actions.
Online editing is powerful for minor modifications (adjusting timer setpoints, adding diagnostic rungs) without production downtime. Risks: an incorrectly edited output rung immediately turns on an actuator; removing an interlock rung creates an unsafe condition. Best practices: use offline simulation first, have second engineer verify, ensure safety circuits are not affected, keep a backup before changes, log all online modifications. Allen-Bradley RSLogix 5000 'Test Edits' mode adds new rungs in test mode before finalizing; Siemens TIA Portal uses 'Change Operating Mode' controls. Many plants require a formal Management of Change (MOC) process for any online edit.
Question 2: When troubleshooting a PLC output that is 'on' in the program but the field device is not operating, what is the correct diagnostic sequence?
- Replace the output module immediately, then test the field device
- Verify the output bit is TRUE in the PLC data table, measure voltage at the output terminal, check output fuse, check field device wiring, then verify field device operation (Correct answer)
- Check only the field device wiring and replace if corroded
- Reset the PLC to default configuration and reload the program
Correct answer: Verify the output bit is TRUE in the PLC data table, measure voltage at the output terminal, check output fuse, check field device wiring, then verify field device operation
Systematic fault isolation: confirm the PLC bit is forced/set (logic works), check the output card's LED indicator, measure voltage at the terminal (output card working?), trace wiring to field device (continuity/break?), then verify field device itself — narrowing the fault zone at each step.
The systematic approach prevents wasted effort: 1) Observe PLC online — is the output bit TRUE? (Confirms program logic is correct or incorrect). 2) Check output card LED — is it illuminated? (LED ON = card trying to output; LED OFF = card not receiving signal or card faulted). 3) Measure voltage at output terminal with multimeter — 24VDC present? (Confirms card functioning). 4) Trace to field device — check for broken wire, loose terminal, blown fuse in field panel. 5) Measure voltage at device terminals — if 24V present but device doesn't operate, device itself is faulty (coil burned, mechanical jam). This tree-of-reasoning approach applies to any I/O fault troubleshooting.
Question 3: In ladder logic, what does the 'one-shot rising' (OSR or ONS) instruction accomplish?
- It creates a pulse output that stays high for exactly one scan cycle when the preceding rung logic transitions from false-to-true (Correct answer)
- It latches an output ON indefinitely until a separate reset instruction clears it
- It generates one pulse per second regardless of rung conditions
- It compares the current scan value to the previous scan value and outputs their difference
Correct answer: It creates a pulse output that stays high for exactly one scan cycle when the preceding rung logic transitions from false-to-true
OSR (One Shot Rising) monitors the rung condition — when it transitions from FALSE to TRUE, it sets its output bit for exactly one scan cycle, then clears it even if the enabling condition remains TRUE. Used to trigger a single action (counter increment, subroutine call) on the leading edge of an event.
Without OSR, any output placed after a continuously-true condition fires every scan (thousands of times per second). OSR stores the previous state in a 'storage bit' — detecting the 0→1 transition and outputting for exactly one scan. Uses: incrementing a counter on each press of a button (without OSR, each scan while button is held increments the counter); triggering a single data write on alarm detection; triggering a sub-routine call exactly once per event. Allen-Bradley uses OSR (One Shot Rising); Siemens equivalent is the P (positive edge) instruction. There is also a falling edge version (OSF / N instruction) that fires on TRUE-to-FALSE transitions.
Question 4: What is a 'PLC fault routine' and why is it important for safe machine operation?
- A backup PLC program that runs when the primary program encounters an error
- A special program section that executes automatically when certain faults occur, allowing graceful fault handling rather than an abrupt CPU fault that leaves outputs in an indeterminate state (Correct answer)
- A password-protected section of the PLC program that prevents unauthorized modifications
- A maintenance logging routine that records fault codes and timestamps to a data file
Correct answer: A special program section that executes automatically when certain faults occur, allowing graceful fault handling rather than an abrupt CPU fault that leaves outputs in an indeterminate state
A fault routine (major fault routine in Allen-Bradley, OB80-OB87 in Siemens) lets the programmer define what happens when a fault is detected — logging the fault, safely ramping down outputs, sending alarms — instead of the default behavior of immediately faulting the CPU and leaving outputs uncontrolled.
Without a fault routine, a major fault (e.g., task watchdog exceeded, illegal math operation) causes an immediate CPU fault — the CPU stops scanning, and outputs either go to their fail-safe state (configured) or hold their last state. A fault routine can: log the fault code and timestamp to a data file, set a specific fault output flag for the HMI alarm, attempt a controlled shutdown sequence (close valves, stop conveyors), then either clear the fault (if recoverable) or allow the CPU to fault safely. Siemens S7 uses Organization Blocks (OB) for different fault categories; Allen-Bradley ControlLogix has a user-defined major fault routine in the controller properties.
Question 5: When a PLC input card shows its LED indicator lit but the PLC program shows the input as FALSE, what is the likely cause?
- The input sensor is faulty and sending incorrect signals
- There is likely a wiring error or the sensor output type mismatches the input card type (e.g., PNP sensor connected to NPN-configured input), preventing correct signal interpretation (Correct answer)
- The PLC scan cycle is too fast for the sensor's switching frequency
- The input card needs replacement because the LED circuit and logic circuit have failed independently
Correct answer: There is likely a wiring error or the sensor output type mismatches the input card type (e.g., PNP sensor connected to NPN-configured input), preventing correct signal interpretation
LED lit (hardware sees a signal) but program bit = FALSE indicates the signal is present but not recognized correctly — common causes: PNP vs NPN wiring mismatch (signal is sinking when card expects sourcing), threshold voltage issue, or card configured for AC when DC input is applied.
24VDC discrete input cards have signal threshold levels (typically >15VDC = logic 1, <5VDC = logic 0). An LED lights when current flows through the indicator circuit; logic interpretation uses a separate threshold comparator. PNP-NPN mismatch is a common installation error: a PNP (sourcing) sensor connects its +24V output to the input terminal — if the card is wired for NPN (sinking) inputs (commons wired to +24V), the signal won't read correctly. Other causes: signal voltage too low (long cable + undersized wire causing voltage drop), input filter time set too long (misses fast-switching signals), or a failed input circuit on the card (rare, but the LED driver and logic transistor can fail independently).
Question 6: What is 'structured programming' in PLC design, and how do routines/subroutines improve maintainability?
- Writing all logic in a single flat ladder program without branching to external routines
- Organizing PLC code into separate routines by function (Startup, Running, Fault, Safety), called from a main routine — making programs easier to understand, test, and modify (Correct answer)
- Using only Structured Text language (no ladder) in all PLC programs for readability
- Dividing the program into sections that run on different CPUs in a redundant PLC pair
Correct answer: Organizing PLC code into separate routines by function (Startup, Running, Fault, Safety), called from a main routine — making programs easier to understand, test, and modify
Structured PLC programming uses a main routine that calls separate subroutines (Startup, Auto_Run, Manual, Fault_Handler) — each handling one logical function. This modular approach makes programs readable, allows testing routines independently, and simplifies modifications without affecting unrelated logic.
A 1000-rung flat ladder program is difficult to navigate and maintain — modifying one section risks unintentionally affecting another. Best practice: MainRoutine calls subroutines via JSR (Jump to Subroutine) based on machine state (IDLE_STATE calls Idle routine; AUTO_STATE calls AutoRun routine). Each routine contains only the logic for that state. Benefits: finding fault logic takes seconds (go to FaultHandler routine, not search 1000 rungs), reuse (copy a machine module routine to the next machine), independent testing (test AutoRun routine in forced conditions without activating Startup), and reduced risk (modifying safety interlock routine is isolated from production logic). Allen-Bradley Studio 5000 supports tasks, programs, and routines; Siemens uses FC, FB, and DB organization.
What does 'online editing' mean in PLC programming, and what precautions are necessary?