Unable to get NI USB-6002 to generate and read data at the same time
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Tim Helps
il 17 Apr 2018
Modificato: Tim Helps
il 17 Apr 2018
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?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Data Acquisition Toolbox Supported Hardware in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!