AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Explainer

Why a counter card skips encoder pulses between PLC updates

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

Short answer

A counter card almost never skips pulses: its counting hardware keeps an accurate accumulated total, and the jump the program sees appears only in the observation layer. The decision is arithmetic: compare the encoder event period, 60 divided by (pulses per revolution × rpm) seconds, with the usable count-update interval the program measures. Movement totals survive any update rate through count differences; acting at every pulse needs the update interval under half the event period, or the card's documented event functions.

On this page
  1. Where the jump actually happens
  2. The encoder event period and the update budget
  3. Why updates straddle whole events
  4. What changing the transfer method changes
  5. When ordinary scan logic can see every pulse
  6. The count-difference procedure
  7. The decision for each requirement
  8. Questions asked

A counter card that advances two counts at a time while an encoder turns is almost never skipping pulses. The card's counting hardware accumulates every event that arrives within its documented input rating; the jump lives in the observation layer — the transfer to the controller, the scan, the program logic, the engineering display — which samples the accumulated total far less often than pulses arrive. The decision is arithmetic: compute the encoder event period from pulses per revolution and shaft speed, then compare it with the usable count-update interval your program actually receives, measured rather than guessed. Movement totals survive any update rate once the program processes count differences. Acting at every pulse needs that interval under half the event period, which ordinary scan logic rarely achieves, or the card's documented hardware event functions. The sections below give the arithmetic, the measurement, and the decision for each requirement.

Where the jump actually happens #

Separate three layers before changing anything. First, the card's counting hardware: it adds each accepted event according to the configured counting mode and holds a running total. Second, delivery: the total travels from the card's registers into controller memory through whatever transfer the platform provides. Third, observation: the scan that reads the value, the comparisons the program makes, and the refresh of the programming-software display, which is a stage of its own and can show stale numbers while the controller already holds fresh ones.

A jump between two successive observations means only that one observation interval spanned more than one encoder event. By itself it says nothing about the counting layer. The counting layer gets one definitive test — compare the accumulated total against a known amount of shaft movement — and the observation layer gets another: timestamp when the program receives a changed value. Everything else in this article hangs on keeping those two tests apart.

The encoder event period and the update budget #

For an incremental encoder producing PPR pulses per revolution on a shaft turning at n rpm:

  • Event frequency f = PPR × n / 60, in Hz
  • Event period T = 60 / (PPR × n), in seconds

Worked example for the inputs PPR = 20 and n = 60: f = 20 × 60 / 60 = 20 Hz, and T = 60 / (20 × 60) = 0.05 s, so events arrive 50 ms apart. Suppose the program timestamps every change of the count and measures a usable count-update interval of 0.1 s. The expected increment per update is f × t_update = 20 Hz × 0.1 s = 2 counts, which reproduces the reported pattern of updates straddling events with zero pulses lost. This is a calculated example for those inputs: double the shaft speed and the event period halves; the update interval comes from your own measurement.

Two documented limits bracket the example before any of this matters: the pulse frequency must sit within the counter module's documented maximum for the configured mode, and the pulse high and low times must meet the input's minimum timing, both from the datasheet of the exact module. The event-period arithmetic governs observation; those ratings govern whether the card can count at all.

Why updates straddle whole events #

When the usable update interval sits near a whole multiple of the event period, every observation straddles about the same number of events, so every update advances by about the same number of counts. Slow drift between the two clocks makes the increment alternate between larger and smaller steps as the phases slip. The skipped intermediate values existed only in the card's total; the observation never had them to lose.

That is why a display skipping numbers is not a pulse-loss test. The two tests from the first section do the separating: the known-movement comparison proves or disproves the counting, and the timestamped update interval explains the jump. Run the movement test first; it takes minutes and settles the question.

What changing the transfer method changes #

Single and block transfer both deliver the same accumulated total. The method changes how much data moves per exchange and how often, not when the events happened, and no transfer method can rebuild individual event times from a running total. Freshness is bounded by the slowest stage in the chain: the card's count-update behavior, the transfer cycle, the scan that reads the value, the display refresh. A faster transfer cannot shorten a scan-limited observation, and shortening the scan accomplishes little when the count data arrives less often than the logic executes.

So measure before choosing. Timestamp each change of the count inside the controller, under real load, and read the usable update interval from the timestamps. If the transfer is the slow stage, a different documented read path can shorten it. If the scan or the display is the slow stage, changing the transfer method changes nothing.

When ordinary scan logic can see every pulse #

Two observations per event are the ordinary sampling requirement, not a vendor rating, and they set the speed limit. To observe every intermediate count in program logic, the usable update interval must be shorter than the event period. To catch each pulse as a discrete input, the program must sample both the active and the inactive state, so the program cycle must stay under half the pulse period; at a 50 percent duty cycle the pulse period equals the event period. Solving t_cycle < T/2 for shaft speed gives n_max = 30 / (PPR × t_cycle), with t_cycle in seconds and the result in rpm; the 30 in the numerator is the 60 seconds-per-minute conversion divided by the required two samples per event.

