From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help analysing encoder data in real time

Solved!
Go to solution

Hello, i own a NI USB 6002 and an rotary encoder and i have a problem collecting data to analyse it in real time.

The thing is, i need to get angular velocity from it, so i need the time.

Here's a photo of my VI.

VI.png

0 Kudos
Message 1 of 5
(3,413 Views)

Hi Jonas,

 

i have a problem collecting data to analyse it in real time.

Which problem?

 

The thing is, i need to get angular velocity from it, so i need the time.

You already know the time…

 

Here's a photo of my VI.

Ok. What should we do with an image?

Attach your VI!

Best regards,
GerdW


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

Sorry, i just noticed it was pretty vague. The problem is: i need to collect data in less time than 1ms and with that VI i'm not able to do that since the wait function has a minimum value of 1ms. Any ideas?

0 Kudos
Message 3 of 5
(3,369 Views)
Solution
Accepted by topic author jonasmedeiros

Well first off id say remove the wait function, no need to have it in there unless you are trying to save resources, but if you need a faster read then id get rid of it. 

 

When speed is an issue with data acquisition, a producer consumer architecture will help.  Examples of this ship with labview.

 

We also cant see what it is going on inside your daq assistant.  Posting some code will help find any areas for improvement.

 

[edit]: I believe you said you need to the time for x.  What your doing in your loop, taking the 1ms wait and multiplying it by the iteration, may not actually be the correct time. If youre looking for relative time you need to take tick count before the loop and minus that tick count from one inside the loop, that will give you relative time.  If you want absolute you can take a timestamp and plug that into your graph.



-Matt
Message 4 of 5
(3,361 Views)

One problem with attaching a mere picture of your code is that we cannot inspect it to see, for example, how you have configured the Dreaded DAQ Assistant.  When you say "an encoder", I think of something that outputs digital values as the shaft moves, but as I can't inspect your DDA (Dreaded DAQ Assistant), I can't tell what you are sampling, how fast, how many samples, etc.  Oh, well ...

 

As I'm sure you realize, to get a Velocity, you need two measurements of Position spaced some Time apart.  One excellent source of time (better than the CPU's clock that is driving the Wait (ms) function) is the timing of your DAQ device which doesn't have to stop for Disk I/O, Windows Update, Virus Scans, etc.  Again, I can't tell what your timing parameters are like ...

 

Bob Schor

Message 5 of 5
(3,350 Views)