NI DAQ External Clock different to Sample Rate

2 views (last 30 days)
Hi,
I have NI DAQ 6341 connected to a desktop. I would like to clock the DAQ with a 10MHz square wave (on input PFI0) and then sample from an analogue input (ai0) at a rate of 1k samples per sec. Hence the clock rate and sample rate are very different.
Sampling normally works:
d = daq.getDevices
s = daq.createSession('ni');
s.addAnalogInputChannel('Dev2','ai0','Voltage');
s.Rate = 1000;
s.DurationInSeconds = 1;
data = s.startForeground();
But Adding a clock then seems to cause problems:
d = daq.getDevices
s = daq.createSession('ni');
s.addAnalogInputChannel('Dev2','ai0','Voltage');
addClockConnection(s,'External','Dev2/PFI0','ScanClock')
s.Rate = 1000;
s.DurationInSeconds = 1;
data = s.startForeground();
The errors that I get are either:
With rate of 1000
"Timeout expired before operation could complete."
Or with rate of 10e6 (equal to the external reference clock)
"Rate cannot exceed 500000 in the current configuration."
I understand this error as the NI DAQ can't sample that high.
So the basic problem is that I can't sample with an external reference clock using a sample rate below the external clock rate.
Many thanks for any advice on this issue.
Matt

Answers (0)

Categories

Find more on Digital Input and Output in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!