LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The completed program does not stop by itself.

I am writing a simple vi to run a loop and also I am writing a few commands outside the loop. I am using a flat sequency structure inside a while loop. I am also writing a few commands oustide the while loop in another sequence structure box adjacent to it.
 
The progrm executes and does exactly what I want, but the program does not stop running and the run button remains pressed. So because of this, when I call this VI in a bigger program the bigger program hangs when it calls the sub VI as the sub VI is not finishing. I tried using the STOP button, but when I do this, even the bigger program stops executing at this step.
 
Is there any way I can stop this subVI alone.
 
 
Thanks,
 
Vijay 
 
 
0 Kudos
Message 1 of 7
(3,006 Views)
It sounds like you have some dataflow problems. A common mistake is to place the stop button outside the while loop. When you do that, the while loop cannot stop. If that's not it, it would help if you posted an image (no bmp please) or the actual VI.
0 Kudos
Message 2 of 7
(2,996 Views)

Hello Dennis,

           Thanks for your message. I have attached a vi with this message. There is one Sub Vi which I have'nt attached and the main VI will not open fully functionally without the other sub VI. But that VI is only a measurement VI and does not create the problem in this VI.

            The program completes and executes the loop, but hangs in the last frame of the program. 

Any suggestions are greatly appreciated.

 

Thanks,

Vijay 

0 Kudos
Message 3 of 7
(2,983 Views)
Your vi has race conditions written all over it.  You local variables are all over the place.  There is no guarantee which will happen first, the variable gets written to, or the variable gets read.  You should learn the concept of data dependency execution flow.  Use wires instead of local variables.  Use Error In and Error Out to create the execution order.  Look at the attached vi, which is a modification of your vi.  Also, if the loop exit conditions are never met (Vout is never less than 0.01 or Vin is never less than 2) then your loop will never exit.  You might want to check if these conditions will actually happen, or put a stop button to manually stop the loop and wire it into an OR function with the other conditions.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(2,974 Views)
I hope you don't expect to stop it by typing values into the Set Vin and SetVout controls. In order for those front panel controls to be read, they would have to be inside the while loop. I also don't understand why you're using local variables at all. If you used a shift register, the dataflow would make more sense. I made a few changes in the attachment. I got rid of the sequence structure all together and added a stop button that you can use to debug the VI. Probe the inputs to the Less Than functions to see it the stop conditions ever become true.
0 Kudos
Message 5 of 7
(2,973 Views)

Thanks very much for the help. I learned how to use the shift register function and I was able to succesfully execute my program. Thanks a lot for the inputs.

I have a very basic idea with labview programming, although I have done a lot of programming in C. I'd like to develop my skills in labview. I would be greatful if you could point me to popular online tutorials and references.

Thanks a lot again,

Vijay

0 Kudos
Message 6 of 7
(2,945 Views)
0 Kudos
Message 7 of 7
(2,940 Views)