LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a DAQ test between subVIs?

Is it possible to pass a DAQ test between subVIs?  I'm using the AI Config, AI Start, and AI Read VIs.  I also have a subVI which I want to perform several DAQ readings on the same channels.  I tried passing the taskID into the subVI by creating a taskOut control but that did not seem to work- in fact the computer blue screened whenever the subVI was called.  I also tried creating new tasks in the subVI but then when control returned to the main VI the initial daq tasks did not seem to function properly anymore...

 

 

0 Kudos
Message 1 of 3
(2,706 Views)

Passing a taskID into subVI is a perfectly fine thing to do. In fact, the DAQ VIs are written that way. It definitely should not blue-screen the computer, so perhaps you wired something incorrectly, or are doing something in the wrong order. Why don't you post your code so it will be easier to diagnose. As for your other attempt, that definitely won't work, since you are creating two separate tasks.

 

EDIT: Just out of curiosity, is there a particular reason you're using the traditional (i.e., old) DAQ functions as opposed to DAQmx?  Are you sure those functions work with whatever board you have, and whatever OS you're running?

Message Edited by smercurio_fc on 01-22-2009 02:55 PM
0 Kudos
Message 2 of 3
(2,698 Views)

Not sure what you mean by a DAQ test? One way to be able to reuse a DAQ measurement is to build an "Action Engine" which basically consists of a case statement within a while loop that has the stop node set to stop, so that the loop executes only once. The case statement, uses a type def control (which allows you to have cases with meaningful names. There should be a shift register on the loop, which will not have a connection outside the loop, making it (an uninitiallized shift register) a storage element that will hold its value from one call to the vi to the next. The first case of the case statement should initialize the DAQ measurement, with the resulting refnum fed to the shift register's right element. Then another case would be the read, with the DAQmx function fed with the refnum, etc. Place this vi early in your program set to the initialize, then you can do the reads where ever needed. Remember to have a "close" case called when daq is no longer needed. It is a very good idea to use the error in/out clusters with the vi to allow you to control when in the calling vi it will be executed (Remember LabVIEW is a data flow language).

 

Hope it helps
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 3
(2,693 Views)