IMDHMIControls LibraryShop main store

Troubleshooting

Why a PLC misses short input pulses and how to catch them

PLC programming Published 8 min read

Short answer

A PLC reads each digital input once per scan, so a pulse shorter than the maximum scan time plus the input filter time can rise and fall between two reads and never be seen, with no fault logged. Catch it with a high-speed counter input, an interrupt task, or a latching input module.

On this page
  1. Why does the PLC ignore a pulse the sensor is producing?
  2. How short a pulse can the PLC be guaranteed to catch?
  3. Where do I read the scan time and the input filter time?
  4. How do I prove the miss on the running machine?
  5. How slow can the reaction from input edge to output be?
  6. Is a 15 ms pulse on a 12 ms scan caught or missed?
  7. What fixes a pulse that is shorter than the scan?
  8. Does the same limit apply to pulses read over a network?
  9. Questions asked

A PLC does not watch its inputs. Each digital input is read once per scan into an input image table, and the logic acts on that copy, so any pulse shorter than the maximum scan time plus the input filter time can go high and low between two reads and never be seen — no fault, no diagnostic, and a symptom that looks exactly like a bad sensor. Scan time ranges from milliseconds in compact programs to 100 ms in large ones, and the number moves every time the program is edited. The fix is hardware capture: a high-speed counter input, an interrupt task on that input, or a latching input module. What follows is the detection criterion, the response-time budget, a worked example, and the proof test.

Why does the PLC ignore a pulse the sensor is producing? #

Because that input is sampled once per scan: a pulse that rises and falls between two consecutive input reads never reaches the input image table, so the controller records nothing, reacts to nothing, and raises no fault.

One scan has four moves. The processor reads the input modules and writes the states into the input image table; it executes the program rung by rung against that table; it writes the results into the output image table; and it drives the output terminals from that image in the I/O update. Between one input read and the next, the image bit is frozen from the logic's point of view. A field change that arrives just after a read waits a full scan to be seen; a change that arrives and leaves inside the gap is never written at all. The CPU has no event to diagnose — the input image simply never changed — so the miss is silent, and the trail points at the sensor, the cable, or the terminal.

How short a pulse can the PLC be guaranteed to catch? #

Only a pulse wider than the worst-case sampling gap is guaranteed to be seen: t_pulse must exceed t_scan_max + t_input_filter, and every millisecond of scan growth removes a millisecond of margin.

The worst case is an edge that arrives immediately after an input read. The pulse must still be present at the next read one full scan later, and it must also outlast the input module's filter, which blanks anything shorter than its setting. The two delays add. Work the rule with the maximum scan time the controller has actually recorded, never the average: scan time varies with program length and instruction content and changes with every edit. Compact programs typically scan in 1-20 ms; large ones push toward 100 ms. Even the controller's own guard rail sits far above fast pulses — on Siemens S7-1200 and S7-1500 CPUs the default maximum cycle time is 150 ms, and only crossing it calls the time-error OB 80 or stops the CPU. The pulse is lost tens of milliseconds before any error exists.

Where do I read the scan time and the input filter time? #

Scan time comes from the processor status or diagnostics view in the programming software, the filter time from the input module datasheet for the configured channel, and the pulse width from a scope or from geometry and line speed.

  1. Open the controller's status or diagnostics screen and record minimum, current, and maximum scan time. Use the maximum.
  2. Read the input module's filter time for the channel as configured; faster filter settings trade noise immunity for capture.
  3. Establish the shortest pulse the process can deliver at that input: measure it at the terminal with a scope or logic analyzer, or compute target width divided by pass speed.
  4. Apply the criterion: if the shortest pulse does not exceed t_scan_max + t_input_filter, that input can be missed.
  5. Repeat after any program change that adds logic, because the check is only as current as the last edit.

The screen names differ by vendor; the quantity is always the scan-time maximum the controller itself reports.

How do I prove the miss on the running machine? #

Fire a pulse generator into the input terminal at the shortest realistic width and count what a counter rung on that address records: a count below the pulses fired proves the sampling miss.

Scope the terminal first. A clean pulse at the module terminal rules out the sensor and the cable before you touch the program. Then substitute the generator, fed at the voltage and polarity the module is rated for and isolated from field power, or you will be testing the module's survival instead of its sampling. Run several hundred pulses at the shortest width the process can produce and read the counter. Missing counts against a clean terminal waveform is the proof: the event happened electrically, and the scan never saw it.

How slow can the reaction from input edge to output be? #

Worst case is the input filter plus two full scans plus the output turn-on delay, t_input_filter + 2 × t_scan_max + t_output_delay, which on a 40 ms scan with a 3 ms filter is 83 ms before the output hardware even starts.

The factor of two comes from the sequence. An edge that lands just after an input read waits up to one full scan to be sampled, and the resulting output image change reaches the physical terminals during the following I/O update. That is the classic cyclic model, where inputs are read at the start of the cycle and the terminals are driven from the image afterwards; controllers that write outputs at the end of the same scan, or immediate-refresh instructions that force a read mid-scan, cut one of those terms down. Add the output module's turn-on time from its datasheet — relay outputs add the most. Use the maximum scan here too, because the worst case arrives on the longest scan, not the average one.

Is a 15 ms pulse on a 12 ms scan caught or missed? #

Caught, with 1 ms to spare: the threshold is 12 ms + 2.0 ms = 14 ms and the pulse is 15 ms, but a single millisecond of scan growth loses it, so the decision is to move it off the scanned input.