Worked threshold for a 20 pulse per revolution encoder and a 25 ms program cycle: n_max = 30 / (20 × 0.025) = 60 rpm. Above that speed, events begin straddling updates and per-pulse logic starts missing actions. The margin shrinks further in practice: the input filter's on and off delays and the input image update consume part of each pulse, and a pulse whose high or low time approaches the filter setting disappears regardless of scan speed — why the PLC input filter drops encoder pulses measures that failure in detail. The same two-samples arithmetic decides whether a scan can catch a timed window at all, as in when a scan time misses an encoder cam window.

For most machines this closes the question quickly: as speed or resolution rises, the threshold falls below any realistic program cycle, and per-pulse actions belong in hardware.

The count-difference procedure #

  1. Establish counts per revolution from the configured counting mode, not from the encoder nameplate alone; the mode decides what one revolution is worth to the card.
  2. Prove the counting layer with known movement: turn the shaft a known number of revolutions and require the accumulated total to move by counts per revolution times revolutions turned. Any shortfall is real pulse loss and points at wiring, signal levels, or the module's input rating.
  3. Measure the observation layer: timestamp each change of the count in the controller under real load; the interval between fresh values is the usable count-update interval.
  4. On every update, compute movement as the difference: subtract the previous count from the current count and carry that difference as movement for the interval.
  5. Handle discontinuities explicitly: discard the delta on the first sample after startup, define the wrap at the module's count-range limit and at any preset or reset, and let the difference carry the sign through direction reversals.
  6. Use the difference as movement per update, scaled to position or speed as the application needs.

A difference spanning several counts is that much real movement delivered on schedule; it is not a queue of delayed per-pulse actions. If each pulse must trigger its own action at its own edge, differences do not substitute — that requirement goes to the decision table below. The wider input-side picture, from wiring and filters to counter configuration, is in counting encoder pulses on a PLC without losing position.

The decision for each requirement #

Read the row that matches the application:

Requirement What satisfies it The check that proves it
Position or movement totals Keep the card; process count differences on every update Known movement matches the accumulated total
One action per pulse Program cycle under half the event period, or the module's documented event functions at the measured event rate The speed-limit formula against actual speed; the event-function rating against the event rate
Fresher count value Shorten whichever stage the timestamps show is slowest Timestamped count changes under real load

For totals, no hardware change is justified by what the program observes; the jump is correct data arriving in batches. For per-pulse actions, compare actual speed with the limit from the two-samples formula: inside it, scan logic works; outside it, move the per-pulse reaction into the counter module's documented hardware event functions — count match, capture, event interrupts — rated against the measured event rate, or reduce resolution or speed until the arithmetic closes. Touch the transfer path only when the timestamps blame it.

One safety note: if the count gates a guard, a stop, or a clamp that protects a person, that function is a safety function — design and validate it through the machine's risk assessment and the applicable machinery safety standard, not through the polling logic in this article.

Questions asked

Does a two-count jump mean the counter card is losing pulses?

Usually no. The card's counting hardware adds every event it accepts; the program simply sampled the accumulated total after about two events had passed. Prove it from the total: turn the shaft a known amount, for example ten revolutions, and require the accumulated count to move by counts per revolution times ten — 200 counts for a 20 pulse per revolution encoder counted one count per pulse. If the total matches the movement, every pulse was counted and the jump is purely observational.

How fast can the shaft turn before scan logic stops seeing every pulse?

Set the program cycle under half the encoder event period, because the logic must sample both the active and the inactive state of every pulse. In numbers: speed limit in rpm = 30 / (pulses per revolution × program cycle in seconds). At 20 pulses per revolution and a 10 millisecond cycle that is 30/(20 × 0.01) = 150 rpm; faster than that, events straddle updates and per-pulse actions belong in the counter's documented hardware event functions.

Would a different transfer method deliver a fresher count?

Only if the transfer is the slowest stage between the card's counter and your logic. Single and block transfer both carry the same accumulated total; packet size changes overhead, not event timing, and no transfer method rebuilds individual event times. Timestamp every change of the count under real load to measure the usable update interval, then shorten whichever stage the timestamps blame — transfer cycle, scan, or display refresh.

How many counts should one encoder revolution produce?

It depends on the counting mode configured in the counter module, not on the encoder nameplate alone. One count per pulse makes one revolution worth the nameplate pulse count; two-edge and four-edge modes make it worth twice and four times that. Take the configured figure from the module's documentation, then confirm it with the known-movement test from the procedure.

Keep reading

  • 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

  • Troubleshooting

    Why a parallel absolute encoder shows no count on a PLC card

    A parallel absolute encoder has no pulse output: it presents the shaft position as a 25-bit binary word across individual PNP lines, so any counter or high-speed input waiting for edges shows zero. The cure is to match the card's input common to PNP sensing, prove each bit at the connector and at the card, and read all the bits together as one unsigned value.

    Sensors, encoders and machine vision on the machine

  • Troubleshooting

    Why the PLC input filter drops encoder pulses

    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.

    Sensors, encoders and machine vision on the machine