12-03-2007 04:16 PM
12-04-2007 05:08 PM
Hi Bill,
The function AI_Change_Parameter is not a DAQmx function and I would not recommend using it. This is a function from the legacy Traditional NI-DAQ drivers. I would instead recommend that you use the newer NI-DAQmx driver. You can use the DAQmx Channel property AI.Excit.Val to specify the IEPE excitation current. For more information on enabling IEPE with DAQmx, refer to the section titled "Integrated Electronic Piezoelectric Excitation (IEPE)" in the NI-DAQmx C Reference Help. The NI-DAQmx C Reference Help installs to Start » Programs » National Instruments » NI-DAQ in Windows.
Refer to this thread for information on how to make NI-DAQmx driver calls from MATLAB.
And of course, make sure that you have NI-DAQmx installed.
Give this a try and let me know if you come across any problems - I'd be happy to help some more.
12-05-2007 05:29 PM
Hi Elizabeth,
Thanks a lot for the help. Your suggestions are very helpful!!! I was able to use MATLAB to invoke DAQmx functions. However, somehow I am not quite there yet. Here are what I did:
AI = analoginput('nidaq,'Dev1'); % MATLAB DAQ command
chans = addchannel(AI,0:7); % 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.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
start(AI); % Start AI;
data = peekdata(AI,10000);
---------------------------------------
The above code ran without error, but the value a, b c, looked suspicious. a = -200088
The obtained data is still noise, the IEPE signal didn't seem to be turned on?
Can you help me with that?
Thanks again
Regards,
Bill
..........................
1. Define the hardware card: AI = analoginput('nidaq','Dev1'); % this is one commend in MATLAB DAQ Toolbox
2. add channels: chans = addchannel(AI,0:7); %this is also a commend in MATLAB DAQ Toolbox
3. load the DAXmx library; funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni');
4. generate a task by DAQmx function; taskh1=uint32(1); [a,b,taskh1] = calllib('myni','DAQmxCreateTask','master',taskh1);
5.. try
12-06-2007 03:12 PM
Hi Bill,
The DAQmx error -200088 that is returned by the DAQmxSetAIExcitVoltageOrCurrent function means that the task specified is invalid or does not exist. Make sure that you use DAQmxClearTask to destroy the task once you are finished. I am not sure of what the problem is, but it seems like you could be getting this error because you created the task the first time you ran the program, did not destroy the task, then ran the program again and tried to create the task again even though the original one was not destroyed.
If that doesn't fix it, then I would check to make sure that you are definitely creating the task correctly. The way you are doing it looks ok to me (in fact, it looks like you just copied it directly from the other forum thread I referred you to), but maybe there is something wrong with that code. If you play around with it a little bit, maybe you will be able to find a problem with the task creation. I really wish I could test out your code myself so that I could be of more help, but unfortunately, I don't have access to MATLAB®.
Give this a try and let me know what you figure out.
MATLAB® is a registered trademark of The MathWorks, Inc. Further, other product and company names mentioned herein are trademarks, registered trademarks, or trade names of their respective companies.
03-04-2010 10:41 AM
Hello,
I have the same problem with my NI WLS 9163 + NI 9234 device. I would like to collect signals from IEPE accelerometers under Matlab. If I try the code from this site or another simple code to create a voltage channel:
DAQmx_Val_Volts= 10348; % measure volts
funclist = loadlibrary('nicaiu.dll','nidaqmx.h','alias','myni'); % Load DAQmx lib
disp('NI: Create Tasks')
taskh1=uint32(1);
[a,b,taskh1] = calllib('myni','DAQmxCreateTask','master',taskh1) % a will be the error code
disp('NI: Create AI Channels')
taskchans1=['Dev1/ai0:' num2str(numofchans-1)];
[a,b,c,d] = calllib('myni','DAQmxCreateAIVoltageChan',uint32(taskh1),taskchans1,'',-1,-10,10,DAQmx_Val_Volts,'')
I get the same error -20088
Could anybody help me please to create IEPE channels for NI9234 in Matlab
05-21-2010 06:36 AM
Hi DeerPark,
I have a similar problem with you for activating the IEPE of my dag card so it
would be very helpfull if you can tell me if you solved the problem and how
you did it.
Actually we get the 200088 error and we cannot solve it.
Any infos would be helpfull.
Thanks in advance.
Greetings