Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Use M-Series cards with DAQmx in Matlab!

You mentioned that you're using "PCI-6035E, Windows 98, MATLAB 6.5.1, and used the 16 bit generic driver nidaq.dll"  If you switch to the PCI-6221 DAQ, Windows XP, NIDAQmx, and MATLAB 2007a, you've changed every variable in the book.  You've got E-series to M-series, Traditional NI-DAQ to NI-DAQmx (totally different API), changed from (effectively) Windows 3.1 to Windows XP.  You've time warped nearly 15 years!  Not too surprising that there might be a few bumps.
 
NI-DAQmx definitely supports counters -- but the interface is quite a bit different.
 
When you say "do you know MATLAB plans to improve it's support of NI-DAQ features in the near future?"  I'm not quite sure what you mean.  We support Traditional NI-DAQ and NI-DAQmx (and many others) with Data Acquisition Toolbox, which is a sophisticated MEX file to allow background acquisition and generation and a bunch of other useful stuff.  You're accessing NI-DAQmx via base MATLAB's Generic DLL support, which works (I've done it myself), but means that you're pretty much on your own getting it to work.  As for the warnings you see, I can't offer any better advice than our tech support did.  Note, however, that you can supress these warnings using the warning function.
 
In the interest of full disclosure, Data Acquisition Toolbox does not support counter/timer functionality at this time.
 
-Rob
-----
Rob Purser
Manager, Test and Measurement
MathWorks
rob.purser@mathworks.com
0 Kudos
Message 61 of 106
(4,902 Views)
Hi

I have a problem using my NI USB-6009.
I want to use MATLAB (R2007a) to control my NI USB-6009, and to get output(voltage).
I have defined a visa object:
abc=visa('ni', 'USB0::0x3923::0x717B::00E112CD::INSTR')
and the message was:
   VISA-USB Object Using NI Adaptor : VISA-USB-0-0x3923-0x717B-00E112CD-0

   Communication Address 
      ManufacturerID:     0x3923
      ModelCode:          0x717B
      SerialNumber:       00E112CD

   Communication State
      Status:             closed
      RecordStatus:       off

   Read/Write State 
      TransferStatus:     idle
      BytesAvailable:     0
      ValuesReceived:     0
      ValuesSent:         0


Then I used fopen(abc), and i received message:
??? Error using ==> icinterface.fopen at 82
Could not open VISA object. Use INSTRHWINFO for a list of available configurations.

Who could please help me to solve this problem?

Thank you
Belfi

0 Kudos
Message 62 of 106
(4,786 Views)

Hi,

I've never tried opening a DAQ device using VISA and Instrument Control Toolbox.  I'll have to try that.

Google "MATLAB data acquisition" for options on accessing the USB-6009 from within the MATLAB environment.

-Rob

-----
Rob Purser
Manager, Test and Measurement
MathWorks
rob.purser@mathworks.com
Message 63 of 106
(4,764 Views)
Hi,

I am new with daq tools (so my questions will be simple).

I am using Matlab R14 with a daq toolbox 2.10.

First i tried to tried to run USB 6008 with visa. But fopen function never worked. (Even i switched the device to NI-VISA by using NIDAQmx Base).

When i used NIDAQmx tools (i.e. GenNUpdates) for Matlab, it worked with user interface but never worked without UI.

When i use daqhwinfo, the response was:

hw = daqhwinfo('nidaq')
Unable to load mex file: E:\MATLAB7\toolbox\daq\daq\daqmex.dll.
The specified module could not be found.

If i try to use analogoutput, it says:

ao = analogoutput('nidaqmx','USB6008');
??? Error using ==> analogoutput.analogoutput
Error using ==> feval
Undefined command/function 'privateCheckObsoleteAdaptor'.

In the forum, i read loadlibrary as a suggestion, but for me it gives such a result:

funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni')
??? Error using ==> loadlibrary>lFullPath
Could not find file nidaqmx.h.

Error in ==> loadlibrary at 120
  header=lFullPath(header);

Probably, i am not on the right way. At least one thing should work, right? Do you have an idea about what is missing?

Thanks...


0 Kudos
Message 64 of 106
(4,676 Views)
The first version of Data Acquisition Toolbox that supported NI-DAQmx (required for USB-6008) was version 2.8, which shipped with R2006a.  The Data Acquisition Toolbox that shipped with R14 was 2.5.  2.10 shipped with R2007a.  You'll need to use a matched version of MATLAB and Data Acquisition Toolbox. 

All the best,
-Rob
-----
Rob Purser
Manager, Test and Measurement
MathWorks
rob.purser@mathworks.com
0 Kudos
Message 65 of 106
(4,663 Views)

Hi Jens_DE,

 

I am having problem running the funclist command,

 

funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni')

 

??? Error using ==> loadlibrary>lFullPath

Could not find file nidaqmx.h.

 

I have downloaded the MatlabGenericDll from the website u stated, may I know where I should place the folder I downloaded,  when I run the command error will appear as below:

 

loadlibrary('MatlabGenericDll', 'GenericDll.h')

??? Error using ==> loadlibrary>lFullPath

Could not find file GenericDll.h.

 

I need your help on this. Thank a lot.

 

 

Regards,

yeelin

0 Kudos
Message 66 of 106
(4,543 Views)
Hi Yeelin!

You should put nicaiu.dll and nidaqmx.h into a directory in your Matlab path list. Easiest way is to add them to Matlab/work.
It would be a bit more elegant to add them to a dedicated "useNI" path or so, but then you need to make sure you add the path
to Matlab's path list. Similarly, all the m-files should be in directories that are in the pathlist.

Does this help?
Jens




0 Kudos
Message 67 of 106
(4,529 Views)

hi Jens,

Thanks for your reply. I need your advice and guidance to solve my problems.

May I know where to get the nicaiu.dll and nidaqmx.h file? Besides that, I still having problems loading the MatlabGenericDll and MatlabGenericDll.h, when I run the command, there is a proactive defense alert appear. I need to quarantine or terminate or allow the so called riskware:RootShell?

 

Thanks

yeelin

0 Kudos
Message 68 of 106
(4,512 Views)
Hi Yeelin!

Install the NIDaqMX CD that came with your card. If you don't have it, you can download the drivers from NI.com. Then do a search for the two files. I don't remember which directory they are in. Then copy them to the Matlab directory.

I've never heard about the Rootkit alert. I assume you are running some kind of Anti-Virus or Firewall software that gets a bit irritated because a dll is called. If you are sure that you got the NI .dll and .h files from a trustworthy source, there should be no security risk in allowing the access of these files.

Good luck
Jens
0 Kudos
Message 69 of 106
(4,508 Views)
hi Jens,
 
Sorry for troublesome you again, i have found the nicaiu.dll and nidaqmx.h file, however when I run the command funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni'), there is a warning shown as
 
Warning: Function C:\Program Files\MATLAB\R2006a\work\input.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.
 
funclist =Empty cell array: 0-by-1
 
Do I need to rename the function? What should I do?
 
 
Thanks in advance
yeelin
0 Kudos
Message 70 of 106
(4,489 Views)