Student Projects

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM (square-wave) Frequency Detection on Counter-DIO

Introduction

Use myDAQ to measure the frequency of a digital signal. Rather than polling a digital line and performing a frequency analysis, data acquisition devices can measure frequency using hardware edge detection, freeing the computer to simply poll the device on demand for its most recent frequency measurement.  The edge detector is a "counter", and is specialized hardware and clocking to perform the measurement. Here, we share a VI for simple, on-demand frequency measurement using myDAQ.

Requirements

  • NI myDAQ (or other data acquisition device such as a USB-6008 or USB-6009)
  • LabVIEW 2010 or later
  • NI DAQmx
  • [optional] NI ELVISmx (for testing this VI)

Implementation

DAQmx returns an error if it does not detect a signal with a frequency above minimum rate (Hz). Hence, DC signals will return an error; this may be the correct behavior for applications where a signal is expected to be present, but we suppress this error in this VI. We configure the timout of the acquisition to be the inverse of the mininimum frequency to be measured, and if this timeout occurs, we assume a DC (0 Hz) signal. This means signals between (0, minimum rate) will be interpreted as DC. Be sure to choose minimum rate (Hz) appropriately for your application.

freq.jpg

Versions

1.0 (2010-11-10): Initial release.

Authors

Alex Zaatari, Jeff C. Jensen

See Also

PWM (square-wave) Frequency and Duty Cycle Detection on Non-Counter DIO - use this if you do not have an available counter input, but instead just a standard DIO.

Comments
Thierry_D.
Member
Member
on

Is it possible to make it compatible with Labview 2009?

elgeeko
NI Employee (retired)
on

I develop in LabVIEW 2010 and generally don't export for previous versions.

Julio_HDT
Member
Member
on

one time i probe this vi in labview 2009, but dosent work

handsomebo
Member
Member
on

this vi can not work!

Contributors