I have by chance come upon this Matlab function:
Multiple-trigger acquisition
dq.NumDigitalTriggersPerRun = 20000;
However, not sure how does this work? Besides I still see the counter output drifting and recovering which implies perhaps for 20000 triggers the counter is free-wheeling, then it recovers back on the 20001th trigger ?
here is the code
s = daq('ni');
ch1 = s.addoutput('Dev3','ao0','Voltage'); % USB-6218
trig = addtrigger(s,"Digital","StartTrigger","External","Dev3/PFI1");
clockC = addclock(s,"ScanClock","External","Dev3/PFI0");
ctr_dev3 = addoutput(s,'Dev3','ctr0','PulseGeneration');%this is output on terminal PFI4
s.NumDigitalTriggersPerRun = 20000;
ctr_dev3.Frequency = 1000; %strangely this is still needed otherwise the counter out and the clock drift away faster (I think by default the internal frequency is set to 100 on these DAQ counter's)
start(s);
I connect ctr_dev3 on ch1 of the scope and PFI0 on ch2 of the scope while it is also triggering the scope. PFI0 input is at 1kHz.
I see the two clocks slowly drift but after a while the two suddenly switch back to realign. And this back and forth is independent of NumDigitalTriggersPerRun.