ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
05-25-2011 10:30 AM
When I look at your code:
funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni'); % Load DAQmx lib
%libfunctionsview('myni'); %zobrazi funkce DAQmx
taskh1=uint32(1); [a,b,taskh1] = calllib('myni','DAQmxCreateTask','master',taskh1); % Using DAQmx command to creat task
[a]=calllib('myni','DAQmxSetAIExcitVoltageOrCurrent',taskh1,'ai.Channel(1)', 10134); % Using DAQmx command to define excitation type, here 10134 means current
[b]=calllib('myni','DAQmxSetAIExcitVal',taskh1,'ai.Channel(1)',0.004); % Using DAQmx command to turn on the 4mA current for channel 1, sensor 1 is IEPE type
[c]=calllib('myni','DAQmxSetAICoupling',taskh1,'ai.Channel(1)',10045); % Using DAQmx command to set AC Coupling
I'm missing the part where you create channel - after creating task, you should add virtual channel into your task. I guess you should use DAQmxCreateTask, and specify which AI you want to use. Then, once you have channels added into your task, you can set excitation for particular channel in task. See "How to use National Instruments M-Series cards with Matlab", it seems someone played a little to create examples.
hopefully we will be again step closer to solution.
regards,
stefo
05-30-2011 09:53 AM
Hi Stefo,
Thanks again. I've already seen the topic on "How to use National Instruments M-Seris cards with Matlab". It's very interesting and I'm able to do every data-acquisistion I want using the NI card. The only thing that still doesn't work is the IEPE. This is now my code, with the channel creation:
clc;
clear all;
AI = analoginput('nidaq','Dev1'); % MATLAB DAQ command
chans = addchannel(AI,0:3); % MATLAB DAQ command
funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni'); % Load DAQmx lib
taskh1=uint32(1);
[a,b,taskh1] = calllib('myni','DAQmxCreateTask','master',taskh1); % Using DAQmx command to creat task
a = calllib('myni', 'DAQmxSetAIExcitVoltageOrCurrent', taskh1,'AI.Channel(1)', 10134); % Using DAQmx command to define excitation type, here 10134 means current
b = calllib('myni', 'DAQmxSetAIExcitVal',taskh1,'AI.Channel(1)',0.002); % Using DAQmx command to turn on the 2mA current for channel 1, sensor 1 is IEPE type
c = calllib('myni', 'DAQmxSetAICoupling',taskh1,'AI.Channel(1)',10045); % Using DAQmx command to set AC Coupling
start(AI); % Start AI;
data = peekdata(AI,10000);
Seems like the error has nothing to do with the wrong choice of the current for the channel, because the line a = calllib('myni', 'DAQmxSetAIExcitVoltageOrCurrent', taskh1,'AI.Channel(1)', 10134); also gives the same error.
06-09-2011 07:32 AM
Dear Bram,
Seams that Mathworks is supporting direct IEPE channel measurements only in newest Data Acquisition Toolbox Software : http://www.mathworks.com/help/toolbox/daq/rn/bstssaq-1.html (probably limited to cDAQ)
Mircea
06-09-2011 07:34 AM
Ok, thanks for the reaction, I will take a closer look at this!
08-30-2011 09:38 AM
Finally solved this one!
You have to install the Matlab 2011b (prerelease) and use the driver NI-DAQmx 9.1
In this Matlab version, you can work with session-based interface. I've used this script:
clc;
clear all;
s=daq.createSession('ni'); %creates the DAQ session
s.addAnalogInputChannel('Dev1','ai0','Accelerometer'); %Add the channel as an accelerometer channel (meaning IEPE is turned on)
s.Channels(1).Sensitivity = 0.01; %Defining the Sensitivity in V/g
data = s.startForeground(); %acquiring the data
plot(data) %plot the data
Thanks for the help guys!
09-15-2011 04:07 AM
Hello,
I found 2 solutions to use NI cards with Matlab : use the Data Acquisition Toolbox of Matlab (version 2011b) or use the NI-DAQmx Tools for The Mathworks, Inc. MATLAB® Software
I tried to install the NI-DAQmx Tools, but I have the following error : the version of the Runtime engine is higher than the 7.0, and I can not install these tools. ( I have Labview 2011)
What is the best solution ? Is there a new NI-DAQmx Tools version ?
Thanks for your experience,
Mathieu
09-15-2011 04:15 AM
Hi Mathieu,
I don't have a good expierence with the NI-DAQmx Tools. It's not so easy to use, and I haven't found a way to integrate IEPE sensors.
According to me the best solution is the use of Matlab 2011b. You can acquire time data directly into Matlab, and then use it the way you like it.
09-15-2011 04:25 AM
Ok. Thanks a lot for your answer !
Mathieu
09-14-2012 07:07 PM
hi guys!
I am working on a project that requires Data Acquisition Hardware and the one i have got is (N1 cDAQ-9178), I wanted to configure it with MATLAB, if anyone of you guys are aware of the procedure, i would really appreciate it.
Thanks in advance.
09-17-2012 10:28 AM - edited 09-17-2012 10:49 AM
Hi Gagz!
First of all I'd like to kindly ask you to tell me the software version of NI-DAQmx and MATLAB®
In order to use our Multifunction DAQ products with the MATLAB® Software, you can choose from two options.
- NI-DAQmx Tools for Data Acquisition with The Mathworks, Inc. MATLAB® Software, but this is supported up to version 2008b of the MATLAB® Software
Download link: https://lumen.ni.com/nicif/us/evaldaqtools/content.xhtml
- or you can use the Data Acquisition Toolbox provided by The Mathworks, Inc.
Here can you request a free trial: http://www.mathworks.com/programs/trials/trial_request.html?prodcode=DA
(Another option would be to import your .m files into a MathScript node in LabVIEW, and utilize the NI-DAQmx functions all within the LabVIEW development environment. )
Data Acquisition Toolbox™ provides functions for connecting MATLAB® to data acquisition hardware.
The toolbox supports a variety of DAQ hardware, including USB, PCI, PCI Express®, PXI, and PXI-Express devices, from National Instruments and other vendors. With the toolbox you can configure data acquisition hardware and read data into MATLAB and Simulink® for immediate analysis.
You can read much more from this product below: http://www.mathworks.com/help/daq/product-description.html
Under this link you can search for the supported devices: http://www.mathworks.com/help/daq/examples/accessing-national-instruments-m-series-and-ni-daqmx-hard...
MATLAB® supports M-Series, E-Series, X-Series, CompactDAQ, USB, and many other types of data acquisition hardware from National Instruments when you use Data Acquisition Toolbox™. Specifically, Data Acquisition Toolbox supports National Instruments data acquisition hardware that uses the following driver software: NI-DAQmx (version 9.2 or higher).
So to use the NI cDAQ-9178 you will need matlab R2010b (version 2.17) and NI-DAQmx 9.2 as Minimum Version Requireements.
After you check the required sw versions, and everything os ok, you can start to use the device.
Here you can find a step by step manual about this:http://www.mathworks.com/help/daq/examples/accessing-national-instruments-m-series-and-ni-daqmx-hard...
In this deatiled description there is a Discover and Configure the Properties of the Acquisition section. I hope reading this through will help you.
If you have any questions feel free to post it. May be a new topic would be more suitable for this subject.
MATLAB® and Simulink® is a registered trademark of The MathWorks, Inc.
Best regards,