LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use an external 10 MHz clock with an NI DAQ?

Solved!
Go to solution

Hi!

 

I have a 10 MHz OCXO (oven-controlled crystal oscillator) that I want to use as the clock for an NI USB-6361 DAQ. This is so that I can synchronize different devices in my experiment.

 

How can I set up the DAQ to use the 10 MHz OCXO clock?

 

Other details in case they're relevant: I'm using Windows 7 with 64-bit LabVIEW 2017

 

 

Thanks in advance!

0 Kudos
Message 1 of 8
(4,912 Views)

You should be able to connect your clock to one of the PFI lines and then use DAQmx Timing to set the sample clock source to the PFI you decided to use.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 8
(4,863 Views)

I tried (VI screenshot below), but LabVIEW throws an error (Error -200081; Sample rate exceeds the maximum sample rate for the number of channels specified. ) at the DAQmx Start Task VI. Surely I'm doing something silly.

 

Perhaps you can point me to an example?

 

Thanks again!

0 Kudos
Message 3 of 8
(4,837 Views)

Your problem is that you are trying to set a sample rate of 10MHz.  Your maximum sample rate with just 1 channel is 2MHz.  Now that I thought about it for a little bit, I think what you really want is to use your clock as the reference clock.  If this is correct, then what you really need to do is use a DAQmx Timing Property Node and set the Sample Clock->Timebase->Source to your PFI line.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 8
(4,824 Views)

I'm not at a LV box to illustrate, I can only describe.

 

1. There's a fine distinction to make between the "Sample Clock" (which is what you *did* try to configure) and the "Sample Clock Timebase" (which is what you *should* try to configure).

 

2. Your code is basically telling the task, "use the signal at PFI7 *directly* as a sample clock, and oh, by the way, believe me when I tell you it's running at 10 MHz"

 

3. What you *need* is a way to tell the task, "use the signal at PFI7 *indirectly* to *derive* a sample clock, and here is some more info about *how*."

 

4.  For that you'll need to dig down using a DAQmx Timing property node.  You need PFI7 to be the "Timebase Source" (or maybe it'll be called "Sample Clock Timebase Source"?). 

 

5. You'll also need to find the property with a name like "Sample Clock Timebase Divisor."   Wire in the integer divisor that'll divide down from 10 MHz to your desired rate.  It may be important to wire in this calculated rate to the "Sample Clock Rate" property -- DAQmx uses the rate to auto-size the task buffer in continuous sampling tasks.

 

I *think* that should cover it.  There may be other approaches that can work -- I know some boards can sync their internal timebases to an external master through a phase-locked loop, but that's something I've done only rarely, only on PXI, and then had to make up a different scheme anyway due to some legacy boards that didn't support that kind of sync. 

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 5 of 8
(4,822 Views)
Solution
Accepted by topic author pkehay

@crossrulz wrote:

Your problem is that you are trying to set a sample rate of 10MHz.  Your maximum sample rate with just 1 channel is 2MHz.  Now that I thought about it for a little bit, I think what you really want is to use your clock as the reference clock.  If this is correct, then what you really need to do is use a DAQmx Timing Property Node and set the Sample Clock->Timebase->Source to your PFI line.


Capture.png

Reference clock. source Tim,  (And the rare cross-post with the up-and coming new DAQmx Master which need a bit of clarification)

 

What I believe you want to do it use you 10MHz VCXO to improve the stability of the DAQ device.  That's the Reference Clock.  Normally the device uses its own internal reference to synchronize its internal timebases  These timebases are then used to derive the other clocks (sample clock, convert clocks ect....)

 

If I'm Right (Stop laughing... It happens) connect your VCXO to any PFI and select that source.


"Should be" isn't "Is" -Jay
Message 6 of 8
(4,820 Views)

Great - thanks! Using the DAQmx timing property was what I was looking for.

 

0 Kudos
Message 7 of 8
(4,814 Views)

Just chiming in to endorse the answer from Jeff Bohrer as a simpler approach than mine for devices that support it.  I expect you'll probably need to define the Reference Clock's known *rate* too as well as the source.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 8 of 8
(4,805 Views)