LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Menu driven program, needs ON TIMEOUT capability to over ride operator when too much time is being consumed in non-essential VI.

In LabView 5.1.1 program, I need an ON TIMEOUT function which will interrupt the operator if they are spending too much time in another VI. ON TIMEOUT should be set-able and will be around 2.5 mins. long. If, the operator selects the Constants.vi, where manually entered data is added to the program, and decides to go for coffee, the ON TIMEOUT would reselect the "default" menu VI and continue gathering data. I am new to programing in LabView.
0 Kudos
Message 1 of 3
(2,736 Views)
terry wrote in message
news:5065000000080000005F2C0000-1000509150000@exchange.ni.com...
> Menu driven program, needs ON TIMEOUT capability to over ride operator
> when too much time is being consumed in non-essential VI.
>
> In LabView 5.1.1 program, I need an ON TIMEOUT function which will
> interrupt the operator if they are spending too much time in another
> VI. ON TIMEOUT should be set-able and will be around 2.5 mins. long.
> If, the operator selects the Constants.vi, where manually entered data
> is added to the program, and decides to go for coffee, the ON TIMEOUT
> would reselect the "default" menu VI and continue gathering data. I
> am new to programing in LabView.

Firstly, my preferred approach to something like this would be to have two
programs (or loops) in parallel; the first actually does the work, the
second is the user interface. When changes have been made and confirmed in
the user interface, only then should they be passed through to the "engine"
which does not stop running while the user is playing. Since as you say
you're new, this is probably going to take too long to explain but it may be
worth thinking about. The simplest way would be to store everything in
globals; the UI sets the globals which contain the settings and the DAQ
program reads its settings for each reading from the global.

The simple brute force approach would be to modify each sub-VI to quit after
a certain length of time. You've not attached any of the sub-VIs but I
assume you have a while loop in them that periodically checks to see if some
"OK" button has been pressed. In this check, simply add a test to see if the
current time is more than n seconds from the time the VI was called. Outside
the loop place a "Get Date/Time In Seconds" node, from the "Time and Dialog"
sub-palette. Wire this into the loop- this is your start time. Inside the
loop place another one; this is your time "now". Subtract "start" from "now"
to get the number of seconds the VI has been running. If this number of
seconds is greater than your timeout (150 seconds) then quit the loop as if
the user had pressed OK.

Caveats; This approach will accept whatever is in the panel at the time the
timeout expires. If the user is half way through editing, this could be bad.
Also, this approach will freeze the master program for those 2.5 minutes.
Therefore your master program cannot be doing anything time critical (like
controlling the power to a furnace) when it calls the sub-VI. This latter
point would seem to make timeouts redundant. Also make sure if you're using
while loops that you have a delay, say 100ms, in there otherwise the while
loop will take as much CPU power as it possibly can and will needlessly
hammer the machine.
0 Kudos
Message 2 of 3
(2,736 Views)
It's a little difficult to give specific advice as there are numerous subvis missing, but in general it looks like you have a subvi (called Constants.vi?) that presents the user with a dialog box for entering data. First, let me point out that there is no inherent reason you have to halt acquisition while the user is entering data--unless of course that's how you want it to work. To prevent interruption of the acquisition process, simply use the VI server functionality to launch the dialog box as a separate process instead of calling it directly. Some excellent examples of how to do this ship with LV. Alternately, you can contact me directly and I can send you the code I use as an example.
If you do wish to have the acquisition halted during data entry, you
can incorporate a timeout by calling the time primative outside the dialog's event loop and passing that value into the loop. Inside the loop, call the same primative again and subtract the original value from the new time, when the difference becomes greater that your timeout abort the dialog event loop. Again, if you contact me directly I can send you code to look at.

Hope this helps...
Mike...
mporter@arielcorp.com

"...after all He's not a tame lion..."

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 3
(2,736 Views)