AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Troubleshooting

Why the PLC input filter drops encoder pulses

Sensors, encoders and machine vision on the machine Published 5 min read By AutomateDirectUSA engineering team

Short answer

A hand-turned 1024 PPR encoder that shows 10 to 30 counts per revolution on a high-speed counter is almost always being rejected by the digital input filter, which suppresses any state shorter than its configured time. Check the signal at the terminal, set the filter below the shortest pulse width, then verify the HSC assignment and count address, in that order.

On this page
  1. Is the encoder signal actually reaching the input terminal?
  2. How short are the pulses, and how does that compare to the filter time?
  3. Is the counter really counting in hardware, and on the right input?
  4. Are you reading the right count value, and does the program location matter?
  5. Questions asked

A 1024 PPR encoder that returns only 10 to 30 counts for one hand-turned revolution is not a broken counter. The usual cause is the digital input filter: it suppresses any state shorter than its configured time, and a hand-turned high-resolution encoder produces pulses far shorter than the default allows. Work through four checks in order: the signal at the terminal, the filter time against the shortest pulse width, the counter's hardware assignment, and the address you read. This article covers the first two in depth, since that is where nearly all of these cases end.

Is the encoder signal actually reaching the input terminal? #

The first check is an oscilloscope on the counter input terminal while turning the shaft, because a counter cannot count a signal that never electrically arrives. An incremental encoder supplies two channels that pulse as the shaft moves; confirm that the connected channel's high and low levels sit inside the input's valid ranges for the CPU variant you have, taken from its datasheet. The input status LED is not a pulse counter: its update rate cannot prove that every edge arrives. If the scope shows clean, full pulses at the terminal and the count is still tiny, move on, because the signal is fine and the qualification stage is the problem.

How short are the pulses, and how does that compare to the filter time? #

The input filter is the cause in almost every 10-to-30-counts case: it requires a state change to persist for a configured interval before the counting hardware accepts it, and a pulse that ends first is discarded. On an S7-1200 the default filter time is 6.4 ms, and selectable values run from 0.1 microseconds upward; on that default, any pulse shorter than 6.4 ms may never be counted at all. A hand turn is not electrically slow: one quick quarter-turn of a 1024 PPR encoder lasts perhaps 250 ms and packs 256 pulses into it, roughly 1 ms each, all rejected by a 6.4 ms filter while the occasional slow passage through one pulse survives, which is exactly the 10-to-30-count signature.

Calculate the pulse frequency from the resolution and shaft speed: f = PPR × n / 60, with f in hertz and n in revolutions per minute. A worked example (calculated, not measured): 1024 PPR at 60 rpm gives f = 1024 × 60 / 60 = 1024 Hz, so a full period is 1/1024 s ≈ 0.98 ms and, at a typical 50 % duty cycle, the high and low intervals are about 0.49 ms each. The decision rule: set the filter to the fastest supported value below the shortest measured high or low interval at your maximum speed, then download the hardware configuration and repeat the marked-shaft revolution test. For encoder counting, choose the lowest setting available and rely on wiring quality rather than filtering for noise immunity.

The same filter applies to every use of that input point, including the high-speed counter, so there is no separate counter setting that overrides it. A checklist for the filter decision:

  • Scope the channel at the terminal at maximum intended speed and measure the shortest high and the shortest low interval.
  • Choose the fastest filter setting shorter than both intervals; note each point has one filter value shared across all its uses.
  • Download and compare the online configuration with the offline project.
  • Expect noise-created extra counts to be fixed by correcting the signal quality, not by lengthening the filter back up.
Observation Likely mechanism Action
Clean pulses at the terminal, count far too low Filter rejects short states Lower the filter time below the pulse width
Loss grows with shaft speed Pulse intervals shrink as f rises Recheck filter against intervals at max speed
Extra or irregular counts Noise accepted as edges Fix shielding and wiring, keep the filter low
No pulses at the terminal Wiring, supply or output mismatch Fix the electrical interface first

Is the counter really counting in hardware, and on the right input? #

With the signal and filter settled, confirm the counter is enabled in the hardware configuration with the intended mode, single-phase count up on the wired input, and that no reset or gate input is repeatedly clearing the value. A hardware counter counts independently of the program scan; a software counter sampling the input bit each cycle will lose pulses between scans, which is a different fault with the same symptom. The live article on matching an incremental encoder to a PLC high-speed counter covers the assignment step in detail. An interrupt is not needed just to accumulate; adding one does not restore pulses the filter already rejected.

Are you reading the right count value, and does the program location matter? #

Read the count from the address the hardware configuration actually assigns to the counter, with the data type the configuration specifies, rather than an address copied from an example project. Where the read happens makes no difference: moving it between a cyclic organization block and a function changes nothing about acquisition speed, because the counting is in hardware. The same principle explains why a PC polling remote I/O cannot count encoder pulses for SCADA, as the linked article on that subject explains: sampling and counting are different jobs. The marked-shaft test is the final proof: one continuous revolution in one direction should change the count by the full resolution, and a single-phase count-up configuration counts transitions in both directions, so rocking the shaft adds counts rather than canceling them. The basics of connecting a 5 V encoder to 24 V inputs are covered in the live article on wiring an encoder to PLC inputs if your levels fail the first check.

Questions asked

What filter time should I set for a 1024 PPR encoder?

Take the shortest high or low interval at your maximum shaft speed and choose the next supported setting below it. On an S7-1200 you can select from 0.1 microseconds upward, so for encoder counting you set the fastest value available and rely on good wiring rather than filtering for noise immunity.

Does moving the count read from OB1 to a function block change the count?

No. The high-speed counter accumulates in hardware regardless of where the program reads it. Moving the read between an organization block and a function changes nothing about acquisition speed; the accumulated value is the same at either location.

Why does rocking the shaft back and forth not cancel counts?

A single-phase count-up configuration counts every qualified transition in one direction, regardless of which way the shaft moves. Rocking adds counts instead of canceling them, so a direction test needs quadrature mode with both channels.

Is the input status LED a good check for arriving pulses?

No. The status indication updates too slowly to show individual pulses and is not a counter. Use an oscilloscope or the counter value itself to prove that transitions reach the terminal.

Keep reading

  • How-to

    Counting Encoder Pulses on a PLC Without Losing Position

    Count encoder pulses with a hardware high-speed counter input wired for quadrature, never with a count instruction in the scan. At 214 rpm and 75 pulses per revolution the encoder delivers 267.5 pulses per second, one every 3.7 ms, while a 10 ms scan cannot guarantee seeing even one in three. Zero the counter at a reference switch and treat every target as counts from that switch.

    Sensors, encoders and machine vision on the machine

  • How-to

    Measuring RPM With a Proximity Switch on a Pulley

    One bolt pass per revolution at 6,000 RPM is a 100 Hz signal any standard inductive proximity switch can produce and a scanned PLC input cannot reliably count, so route it to a high-speed input and verify the ON pulse clears the input's documented minimum — 100 µs on the DL05's X0–X2 inputs — with a scope at full speed.

    Sensors, encoders and machine vision on the machine

  • How-to

    Sizing a Spindle Encoder Input for Servo Feed Control

    A 2000 PPR quadrature encoder on a 250 RPM spindle produces 33,333 counts/s, which fits a 50 kHz counter but overruns a 10 kHz variant; the most resolution that counter family allows is 3000 PPR. Scale feed per revolution to motor RPM through screw lead and gear ratio, then keep command pulses per revolution low enough that rapid speed stays under the 100 kHz pulse-output ceiling.

    Sensors, encoders and machine vision on the machine