Encoder Trouble

I’m working with this year’s Digital Quad. Encoders.

I’ve openned two Digital Inputs for the A and B sources of Encoder Open. After openning it I run ConfigTimer, Start, and Reference Export in that order. I’m getting CounterIndex set as Invalid. When is that set and what can I do to fix this?


I can’t answer your specific question, but the last time I had an Encoder question, it was answered for me when I looked at the Encoder example in the LabView examples. Have you looked at it?

It’s set in the 1x or 2x Decoding Type case of the Encoder Open vi. It remains unset (i.e. Invalid) in the 4x case, because a Counter is used in the implementation only for 1x or 2x decoding.

Why do you think it needs to be fixed?

I have looked at the example.

Thanks for that explanation. It seemed to me that anything set to invalid was a problem, but it’s possible that the issue is elsewhere. I’ll have to do some more debugging when I get back to school.

I am now running the example with no luck. Unless I short the connection the count does not change. I’ve wired it as it says. The channels correspond. I’ve assembled the encoder as the US Digital site says.

What are all of the aspects of a working encoder? Could I have skipped something?

An encoder requires power (make sure there is +5 on the +5 connection, and ground on the ground connection). It will provide a pair of digital signals on the A and B connections (look at them with a voltmeter or oscilloscope).

The US Digital E4P has an optical sensor pair pointing at a disk with a reflective pattern on it. If you take the cover off the encoder, you will see the non-pattern side of the disk. If the disk is at an appropriate distance from the sensor, as it rotates it will cause the digital outputs to change in phase quadrature (first one output goes high, then the other, then the first goes low, then the other).

If power is not present, it will not work.

If the signal lines are not connected to digital inputs, it will not work.

If the disk is upside down or too far away, it will not work.

If the disk is too close, the pattern surface will probably touch the body of the encoder, get scratched, and soon be damaged to the point where it will not work.

I never did get one of our encoders working. I had several of our mentors check the wiring and setup and no one could explain it.

Current is passing through the wires, says the voltmeter. It has power, says the red light on the encoder. The disk and base are an appropriate distance away from each other, because the cap is on (though one of the disks was noticeably scratched the other was still unsuccessful).

I’ve accepted that I can’t expect to have them working by the end of build season. Is my next step to see if a brand new set have the same issues?

Maybe it’s working fine but the programming has a problem. Can you show us how you’re opening them and how you’re reading them?

Check to make sure each of the Digital In are working.

Open the Simple Digital Input Example.vi
Change the IP address in the project window to your cRIO’s ip address.
Select the correct DIO Module and DIO Channel for encoder Channel A.
Run the VI
By hand turn the wheel connected to the encoder VERY SLOWLY.
You should see the Digital Input Value blink on and off.

Do the same for encoder Channel B.

If one does not work you know which line needs to be checked.
If the Digital Input lines do not work, the encoder VI will not work.