Worked example, with illustrative inputs:

  • Passing flag 18 mm wide on a 1.2 m/s line: pulse width = 18 mm ÷ 1200 mm/s = 0.015 s = 15 ms.
  • Maximum scan time from the diagnostics view: 12 ms. Configured input filter: 2.0 ms.
  • Detection threshold: 12 ms + 2.0 ms = 14 ms. Margin: 15 ms − 14 ms = 1 ms.
  • Response budget to the output terminal: 2.0 ms + 2 × 12 ms = 26 ms, plus the output module's turn-on time.

One millisecond of margin on a target whose width wears and whose line speed gets raised is not a design. Keep a pulse on a scanned input only when it is at least twice the threshold — 28 ms in this example — and otherwise put it on a high-speed counter input or an input interrupt.

What fixes a pulse that is shorter than the scan? #

Hardware capture, in one of three forms: a high-speed counter or fast-input channel counts edges independent of the scan, an interrupt task tied to the input executes on the edge, and a latching input module holds the event until the program resets it.

  • High-speed counter input. The module's hardware counts edges and totals them between scans. Choose it when the program needs how many or how fast — counts, rates, position. The wiring and setup are the same job as configuring a CP1H high-speed counter for an encoder input, with the counter read as data rather than as a raw bit.
  • Input interrupt or event task. The controller executes a short routine the moment the edge arrives, then returns to the scan. Choose it when the program must react — stop, reject, mark — rather than count. Keep the routine short so it does not inflate the scan for everything else.
  • Latching input module. The module captures the change and holds it for the program to read and reset. Choose it when only whether it happened matters.
  • Change the event itself: a wider flag, a slower pass, or a sensor with a longer output pulse moves the pulse width instead of the capture.

Below the threshold there is no ladder-only fix. A rung cannot examine a bit that was never written.

Does the same limit apply to pulses read over a network? #

Yes, and the window gets wider: a polled link stacks its update period on top of the scan, so the limit becomes roughly t_scan_max + t_input_filter + t_poll, and short events disappear just as silently.

The arithmetic, not the medium, is the culprit — the same mathematics explains why PC-polled remote I/O cannot count encoder pulses for SCADA, where the poll period dwarfs the scan. The mirror problem hits commands you send: a one-shot handshake asserted for a single update can be missed by a slower partner, the failure mode behind how DCAF commands run once without missed requests. In both directions the rule is the same — stretch the event past the slowest sampling period in the chain, or capture it in hardware at the point where it arrives.

Questions asked

Will a faster CPU alone solve the missed pulses?

It narrows the window but never closes it. Scan time is set by program length and instruction content, and it grows with every edit, so a pulse that fits today's scan can be lost after next month's code change. If the shortest field pulse sits anywhere near the scan-plus-filter threshold, put that input on hardware capture instead of trusting CPU speed.

Can an immediate input instruction catch the pulse in software?

No, not by itself. An immediate-refresh instruction reads the physical input mid-scan instead of from the image table, but the rung still executes only once per scan, so a pulse that falls between scans stays invisible. The software fix that works is an interrupt or event task triggered by that input, because its execution is tied to the edge rather than to the scan.

Why does the PLC log no fault when a pulse is missed?

Because from the controller's point of view nothing happened. Diagnostics report module failures, wire breaks and terminal states; the input image table simply never changed, so there is no event to flag. That is what makes this fault costly: the counter reads low, the reject never fires, and the only evidence is the process result.

When do I choose a latching input module over a high-speed counter?

Choose the counter when you need how many or how fast: totals, rates, or position from a pulse train. Choose the latching module when you only need whether: a proof-of-passing or proof-of-trigger flag the program can read and reset. Both capture below the scan threshold; the counter adds measurement, the latch adds simplicity.

How much margin should the pulse width have over the scan?

Design for at least twice the detection threshold, a pulse width of 2 x (t_scan_max + t_input_filter). On a 12 ms scan with a 2.0 ms filter that means 28 ms, because a 15 ms pulse passes with 1 ms to spare and fails the moment the program grows. Mechanical wear on the target and line-speed increases both attack the same margin.

Keep reading

  • How-to

    Run Logix 5000 PID loops in a periodic task

    No. Thirty PID instructions in a FOR loop in a continuous task, with no timer, execute once per scan at a varying interval, so their loop update time setting never matches reality. Move the routine into a periodic task whose period equals the shared update time, and write that same period into every loop's .UPD.

    PLC programming

  • Troubleshooting

    Trace an HMI command that never reaches the PLC output

    When the screen shows a command but the machine does not act, walk five boundaries in order: the screen object's tag binding, the communication connection and controller identity, the input interface, the ladder logic with its permissives, and the output interface. Because a PLC reads inputs once per scan and a scan is typically milliseconds, a brief command can be read and overwritten within one scan. The first boundary where indications disagree marks the fault.

    PLC programming

  • Troubleshooting

    Why PC-polled remote I/O cannot count encoder pulses for SCADA

    A 100 PPR quadrature encoder on a line at 200 m/min produces 333 Hz on channel A, about 1.3 kHz once the counter decodes quadrature at 4x. No PC poll, and no 4 ms discrete input, can follow that rate. Count the pulses in a PLC high-speed counter input and let the SCADA sample the accumulated register.

    Controllers and I/O