MATLAB Answers

daq.IsContinuous is not continuous

13 views (last 30 days)
Aiveen
Aiveen on 6 Aug 2014
Answered: Julian on 23 Nov 2016
If s.IsContinuous is set to true or to false, there is no difference in my results. The code does not seem to carry out the task of s.IsContinuous = true. It registers that I have set it to true, it just does not follow. It will only output the signal once. I am outputting an analog signal and read it off an oscilloscope.
My aim is to allow the square wave to run until I stop it as I require it for varying lengths of time. It is impractical to have to define the number of square waves using queueOutputData each time due to the varying number of waves necessary and it will also involve very large numbers.
I would appreciate any help.
I am using Matlab 2013a and NI 9269, below I show the simple code and Matlab's response.
Many thanks, Aiveen
CODE:
s=daq.createSession('ni');
s.addAnalogOutputChannel('cDAQ9181-1980EF4Mod1','ao0','Voltage');
s.Rate=25;
s.IsContinuous = true
s.queueOutputData(repmat([0 1],1,12).');
s.startBackground;
Also tried for s.queueOutputData(10*sin(linspace(0,2*pi,1000)).');
REPLY:
EDU>> ni6929_step1
s =
Data acquisition session using National Instruments hardware:
Will run continuously at 25 scans/second until stopped.
Number of channels: 1
index Type Device Channel MeasurementType Range Name
----- ---- -------------------- ------- --------------- ---------------- ----
1 ao cDAQ9181-1980EF4Mod1 ao0 Voltage (Diff) -10 to +10 Volts
Properties, Methods, Events
s.startBackground;

Answers (1)

Julian
Julian on 23 Nov 2016
You need a listener to run continuous background generation. If you're still interested in a solution, or to whom it may concern, there is a example by mathworks:
Maybe, someone working on a similar problem can tell me, if using listeners can put slightly delays into the signal output of the NI Device (during re-buffering the signal for example).

Community Treasure Hunt

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

Start Hunting!