LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW-Reading encoder data and RPM continuously, using NI-9401 through cDAQ-9185

Hello,

I am trying to read the RPM of an angular encoder, using NI-9401 connected through cDAQ-9185.

Encoder info: 2 channel quadrature TTL output (A/B) with 16 pulses per revolutions.

 

I started by using the existing example (examples --> DAQmx --> Counter Input --> Counter - Read Encoder)  to read the position of the encoder (the turning angle in degrees). I attached the example to this post. 

 

Then, in order to receive the RPM from the position reading- I used shift register to save the position reading from the previous loop, I calculated the difference between the current position and the previous position reading, I divided this value[deg] by 360, then divided by the loop time[s]  (the dt between the two position measurements), then lastly multiplied this value by 60 to convert from [rounds/s] to [rounds/min]. This project is attached to this post as well, called Counter_Read Encoder_N3-Copy.

 

I did the same thing with another example (examples --> DAQmx --> Counter Input --> Counter - Count Edges), and instead of dividing the difference between measurements by 360 I divided them by 16 (pulses per revolution). 

 

In both cases, the problem is - the measurement displayed is not continuous. The encoder position (and the RPM value accordingly) is not changed with every loop, but rather only when the rotating device is first connected to the power supply, or when disconnected from it. So, once the device is connected to the power supply and running- the position is not updated every loop, the indicator value is unchanged, therefore the RPM is shown as 0.

 

What am I missing? I would really appreciate your help in getting a continuous RPM reading. 

Thank you!

 

 

0 Kudos
Message 1 of 1
(400 Views)