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.
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.
1.0 (2010-11-10): Initial release.
Alex Zaatari, Jeff C. Jensen
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.
Is it possible to make it compatible with Labview 2009?
I develop in LabVIEW 2010 and generally don't export for previous versions.
this vi can not work!