LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

time out

While running a labVIEW program, it hangs. Is it possible to time out in labVIEW and carry on?
0 Kudos
Message 1 of 23
(12,915 Views)
There's no built-in, generic time out function in LabVIEW. Many of the built-in functions include a Timeout terminal and many of them are set to -1 which make them never timeout. This way they sit and wait for data to be available without taking any processor time. The "Dequeue Element" and "Wait on Notification" functions are like this, but you can connect a number to make them not wait if needed.

Other than that, you'll need to build a timeout function your self using some of the Time functions from the Timing palette. But, whatever is hanging up the program now, still will. You'll need to figure out a way to not have that function sit and wait forever.

What is causing it to hang?

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 23
(12,912 Views)
I have open the time palette. Which sub vi is applicable. The vi is in labVIEW6.0.
0 Kudos
Message 3 of 23
(12,896 Views)
As I said, there's no built-in function to do a time out, so we're going to have build one.

In it's simplest from, all you need are two "Tick Count(ms)" functions, a "Subtract" and a "Greater Than".



The first Tick Count gets the current time in ms and sends this into the loop throught the tunnel. The Tick Count in the loop outputs the current time on every iteration of the loop so you can compare the current to the original from the loop tunnel. Just subtract these two values and see if it's larger than what your you want your time out to be. (specified in ms here, so this is a 2 second timeout)

One very important thing to keep in mind is that the loop MUST BE ITERATING for this to work. If something is stalling the loop and not letting it run, this will not work. The Tick Count functions (as with all functions and subVIs) are read or written to only once per loop iteration. You'll to figure out what is stalling the loop and fix that as well.

Let us know if you need more help on this.

Ed

Message Edited by Ed Dickens on 05-04-2006 12:55 PM



Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 4 of 23
(12,880 Views)
There is timeout code similar to this in the Measure Pulse Width or Period functions that you are using. As I mentioned in one of your other posts on the same subject, you have the timeout set too high.
Message 5 of 23
(12,870 Views)
Is it in the time and dialog menu? Or is it part of measure period sub vi? Someone mentioned that the default is -1 as the reason for hanging. Should I change it to +1?
0 Kudos
Message 6 of 23
(12,861 Views)
Is it in the time and dialog menu? Or is it part of measure period sub vi? Someone mentioned that the default is -1 as the reason for hanging. Should I change it to +1? Ihave gone thrugh the manual and the help files but unble to locate the required information.
0 Kudos
Message 7 of 23
(12,855 Views)
If you are referring to Ed's mention of the default being -1 this doesn't "cause" something to hang but it does cause the sub vi NOT to time out. Essentially you are setting the timeout value to infinity by setting the timeout to -1 or by not setting a value since the default is -1. Now I believe all timeouts are in milliseconds, so if you set the timeout to +1 the sub vi will timeout in one millisecond which is a bit quick.

Cheers,

--Russ
Message 8 of 23
(12,847 Views)
I am going to try to set it at +5000 (5 seconds), when I go to the lab next week. What happens when it times out? Does it give a zero reading or no reading. I would like it to give a valid reading before going to the next stage. Is that possible?
0 Kudos
Message 9 of 23
(12,830 Views)
Look again at the VI. The timeout is in seconds. With a -1 setting, you have it now set for about a 67 second timeout. I don't think you will like 5000 seconds any better. If the counter does timeout, the Boolean indicator called "timeout?" will be true. If you were to go to the help menu and enable the "Show Context Help", most of your questions about the VI that you are using will be answered.
Message 10 of 23
(12,826 Views)