Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Error Status Code -200089 for analog output with MATLAB and NIDAQmx

I'm using MATLAB (R2006a) and the DAQ Toolbox (2.8.1) 
to control an
instrument through analog in/out using a
NI DAQPad-6015 and NIDAQmx 8.0.1 driver. I get the
following error on the 10,000 iteration of a loop that
sends the analog output signal using the MATLAB command
putsample:

??? NIDAQmx error: Task name specified conflicts with
an existing task name. Task Name: MWDAT0020 Status
Code: -200089

Error in ==> glc_feed at 969
putsample(ao,[glcsig airsetsig]);


It looks like an error from the NIDAQmx driver to me, but
I suppose it could have something to do with MATLAB too.
I have included
a minimal M-file at the end of this message that reproduces
the error even with nothing connected to the DAQ
board. The error only occurs with both AI and AO
active. Both function ok separately. Furthermore,
the error appears related to the TriggerRepeat value
for the AI object and the number of AO channels. The
number of AI channels (I tested 1 and 7) and the
sample rate (1, 100, 1000 were tested) don't seem to
matter, in fact no GETDATA command (for acquiring the
analog input) is needed to
produce the error. With 2 AO channels, the error
occurs on cycle 10,000 if the TriggerRepeat value is
111 or higher (including 'inf' for continuous
triggering which is the setting I normally use).
TriggerRepeat values of 110 or lower do not produce
the error. However, if there is only 1 AO channel, a
TriggerRepeat of 110 does produce the error. I didn't
check other TriggerRepeat values with one AO channel
since I need to use both AO channels for my
application.

There are no other USB devices on the computer, not
even a mouse or keyboard. I'm using a Toshiba
Satellite A60 laptop running Windows XP, and no other
programs are running at the same time. I also restart
the computer immediately before starting MATLAB.
Everything seems to be working fine up to the error.

In the past, I have used essentially the same program
successfully with a NI DAQCard-6024E and the
traditional NIDAQ (not NIDAQmx) drivers and whatever
versions of MATLAB and the DAQ Toolbox were current in
2001-2003.

Thanks for your help,

Jim Zawada
jimmyz@f-a-b-inc.com

%-------- MATLAB M-file for analog output error
%%%
%%% Clean up variables from any previous run
%%%

vs = who;
if find(strcmp('ai',vs)),
stop(ai); stop(ao);
delete(ai); delete(ao);
clear ai ao;
end

clear all;

cyclenum = 0; % counter of AI/AO loop cycles for dubugging

%%%
%%% Setup analog input
%%%

samplerate = 1000; % Doesn't seem to affect error
triggerrepeat = 110; % <= 110 is ok, >110 (including 'inf') crashes on cycle 10000

ai = analoginput('nidaq','Dev1');
aichans = addchannel(ai,0:6); % Number of channels doesn't have an effect
set(ai,'SampleRate',samplerate);
set(ai,'InputType','Differential','TriggerRepeat',triggerrepeat);

%%%
%%% Setup analog output
%%%

ao = analogoutput('nidaq','Dev1');
aochans = addchannel(ao,0:1);
set(ao,'SampleRate',samplerate);

start(ai);

disp(['starting loop']);

for cyclenum = [1:10001],
% GETDATA command does not affect the error
%[tempaidata, temptime] = getdata(ai,1);
putsample(ao,[1 2]);
end

disp(['done with loop']);
0 Kudos
Message 1 of 3
(4,649 Views)
Hello Jim,

Unfortunately, you'll probably have to contact the Mathworks in order to resolve this issue.  It is definitely a DAQmx error that you are receiving, but the ultimate cause of the error is a result of how the Mathworks Data Acquisition Toolbox is implementing the DAQmx driver behind the scenes.  Error -200089 indicates that the at some point, your program is trying to recreate the DAQmx Task, and it already exists in the driver's memory.  This error often occurs when not properly clearing the DAQmx Task at the end of a program, and trying to restart the program causes a conflict in the driver.  The best I can do is give you this background information about the error, point you towards the following discussion forum with some basic information about using MATLAB with the DAQmx driver, and tell you to contact the Mathworks with this issue.

KB 23KH8MG4: Which National Instruments DAQ Devices Are Compatible with The MathWorks, Inc.'s Data A...

Discussion Forum: Use M-Series cards with DAQmx in Matlab!

Regards,
Travis G.
Applications Engineering
National Instruments
www.ni.com/support
0 Kudos
Message 2 of 3
(4,632 Views)
Thanks, Travis.  I have received word from Mathworks that it is indeed a problem with their DAQ Toolbox v. 2.8.1 and they are working on a fix.

Jim Zawada
0 Kudos
Message 3 of 3
(4,621 Views)