LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why doesn't the STOP button stop this vi?

Solved!
Go to solution

Hi,

 

I took an example from Labview 2011 called "Meas Dig Period-Low Freq 1 Ctr.vi". This example vi measures a single period, but, I want to measure period over and over again, so, I put it into a WHILE loop, but, the STOP button does not stop the vi.  Instead, I have to use ABORT to stop the vi...

 

How do I stop this vi?

 

Dave

0 Kudos
Message 1 of 4
(2,356 Views)

The counter read in the while loop will wait until it either gets something to count or the timeout period expires.  I suspect you just didn't wait the ten seconds it takes for the timeout to occur.

0 Kudos
Message 2 of 4
(2,350 Views)

In fact, after I select STOP and wait a long time, an error appears indicating that the timeout has expired!!!  Error 200474 appears.  Then, it will stop after the Error 200474 box appears twice, which is about 2x the timeout period.  Doesn't the STOP override the timeout?

0 Kudos
Message 3 of 4
(2,342 Views)
Solution
Accepted by topic author dav2010

It doesn't overwrite the timeout.  The while loop is a seperate beast from the counter read.  You wouldn't want your while loop to always cause you to miss error messages, would you?

 

I usually just clear the timeout error message on counters.

 

You get the message twice because the loop actually runs twice.  The first time the stop button is read as false almost as soon as the loop starts.  Then you click it.  In the mean time you have to wait the 10 seconds for the counter timeout to occur - When it does it gives you the error.  Then the loop runs again.  This time it reads the stop button as true, since you clicked it during the ten second timeout period of the last loop.

A while loop always lets everything inside finish executing before it ends, so you have to wait for another ten second timeout to occur which produces another error.

 

Unless you need to measure very, very low frequencies I'd set your timeout to a more reasonable number, and just clear the error if it matches 200474.

Message 4 of 4
(2,335 Views)