LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sub Vi problem

Hi, I am trying to figure out why the following vi does not do what I want it too 😞 . I would like to update the value of the control through the sub vi. I am doing this with a reference. However, although the control on the main front panel changes accordingly, the information is not being sent to the other sub vi in real time. In fact, if you open the other sub vi you will see that the value does not get written to it until the other sub vi stops running.  Thanks for any help!
0 Kudos
Message 1 of 3
(2,709 Views)

The numeric in subvi.vi will only update once subvi2.vi completes because you have them both in the same loop. They will both start running at the same time, but since the subvi with the for loop will take 20 seconds to complete, the indicator on the other subvi will only update to 3 once the next iteration of the loop begins. I'm not exactly sure what it is you are trying to accomplish with this code, but it is doing exactly what I would expect it to do.

If you want the indicator in subvi.vi to update every 5 seconds and show you each number 0,1,2,3, you will have to put it in a separate loop so that it runs more than once during the 20 seconds it takes the other VI to complete.

Message 2 of 3
(2,700 Views)
Hi, thanks! I appreciate the help. It solved the problem. The idea here is to have some controls changed in a subvi upon some condition. The controls are fed into a DAQmx write. The subvi drops the current on a bunch of power supplies slowly and so it is imperiative that the infomation gets written to the DAQ write as it changes. I try to avoid a bunch of wires in my code to keep it understandable. Hence, I wanted to have a sub vi to power down some supplies and another vi which actually continually writes to those devices. Upon a power down boolean button the sub vi will slowly change the references of the controls to my main write to DAQ vi. I need to ensure that the write to DAQ vi is called many times while this is happening so that the "last" value of 0 doesn't get written to the instruments suddenly. Putting loops around the vi.'s as you suggested solved the problem perfectly! Thanks
0 Kudos
Message 3 of 3
(2,675 Views)