Matlab daq input and output issues.
1 view (last 30 days)
Show older comments
I can't seem to get matlab to talk to the daq. I have it connected and got the analog input recorder working, but can not seem to get any output. I have tried the instrument control and can't get it to connect. With that issue I tried the regular programing way. Nothing seemed to work. I am trying to send out a sin sweep from 1 hz to 5000 hz if possible over 5000 seconds. If it has to be done in small segments of 1000 that would be fine as well.
Here is the code I was trying to use.
a = 1
b = 1000;
t = linspace(0, 1000, 100000);
y = chirp(t, a, t(end), b);
plot(t, y, 'b*-');
grid on;
This code is for the sweep.
s = daq.createSession('ni');
addAnalogOutputChannel(s,'Dev1', 0, 'Voltage');
s.Rate = 10000;
data0 = y
queueOutputData(s,repmat(data0, 5, 1));
s.startBackground(1000);
s.wait(100000)
1 Comment
Siddharth Bhutiya
on 12 Nov 2018
How are you testing the generated output ?
What are the values of "s.ScansQueued" and "s.ScansOutputByHardware" properties of s, before and after the "s.startBackground" command ?
Answers (0)
See Also
Categories
Find more on National Instruments Frame Grabbers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!