LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How would you do this?

Hi,

How would you set up and code the following situation:

My main vi has a loop which sends user-defined commands to a sub-vi for processesing.  One of the commands is a delay command, which needs to sit in an idle loop for a given number of seconds.  I would still like to update the controls on the front panel during this time, and I would also like to bail out of the delay if the user clicks an 'abort' button on the front panel.

In my massive LabView experience of 1 week, I have not found a way to do this.  Any ideas would be greatly appreciated.  I already have the front panel and loop set up, along with the command processing vi (basically a switch statement).  What I need help with is updating controls during a delay, and exiting early from the delay based on input from front panel.

Thanks,

Curtis
0 Kudos
Message 1 of 6
(3,206 Views)
Can you try to put the "abort" button inside the idle loop and wire it to its stop icon?
I am not quite sure if i am understanding you correctly. Maybe post a screenshot?
0 Kudos
Message 2 of 6
(3,195 Views)
One possible way of waiting a certain amount of time would be to place a "tick count" or "get date/time in seconds" function right before the start of the loop. You could then connect an abort button as well as well some logic that checks (using another "tick count" or "get date/time in seconds" function) whether the predetermined amount of time has passed since the starting time. Connect the abort button and this logic to an "or" function (and then to the stop terminal of the loop) and it should work as I understand your question. Within the loop you could continue to read and/or update the front panel as it waits for the time to pass.

Hope that helps.

Message Edited by kaufman on 06-27-2006 01:31 PM

0 Kudos
Message 3 of 6
(3,184 Views)
If you want to stop the subVI from the main, you can have the subVI call in a separate while loop and pass it a reference to a control that is on your main front panel. The subVI cannot use the regular delay or wait functions so you will have to use something like tick count or get date/time in seconds. Here's a simple example that does what I think you want.
0 Kudos
Message 4 of 6
(3,170 Views)
Sounds like you're talking about references.

In order to have sub-vi's update things on the calling vi's front panel, you need to pass the sub-vi a reference (right click on control->create->reference) to that control.  Then in your sub-vi, create a property node (programming->application control->propterty node), and wire both the reference and the new value of the control to it.

Once I get more time I can post an example of this.

Edit: looks like Dennis beat me to it.

Message Edited by Novatron on 06-27-2006 02:46 PM

0 Kudos
Message 5 of 6
(3,161 Views)
Thanks everyone for your quick replies.  It took awhile to figure out how to do this with references, but I think it's working now.
0 Kudos
Message 6 of 6
(3,129 Views)