Troubleshooting
Why a high-speed counter position jumps between PLC window comparisons
Short answer
The counter is not dropping pulses. The 1734-VHSC24 transfers its accumulated count once per Requested Packet Interval, so at a 2 ms RPI a 60 kHz encoder stream arrives as 120 counts, 24 mm of 200 mm-wheel travel, per update. A sampled GRT/LES window never evaluates the in-between positions; test each new sample against the previous one for a crossing, or program the module's own outputs to compare at the count.
On this page
- Why does the encoder position jump instead of moving smoothly in the PLC?
- Why doesn't the 1 MHz counter rating prevent the jumps?
- How many counts and how much travel pass between two counter updates?
- Why do GRT and LES window comparisons miss positions the counter counted?
- How do I replace a sampled window with crossing detection in ladder logic?
- Can the counter module switch an output without waiting for the scan?
- How do I verify the fix before it rejects real product?
- Questions asked
The 1734-VHSC24 is not dropping pulses and the encoder is not the fault. The module accumulates every valid input edge and transfers the running total to the controller once per Requested Packet Interval, so the ladder sees position as a staircase, not a stream. A GRT/LES window tested against a sampled position cannot turn true during a step that jumps clean over it, even though the counter passed through every intermediate count. The fix is to compare each new sample with the previous one, which is crossing detection, or to let the module's own outputs do the comparison at the count. The numbers below use the actual application case: a programmable incremental encoder set to 1,000 PPR on a 200 mm measuring wheel, inspection windows set in ladder, and the counter module on a remote I/O connection.
Why does the encoder position jump instead of moving smoothly in the PLC? #
Because the module reports its count once per Requested Packet Interval: at your 2 ms RPI a 60 kHz encoder stream reaches the program as one 120-count step, about 24 mm of travel on a 200 mm wheel, and the ladder only evaluates the endpoints of that step.
The pipeline has four stages: the encoder edge, the accumulated count in the module, the transfer of that total across the I/O connection at the RPI, and the task reading the input image once per scan. The counter does its job through all four; the visibility of the position stops at stage three.
Trend the raw counter value, the scaled millimeter value, and the difference between consecutive samples at steady belt speed, and the cause sorts itself:
- Every sample advances by the same large count: reporting granularity. The count is intact; the ladder is only shown it once per update.
- The raw count moves evenly but the scaled value jumps: the scaling instruction, its data types, or its rounding.
- The raw count advances unevenly at constant speed: wiring, input filtering, or mechanical slip. Check the encoder signal and its return at the module terminals, not only at the encoder.
- The raw delta is wrong after one marked wheel revolution: the decoding mode's multiplier, not lost pulses.
Run the trend with the inspection logic bypassed so acquisition is measured on its own. The bypass does not remove the RPI or the scan, so the step remains by design.
Why doesn't the 1 MHz counter rating prevent the jumps? #
The 1 MHz rating says how fast the module accepts valid edges, while the RPI says how often it hands the running total to the controller; the two limits are independent, so a perfectly counted input still reaches the program as 500 totals per second at that update interval.
An input rate far below the counter's edge rating guarantees the module counts correctly; it says nothing about how often the program is allowed to look. The module refreshes its input image every RPI, and the task samples that image once per scan, so consecutive executions can read the same total twice and then see a double step. The observer's rate, not the counter's rate, decides what the controller sees, which is the same rule behind why PC-polled remote I/O cannot count encoder pulses for SCADA. That is why the symptom survived every test that removed other logic: the tests changed the program, not the update interval.
How many counts and how much travel pass between two counter updates? #
At 1,000 PPR and 3,600 RPM the encoder produces 60,000 pulses per second, and that rate against the update interval decides every number in this fault.
Worked example, assuming one reported count per programmed pulse:
- Pulse rate: 1,000 x 3,600 / 60 = 60,000 pulses per second
- Counts per update: 60,000 x 0.002 s = 120 counts
- Distance per count: 200 mm / 1,000 counts = 0.2 mm
- Travel per update: 120 x 0.2 mm = 24 mm
At the 1,750 RPM the drive actually delivers, the same arithmetic gives 29,167 pulses per second, about 58 counts and 11.7 mm per update. If the module still sits at its documented default RPI of 80.0 ms, which the manufacturer's counter FAQ lists for the 1734-VHSC5 and 1734-VHSC24, one update carries 60,000 x 0.08 s = 4,800 counts, about 960 mm on this wheel, and the position would be unreadable rather than merely steppy.
Before trusting any of these figures, confirm the counts you actually receive: mark the wheel, turn it exactly one revolution, and compare the raw-count change with the programmed PPR times the decoding multiplier. The checklist at the end includes that test.
Why do GRT and LES window comparisons miss positions the counter counted? #
A sampled window is true only while the sampled value lies inside it; when one scan reads 88 mm and the next reads 112 mm across a window set at 100 to 110 mm, both samples sit outside, the rung stays false, and every count in between went unevaluated.
Nothing was lost. The counter holds the correct running total the whole time; the comparison simply never executed with a value between 100 and 110 mm in it, because the input image skipped that band in one update. This is the sampled-observation problem in position form, the same one described in why a PLC misses short input pulses and how to catch them.
Note also that the step size is belt speed times the update interval, not pulse size, so reprogramming the encoder to fewer PPR changes the count increment but not the millimeters per step.
How do I replace a sampled window with crossing detection in ladder logic? #
Compare each new sample with the previous one and ask whether the pair straddles the target or the window; a crossing rung fires once no matter how many counts arrived between the two samples, which is exactly the case a position test cannot see.
Keep the comparisons on the raw count. These are example DINT tags in the controller holding raw counts, not instruction-defined names: PrevRaw, CurrRaw, Target, LowLimit, HighLimit. Initialize PrevRaw to the live count when the logic first enables, and refresh CurrRaw once per scan from the input image:
CrossedTarget := (PrevRaw < Target) AND (CurrRaw >= Target);
TouchedWindow := (PrevRaw <= HighLimit) AND (CurrRaw >= LowLimit);
PrevRaw := CurrRaw; // store only after every crossing test this scan
The test proves the result. With Target at 500 counts, a sample pair at 450 and 560 sets CrossedTarget true on the second scan, and a pair at 450 and 490 leaves it false. With the window at 500 to 550 counts, a pair at 480 and 650 sets TouchedWindow, and a pair at 600 and 620 does not.
Then handle the edges of the pattern: mirror the comparisons for reverse travel; force PrevRaw to the live count after any counter reset or rollover so a wrap cannot fire a false crossing; latch each inspection event when its crossing bit sets and clear the latch from the package-sequence logic, not from the window going false; convert counts to millimeters only after the crossing tests, because the integer count is the cleaner boundary. Comparing each new sample against the previous one is the same consecutive-sample discipline used in data-logging alarms, laid out in why Node-RED temperature alarms require consecutive samples.
Crossing logic fires after the controller receives the new count, so it removes the missed window but not the update-and-scan latency. When an output must switch at an exact count, use the module's own outputs.
Can the counter module switch an output without waiting for the scan? #
Yes. The 1734-VHSC24 user manual documents two on-board outputs whose on and off counts you program in the module configuration, and the module drives them from its own count, so a marker fires at the programmed count without waiting for the RPI or the task.
Use them for the inspect and eject marks: the output answers the count directly, so the update interval and the scan stop mattering for its timing, while the controller keeps reading the position for alarms, trends, and the operator interface. Prove the configuration before running product: set the on and off counts, rotate the wheel by hand with the belt stopped, and confirm each output toggles at its programmed count. If windows you set in the output configuration never fired on the line, re-download the module configuration and repeat the stationary test, because an output that never moves is a configuration the module is not acting on, not a counter fault.
How do I verify the fix before it rejects real product? #
Turn the wheel slowly through every target and demand exactly one event per crossing, then run at line speed and check that the raw count advances by roughly 58 counts per update at 1,750 RPM while every over-jump sets the crossing bit.
Work down the list in order and do not move on until each line passes:
- Marked-wheel test: rotate exactly one revolution and compare the raw delta with the programmed PPR times the decoding multiplier.
- Baseline the input with no input filter; a filter set below the pulse rate hides real edges and imitates lost counts.
- Trend the raw count, PrevRaw, and every crossing bit at normal line speed; the raw delta must match the counts per update calculated for that speed.
- Exercise reverse travel, counter reset, counter rollover, a stopped belt, and closely spaced packages; every target must produce exactly one event per pass.
- Measure the time from a mark passing the sensor to the reject output energizing, convert it to distance at belt speed, and compare it with the process tolerance.
Keep the reject output inhibited until the marked-wheel and line-speed passes prove one event per crossing, because a doubled event ejects good product and a missed event ships a defect.
Decision: at the configured RPI with a 1,000 PPR encoder at up to 3,600 RPM, no window comparison on the sampled position can work. Replace it with the crossing pattern in the controller, and move any output that must switch at an exact count into the module's on/off count configuration. Lowering the PPR or tightening the window does not fix it, and lowering the RPI only shrinks the step. For a future machine that must decide finer than one update step at full speed, spec the comparison into the counter module from the start.
Questions asked
Does lowering the encoder PPR stop the position jumps?
No. Distance per update is belt speed times the update interval, so at unchanged belt speed the position still steps about 24 mm per update no matter what PPR you program. Going from 1,000 to 500 PPR halves the count increment to about 60 counts and doubles the distance per count to 0.4 mm, so inspection resolution gets worse, not better.
What counts per revolution give a usable inspection resolution?
Count quantization alone sets that floor: a 200 mm wheel needs 200 reported counts per revolution for 1 mm steps, about 67 counts per revolution to stay within 3 mm, and 40 counts per revolution for 5 mm. These figures say nothing about the step between controller updates; crossing logic or the module outputs cover that.
Why does the count look perfect when I jog the belt slowly?
The step size scales with speed. At 100 RPM a 1,000 PPR encoder produces about 1,667 pulses per second, so one update carries only 3 or 4 counts, roughly 0.7 mm on a 200 mm wheel, small enough to look continuous. The same update that carries 120 counts at 3,600 RPM carries 3 here, so a jog test hides the fault.
Does the task scan matter as much as the RPI?
Yes. The input image refreshes every RPI and the task reads it once per scan, so the position your logic acts on can be one RPI plus one scan old, about 4 ms with both near 2 ms, which at the design count rate is 240 counts, or 48 mm, of stale position. Crossing logic and the module outputs both take that latency out of the decision.