From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Encoder measurement with myRIO

Solved!
Go to solution

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.

0 Kudos
Message 1 of 2
(3,759 Views)
Solution
Accepted by topic author Mosio79

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


Corey Rotunno

0 Kudos
Message 2 of 2
(3,726 Views)