LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find a delay and avoid/remove it from a while loop

Solved!
Go to solution

Hi there,

 

I'm relatively new to Labview, so sorry about the code in advance. I'm trying to make a simple function generator, and so I'm using this while loop, and it's supposed to run for 1000ms (the length of the buffer with it's sample rate and number of samples), but I'm getting a delay of anywhere between 25 - 30 ms.

 

Any ideas in how to fix this, or where it's coming from?

 

Thank you kindly in advance.

0 Kudos
Message 1 of 13
(2,920 Views)

could you post it in a earlier version please

 

Thanks

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 2 of 13
(2,916 Views)

Why are you setting up and clearing the task inside of the while loop?  You should only setup once before the loop and stop/clear it after the loop.  All you should have inside of your while loop is the DAQmx Write.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 13
(2,907 Views)

I don't quite understand what you mean, sorry. If I have just the DAQmx write in my loop, the data only ouputs once. What I need to do is have a constant output of this waveform, without the delay between cycles

0 Kudos
Message 4 of 13
(2,898 Views)

After thinking about this some more, I think what you really need is the Regeneration Mode.  Put down a DAQmx Write property node and choose the RegenMode.  Set it to allow.  What this will do is cause the task to repeat automatically.  All you'll have to do is set that property, perform the DAQmx Write with the Auto Start set to FALSE, use the DAQmx Start Task when you want the waveform to start, and DAQmx Stop Task when you want it all to end.  You will probably need to write a 0 to the task when you are all done to reset those channels.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 13
(2,856 Views)

Almost there! Now the delay is ~16ms, instead of 25ms. I added the DAQmx Clear Task to append that zero as you said to, but I'm guessing that the rest of the delay is due to the actual code running/outputting?

0 Kudos
Message 6 of 13
(2,839 Views)

Also, here's what the file looks like now:

0 Kudos
Message 7 of 13
(2,834 Views)

You don't need the while loop at all.  Put in an event structure or something of the like to pause you program until you want to stop.  The hardware will take care of it all for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 13
(2,826 Views)

@crossrulz wrote:

You don't need the while loop at all.  Put in an event structure or something of the like to pause you program until you want to stop.  The hardware will take care of it all for you.


Hi,

 

When I tried open the attached VI, it was looking for a polymorphic VI (with a specific instance of "Multi Channel Wfm w/Attributes - DBL")...
Any idea, where to download this from?


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 9 of 13
(2,813 Views)

For some reason, this only runs the signal once, then outputs a negative DC offset. 

 

Any idea why?

0 Kudos
Message 10 of 13
(2,806 Views)