This example was developed for an instrument to study the extinction of light attributable to particles, but can be applied to any measurement where a generated pulse on one card in a PXI chassis is used to trigger an acquisition on another card. In this case, using cavity ring down spectroscopy (CRDS), a laser pulse is stored in a high finesse cavity and the decay in the pulse (exponential in this case) is monitored for a brief period upon the generation of the pulse. To increase the signal-to-noise ratio and therefore a better estimate of the decay constant, high acquisition rates are required. Due to the requirements of the project, the generation of the pulse and the high frequency acquisition can not occur on the same card hence the need to use two different cards for generation and acqusition (in this specific case, an M-series for generation and an S-series for acqusition).
Below is the code snippet for this particular setup.
- Select a counter for generating a pulse on the master card using the Pulse Main control.
- Set the frequency that the pulse will be generated using Frequency.
- Set the duty cycle of the pulse on the master counter using Duty Cycle. For our purpose, the laser pulse is generated on the rising edge of the pulse on the master counter so the duty cycle is not important for this porcess. However, we are only interested in a small portion of the sample following the firing of the laser. Since this VI will only acquire while this signal is high, the duty cycle is used to define the period over which the sample is acquired.
- Select the counter for the slave card on which the pulses on the master card will be reproduced using the control labeled Gated Ctr.
- Select the channel on which the analog in will be collected (AI Channel) and the sampling frequency (AI Frequency).
What is happening on the diagram...
- Create three channels that will be used in the actual acquisition - one to generate a pulse on a counter on one card (in this case, a card that also generates AO), another for a counter used to gate a signal on the slave card (in this case, one that can acquire AI at high frequencies) and one for actually acquiring AI on that slave card. The counter defined by Pulse Main will fire at the rate defined by Frequency. The signal will remain high for the period defined by Duty Cycle.
- Connect the InternalOutput for the counter on the main card to the PXI_Trig0 on the PXI backplane using the DAQmx Connect Terminals VI. Using the DAQmx Trigger node, set the slave counter to pause when the pulse on the PXI_Trig0 is low. When the signal is high on this channel, the counter will generate pulses on the counter defined by Gated Ctr at the rate defined by AI Frequency.
- Each channel will sample continuously with the behavior described above. The AI will be sampled when the pulses on the counter defined by Gated Ctr are high.
- Since the Gated Ctr and AI Channel are dependent on Pulse Main, arm these two first; sampling will not begin until the task on Pulse Main is started.
- Begin sampling. Define the number of samples to be the AI Frequency multiplied by the Duty Cycle on Pulse Main. This will generate a loop that runs at 1 Hz, collecting only the number of samples generated during that period, no more, no less.
- Stop and clear all tasks using the DAQmx Clear Task VI. Disconnect the two terminals connected at the beginning using the DAQmx Disconnect Terminals VI. Check for any errors generated through the process of shutting down and alert the user.
What to expect
While running, this VI will collect x samples at 1 Hz, where x is equal to the product of the AI Frequency and the Duty Cycle. This can be easily modified to acquire at different rates by taking only a fraction of these samples. In the particular case for which this VI was developed, the signal will be a series of exponential decays, the number of which should be equal to the Frequency.