Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Measurement multithreading with daqMX board

I'm trying to make analog voltage measurements on separate channels of a PXI-6229. THis works fine as long as I do it in a single VI, but if I try to have two separate vi's (e.g. one that measures voltages on channels ai0-ai3 and one that measures voltages on channels ai4-ai5) then there seems to be trouble -- sometimes one vi will read NaN, while the other reads voltages, and visa versa. Is there some timing that is necessary between the vi's in order for there not to be a traffic jam, or do I have to set up some kind of DMA stuff so that data is put into the card's buffer and transferred asynchronously? I could use notifiers I guess for one vi to tell the other that it's done, but I figured that labview would just take care of the traffic on it's own. I'm attaching two separate vi's (meas1.vi and meas2.vi) to illustrate my problem. Each on it's own runs fine, but running at the same time causes errors. I guess I could also have a vi that reads out all the channels and distributes the data to other vi's via shared variables, but I'd much rather have seperate vis, running at different rates, reading out different channels on the PXI card.

NI Software : LabVIEW version 8.0
NI Hardware : Multifunction DAQ device PXI-6229
Driver Version : latest
OS : Windows XP
0 Kudos
Message 1 of 8
(3,981 Views)
Can't open your vi because of version- but- you can't expect to communicate with two independently running vis. That board has a single A/D that is multiplexed between channels.

You need to set up a producer-consumer architecture where the data acquisition loop acquires all the data and two data analysis vis look at different parts of it.
0 Kudos
Message 2 of 8
(3,969 Views)
Thank you for contacting National Instruments!
 
To expand on the last post, you can only run on concurrent Analog Input task on that board because of its single A/D converter.  That is why it ran as a single VI, but won't run as a pair of VI's.  There are several ways around this.  I agree that the producer/consumer loop would probably be the "safest", in terms of data integrity, of going about this.  But, you are right in that you can acquire all of the data with one VI, and then direct the data to other VI's for the processing side. 
 
-Jeff P.
0 Kudos
Message 3 of 8
(3,959 Views)


@Jeffrey P wrote:
Thank you for contacting National Instruments!

 

To expand on the last post, you can only run on concurrent Analog Input task on that board because of its single A/D converter.  That is why it ran as a single VI, but won't run as a pair of VI's.  There are several ways around this.  I agree that the producer/consumer loop would probably be the "safest", in terms of data integrity, of going about this.  But, you are right in that you can acquire all of the data with one VI, and then direct the data to other VI's for the processing side. 

 

-Jeff P.



Okay, thanks. Where can I find an example of this? If I had to make it up myself, I'd either use shared variables (I'm using LV8.0) or I'd use datasocketing, or I'd use notifiers. Are there advantages to one or the other? I assume that one has more overhead somehow?
0 Kudos
Message 4 of 8
(3,953 Views)
Incidentally, can I have seperate vi's for a single board, if one of them does only analog in, and the other does only analog out or digital out, or do I need a single vi per board?

thanks!

Jesse
0 Kudos
Message 5 of 8
(3,947 Views)
It depends on which method you choose.  You would use a producer/consumer loop if you want to keep 2 separate VI's.  You would have to clear one task before you start the other one.  The producer/consumer theory would enable you to accomplish this.  Your other method, and probably the more simple, is to just acqire all of your data at the same time.  You can then save each separate data set in its own variable, and then access that variable from another VI.  You can find examples of producer/consumer loop by searching for "producer" in the NI Example Finder.
 
-Jeff P
0 Kudos
Message 6 of 8
(3,947 Views)
You can have separate VI's that access separate "functions" of the board.  That is, VI 1 can do analog input, VI 2 can do analog output, VI 3 can do digital I/O (this is all one function), and VI 4 can access the counter channels.  However, VI 1 and VI 2 cannot both do analog input, or both do analog output. 
0 Kudos
Message 7 of 8
(3,945 Views)
okay, thanks everyone -- got it. Wow, you guys respond so fast!

j.

0 Kudos
Message 8 of 8
(3,935 Views)