cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

Output Sampling Rate and Loop Time

¡Resuelto!
Ir a solución

Hi you guys,

 

I'm pretty new to LabVIEW and I have a probably stupid question. How do I control the output signal rate? For example, an IV sweep. Each while loop will output a voltage value (calculated from the direction and step size), but loop execution time may vary. So how do I keep an ACCURATE SWEEP RATE? You can input a sampling rate in DAQmx Timing VI, but how does it work with a loop(which is actually calculating the output value for each step)?  It's all a bit confusing... Thank you so much if anyone shed some light for me!! Thanks!

 

 

0 kudos
Mensaje 1 de 9
7.157 Vistas

First, describe what equipment you use. Most likely, there is no direct solution to your problem. The delays between setting the frequency and its actual change are not described and their stability is not guaranteed. The most reliable solution is to change the duration of the signal with constant frequent sampling

Labview 4.0, 5.0, 6.1, 8.6, 2009, 2011, 2012, 2014
If you do not know something, ask me.
0 kudos
Mensaje 2 de 9
7.136 Vistas
Solución
Aceptado por alexalexalexalex

When doing I/O, it is (often) better to let the DAQ Hardware handle the timing issues rather than the PC/LabVIEW/While loop.  Thus if you want to output a frequency sweep, one method might be to first generate all of the points of the sweep (for example, you want to sweep from 10 to 1000 Hz over a period of 10 seconds, and you have a DAQ device that can output data at 10KHz, so you generate 10 * 10000 = 100,000 points representing the entire waveform, set you DAQ Output device to accept 100,000 points and output at 10KHz, feed it the points, and let it go!

 

If it can't take that many points all at once, you simply tell it to take, say, 1000 points and output at 10KHz, then set it for "continuous sampling" and (using a For loop) feed it 1000 points at a time (for 100 repetitions to get the entire waveform) -- the DAQ device should be able to "keep up" with you (after all, you are only updating it 10 times a second, very slow in CPU terms).

 

Bob Schor

0 kudos
Mensaje 3 de 9
7.119 Vistas

Got you. That's probably the way to go.

 

Is there a limitation on how fast a loop can execute, I guess it depends on the CPU? Like, if use the For loop (or while loop), to repetitively output points like you mentioned, will there be a gap if the loop can't keep up (say desired update was too fast compare to the loop speed)? Is there a highest updating rate below which is safe?

 

On the other hand, I wonder, if I can use a timed loop for controlling the rate of outputting voltage signals or reading in signals. Or is it not very precise? Like, if the execution time is longer than the set time period, then it won't go to the next iteration till everything is finished?

 

Thank you very much!!!

 

 

 

 

0 kudos
Mensaje 4 de 9
7.107 Vistas

Yes, everything has to complete in your diagram to move to the next iteration. That's true for a while loop, a timed loop, a for loop, etc. I probably would want a real time system for a loop rate faster than like 5 updates per second. Otherwise, OS stuff will get in the way and introduce massive jitter.

0 kudos
Mensaje 5 de 9
7.102 Vistas

Also, if outputting a large amount of points using the DAQ write instead of loops, is there a way to stop it somewhere in the middle before it's finished?

0 kudos
Mensaje 6 de 9
7.088 Vistas

@alexalexalexalex wrote:

Also, if outputting a large amount of points using the DAQ write instead of loops, is there a way to stop it somewhere in the middle before it's finished?


Yes, DAQmx Abort Task.vi will do that


"Should be" isn't "Is" -Jay
0 kudos
Mensaje 7 de 9
7.078 Vistas

Cool! Thank you guys for all the help! 🙂

0 kudos
Mensaje 8 de 9
7.067 Vistas

Thank you! 🙂

0 kudos
Mensaje 9 de 9
7.065 Vistas