Unable to get NI USB-6002 to generate and read data at the same time

조회 수: 9 (최근 30일)
Stefan Gramatikov
Stefan Gramatikov 2016년 10월 29일
편집: Andrei 2018년 4월 27일
I am using USB-6002 DAQ Device from NI to output a set of values and read them on another port. I have the following code, which setups a session, introduces one input and one output channel, sets a listener with a plot function for the read and queues data to output, but MATLAB returns the following:
Error using ioData (line 17)
Hardware does not support the specified connection. Check
the device's user manual for valid device routes and
pin-outs.
I have tested the functions separately and they work, most of the code is from MATLAB's own examples. If I run the function without the output port initialization and data queue, + setting the time to run, it runs as a normal input function, I guess my problem is connected to using both input and output at the same time. Do you have any ideas how to accomplish that? This is my code:
function ioData(time,rate)
global s
s= daq.createSession('ni');
ch=addAnalogInputChannel(s,'Dev1', 0, 'Voltage');
ch.TerminalConfig = 'SingleEnded';
addAnalogOutputChannel(s,'Dev1', 0, 'Voltage');
s.Rate = rate;
%s.IsContinuous = true;
s.IsNotifyWhenDataAvailableExceedsAuto = true;
global t
global d
t=[];
d=[];
lh = addlistener(s,'DataAvailable', @pr );
queueOutputData(s,linspace(-5, 5, rate*time)');
s.startBackground();
function pr(src, event)
t=[t;event.TimeStamps];
d=[d; event.Data];
i=size(t)-src.Rate*3;
if(i<1) i=1; end
plot(t(i:size(t)),d(i:size(d)))
axis tight
end
end
  댓글 수: 5
Tim Helps
Tim Helps 2018년 4월 17일
편집: Tim Helps 2018년 4월 17일
Hi Andrei, thank you for this clarification. I tried to get this exact information (which devices produce this error) from NI, and they told me "for the record, I am 90% sure the USB6001 should be able to do both Analog Out and Analog In simultaneously."
Is it just the 6001-6003 that lack this ability then? Will the next cheapest option (USB-6210 or USB-6211) perform without problem?
Andrei
Andrei 2018년 4월 27일
편집: Andrei 2018년 4월 27일
Tim, I ran a test with an NI USB-6211 and was able to do simultaneous analog input and output.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Acquisition Toolbox Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by