daq.IsContinuous is not continuous

조회 수: 10 (최근 30일)
Aiveen
Aiveen 2014년 8월 6일
답변: Ann Soniya m micheal 2021년 11월 23일
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;

답변 (2개)

Julian
Julian 2016년 11월 23일
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).

Ann Soniya m micheal
Ann Soniya m micheal 2021년 11월 23일
In legacy, can try
start(d,"Continuous"); to make it continuous.
In session try s.startBackground('continuous'); to make the back ground task continuous and stop the execution by deleting the listener

제품

Community Treasure Hunt

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

Start Hunting!

Translated by