10-03-2007 03:45 PM
10-04-2007
06:24 PM
- last edited on
10-29-2025
09:38 AM
by
Content Cleaner
Hello Charles,
Thanks for contacting National Instruments.
If I understand correctly, you would like to use an external 10 MHz clock to time an analog input acquisition. At the same time, you would also like to count the number of edges of the sample clock that have occurred. I am also assuming you are using LabWindows CVI to write this code.
The error you are getting is from the DAQmxSetTimingAttribute command. This function is used to route the internal reference clock of the device to a PFI line. This is used mainly when synchronizing multiple DAQ cards to the same sample rate.
To specify an external clock for use in a finite acquisition, please refer to the shipping example Acq-ExtClk. For CVI, you can click Help-> Find Examples to bring up the NI Example Finder. This examples is located under Hardware Input and Output -> DAQmx -> Analog Measurements -> Voltage. For any other language, please refer to the DAQmx readme file in the Program Files -> National Instruments -> NI-DAQ. This will provide the directory path location for the DAQmx examples in other programming languages. This example uses an external clock to perform a finite acquisition. The line:
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,clockSource,rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,sampsPerChan));
Allows for you to specifically set which pin uses the sample clock as well as other timing parameters. You can view the CVI help for more information regarding the inputs of this function.
For more information regarding a reference trigger, please see the Getting Started with DAQmx Page. Under the Basic Programming link, there is a link (Triggering Using DAQmx) that goes over the different trigger types. A reference trigger is used to stop acquisition. However, acquisition will stop after the number of samples specified in SampsPerChan has been met.
A finite aquisition will stop after the number of samples specified in the timing configuration command have been read. This reduces the necessity of a counter task. If it is still necessary to count the number of edges during the acquisition process, the following information may help you get started. A counter task can be run at the same time as an AI task. The input channel of the counter can be specified as the same pin as the sample clock. This will not guarantee that the counter task and the AI task start at the same time. To do this, you can specify a start trigger for the counter task using the line:
DAQmxCfgDigEdgeStartTrig (CtrTaskHandle, "/Dev1/ai/StartTrigger", DAQmx_Val_Rising);
By starting the counter task before the AI task, you will guarantee that the counter will start at the same time as the AI.
Please post back if you have any more questions.
10-08-2007 12:45 PM
Hi Browning, thanks for the information. I would like to clarify that we are using the internal sample clock of 100KHz. But we would like the
reference clock for the PLL of that sample clock to be the external 10MHz GPS clock.
Thanks
-Charles
10-08-2007 01:47 PM
10-09-2007
07:05 PM
- last edited on
10-29-2025
09:39 AM
by
Content Cleaner
Hello Charles,
Depending on whether you are using the PCI or PXI version of the 6251, the options for which input on the card uses the external 10 MHz reference clock will change. Looking at the M Series DAQ Manual on page 9-2 I found the lines used as the timing source for an External Reference Clock. This lists the RTSI and PXI lines that can be used for this reference clock source. You should also be able to use an unused PFI line on your device. This can be set using the DAQmxSetTimingAttribute command in CVI with DAQmx_RefClk_Src set as the attribute to be set. This will cause the VI to phase lock loop the external 10 MHz clock to the internal 10 MHz clock.
At this point you should be able to specify the sample clock for your DAQmx task to use the internal sample clock by leaving the source in the DAQmxCfgSampClkTiming command to NULL or OnboardClock. The sample clock speed can be set to 100 kHz.
Please post back with any questions.