필터 지우기
필터 지우기

DAQ Toolbox: Triggering addDigitalChannel without an analog channel

조회 수: 1 (최근 30일)
Jackson Crane
Jackson Crane 2018년 7월 19일
댓글: Graham Steven 2019년 5월 21일
I'm having trouble connecting a digital input channel to a trigger with the DAQ toolbox. I'm able to successfully trigger my digital channel if I also have an analog signal in the same session (and reduce my frequency), however I need to sample my digital signal at 10 MHz and I do not have the analog hardware that is capable of these frequencies. Furthermore, I cannot seem to successfully replicate this example (https://www.mathworks.com/help/daq/acquire-digital-data-using-a-counter-output-channel-as-external-clock.html) and successfully sample at 10 MHz. I can instead, for example, use the built in 100 kHz timebase (and throttle to 100 kHz) and collect data, but it is unable to trigger and instead collects immediately upon running the script.
My script:
clearvars
freqDigital = 100;
sClock = daq.createSession('ni');
clockChannel = addCounterOutputChannel(sClock,'cDAQ1Mod5',0,'PulseGeneration');
clockTerminal = clockChannel.Terminal;
clockChannel.Frequency = freqDigital;
sClock.IsContinuous = true;
sClock.Rate = freqDigital;
sDigital = daq.createSession('ni');
addDigitalChannel(sDigital,'cDAQ1Mod5','port0/line1','InputOnly');
sDigital.Rate = freqDigital;
sDigital.DurationInSeconds = .1;
addClockConnection(sDigital,'External',['cDAQ1/' clockTerminal],'ScanClock');
startBackground(sClock);
for i = 1:10
if sClock.IsRunning
break;
else
pause(0.1);
end
end
% addTriggerConnection(sDigital,'External','cDAQ1/PFI1','StartTrigger');
% sDigital.ExternalTriggerTimeout = 5;
% cDigital = sDigital.Connections(2);
% cDigital.TriggerCondition = 'RisingEdge';
[dataIn, timeStamps, triggerTime] = startForeground(sDigital);
As it is this script simply times out and doesn't collect any data. When I uncomment the trigger and then trigger the circuit, again it simply times out.
Hardware: 1x NI cDAQ-9178 chassis 1x NI 9402 digital input/output DAQ card 1x NI 9201 analog voltage input DAQ card
  댓글 수: 1
Graham Steven
Graham Steven 2019년 5월 21일
Were you able to resolve this issue? I am trying to do something similar with the same hardware

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Analog Input and Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by