05-12-2006 03:20 PM
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']);
05-15-2006 05:13 PM
05-16-2006 02:01 PM