Deadline, not delay
A watchdog is not a normal IEC timer in the user program. It is runtime supervision around task execution or scheduling.
A PLC watchdog is a time boundary around controller execution. When a task takes too long—or does not start when expected—the runtime raises a fault according to platform configuration. The hard part is not defining the timer. It is proving why execution overran, what the controller and outputs did, and how recovery avoids an unsafe or unexplained restart.
Vendor behavior differs. CODESYS documents task watchdog time and sensitivity; Rockwell documents task watchdog major faults. Exact fault codes, output states, recovery handlers and allowable settings must come from the installed controller, firmware and safety design.
The scheduler starts a continuous, periodic or event task according to its configured trigger and priority.
Programs, routines, function blocks and communication work consume time while higher-priority activity may interrupt.
The configured watchdog and sensitivity define when late execution becomes a controller exception or major fault.
The platform records diagnostics and applies its configured task, application, controller and output behavior.
The watchdog observes elapsed execution, not whether the process result was logically correct. Code can finish inside the limit and still be wrong; correct logic can also overrun because its execution path is unbounded.
Answer first
A PLC watchdog timer monitors whether a controller task completes within an allowed execution time. If elapsed time exceeds the configured limit, the controller reports a watchdog or task-overrun fault and follows platform-specific handling. A watchdog protects runtime availability; it does not validate the control algorithm, prove safety integrity, or automatically identify the slow instruction. Diagnosis requires task statistics, the execution path, competing workload, fault records and the machine state at the first overrun.
A watchdog is not a normal IEC timer in the user program. It is runtime supervision around task execution or scheduling.
Capture the task, maximum scan, code path, communication state and first fault before clearing or increasing the limit.
A task may halt, an application may stop, outputs may take configured defaults, or a major controller fault may occur.
Runtime boundary
Start with the controller execution model because “PLC scan time” can refer to a continuous task, a periodic task, one program, one routine or the complete application cycle.
The task becomes ready after its cyclic interval, event or continuous scheduling condition.
Configured programs run in order and follow data-dependent branches, loops and function-block work.
The runtime completes the cycle and may update outputs or services according to the platform model.
Elapsed execution is compared with the watchdog threshold and sensitivity rules.
The platform may include interruptions, I/O service or other runtime work differently. Treat the exact measurement boundary as a controller-specific fact.
A cyclic PLC program is repeatedly scheduled by the runtime. On a simple controller, engineers often call one complete repetition the scan. On a controller with several tasks, each task has its own period, priority and execution budget. A ten-millisecond motion task and a one-hundred-millisecond supervisory task can therefore have different watchdogs and different consequences. Before diagnosing an overrun, record the exact task name, type, configured period, priority, watchdog, firmware and program calls assigned to it.
The watchdog normally measures elapsed task execution from task start until its configured programs finish. Elapsed time may include pre-emption by higher-priority work depending on the platform. That means a task can overrun even when its own logic did not change: a new high-priority task, communication load, motion processing or runtime service can consume the available wall-clock budget. Conversely, average task time can look healthy while one rare data path exceeds the limit.
Do not confuse this with an ordinary TON instruction. A TON models process time while the PLC continues scanning. A task watchdog is enforced by the runtime when execution is late. A communications watchdog supervises stale or missing messages. An external hardware watchdog may supervise whether the controller itself is alive. Each answers a different question and produces different diagnostic and output behavior.
| Mechanism | What it supervises | Typical evidence | Wrong assumption |
|---|---|---|---|
| Task watchdog | Task completion within a runtime deadline | Task name, elapsed/max time, exception or major fault | It identifies the exact slow rung automatically. |
| Omitted-cycle supervision | Whether a scheduled task starts at all | Missed releases, scheduler or priority diagnostics | It is identical to one long task execution. |
| Communications watchdog | Fresh messages from a peer or device | Connection status, sequence, timeout and data quality | The controller CPU has stopped. |
| IEC TON / TOF | A control condition over process time | Preset, elapsed and done state in the user program | It protects the runtime from an infinite loop. |
| External hardware watchdog | Controller or processor liveness | Hardware diagnostics, reset cause and module status | It validates machine control logic. |
Root-cause families
Treat watchdog diagnosis as a boundary search. Find which workload or path changed before changing the limit.
Unbounded loops, large array work, recursion, excessive iteration or a rare state activates expensive logic.
Higher-priority tasks, interrupts or poorly chosen periods delay completion of the affected task.
Communications, logging, visualization or device diagnostics add work or blocking behavior.
Firmware, memory pressure, hardware faults or configuration changes alter runtime performance.
The first category that correlates with the maximum-time excursion becomes the next proving test; it is not yet the final root cause.
Begin with data-dependent execution. A WHILE loop that waits for a process value can never complete because the physical value changes between scans, not inside the current scan. A FOR loop over a recipe array may be acceptable at fifty elements and destructive at fifty thousand. String manipulation, sorting, protocol parsing and bulk copies can create a rare but legitimate long path. Bound every loop, divide large work across scans and measure worst-case input rather than the friendly commissioning sample.
Next examine scheduling. Adding a faster periodic task or raising its priority can starve lower-priority work. Two tasks that share locks or resources can create blocking and jitter. A task period that is shorter than its worst execution time guarantees backlog. Record minimum, average, maximum and jitter by task over representative machine modes; one average number cannot reveal a deadline miss.
Communications and diagnostics also matter. Synchronous file operations, large recipe transfers, excessive online monitoring, dense trace capture and bursts of network processing can change timing. A programming workstation may make the fault appear only while many tags are watched. Test with and without the suspected workload, but preserve the same process and program state so the comparison is meaningful.
Finally consider environmental and platform changes: firmware upgrades, memory exhaustion, failing storage, a new module, power quality or temperature. These are less common than code and scheduling errors, yet they matter when the program fingerprint is unchanged. Use controller diagnostics and official service guidance rather than assuming every watchdog is a programming defect.
Machine consequence
The same phrase—watchdog timeout—can lead to different task, application and output states on different systems.
The runtime captures a code, task, time and diagnostic context available before or after recovery.
A configured fault routine, exception policy or runtime default determines whether recovery is attempted.
Outputs may hold, reset, de-energize, follow fault programs or enter module-specific states.
Manual intervention, cleared demand and a verified machine state determine whether operation may resume.
Document observed behavior on the exact controller. Do not borrow the output response from a different platform family.
Do not write “the outputs turn off” as a universal watchdog rule. Output behavior depends on controller state, I/O ownership, module fault action, produced data, network connection response and any configured fault program. A physical output may also remain energized through interposing hardware or stored energy after the controller command changes. The safety assessment and electrical design must define the required response independently of ordinary software assumptions.
Fault handlers require restraint. A handler can save evidence, place ordinary logic into a documented state or support an approved recovery path. It must not repeatedly clear an overrun while the same unbounded path remains active. Some platforms escalate repeated watchdogs, and an automatic clear can hide a machine that is no longer executing its intended control interval.
Recovery begins from physical truth: identify which actuators moved, which state was retained, whether commands remain present and whether sequence data is coherent. Clear the initiating demand before returning the controller to run. Reinitialize only the state that the recovery design specifies; resetting every tag can destroy evidence or create an unplanned process transition.
Evidence sequence
A disciplined sequence turns “the PLC froze” into a reproducible timing defect with a named execution boundary.
Save the controller fault, task statistics, time, machine mode, inputs and software revision.
Identify the task, routine path, state and workload active during the maximum-time excursion.
Compare overruns with data size, communication bursts, priorities and online services.
Use safe representative inputs and instrumentation to trigger the same timing boundary.
Change one factor at a time. A faster scan after several simultaneous edits does not show which edit corrected the defect.
First preserve volatile evidence. Photograph or export the fault log, controller mode, task monitor, maximum scan and timestamp. Record the machine state, recipe, batch step, active alarms and connected engineering tools. If the controller must be power-cycled for recovery, capture what will be lost first. A statement such as “faulted sometime on night shift” is not enough to distinguish a rare data path from accumulating load.
Then localize without adding heavy instrumentation that changes the timing. Use built-in task metrics, trace features and controller-supported profiling where available. Add coarse execution markers around major routines before instrumenting every rung. Binary search is useful: identify which half of the program contains the timing jump, then narrow further under the same stimulus.
Compare normal and failing runs using the same program version. Vary one input dimension: array length, message count, recipe size, active client count or machine state. If the execution time grows linearly or quadratically with data size, the curve itself is evidence. If time jumps only when a higher-priority task runs, scheduling is the stronger lead.
After correcting the path, repeat at worst credible load and retain margin. Run startup, normal production, fault, recovery, recipe change and online maintenance modes. A watchdog repair is incomplete if the controller survives a quiet bench test but still misses deadlines during the busiest production transition.
| Field | Why retain it | Example proving question |
|---|---|---|
| Task and trigger | Names the actual supervised execution boundary | Was it the continuous task or a periodic communications task? |
| Period, priority, watchdog | Defines the schedule and time budget | Did configuration change before the first fault? |
| Last / average / maximum time | Separates typical load from rare excursions | Is growth gradual, bursty or one specific outlier? |
| Program and firmware revision | Connects behavior to an exact build | Can the same binary and configuration reproduce it? |
| Machine mode and sequence state | Identifies data-dependent paths | Does the overrun occur during startup, recipe transfer or recovery? |
| External workload | Exposes communications and online-tool correlation | Did a trace, HMI poll burst or download coincide? |
Engineering margin
A threshold is a risk and scheduling decision, not a number copied from another machine.
Measure the worst observed time across credible modes and high-load test conditions.
Allow justified variation without normal nuisance faults.
Configure a value supported by the target and documented with its sensitivity behavior.
Keep the boundary below a delay that creates unacceptable control or equipment consequences.
The acceptable window must be measured again after program, firmware, communications or task-configuration changes.
Measure first. Capture task execution across representative production, startup, changeover, fault and recovery conditions. Include the largest supported recipes and the intended number of communication clients. Use the maximum and distribution, not only the average. If maximum time is still climbing during the test, the sample has not established a stable bound.
Then define margin based on variability and process consequence. A threshold only slightly above a noisy maximum creates nuisance stops; a value hundreds of times the normal scan can allow a stalled control loop to persist too long. The correct number balances scheduler variation against the maximum tolerable loss of timely control and the platform fault response.
Document why the number is acceptable, who approved it and which test supports it. Treat a watchdog increase as a control change requiring review. If the program begins overrunning after a release, raising the limit may merely convert a visible fault into slower, less deterministic control.
Controlled verification
The goal is to prove detection, evidence, outputs and recovery—without creating an uncontrolled machine hazard.
Find unbounded loops and calculate the maximum designed iteration or workload.
Inject bounded delay or high data load with no connected hazardous motion.
Confirm actual fault records, task state and configured output response on representative hardware.
Verify the approved physical response and restart interlocks under the site procedure.
Stop at the lowest layer that answers the requirement. A live machine fault is not the first test environment.
Never add an infinite loop to a production controller as an informal experiment. Use a bounded workload whose duration can be increased gradually, or use a vendor-supported test method. Start offline or on isolated representative hardware. Define the stop condition, expected code, expected controller mode and method of recovery before the first run.
Verify more than fault appearance. Confirm the task and timestamp in diagnostics, what other tasks did, how local and remote I/O behaved, whether the HMI showed stale data, which outputs physically changed and whether the fault survived power loss. A screen capture of the fault code alone does not prove the machine consequence.
Finally prove recovery. Remove the injected cause, clear run demand, establish safe physical state, acknowledge according to procedure and return to run. Confirm that sequences do not resume from an invalid step and commands do not automatically re-energize. Store the result with the program and controller version so future changes can rerun the same acceptance case.
Design for bounded work
The strongest fix is an execution design whose maximum work can be explained before the machine is commissioned.
Use explicit maximum iterations and error exits that cannot wait forever for process change.
Distribute large recipe, logging or parsing jobs across scans where the requirement permits.
Trend maximum time, jitter and margin during realistic operating modes.
Include task-time acceptance limits in release and commissioning evidence.
Timing is a maintained product property. A passing functional test does not replace an execution-time regression check.
Make every loop visibly bounded. Validate array limits before iteration, reject malformed lengths and avoid waiting inside a scan for external state. For algorithms that may process large collections, use a stateful worker that handles a fixed number of elements per cycle and exposes progress, completion and error states.
Separate fast control from slow support work. Motion, interlocks and critical process control need predictable tasks; reports, recipes, diagnostics and noncritical communication can often run at lower priority or in staged services. Shared data then needs an explicit consistency strategy so moving work does not create races or half-updated structures.
Treat timing like memory or I/O capacity: budget it, observe it and regression-test it. Record maximum task times for a known scenario set before release. Flag meaningful growth even when it remains below the watchdog, because disappearing margin is the earliest warning that the next feature may cross the boundary.
Related technical cluster
These are the closest supporting owners and product surfaces. Each link advances a specific part of the same engineering task instead of sending you to a generic content index.
Verified product surface
The browser simulator makes the cyclic execution model visible and supports deterministic behavior tests, but it does not claim to emulate a vendor controller scheduler or hardware watchdog.
The learning interface shows how contacts, instructions and outputs are evaluated through repeated scans.
Scenario cases reset to fresh state, apply timed actions and assert outputs or process state against explicit deadlines.
Structured Text and ladder exercises expose program paths whose behavior can be observed under repeatable inputs.
Troubleshooting scenarios connect logic state, input evidence and output consequence without claiming controller fault-code parity.
The product does not currently emulate controller task priorities, pre-emption, hardware execution timing, vendor watchdog fault codes, fault routines, firmware scheduling, I/O fault-state modules or safety-task behavior. A future scan profiler and bounded watchdog fault-injection lab could expose educational timing evidence while remaining explicitly separate from target-hardware validation.
Answer-engine questions
It is runtime supervision that checks whether a controller task completes within an allowed execution time. Exceeding the limit raises a platform-specific task exception or controller fault.
Common causes include unbounded loops, unexpectedly large data work, higher-priority task interference, communication or logging bursts, blocking resources, configuration changes and less commonly firmware or hardware problems.
No. A TON measures a process condition while the program keeps scanning. A task watchdog is enforced by the runtime when scheduled execution exceeds its allowed time.
Not universally. Output response depends on controller, application, I/O module, network, configured fault handling and electrical design. Verify the exact target and physical machine response.
Preserve the fault and task metrics, identify the affected task and active machine state, correlate maximum time with code paths and workload, then reproduce with one controlled variable at a time.
Only after measuring worst-case execution and confirming the larger delay remains acceptable. Increasing the limit without finding new scan-time growth can hide a defect and reduce control determinism.
Yes. A loop whose exit cannot become true within the current scan can prevent the task from completing. Loops should have explicit finite bounds and error exits.
On platforms that provide it, sensitivity modifies how consecutive or exceptionally long overruns trigger the watchdog. The precise rule is platform-specific and must be read from the target documentation.
Use bounded injected workload on simulation or isolated representative hardware, define expected fault and output behavior first, preserve diagnostics, and prove controlled recovery before any machine-level test.
No. It teaches scan behavior and deterministic testing but does not emulate controller scheduling, hardware timing, vendor fault codes, fault routines or safety-task watchdog behavior.
Primary sources
This guide separates transferable engineering practice from product-specific behavior. Use the primary sources below for exact standard wording, target-controller support, firmware behavior and production design decisions.
Turn the guide into evidence
Start with the scan-cycle visualizer, identify one bounded execution assumption, and write a repeatable test that proves its worst credible input does not change the required behavior.