Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Aviod frequency time-out in DAQmx

I'm trying to measure the frequency of a square-wave signal from a turbine flowmeter. The flowmeter is installed in a complex system of valves, pumps, and other sensors. I have created a main VI in LV 7 which controlls this system as well as acquires data from all the sensors (mostly attached to NI-DAQmx hardware). This Vi is basically a large while loop that operates continuously until the user terminates it. The flowmeter pulse is to be measured by a single counter on a 6061E board configured by NI-DAQmx single low frequency tasks.

I have configured the task in MAX with a hi limit of 5kHz and a low limit of whatever the default is for the 10kHz time base (I think around 0.02Hz) and connected the signal to PFI4 (for counter 1) a
s instructed. My flowmeter's frequency varies from 0 to 3kHz. Since my system's flow rate is zero upon start-up of my main VI, the frequency measurement task times out, producing an error message, shutting down the VI.

Is there any way to measure my flowmeter's signal without these time-out troubles? I can't seem to find any period or frequency measurement examples that allow the signal to go to zero without creating some sort of error.

Thanks,
Tom
0 Kudos
Message 1 of 2
(3,463 Views)
You have two options. The first is to wire a -1 into the timeout input of the Read VI (see attached picture). This is equivalent to an infinite timeout and will cause the driver to poll the number of samples available for reading until the requested amount of data has been transferred. The driver does yield inside of this polling loop, but it may still utilize more CPU than desired for your application.

If CPU utilization becomes an issue, you can query the Available Samples Per Channel attribute in the Read Property node (see attached picture) in your while loop instead of directly calling the Read VI. Once the available samples has reached the desired threshold, you can call the Read VI without having to worry about timeouts or blocking waiting for da
ta. This will also allow you the opportunity to introduce a sleep time in your loop to reduce CPU utilization.
0 Kudos
Message 2 of 2
(3,463 Views)