09-19-2014 04:37 AM
Hello,
I cannot find the error in this VI, I am trying to stop the VI through the button after pressing Go but the VI does not stop.
Can anyone tell me where the problem is.
Thanks,
Zied
09-19-2014 05:25 AM
I can not see your vi , have 2009.
but did you register for go event and passed true from this case to while loop, are you just placing the stop button outside the event structure and do not have any timeout event also.( just guessing )
09-19-2014 05:42 AM
Sorry I saved for version 9.
zied
09-19-2014 05:43 AM
Run in highlight mode and you'll see the problem. The bottom right loop will never stop since you send a False to it when you press Go.
/Y
09-19-2014 05:46 AM
Check your VI Data Flow. Once your pressing “go” , it’s going to True case. In your 2nd case structure 2nd while loop will run continuously. You should stop somewhere.
09-19-2014 06:41 AM
Apart from the suggestions given , purpose of your vi is not clear .What exactly are you trying to achive???
Learn data flow, if you are passing the stop values to while loop from outside either they will run once or they will run forever.
and please get rid of CPU hogging loop, put some delay there and repost your vi with changes.
09-19-2014 08:56 AM
Sorry but I did not understant your answer, could you clarify it. In this Vi Just I want to use push button to go between event, for a simple example I used Go and Terminate all and the big while loop is just plotting a random number over time.
Zied
09-19-2014 09:05 AM
Zied,
point is, the computer is only doing what you tell him to do. So there is a difference between what you want to do and what you implemented in the VI.
You are running into some of the caveats of the event structure.
I recommend you to think about taking LV classes or work through LV tutorials to increase your awareness of data flow implementation.
Norbert
09-19-2014 09:06 AM
You must understand dataflow, and running the VI in highlight mode is a good way to do just that.
Your main loop wont loop until all included functions have finished, and the bottom right loop wont ever finish since the End loop terminal is permanently false. Thus the stop button will wait forever and the program will be unresponsive.
Your loops runs as fast the CPU can manage, millions of loops per second, just burning the cpu and stealing performance from windows. Add a small wait to them, 10ms is enough to make a huge difference.
/Y