Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Access NI-DAQmx drivers with Matlab "loadlibrary" function

I would like to know how to interface the NIDAQmx drivers to Matlab. The Matlab "loadlibrary" function requires a header.h file and a library.dll file however I cannot locate the nidaqmx.dll or similar file.

The header file is loacted at: C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h

Is this the correct way of calling the NIDAQ drivers within Matlab?
Is there any advantage to using the new mx drivers over the traditional ones or should I be using the legacy NIDAQ drivers (ie 'nidaq32' and 'nidaq.h') instead of NI-DAQmx?

Thanks
Luke
0 Kudos
Message 1 of 8
(7,313 Views)
Hi LukeC,

I'm not too familiar with the Matlab "loadlibrary" function, but if it's part of the Data Acquisition Toolbox, according to Mathworks, DAQmx is not supported.

Are the NI M-Series PCI and PXI boards supported by Data Acquisition Toolbox 2.5 (R14)?

You can however make use of the Simulation Interface Toolkit to work with the DAQmx driver

Using NI-DAQmx with the LabVIEW Simulation Interface Toolkit

The tutorial, Answers to Frequently Asked Questions about NI-DAQmx and Traditional NI-DAQ (Legacy), will provide information on the difference between the Traditional DAQ and DAQmx drivers.

Thanks,
Lesley Y.
0 Kudos
Message 2 of 8
(7,294 Views)
Thanks for your reply, I have since found a solution by doing a more comprehensive search of the messages. If anyone is interested the way to call the NI-DAQmx drivers within matlab is as by calling the "nicaiu.dll" library as follows:

loadlibrary('nicaiu.dll','NIDAQmx.h','alias',''aliasname')

Full credit given to Jens_DE, here is the link to the post

http://forums.ni.com/ni/board/message?board.id=250&message.id=10165

Thanks!!
0 Kudos
Message 3 of 8
(7,289 Views)
I am using NiDAQmx driver 8.6. The nicaiu.dll does not appear to be included with this version of the driver. I would like to control S-series NI devices through matlab. I need to synchronize multiple devices and to trigger them all simultaneously. The Data Acquisition toolbox seems to allow control of the trigger sources for each device. But it does not seem to support manipulation of the trigger channels directly. For example, there is no straightforward way to interface with RTSI nor PFI channels. My thoughts are that I must interface with the driver C functionality through matlab. The only way I have found to accomplish this in my searching is through matlab loadlibrary command which calls for the usage of 'nicaiu.dll'. Hence I would like to know how to get it. Or I am all ears to entertain other means of trigger control and manipulation through matlab
0 Kudos
Message 4 of 8
(6,686 Views)
Hi,

That dll is included in DAQmx 8.6 and is installed in the WINDOWS\System32 directory. If yours isn't present, then I recommend repairing the driver through the Control Panel's Add or Remove Programs utility. Please let me know if you need further clarification.
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 5 of 8
(6,667 Views)
Just a note -- the Data Acquisition Toolbox has supported NI-DAQmx devices since our R2006a release.

-Rob
-----
Rob Purser
Manager, Test and Measurement
MathWorks
rob.purser@mathworks.com
0 Kudos
Message 6 of 8
(6,654 Views)
Thanks Rob,

But, as far as I can tell, Matlab offers only limited support for NIDAQmx driver. Unless I am missing something about the way the interface works, it appears to me that the functionality offered by the Matlab toolbox alone seems to be very limited. For example, using the toolbox alone, how do I simultaneously trigger multiple devices from a single hw trigger source that originates with one of the devices? How do I synchronize multiple devices to use the same sampleclock? Let,s say I want to use the 20MHz clock from the PCI 6115 as the clock for the 6115 and for a PCI6133. Using toolbox, I can assign the 6133 to look to the RTSI0 line for its external clock source. But, the toolbox does not allow any way to assign the clock to that RTSI0 line in the first place. Same goes for the PFI lines. Am I missing something? I have resorted to using the C-functionality that is packaged with the driver to interface with the missing matlab toolbox functionality. For example, I can use the C-library to connect the 6115 20 MHZ clock to the RTSI0 line. Then proceed with toolbox for the acquisition. As yet, I haven't figured out how to use the C-functionality to route a trigger TTL to the RTSI, but I am working on it. Any advice would be welcomed.

Thanks
0 Kudos
Message 7 of 8
(6,648 Views)

Hi all,

 

As of our October 2008 release, R2008b, the Data Acquisition Toolbox provides full support for RTSI signals.  For a demo, visit

http://www.mathworks.com/products/daq/demos.html?file=/products/demos/shipping/daq/demosync_ai_and_a...

 

-Rob

-----
Rob Purser
Manager, Test and Measurement
MathWorks
rob.purser@mathworks.com
0 Kudos
Message 8 of 8
(6,306 Views)