LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing DAQmx tasks in and out of LabVIEW-made DLL functions

Hi,
 
Our system involves monitoring a number of DAQmx devices.  The main code for the system is written in C++, and currently the interface between the top-level C++ code and the NI hardware is done by means of LabVIEW VIs compiled into a DLL.
 
One problem that we've run into is that each time a data acqusition function is called, it configures the DAQmx device - a slow process.  Ideally, we'd like all the configuration to be done once (in one function), and then have another function with just the grab operation that can be called again and again.
 
The only way I can see to do this is to pass the DAQmx Task out of the configuration function, so that it can be held by the higher-level program and then given as an input to the grabbing function.  Unfortunately, when setting the prototypes for functions when compiling to a DLL, LabVIEW does not let you output or input either DAQmx Tasks or Clusters.  (I assume a DAQmx Task is just a specialisation of Cluster?)
 
Is there a good way of exporting and importing this kind of data type?
 
Thanks in advance,
 
Ian
 
P.S. I did briefly investigate Measurement Studio (for .NET 2003 in our case) and found it had a "CNIDAQmxTask" class.  Is there any way to use this useful-sounding class without resorting to doing the whole thing in C++ with Measurement Studio rather than in LabVIEW?
0 Kudos
Message 1 of 2
(2,379 Views)
Hi Ian,

You should be able to pass the DAQmx Task as a string by using the Flatten to XML string function located in the XML sub palette of the String palette. When you pass it back to the LabVIEW dll function you can convert it back to a task by using the Unflatten from xml string function.
Alternatively you can program the acquisition directly in Visual C++. There should be example code for this in the C:\Program Files\National Instruments\NI-DAQ\Examples\VisualC\Ai directory. If this directory isn't on your hard drive then you need to install Visual studio support for DAQmx. To do this goto Add/Remove Programs\National Instruments Software\NI-DAQmx and select modify. Follow the instructions and when it asks you what support to install make sure you select Visual Studio 2003.

Regards

Jon B
Applications Engineer
NIUK & Ireland
0 Kudos
Message 2 of 2
(2,336 Views)