LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

incremental encoder on cRIO

Hello, I'm working on compactRIO 9012 and I want to calculate the angular position from an encoder, I have the NI 9505 as acquisition module, is there any predefined function on labview that calculate the angular position, I have seen some exemples that only uses DAQmx to do it.

help please. 

0 Kudos
Message 1 of 9
(4,062 Views)
Did you try to create an "angular position" task in MaX ? The NI9505 may be able to give you the position by itself if you have an absolute encoder.
CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 2 of 9
(4,047 Views)

hello, thank you for answering , no I didn't know that it exist 😛 could you please tell me where to found it, actually it's my first time on labview 😉 

0 Kudos
Message 3 of 9
(4,040 Views)

Hi ramlus,

 

I have the NI 9505 as acquisition module, is there any predefined function on labview that calculate the angular position

As far as I can see from the NI9505 example project your module does NOT output any information about encoder state, it just uses the encoder internally to control your motor.

You will need some other way to read the encoder information - like a DIO module with counter capability…

 

The NI9505 is no "acquisition module", it's a driver for brushed servo motors!

 

@Maxime:

On the cRIO RT target you will not be able to use any DAQmx functions or DAQmx tasks defined in MAX…

 

Edit:

You can access the Encoder AB signals on the FPGA level. There you could create your own counter routine!

You also have "Encoder Index" and "Drive Direction" available…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(4,037 Views)
Sorry GerdW, bad habits. I've been using DAQ quite a lot. More than cRIO obviously. Thanks for your correction 🙂
CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 5 of 9
(4,016 Views)

hello, 

yes indeed I acquired the encoder and I have two LEDs (A and B), the  "Encoder Index" and the "Drive Direction" ,but the problem is that I don't  know how to use them to calculate the angular position : / I have not find tutorials with the cRIO, could you help me please.

0 Kudos
Message 6 of 9
(3,969 Views)

Figure 6 in this tutorial gives one example of code for calculating position from a quadrature encoder using FPGA.

 

If none of that makes sense, try starting with the RIO Getting Started guide and reading about FPGA interface mode.

---
CLA
0 Kudos
Message 7 of 9
(3,941 Views)

Hello,

thank you for your help,

I followed the tutorial you gave me ,  I can not tell if the values ​​I get are fair or not ,and I have some questions :

how to know the number of pulse per revolution??

and  is it  normal to get a negative value of Velocity??

should I connect a motor (to the encoder ) to work properly because for now I 'm turning it myself

cordially 

0 Kudos
Message 8 of 9
(3,901 Views)

Hi ramlus,

 

I can not tell if the values ​​I get are fair or not

You're the one who has the test setup in front - so you're the one who should know the expected RPM values!

 

how to know the number of pulse per revolution??

You're the one who has the test setup in front - so you're the one who should know which sensor is used in the setup!

 

and  is it  normal to get a negative value of Velocity??

It is normal when you use a quadrature encoder. This type of encoder can also detect direction of rotation and so outputs "negative" speed for opposite direction…

 

One question: How do you determine your loop iteration speed? Your RPM calculation strongly depends on iteration time - but you don't seem to use any time measurement in the loop…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(3,896 Views)