LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop doing AO/AI ... Performance?

Hi!

I have been trying to get a VI to do concurrent Analog
data in and out and both the input and output rates and
waveforms can change while the VI is running. My problem
is this:

(a) If I try putting the read and write operations in
separate while loops, one or the other loop will
die in a buffer over/underrun.

(b) If I put both into the same loop, then this works
but I am limited in the choice of data-rate parameters
because eventually one or the other DAQ VI will take
too long.

At this point I have only one loop and the buffers are big
enough to hold 10 iteration. Every time one of the loops
dies I reset it. Still this seems awkward. Is there a
way of improving on the loop overhead and putting t
he
input and output in separate loops? Or any other way to
improve performance?

Rudolf
0 Kudos
Message 1 of 6
(3,033 Views)
Once in the read function, the program "hangs" until the number of data points is in the buffer. The same applies to the write function. This means that most of the time, your program is waiting.

To solve this problem, you must use DAQ occurrences (--> hardware events).

For examples for using daq occurrences, type "daq occurrence" in the search of the LabVIEW help or even better, at http://zone.ni.com/devzone/devzoneweb.nsf

Hope this helps
0 Kudos
Message 2 of 6
(3,033 Views)
Ok, I knew that ocurences did something useful but I am
still a bit confused:

* Can you set an occurrence for an output event. None
of the examples I've seen say so but it looks like
it should work

* How do occurrences actually help with the "hanging"
problem. Does the compiler see the occurrence in
a loop and change the wait parameters?

I looked at devzone but most of the stuff I found there,
even the promising looking stuff was all about
synchronizing and triggering, not about occurrences.

Rudolf

JB wrote:
: Once in the read function, the program "hangs" until the number of
: data points is in the buffer. The same applies to the write function.
: This means that most of the time, your program is waiting.

: To sol
ve this problem, you must use DAQ occurrences (--> hardware
: events).

: For examples for using daq occurrences, type "daq occurrence" in the
: search of the LabVIEW help or even better, at
: http://zone.ni.com/devzone/devzoneweb.nsf

: Hope this helps
0 Kudos
Message 3 of 6
(3,033 Views)
I'm very surprised that you didn't find the information about DAQ occurrences in the Developer Zone. The search for "daq occurrence" in http://zone.ni.com/devzone/devzoneweb.nsf displays a page with several interesting links about this subject.

You will find a general description for DAQ occurrences at : http://zone.ni.com/devzone/conceptd.nsf/webmain/37AAEB4093AAA86186256802007B8C62?OpenDocument

or in the first paragraph of :
http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/cc2287c9c122b68c862568660060ca31/

For an example of AO occurrence see : http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/4e6859da1f62757b86256a3f006dc6b9?OpenDocument
0 Kudos
Message 4 of 6
(3,033 Views)
Rudolf;

The way to go on this is by using the Asynchornous Acquisition instead. You can find some examples on that at Labview shipping examples.
Hope this helps.
Filipe
0 Kudos
Message 5 of 6
(3,033 Views)
I will look again. What I am totally unsure about is how LabView decides
on whether it uses DMA or not, seeing that there is no obvious
description of this.

I did finally manage to get the two loops separated and timed using
occurrences (yes, they are asynchronous) but the performance is ... odd.
It pretty much works fine for a while and then I get a bunch of errors
(timeouts and buffer over/underrruns) after which it works just fine again.

What puzzles me about this is that both that read and write buffers are
dimensioned such that even if the read and write attempts clash there is
enough space/data to just wait until the next time around, so the user
interface update could be choppy or slow but I should not be getting the
buffer errors!

R
udolf



Filipe wrote:
: Rudolf;

: The way to go on this is by using the Asynchornous Acquisition
: instead. You can find some examples on that at Labview shipping
: examples.
: Hope this helps.
: Filipe
0 Kudos
Message 6 of 6
(3,033 Views)