フィルターのクリア

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 Center および File ExchangeAnalog Input and Output についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by