Troubleshooting
High-Speed Counter Double Coil Loses Pulses in One Direction
Short answer
A duplicated counter coil, not scan time, makes an FX high-speed counter lose pulses in one direction: the OUT rung whose drive input is OFF resets the present value each scan. Keep one OUT instruction, OR both motion conditions into it, reverse with the direction special relay M8235, and reserve two registers for every 32-bit comparison operand.

On this page
- Why does a high-speed counter lose pulses in only one direction?
- Why will a faster scan or a subroutine not recover the missing pulses?
- How do I confirm a double coil is the fault?
- How do I program the counter with one coil instead of two?
- How do I reset the count at a fixed reference sensor?
- Why did the DHSZ positioning instruction freeze the whole program?
- How do I verify the count before trusting the position?
- Questions asked
If an FX-series high-speed counter records a fraction of the expected pulses in one direction and the full count in the other, the program has two OUT instructions on the same counter. The rung whose drive input is OFF resets the counter every scan, so most of the pulses never survive to the end of a scan. Faster routines, different presets and scan-time tuning are dead ends: high-speed counters count in hardware, outside the scan. Delete both coils, drive one OUT C235 from an OR of the extend and retract conditions, switch direction with M8235, and reset the count at a fixed reference sensor. The sections below give the confirmation checks, the corrected program, the register rule for the high-speed comparison instructions, and the cycle test that proves the count agrees in both directions.
Why does a high-speed counter lose pulses in only one direction? #
Two OUT instructions on the same counter cause this: in an FX high-speed counter, an OUT rung whose drive input is OFF resets the present value every scan, so one direction keeps its count while the other loses about nine pulses in ten. The counter is not broken, the input is not too fast, and the HMI refresh is not involved: the opposing rung wipes the count while the axis moves.
The measured case shows the pattern. A manual test gave roughly 10,000 pulses for one full stroke. The program recorded about 1,000 pulses on extension and the full amount on retraction. The shortfall is 10,000 − 1,000 = 9,000 pulses, and 9,000 ÷ 10,000 = 0.9, a 90% loss in one direction only. A hardware or input-rate fault would steal pulses in both directions; a direction-selective loss points at program logic, and a duplicated counter coil is the cheapest thing to check. Which direction survives depends on the rung order in the program, so treat any duplicated counter coil as the fault regardless of which direction loses pulses.
Why will a faster scan or a subroutine not recover the missing pulses? #
It will not, because these counters accumulate input transitions in dedicated hardware, outside the ladder scan; a faster program changes nothing. After removing the duplicate coil, check the counter-to-input assignment and the sensor waveform instead of chasing scan time.
The scan still matters for two other things. Ordinary outputs such as the actuator drive bits update at scan pace, which is fine for driving a cylinder or motor but far too slow for position thresholds, as the section on DHSZ below shows. And the counter number must match the physical high-speed input: C235 counts input X0 in the FX input-assignment table, the counters C235 through C255 share inputs X0 through X7, and one input serves one counter at a time. Check that table in the FX hardware manual, document JY992D88101 in that manual series, before wiring the second actuator, and pick its counter by the input it is wired to. For the wider picture on capturing pulses reliably, the article on counting encoder pulses on a PLC without losing position covers the same count-integrity questions from the input side.
How do I confirm a double coil is the fault? #
Search the complete program for every instruction that addresses the counter, including OUT, RST and any high-speed comparison operand; in the fault case this found two OUT C235 rungs, one under M1 and one under M2, and either one alone resets what the other accumulated. That search is the confirming check. Match the symptom against this list:
- Extension records a fraction of the count, retraction records the full amount: duplicate OUT instructions on the counter. Confirm with the program search above.
- Both directions miss pulses with a single counter coil: wrong counter-to-input assignment, poor sensor waveform or an input-rate limit. Confirm at the PLC terminal with the sensor powered.
- Direction is reversed but the pulse quantity is stable: the direction special relay state does not match the commanded direction. Confirm by monitoring the relay against the motion command.
- The program stops responding after adding a high-speed comparison: overlapping 32-bit register operands. Confirm against the register allocation rule in the DHSZ section below.
Work the list top down; the first entry is the cheapest to check and the one this fault matches.
How do I program the counter with one coil instead of two? #
OR the extend and retract rungs into one drive condition and execute a single OUT C235 with a preset such as K30000, well above the roughly 16,000 pulses a full stroke produced; M8235 handles the reverse direction. The corrected structure keeps one owner for the counter while the two motion commands stay separate:
LD M1
OR M2
OUT C235 K30000
LD M1
OUT Y000
LD M2
OUT M8235
OUT Y1
The HMI drives M1 for extend and M2 for retract. M1 energizes Y000, M2 energizes Y1 and turns on M8235 so the counter counts in reverse. The preset K30000 is an example ceiling; take the real full-stroke count from your own mechanics and sensor and set the preset above it. Interlock M1 and M2 in the program so both actuator outputs cannot energize together, since driving both directions at once can damage the actuator and its mechanics. The same rule applies to the second actuator: one supported input, its assigned counter, one counter instruction, one direction path.
How do I reset the count at a fixed reference sensor? #
Reset the counter with an RST instruction driven by the inductive sensor at the mechanical position zero, and reference it before every cycle that needs an absolute origin. The preset value does not reset anything: an FX high-speed counter with a preset of K0 still counts, its completion condition is already true at zero or above, and only an explicit reset clears it. This is the same fixed-reference approach as homing an absolute encoder axis to a reference sensor, applied to an incremental count. Treat the reference reset as part of the cycle, because a single-pulse incremental sensor tracks travel well but every missed or extra edge shifts the calculated position until the next reset at the fixed sensor.
Why did the DHSZ positioning instruction freeze the whole program? #
The two operands overlapped: DHSZ is a 32-bit instruction, so a value starting at D1 occupies D1 and D2, and the next operand beginning at D2 corrupted both. The arithmetic is 32 bits per operand divided by 16 bits per data register, which is 32 ÷ 16 = 2 registers per operand. The failed attempt compared the count against a target in D1 and a tolerance in D2, so the tolerance began inside the target value; the fix is to allocate D1 and D2 to the first value and D3 and D4 to the second, and to keep every later operand after the previous pair. Do not use CMP or ZCP here at all: they are scan instructions and act at most once per scan, while DHSZ, DHSCS and DHSCR act at the pulse rate in hardware. Check the operand order for each instruction in the FX programming manual, document JY992D48301, before entering the comparison values, the counter and the destination bits, because entering them in the wrong order produces the same frozen-program symptom.
How do I verify the count before trusting the position? #
Monitor the command bits, the direction relay, the counter and both outputs together, then run repeated full strokes: the corrected program in this case settled at about 16,000 pulses in each direction with matching endpoint values cycle after cycle. Note that the earlier manual test and the corrected operation were different mechanics and sensor setups, so their full-stroke counts are not one calibration; establish the current full-stroke count under the final setup and judge the fix by directional agreement and repeatability:
- Monitor M1, M2, M8235, the counter present value and both outputs in one view.
- Reset the counter at the fixed retracted reference.
- Run one full extension and record the final count.
- Run one full retraction and confirm the count returns to the reference with the correct sign.
- Repeat several cycles and compare the endpoints.
The decision: if both directions agree within your tolerance cycle after cycle, the double coil was the fault and the position logic is safe to build on. If a stable offset remains between measured and expected counts, recalibrate the scaling for the current mechanics. If the error wanders between cycles, the pulse signal or the counter-to-input assignment is still at fault, and no threshold tuning will fix it.
Questions asked
Does a preset of K0 stop an FX high-speed counter from counting?
No. The counter keeps accumulating input pulses regardless of the preset. With a preset of K0 the completion condition, a present value greater than or equal to zero, is true immediately, so the status bit tells you nothing. Use a preset above your largest expected count, for example K30000, and reset the counter explicitly from program logic.
How do I make a high-speed counter count down instead of up?
Turn on the direction special relay for that counter while its OUT rung stays driven: M8235 reverses C235. Each counter in the C235 to C255 family has its own relay numbered to match it, so the relay and the counter must refer to the same counter number or the direction flag does nothing.
Can two high-speed counters use the same input at the same time?
No. The counters C235 through C255 share the eight high-speed inputs, and one input serves one counter at a time. Take the pairing from the input-assignment table in the FX hardware manual before wiring a second actuator, and pick the counter by the input it is connected to, not by taking the next free number.
Why not use CMP or ZCP on the counter value for positioning?
Both are scan instructions: the program evaluates them once per scan, so a fast count passes the threshold between scans and the output acts late or never. The high-speed comparison instructions act at the pulse rate in hardware, so keep all threshold logic on those and leave the scan instructions to slow housekeeping.
