LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For Loop timing

Solved!
Go to solution

For what conditions For Loop waits for to proceed to the next iteration? Is their "dead time" associated with this?

 

If you have DAQmx read inside For Loop and DAQmx trigger start outside the loop, what controls the flow of execution?

 

Thanks.

0 Kudos
Message 1 of 22
(5,014 Views)

@Zakhar wrote:

For what conditions For Loop waits for to proceed to the next iteration? Is their "dead time" associated with this?

 

If you have DAQmx read inside For Loop and DAQmx trigger start outside the loop, what controls the flow of execution?

 

Thanks.


There is no dead time I'm aware of.  The time of a loop iteration is based on the longest run piece of code, or string of code execution within that loop.

0 Kudos
Message 2 of 22
(4,994 Views)

The Basic Principle of LabVIEW is Data Flow -- everything inside a Structure (Loop, Case, sub-VI, Frame) needs to execute before the Structure can "proceed".  True, Loops have an insignificant amount of code that does such things as increment the Loop Index ("i") and sometimes (For Loop) compares it to a Limit, but that's probably nano-seconds and can be safely ignored (or, alternatively, the "dead time" is measured in nano-seconds).

 

Bob Schor

0 Kudos
Message 3 of 22
(4,966 Views)

If your VI is fairly simple, it might be instructive to use labview's debug capabilities. These include highlighting execution and stepping through functions while the code is running.

 

If your code is complex, you'll likely want to use breakpoints to get to the part of code that is causing issues. Take a look at this very basic tutorial:

 

http://www.ni.com/getting-started/labview-basics/debug 

0 Kudos
Message 4 of 22
(4,949 Views)

Thank you Bob Schor.

 

So, if DAQmx read is set by DAQmx clock to read 9000 samples at 10^6 rate, i.e. for 9 ms, and trigger is continuous (10 kHz or 10 ms between pulses). DAQmx read reads waveform, For Loop index increases by 1, and it waits for next trigger (in ~ 1 ms) to repeat read?

0 Kudos
Message 5 of 22
(4,897 Views)

Correction: trigger rate 100 Hz

0 Kudos
Message 6 of 22
(4,895 Views)

Hmm, does this mean you want a retriggerable task?

 

https://www.ni.com/en/support/documentation/supplemental/21/retriggerable-tasks-in-ni-daqmx.html

 

In this situation, the for loop waits for the data to be available (your 9000s samples) OR for the timeout to occurs (there is a wire for timeout on the DAQmx Read). Once the acquisition is complete, the for loop will iterate and it will wait again for 9000 samples or a timeout.

 

If you know your trigger is coming at 100Hz, then clearly you can set the timeout to be anything larger than 1ms, such as 10ms to be safe.

0 Kudos
Message 7 of 22
(4,854 Views)

It is a retriggerable task, although placing Start.Retriggerable and DAQmx Start Task after DAQmx Trigger (as shown in this white paper) doesn't change anything.

 

Thanks.

0 Kudos
Message 8 of 22
(4,848 Views)

Is your task set to continuous or finite? If you had it on continuous before, you might need to set it to finite with retriggerable.

 

Honestly though, I'm gonna have to keep guessing what you want until you tell us what you have and what you want it to do.

 

Also, what is your trigger setup?

0 Kudos
Message 9 of 22
(4,840 Views)

I should have probably explain better the issue. Please see attached the screen shot of a simplified program.

 

I am trying to acquire fixed number of waveforms (which I define by number of For Loop cycles). The start of data acquisition is set by a hardware trigger coming to DAQ board.

When I am looking at recorded tdms file, I do see N columns defined by For Loop but the time between them (defined by a tamp stamp in tdms) varies in a wide range.

 

Thanks.

0 Kudos
Message 10 of 22
(4,831 Views)