Overview
This example allows you to read a period measurement from your counter pin at the same rate as your analog input.
Description:
As described, the VI would read a period measurement and match the rate of the usage of the analog input. It will hold the previous period value (stale data) until the next period is completed. This will get around the error, "The requested Samples have not yet been acquired", when trying to run a buffered period measurement faster than the frequency of the signal of interest.
Basically, this VI allows you to perform a buffered period measurement at whatever rate you would like, and the value returned will be old data until the new period has completed.
This allows you to log data for period 1 to 1 with the analog input data.
Things to keep in mind:
- The data might be stale/old.
- The counter is correlated to the analog sample clock.
- The analog sample rate determines the period resolution/accuracy.
- If the sample rate gets to be high enough, it could be necessary to use producer/consumer architecture to prevent buffer overflow.
Steps to Implement or Execute Code
To implement this example:
- Configure the following parameters: Counter channel, Analog input channel, the sampling rate, and samples to read for your application
- Run the VI
- (Optional) Turn on the Highlight Execution to see the flow of the VI
To execute this example:
- Install the required software.
- Connect the DAQ hardware that supports the Counter and Analog Input features
- Confirm the connection with the MAX with TestPanel
- Open the VI and refer the Implement Steps
Requirements
Software
LabVIEW 2012 or compatible
NI-DAQmx 9.0 or compatible
Hardware
cDAQ with C series Counter Input and Analog Input Module
**This document has been updated to meet the current required format for the NI Code Exchange.**
Adam
Academic Product Manager
National Intruments