LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loop 101

I looked at the search results and still not 100% clear.  I have a very basic homework question. This is my first time ever using LabVIEW and am experiencing a pretty serious learning curve. I'm pretty sure I know what the question is asking, but I'm not 100%. I have a little trouble making complete sense of the terminology.

 

Here is my Question:

 

Using a single While Loop, construct a VI that executes a loop N times or until the user presses a stop button. Be sure to include the Time Delay Express VI so the user has time to press the Stop button.

 

 - I have the while loop open in my Block Diagram.

 - I have a stop button inside the loop connected to the Loop Condition

 - I have a numerical indicator "loop counter" connected to the Loop Iteration

 - I have a "Wait Until Next ms Multiple" sitting inside my loop that is connected to a constant value of 1000

 

1. What is a "Time Delay Express VI"?

2. Is the timer I'm using considered a "Time Delay Express VI"?

3. How could the user not have time to push the stop button? Can't you push it whenever you want?

4. Do I need some kind of control in my front panel labeled "N times" so the user can select the amount of executions?

 

I apologize in advance for how simple these questions are. My head starts spinning when I read one of these questions because I have so many questions.

 

Thanks, Matt

0 Kudos
Message 1 of 2
(2,939 Views)
  1. The time delay express VI is located under Express/Execution Control.
  2. No but it is used by the express VI. Drop the express VI and you can configure it. You can right click and select show front panel and it will convert to a normal VI that you can open and look at.
  3. I didn't understand that one at first. You should always have a delay of at least 0mS in a loop that is not throttled in order to make sure it doesn't hog the CPU. (0mS you ask? That just forces the thread to yeild to the CPU). But further reading it says that the loop stops after a number of iterations or when the stop button is pressed. If the loop is executing at a million times per second and you have it set to stop after five iterations the user will never get the chance to press the button.
  4. You need to compare the number of loop iteratios to either a numeric constant or control. You then use boolean logic along with your stop button so that the loop stops when the number of iterations is met or the button is pressed. It's a homework assignment so I will let you figure out which boolean function. It should be obvious Smiley Wink
=====================
LabVIEW 2012


Message 2 of 2
(2,934 Views)