Rapid external Triggering with NI DAQ

조회 수: 18 (최근 30일)
Marina Imsiecke
Marina Imsiecke 2017년 6월 6일
댓글: Marina Imsiecke 2017년 12월 20일
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
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.
Marina Imsiecke
Marina Imsiecke 2017년 12월 20일
Hi Ben, yes, this is a Problem of Matlab Overhead, that just requires some time to reset the trigger. I talked to an employee, and they were not aware of the problem, so it might be reduced in a future release. As for now, you probably have to use some other program to achieve your goal, I ended up coding it in C++. There's lots of examples for that elsewhere. Sorry for the bad news, but there seems to be no way around this at the moment. If you find one, please let me know! This makes my life harder too...

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile 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!

Translated by