To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example works to synchronize two similar channels of different types.
Description
In order to synchronize two similar channels (analog input, analog output, etc.) but different types (temperature, pressure, etc.) in CompactDAQ we can wire the DAQmx Create Channel VIs in parallel and then start the task. If we wish to then change the sampling rate of the Analog Input task with a frequency measurement we must then ensure that the sample clock of the Analog Input task is configured accordingly. In this example we synchronize a temperature and a pressure measurement with a variable frequency.
Requirements
Software
Hardware
Steps to Implement or Execute Code
Open SyncAIwithVarFreq VI.
Set the Temperature and Pressure Analog Input configurations.
Split the Frequency signal between two channels, X and Y.
Set the Frequency channel to ctrX and the Sample Clock Source to PFIY.
Set the AI Sample Rate to the greatest expected clock frequency.
Run the VI.
Additional Information or References
Items To Note:
1) We must first split our frequency signal between two channels. This will ensure that we can use one as a clock source and one as a measurement.
2) The Frequency Channel for measurement must be set to ctrX where X is one of the split frequency channels.
3) The Analog Input Sample Clock must be set to PFIY where Y is the remaining split frequency channel.
4) The Analog Input Sample Rate must be set to the greatest expected clock frequency. While the actual sampling rate is set by the frequency measurement, setting this value sets the buffer size for the acquisition.
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.