How come endless loops don't stop the code?

Hello.
I have been programming in LabVIEW for about a year, and until now I programmed everything with the same structure, like the one shown in the default code. Say I wanted to run a motor with a constant 50% speed, I’d do it like this: open the motor at Begin.vi and set it with a curtain reference name.
At the Teleop.vi I’d call the get motor vi and the set speed vi to give it 0.5 speed, and finally I’d go to the Finish.vi and close the motor.

Today I read the Basic Motor Control Tutorial at NI.com and saw this code example:

http://img39.imageshack.us/img39/3699/47123336.png

Now… If I called this motor control vi file from inside Teleop.vi, would it work? is it better than what I usually do? and wouldn’t the endless loop (say I won’t press the stop button, or replace it with a False constant like I’ve seen in several other code examples) freeze the code and prevent the other vi files in Teleop.vi from working?

Thanks.

This simple motor control VI is simply demonstrating how to do a quick test. You are correct that this is probably not how you want to do it on your robot. Once you enter the loop, that code will not exit the loop until its stop button is pressed. Additionally, it has no delay in the loop. Later in the PDF, it adds other components that effectively build a small RobotMain that only controls the one motor.

Greg McKaskle

I understand now, thank you!

This brings up a related question - how do I integrate example code into my robot code? The answer is on the LabVIEW Getting Started Window (View>>Getting Started Window… if you already have VIs open). Click on Tutorial 7 - Integrating Examples into Robot Code.