>by Michael Antonios
The number of pulses for the total lenght of the track it's around 125000 (plus minus maxium 10 pulses) for the universal counter device (the hardware device) and around 128000 for the aplication program (plus minus 100 pulses).
>mross
IF the signal from the encoder is correct (proper voltages High and Low, and noise free), THEN the count will be correct.
This is gauranteed.
You probably have a noise problem ( I speak from experience). The counter is expecting TTL logic. In my experience, if the low of the encoder signal has noise exceeding 0.8V, the counter will falsely count the noise.
The simplest solution could be to trigger on the falling edges of the encoder signal. There is more "headroom" coming dow
n with TTL. If your high signal is running 5V, the undefined range starts at 2.4V (which is pretty much when the counter will start counting). This gives you the ability to reject 2.6V of noise. On the rising edge, you may have a 0.3V low and only 0.5V of noise rejection.
The other option is to clean up the noise. Get an osilloscope and start looking. Fix any bad grounding and wiring practices. Turn off any noisy equipment. There are ways to buffer the counter input so that the encoder signal is a differential signal. Optocouplers and schmitt triggers can clean up the encoder signals. Sometimes the encoder needs to drive some current to be less noisy. A fast Line Receiver can clean up rounded off encoder pulses (see US Digital - $16).
Good luck,
mike