LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Program Hangs when measuring frequency of 0 Hz

Where is the situation; I'm running CVI 8.2 with 6251. Counter 0 is setup to measure frequency, timing is therefore implicit.
 
The problem occurs when I try and stop the task and the frequency to C0 is 0Hz. Since timing is implicit DAQmx waits until all samples are acquired to stop the task but this does not occur since the frequency is zero. Indeed if the frequency is not zero the task stop and the program terminates normally.
 
I have tried aborting the task but this returns an error. Could you provide a workaround for this problem.
 
Thanks
EP
 
 
0 Kudos
Message 1 of 5
(4,575 Views)
 Hi EP,

 LabWindows/CVI does have a way of disabling the error-checking that occurs during run-time of the program. There is a KnowledgeBase article here that discusses how to do this. Another resource is this forum posting.

 Is the frequency being measured generated by the same DAQ device? If so you could probably have a software flag that would prevent the
frequency measurement from taking place until there is a output to be measured.

 Hope this helps!

 Have a great afternoon.

 MatthewW
 Applications Engineer
 National Instruments




Message Edited by Matthew W on 08-11-2007 03:33 PM

0 Kudos
Message 2 of 5
(4,543 Views)

Hello and Thanks for your response,

The frequency signal is generated from an optical encoder and is used to measure angular velocity.

I should be clear that there is no error generated by DAQmx. Since 0Hz frequencies is not an unusual event in my application the task timeout is disabled. It appears that the program waits at the stop task function. There is theerefore not crash. The program simply waits.  I would think that stopping the task would override the need to acquire all the samples in the task but this does not appear to be the case.

EP

0 Kudos
Message 3 of 5
(4,532 Views)

The waiting is an expected behavior due to the low frequency of the input signal.  The counter is comparing your signal to an internal source of about 1.9Hz for timing purposes.  Since your signal is 0Hz, it will cause your application to wait and hang until it times out.  Your best option is to enable timeout for your counter and also pass/ignore the error that would be generated by the waiting for a frequency below the internal comparator. (See Matthew's forum link above)

Alex A.

Alex A.
Applications Engineer
0 Kudos
Message 4 of 5
(4,495 Views)

Thanks for your responce, 

Ok, I will try this. But I really think that stopping or aborting the task should override the measurement request.

EP

0 Kudos
Message 5 of 5
(4,490 Views)