12-08-2016 07:51 PM
Hi everybody. I'm using a 3 channels quadrature encoder (http://www.maxonmotorusa.com/maxon/view/product/sensor/encoder/Encoder-HEDL-5540-500imp/110518) with myRIO. Im using the Encoder function from myRIO library to get the counter value.
I am using only A and B channel, and I get about 2000 counts/rev . However, as you can see in the encoder specification, it should be 500 counts/turn.
So does anybody have any idea why its 2000 counts instead of 500? is it because its a x4 enocder and I should devide it by 4?
Thank you in advance for your response.
Solved! Go to Solution.
12-09-2016 08:34 AM - edited 12-09-2016 08:39 AM
Mosio,
What you are seeing is probably an X4 decoding type. So, even though your encoder's output has 500 pulses per rev per channel, you are getting 4 updates per cycle.
X4 decoding means you get one count on the rise of "A", one count on the rise of "B", another count on the fall of "A", and a final count on the fall of "B" for a total of 4 ticks per pulse cycle.
This article helped me recently in reading my encoder: https://www.embeddedrelated.com/showarticle/158.php
EDIT: To answer you question "Should I divide by 4?". Either divide by 4 after the encoder position task read, or change your task configuration to 2000 pulses/rev. I prefer to change the task configuration directly rather than divide the result by 4. But be careful in what you do, I can change my read task to X1, X2, or X4 decoding and leave the pulses/rev the same and still get valid results, the task seems to do the dividing automatically in my case. However, I am using an NI9361 which is quite a bit different than most other DI modules that use the counters onboard to the chassis.
Corey