LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

updating progress bar sent from sub vi

Hi,
I have been trying to update a progress bar, but have had no luck.  The progress bar is active when a sub vi is called.  It works fine in the sub vi, but I can't seem to create any kind of reference, output, or anything to get it to update in real time on the main vi.  Here is how the program is structured.  The main program calls a sub vi which reads user inputs.  These user inputs are them sent to an system exec.vi call.  While the system exec is runing, a while loop is executing, which is checking the size of the file that is being created.  The progress bar works fine in the sub vi, but when I wire it up to the main vi, it only shows the final completed status.  I tried creating a global variable, which updates in real time, but it still would not update on the main vi.  I am going crazy trying to figure this out, having spent 8 hours so far on it.  Please help.
0 Kudos
Message 1 of 10
(5,808 Views)
Seems to me this is normal operation from a program flow aspect. Since the subvi is executing the main vi is not. You would need to create a global variable that the subvi updates, then update it in another thread outside the thread that is executing the subvi. Maybe two while loops, one contains the thread executing the subvi and the other updates front panel variable progress bar. Just a thought.
0 Kudos
Message 2 of 10
(5,801 Views)
A control reference will work. Here's a simple example. There are other shipping examples of references.
Message 3 of 10
(5,795 Views)
I tried to use a global variable, but it did not work.  The global variable would real time update, but the progress bar it was wired to on the main vi would not update.  Thanks for the Control Reference.llb.  I think I can set my program up like that.  Thank you so much, I can't try it unitl Monday.  Thanks again.
0 Kudos
Message 4 of 10
(5,791 Views)
How do you display the progress simultaneously in both the parent and the child vi when the progress bar is passed as a reference from the parent?

I have implemented a system based on the Control Reference example in the attachment in this thread supplied by Dennis. I would like to have a local indicator in the sub VI for use in debug, but if I create an indicator on the reference wire, it creates a reference rather than a front panel object with a progress bar.

0 Kudos
Message 5 of 10
(5,637 Views)
You do not create an indicator on the reference wire. The reference is not the value. You would simply create an indicator on the wire that is going to the value property.
0 Kudos
Message 6 of 10
(5,619 Views)
Yes, I appreciate that but I was hoping for something more elegant than the attached.
Cheers
Duncan

@Dennis Knutson wrote:
You do not create an indicator on the reference wire. The reference is not the value. You would simply create an indicator on the wire that is going to the value property.



Download All
0 Kudos
Message 7 of 10
(5,602 Views)
Sorry for the duplicate attachments 🙂
0 Kudos
Message 8 of 10
(5,601 Views)

To get a local indicator with my original VI, all I did is shown below. I don't undertand the purpose of the modifications you made.

Message Edited by Dennis Knutson on 08-08-2007 09:33 AM

Message 9 of 10
(5,596 Views)
Hmmm, that's a bit restrictive.
My sub vi is very busy and takes a long time to execute as it does lots of separate processes, not just one loop. Each time another process completes, I call an 'increment progress bar' vi. This increment vi is passed the reference to the parent's bar and contains a read value property node, increment, write value property node.
The additional loop in my example was basically monitoring the parent bar's reference and incrementing the local bar if the parent bar incremented. It could be made slightly less messy by doing it by event I guess.

0 Kudos
Message 10 of 10
(5,575 Views)