LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using DAQmx to measure time simultaneously with encoder position

Solved!
Go to solution

Hello,

 

I am trying to read the output of two encoders at high speed in parallel (rotating at up to 300 & 75 Hz respectively). I would like to measure the speed and acceleration of these encoders.

 

The current VI (attached) that I am using measures the position data from both encoders as I would like. However, I need the time of each position measurement to calculate the speed and acceleration. (I also need the time for other things afterwards too).


I am currently using a producer-consumer loop to save data to .TDMS file with the Z pulse on the disc encoder being used to release the queue of data acquired, so the acquisition rate is not constant.


I have tried using the high-resolution seconds VI in the producer loop the output in the VI main window appears to read the time as I would like it, but this saving into the TDMS file, I may be wrong on this (screenshot attached).


I have tried initialising the array to the correct length in the producer loop, but this doesn't work (screenshot attached).


Is there a simple way to acquire the time data at the same rates as the encoder position data?

 

(Using LabVIEW 24 (64bit) CRio 9055 with a NI-9401 Digital input module)

0 Kudos
Message 1 of 7
(289 Views)

Many of us can't open brand new 2024 LabVIEW code.  You will get more help if you back save (File > Save for Previous...) and choose 2019 or so.  😉

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 7
(277 Views)

Updated VI attatched, thanks for letting me know 👍

0 Kudos
Message 3 of 7
(265 Views)
Solution
Accepted by topic author R.jon8s

Since you are using the Z-signal as the sample clock source, unfortunately there is no way to determine the timing accurately since it is not captured in the first place. You should use a sample clock source with a known timing, usually this can be generated using another counter.

-------------------------------------------------------
Control Lead | Intelline Inc
Message 4 of 7
(223 Views)

By another counter do you mean the output of another encoder rotating at a known speed?

 

I have tried using the A pulse but the acquisition can't keep up with the hardware (see attached screenshot), I have also tried using the internal 20MHz clock, but this doesn't seem to work for me (I'm not entirely sure why) - this would solve my issues if the data was acquired at a constant rate.

 

 

0 Kudos
Message 5 of 7
(204 Views)
Solution
Accepted by topic author R.jon8s

No, you can use another of the counters built into your 9055 chassis to generate a pulse train at a known and constant rate.  Your chassis has 4 and you're only using 2 of them so far.

 

You'd probably refer to it as something like "ChassisName/_ctr2" when configuring the continuous pulse train.  Note the leading underscore character when using a chassis counter internally rather than accessing it via a DIO terminal on a module.  Then also your encoder tasks would specify their sample clock source to be something like "/ChassisName/_ctr2InternalOutput".   Finally, you should make sure to start the encoder sampling tasks *before* starting the pulse train task.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 6 of 7
(175 Views)

Thanks, Kevin

 

I have updated my VI (attached) to use the internal pulse source.

 

For anyone looking to replicate this, you need to include internal channels, under the "I/O name filtering option" for the internal counter source and include advanced terminals for the encoder clock source.

 

This appears to work broadly as I would like it to!

0 Kudos
Message 7 of 7
(126 Views)