Rapid external Triggering with NI DAQ
조회 수: 18 (최근 30일)
이전 댓글 표시
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
Ben Urban
2017년 12월 19일
편집: Ben Urban
2017년 12월 19일
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.
답변 (0개)
참고 항목
카테고리
Help Center 및 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!