When a high-speed counter is disturbed, the usual symptom is a count that runs high, runs low or jumps every so often, while the PLC itself raises no alarm. The key is to decide first whether the trouble lies in the signal source, the transmission path or the counter module's input, then isolate each stage from the outside in, instead of reaching for the program straight away.
A count that only ever runs high usually means noise pulses are being added or the input filter is too short. One that only ever runs low points to too little signal amplitude, slow edges or a frequency already beyond the limit. A count that wanders up and down irregularly usually involves screening, earthing or a common-mode potential difference. Writing these characteristics down narrows the search a great deal. If the count is clean when the machine is stopped but goes wrong when a VFD or contactor operates, the cause is almost certainly electromagnetic interference.
Connect the encoder or sensor on its own to an oscilloscope or a counter-capable instrument and check amplitude, edge steepness and any glitches. An encoder starved of supply voltage, a loose coupling, a dirty code disc or an ageing opto pair all cause missing pulses that have nothing to do with external interference. This step separates "the signal was never good" from "the environment has spoiled the signal".
Encoder signals need screened twisted-pair cable, with the screen earthed at the controller end only; earthing both ends creates a ground loop that actually admits interference. Route signal cable away from power cable and VFD output cable, keeping parallel runs as short as possible, generally at least 20 cm apart, and crossing at right angles where a crossing is unavoidable. Where a cable is over-long or bundled with motor leads, re-route it rather than adding filters.
The PWM on the output of a VFD or servo drive couples through stray capacitance onto the signal cable and creates a common-mode voltage. Countermeasures include separating signal earth from high-current earth, single-point earthing, a common-mode choke at the input, and where necessary a differential input or an optically isolated counter module. An output reactor or dv/dt filter on the drive also cuts the coupling. Never let the isolated and non-isolated sides share one signal earth.
Once the hardware is proven sound, look at the input filter time constant, the sampling time and whether the counting mode matches the application. A filter set too long throws away genuine high-speed pulses, while one set too short fails to block spikes, so a balance has to be struck between reliable counting and response speed. The program can also add a plausibility check, such as an alarm when the rate of change of the count exceeds a limit, but limiting must never be used to mask a real signal problem.
| Symptom | Likely cause | Action | How to verify |
|---|---|---|---|
| Count only ever high | Noise pulses added, filter too short | Lengthen the filter, add screening and a common-mode choke | Compare counts with the VFD stopped |
| Count only ever low | Too little amplitude, slow edges | Check supply and output type, shorten the cable | Scope the amplitude and edges |
| Direction occasionally reverses | Interference on A/B or a lost phase | Fit a differential encoder, earth the screen at one end | Reverse slowly and check the phases |
| Jumps when a contactor operates | Spike from an inductive load breaking | Add an RC or freewheeling path across the coil | Switch the load in and out and watch |
| Errors while the VFD runs | PWM common-mode coupling | Fit an output reactor, move signal cable away from power cable | Start and stop the drive and compare |
| Errors only on a long cable | Stray capacitance, reflections at the far end | Go differential, shorten or split the run | Retest with a short cable |
| Occasional dropped counts | Screen earthed at both ends, ground loop | Earth at one end only, separate signal earth | Measure the potential between the two earths |
| Fine at start-up, then drifts | Thermal drift or a supply fluctuation | Regulate the supply, check conductor size and volt drop | Monitor the supply voltage |
| Appears only on another machine | Different earthing system, potential difference | Unify earthing, add an isolating module | Compare the two cabinets |
Work in the order of source, transmission, supply, then software, because the first three hold the root cause and software filtering only reinforces them. The commonest misdiagnosis on site is to treat interference as a program fault, tweaking filter parameters again and again while the real cause remains. Record the count after each single change so you can tell which measure actually helped.
The electromagnetic immunity requirements for the control system containing the counter follow IEC 61326-1 and the generic immunity standards in the IEC 61000-4 series (the GB/T 17626 series in China); emission limits for industrial environments follow GB/T 17799.2. The electrical connection, protection and earthing of the equipment follow GB 5226.1 and the equivalent international standard IEC 60204-1. The measures described are general engineering practice; the actual limits are as given in the relevant standards and the manufacturer's manual.
Stop the machine, isolate, prove dead and apply lock-out/tag-out before any troubleshooting, and on VFD and servo DC links wait until the capacitors have discharged before touching terminals. Where the signal source specification is unclear, go by the manufacturer's manual rather than changing the wiring on experience alone.