Rapid external Triggering with NI DAQ
显示 更早的评论
I need to trigger an analog output signal generated by a National Instruments USB-6216 BNC card with an external trigger that occours irregularly every 30 ms or so. Unfortunately the NI card seems to be to slow to trigger at that rate, and misses a lot of triggers. Is there a solution to this problem? Can it be changed in the settings or somehow adressed differently? I use MATLAB 2017a with the Data Acquisition Toolbox with the following code:
s = daq.createSession('ni'); AOChan = addAnalogOutputChannel(s,'Dev1','ao0','Voltage'); tc = addTriggerConnection(s,'external','Dev1/PFI0','StartTrigger'); s.Rate = 44100; s.TriggersPerRun = 100; outputData = sinSig; % output Signal is a 16 ms sinosoid queueOutputData(s,outputData); startForeground(s); % also tried startBackground(s);
I found similar problems, that are still unanswered: https://de.mathworks.com/matlabcentral/answers/36397-fast-triggering-with-ni-daqmx-ni-6281 https://de.mathworks.com/matlabcentral/answers/146398-speeding-up-national-instruments-data-acquisition-retrigger
Thanks for the help!
3 个评论
Tushar Upadhyay
2017-6-16
Are you experiencing the same issue outside MATLAB using vendor utility. Please provide the external trigger source model number. Alos, provide the output of daqsupport command.
I have this same problem using my code (below). I have triggers that go off every 10 ms with with a 1 ms acquisition time. The DAQ acquires the 1 ms as it is supposed to, but the best the trigger can do is ~100 ms. I set a timeout to wait for the trigger, but it should allow acquisition as soon as a new trigger is found. If I set the external trigger to more than 130 ms the code starts behaving properly.
s = daq.createSession('ni'); addAnalogInputChannel(s,'Dev2','ai0','Voltage'); s.Rate = 20000; s.DurationInSeconds = 0.001; s; addTriggerConnection(s,'External','Dev2/PFI0','StartTrigger'); s.ExternalTriggerTimeout = 1; s.TriggersPerRun = 10; [data,timeStamps,triggerTime] = s.startForeground(); plot(timeStamps,data)
The external source is a pulse I create from an arduino microcontroller (which really shouldn't have anything to do with the problem). It should be within the sampling ability of the DAQ (NI USB-6001). I'm sorry I couldn't help. It might be a problem of Matlab.
Marina Imsiecke
2017-12-20
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Acquisition Toolbox Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!