continuous data acquisition with external trigger NI-USB 6218

4 Ansichten (letzte 30 Tage)
marianna
marianna am 3 Mär. 2014
Bearbeitet: Friedrich am 3 Mär. 2014
Hi,
I am trying to acquire continuous analog input data from a NI-USB 6218. I want to start and stop acquisition when I receive an external trigger on another channel (either analog or digital).
So far I've tried with the digital trigger using the following code:
set(ai,'TriggerType','HwDigital')
set(ai,'HwDigitalTriggerSource', 'PFI0')
set(ai,'TriggerCondition','PositiveEdge')
set(ai,'TriggerConditionValue',4.5)
set(ai,'SampleRate',RATE)
set(ai,'SamplesPerTrigger',Inf)
set(ai,'InputType','SingleEnded');
set(ai,'TimerFcn',@AcquireData);
set(ai,'TimerPeriod',0.5);
function AcquireData(hObject, event)
persistent totalData;
data = getdata(hObject);
if isempty(totalData)
totalData = data;
else
totalData = [totalData; data];
end
The problem is that as I run the command "start(ai)" I get an error:
Error using daq.analoginput_nidaqmx_1_87/start
NIDAQmx error : Requested value is not a supported value for this property. The
property value may be invalid because it conflicts with another property.
Property: DAQmx_SampQuant_SampPerChan Requested Value: 0 Valid Values Begin
with: 2 Valid Values End with: 8589934590 Task Name: MWDAT0183 Status Code:
-200077
It looks like I cannot set the samplePerTrigger property to Inf...
Can anyone help? Any suggestion on how to start/stop ai continuous acquisition with an external trigger? I need a hardware trigger because I have to start acquisition at the very same time of trigger turning on.
Thanks, Marianna

Antworten (0)

Kategorien

Mehr zu Simultaneous and Synchronized Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by