Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-DAQ 6225 M for LabWindow 6.0

The Document show that DAQmx do not support on Labwindows less than 7.0. Is there solution that I can use library and functions of DAQmx in LabWindow 6.0 development?

0 Kudos
Message 1 of 5
(3,439 Views)

Hi Vincent,

 

You should be able to access the DAQmx C API with unsupported compilers by using LoadLibrary("nicaiu") and GetProcAddress(). It's less convenient than using a supported version of LabWindows/CVI, but it should be possible to get it to work.

 

Brad

---
Brad Keryan
NI R&D
Message 2 of 5
(3,435 Views)

Brad,

 

Your suggestion might help, but I'm not good at Windows SDK. Do you have precise steps or examples for me to include DAQmx API into my application for LabWindow 6.0.

 

BG,

 

Vincent Lee

0 Kudos
Message 3 of 5
(3,428 Views)

Hi Vincent,

 

The best solution would be to upgrade to a supported version of LabWindows/CVI. Version 6.0 is over ten years old.

 

If you absolutely must take the unsupported route, the basic idea is to call GetProcAddress for each function you want to use, and cast the resulting function pointers to the correct types:

 

#include <NIDAQmx.h>
#include <windows.h>

int main() {
   HMODULE daqmx = LoadLibraryA("nicaiu");
   if(daqmx) {
      typedef int32 (__CFUNC *DAQmxCreateTaskFnPtr)(const char[], TaskHandle*);
      DAQmxCreateTaskFnPtr daqmxCreateTaskFn = (DAQmxCreateTaskFnPtr) GetProcAddress(daqmx, "DAQmxCreateTask");
      typedef int32 (__CFUNC *DAQmxClearTaskFnPtr)(TaskHandle);
      DAQmxClearTaskFnPtr daqmxClearTaskFn = (DAQmxClearTaskFnPtr) GetProcAddress(daqmx, "DAQmxClearTask");
      if(daqmxCreateTaskFn && daqmxClearTaskFn) {
         TaskHandle task;
         daqmxCreateTaskFn("", &task);
         daqmxClearTaskFn(task);
      }
      FreeLibrary(daqmx);
   }
}

 

This uses NIDAQmx.h for the type and constant definitions, but not the function declarations. Add the corresponding directory (e.g. "C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\include") to the include path.

 

Note: I tried this code with Visual C++ 2010 but not with LabWindows/CVI 6.0. There may be other incompatibilities between LabWindows/CVI 6.0 and DAQmx that I am not aware of. After all, this combination is unsupported.

 

Brad

---
Brad Keryan
NI R&D
Message 4 of 5
(3,406 Views)

Brad,

 

I have to do it in LabWindows 6.0. Thanks for your information. It really help me a lot.

 

Vincent Lee

0 Kudos
Message 5 of 5
(3,396 Views)