how to output signal using NI DAQmx continuously

1 view (last 30 days)
I need to output sinusoidal signal using NI channel
I code like following;
s=daq.createSession('ni'); ch=s.addAnalogOutputChannel('6711',0,'Voltages'); rate=66000; s.Rate=rate; f=3300; t=(1:rate)/rate; output=sin(2*pi*f*t);
s.queueOutputData(output);
lh=addlistener(s,'DataRequired',@queueMoreData);
startBackground(s);
pause(); delete(lh)
// and function queueMoreData is like following
function queueMoreData(src,event) rate=66000; f=3300; t=(1:rate)/rate; output=sin(2*pi*f*t); s.queueOutputData(output); end
and as a result of these code, only one period runs.. I want the sin signal running continuously until I command not to..
What's the problem??

Answers (0)

Categories

Find more on Digital Input and Output 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!