Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

Correlate Analog Input and Frequency Measurement Using LabVIEW with DAQmx

Overview

This VI correlates frequency measurement with the time base of an analog input measurement in software. 

 
Description

One applied case is the correlation of power data with temperature and pressure acquisitions in the 5-40 Hz range. The actual timing will slightly differ due to the two signal types. This VI is best suited for low frequency measurements.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Choose the counter input terminal for your signal and specify the maximum and minimum frequency range
  2. Choose the analog input channel that your analog input is connected to.
  3. Set the sample rate and samples to read.  The frequency measurement will duplicate itself the number of times of the samples to read in order to ensure you have a continuous graph.

 

Additional Information or References
VI Snippet

012.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

National Instruments
Applications Engineer

Visit ni.com/gettingstarted for step-by-step help in setting up your system.
Comments
Member yahya2006
Member

Hello

how is the connection on the DAQ signal. since you are using both inputs (ai and counter) from where you get the waveform?

thanks for the post

CLSmith
NI Employee

Thanks for the message yahya2006,

If I interpret your question right, the waveform data from the counter is built within the while loop using the time information from the AI.  This is not effective for higher speed measurements since the measurements actually use different timing sources, as mentioned in the comments above.  Please post a reply if this does not answer your question.

Thanks,

Chris

National Instruments
Applications Engineer

Visit ni.com/gettingstarted for step-by-step help in setting up your system.
Member yahya2006
Member

Hello Chris and thanks for your reply.

Actually i was testing your vi on my DAQ signal Accessory. However I was not sure if i connect the AI channel directly to the counter input since both are inputs for signal.

On the DAQ i have a generator function and i want to measure the frequency of the signal by using the counter.

Thanks

CLSmith
NI Employee

Yahya2006,

If order to make a frequency measurement on the signal generated by the frequency generator (square wave) you can create a frequency measurement task referencing the counter input.  Find more information on this task type below.  Alternatively, you can make a frequency measurement on an analog input signal in software by using an FFT or other frequency analysis VIs.

Frequency Measurements: How-To Guide - Developer Zone
http://zone.ni.com/devzone/cda/tut/p/id/7111

Best,

Chris

National Instruments
Applications Engineer

Visit ni.com/gettingstarted for step-by-step help in setting up your system.