DAQ Toolbox: Triggering addDigitalChannel without an analog channel

2 visualizzazioni (ultimi 30 giorni)
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 Commento
Graham Steven
Graham Steven il 21 Mag 2019
Were you able to resolve this issue? I am trying to do something similar with the same hardware

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Data Acquisition Toolbox Supported Hardware in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by