How can I perform a multi-trigger acquisition with startBackground (Data Acquisition Toolbox)
2 次查看(过去 30 天)
显示 更早的评论
I got an application where I would like aquire data at multiple triggered times and read it out at the end alltogether (using the Data Acquisition Toolbox and an NI DAQ PCI-6221). However, my problem is that I can only read out the data acquired after each trigger individually. My code looks like this:
s = daq.createSession('ni');
s.Rate = 25e3;
s.DurationInSeconds = 0.001;
chAI1 = addAnalogInputChannel(s,'Dev2','ai1','Voltage');
chAI1.TerminalConfig = 'Differential';
s.addTriggerConnection('External', 'Dev2/PFI12', 'StartTrigger');
s.Connections(1).TriggerCondition = 'FallingEdge';
s.TriggersPerRun = 10;
s.addlistener('DataAvailable', @MyReadoutFnc);
prepare(s);
startBackground(s);
The problem is that the listener is triggered through the DataAvailable event which is defined by s.NotifyWhenDataAvailableExceeds = 25, i.e. the NumberOfScans acquired for a single trigger. When trying to set s.NotifyWhenDataAvailableExceeds higher I get the error: "NotifyWhenDataAvailableExceeds must be less than or equal to the NumberOfScans.". How can I manage to buffer the data on the device and read it out once all data is taken?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Analog Data Acquisition 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!