Using a Variable Frequency Analog Input Signal as the AI Sample Clock
Overview
This document explains how to use a varying frequency external analog signal, like a sine wave, as the sample clock for an analog acquisition.
Overview
There is a way to use an external analog signal of varying frequency as the sample clock for an analog acquisition or generation. Doing this requires the use of the analog trigger detection circuitry output, namely the Analog Comparison Event signal. This analog trigger circuitry generates a hardware pulse each time an analog trigger condition is met. This functionality is available on M, S and some E series devices.
Applications
This sort of application is common when using external hardware like a laser interferometer (there is information about this device linked below). An interferometer, in particular, generates a sine wave that is centered around zero volts and normally does not have a peak to peak voltage amplitude that is enough to use as a TTL input. This signal indicates exactly when the data being output by the interferometer should be sampled.
M and E Series
With M series devices and E series devices there is a single Programmable Gain Instrumentation Amplifier (PGIA) that follows the input channel multiplexor. In M series and the E series devices that support analog triggering, output signal of the PGIA is fed into the analog trigger circuitry where the analog trigger conditions are checked. If the analog trigger conditions are met a hardware pulse is output to the AI, AO and Counter circuitry which is then usable in those tasks. Figure 1 is from the M and E series user manuals. This gives a visual representation of the circuitry involved with using an analog trigger and shows the analog comparison event that is generated each time this trigger condition is met.
[+] Enlarge Image
Figure 1: M and E Series Analog Trigger Circuitry
S Series
The analog trigger circuitry for an S series board is similar to the M and E series devices. The difference lies in the front end of the circuitry. S series devices are simultaneously sampled therefore, each of the analog inputs have their own PGIA and ADC. The analog signals to be compared using the analog trigger detection stage are still multiplexed, like the M and E series devices. Figure 2 shows the analog trigger circuitry for S series devices.
Figure 2: S Series Analog Trigger Circuitry
Implementation
To use the analog comparison event as the sample clock, you must set up a DAQmx task (AI, AO or Counter) to use an analog start trigger. The source of the trigger has to be either another analog input channel or an APFI line. You must then set the parameters of that analog trigger (analog edge or analog window).
This start trigger will initiate the start of your acquisition or generation as well as serve as the sample clock for that task.
The sample clock of the DAQmx task will then use the Analog Comparison Event as it's source input. The example VI named ai_ext_sample_clk_trig_event.vi, attached below, displays the proper inputs to the timing VIs as well as the correct trigger setup.
Note:
One thing that must be taken into account is that the frequency of your external signal is varying. This must be accounted for by specifying the maximum expected frequency as the frequency input to the DAQmx Timing VI or you will likely run into errors such as error -200019, which arise because the buffer size has not been allocated properly. There is a knowledgebase article that describes this error linked below.
Related Links
NI Developer Zone: Laser Interferometer
Knowledgebase 3NMEUHX6: What Causes Error -200019 When Increasing the Sample Rate of an Analog Input Task with an External Clock?
E Series User Manual
M Series User Manual
S Series User Manual
Requirements
Filename: ai_ext_sample_clk_trig_event.vi
Software Requirements
Application Software: LabVIEW Base Development System 8.2
Hardware Requirements
Hardware Group: Multifunction DAQ (MIO)
Driver: NI-DAQmx 8.7.2
Reader Comments | Submit a comment »
Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
