Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

myDAQ encoder sample rate

Solved!
Go to solution

I would like to know how to set the sample rate to an encoder using a myDAQ device.

I'm using DAQ Assistant in LabView and the only option available in "Timing Setting / Acquisition Mode" is "1 Sample (On Demand)". I'm geeting 1 second sample rate and I'm not sure if it's possible to control that. Thank you.

0 Kudos
Message 1 of 15
(5,485 Views)

Hello thiago.barbosa.

 

When you configure a task to work On demand, your sample rate will be controlled by to loop timing (always bounded by the minimum period your loop can run in your computer). MyDAQ is able to return point faster than 1 sec period, maybe your problem is related to your code. Could you share it here?

Plínio Costa
Senior Techinical Support Engineer
National Instruments Brazil



0 Kudos
Message 2 of 15
(5,418 Views)

Dear Plinio,

 

Thank you for your answer. Find attached my VI and a sample file with data generated using that VI. 

I'm implementing a closed loop control of a linear actuator. Reading voltage e current with a USB-6009, reading encoder with myDAQ and sending controller output with myDAQ. 

The setpoint signal (reference signal) is genereted by a Simulate Signal.

 

Regards!

 

Download All
0 Kudos
Message 3 of 15
(5,413 Views)

I've found what it is causing this behaviour, you are using a task to acquire voltage and current timed to 100Hz and configured to acquire 100 samples each iteration, so you loop will take 1s to execute. 

 

We recommend you to use the samples to read value 10 times less than your rate, so your loop will take 100 ms.

 

Do not use it more than 20 times less for windows, if so your loop timing will be lower than 50 ms which is not a good timing for windows.

Plínio Costa
Senior Techinical Support Engineer
National Instruments Brazil



0 Kudos
Message 4 of 15
(5,399 Views)

In fact the acquisition setting has partially solved the problem. Following your instructions I could get samples at 50 or 100ms period (encoder and voltage/current). Thank you.

But I still get a problem in the "Simulate Signal" block. In the Timing Configuration, I'm not able to set "Sample per second (HZ)" and "Number of samples" to get the signal desired (frequency of 0,005Hz). 

Do you have any idea how to help on that?

0 Kudos
Message 5 of 15
(5,382 Views)

Sure, I can help you, but first try to explain me what you are trying to do with the following code section (attached).

 

Maybe you are on the wrong path. As far as I've understood you are creating a sine setpoint to your control, right?

 

 

Plínio Costa
Senior Techinical Support Engineer
National Instruments Brazil



0 Kudos
Message 6 of 15
(5,370 Views)

Refers to the example below if you want to generate a point-by-point sine wave as a setpoint.

 

I've configured the express function as Number of samples: 1 and Sample rate: 10, so your iteration duration will be 100ms (it's not necessary the timing function, it was just to emphasize the timing value).

 

Plínio Costa
Senior Techinical Support Engineer
National Instruments Brazil



0 Kudos
Message 7 of 15
(5,364 Views)

That's right. I'm trying to create a sine setpoint signal to my control (at very low frequencies / around 0.005 to 0.01Hz).

I wasn't able to open the Example.vi (I'm using LabView version 14.0). Is it possible to make it available in that version?

Thank you!

0 Kudos
Message 8 of 15
(5,360 Views)

Attached previous version VI

Plínio Costa
Senior Techinical Support Engineer
National Instruments Brazil



0 Kudos
Message 9 of 15
(5,358 Views)

Sorry about the long delay to answer your last post (I was offline last two weeks). But I still having problems. And that’s interesting: following your recommendation to setup the express function (Number of samples: 1 and Sample rate: 10) in my PositionControl.vi I get a signal 10 times slower the expected!

The file attached shows the results I get from reading the process variable. This file ends at 14.5 seconds, but in practice it took 145 seconds to run that experiment.

Have any idea what’s happening?

Thank you again!

0 Kudos
Message 10 of 15
(5,299 Views)