LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

please help me stop my program when n gets to 15

Solved!
Go to solution

hey guys

after gathering lots of suggestiong from you, im almost done with my vi.

i need one more thing i havent been able to do so. i have a counter  on my vi (the one from the FOR LOOP) that runs from 1 to 15 and starts over. i need my vi to completly stop when that counter gets to 15. i tried a while loop that compares the counter to 15 and returns a boolean value to stop the program but i couldnt get it to work.

here is a zip with my vi file and a measurement file to test it. i will really appreciate if someone could help me with this simple issue.

thanks!

Message Edited by moreins on 11-16-2008 09:18 PM
Message Edited by Support on 11-17-2008 01:38 PM
0 Kudos
Message 1 of 9
(2,636 Views)
If you just simply eliminate the while loop, the program will run for 15 iterations. No more or no less. However, I don't know why you say the counter goes from 1 to 15. The counter goes from 0 to 14.
0 Kudos
Message 2 of 9
(2,625 Views)

hello

thanks for your reply

im running the vi without the WHILE LOOP and indeed, the counter goes from 0 to 14. i was running it continously so thats why it never stopped. thanks for that one.

final question: is there any way to place a RUN ONCE button in the front panel and a reset button that zeros my 2 numeric indicators?

 

thanks!

Message Edited by moreins on 11-16-2008 09:51 PM
0 Kudos
Message 3 of 9
(2,620 Views)

You don't ever want to use the Run Continuously button unless you are doing something like debugging a VI.

 

Why don't you use the Run button that is on the toolbar????  (It is right next to Run Continuously)

0 Kudos
Message 4 of 9
(2,614 Views)

Hi

 

If i get your question right, you wish to control the number of times the FOR loop iterates?

 

Might be you should change the constant wired to 'N' of the For Loop to a control, and run the counter.

 

If i got your question wrong, please explain what you mean by Run Once control on F.P

 

Good luck

  

0 Kudos
Message 5 of 9
(2,613 Views)
The 'Run' button is a run once button and that is the only button you should need. Never use the run continuous button for normal operation.
0 Kudos
Message 6 of 9
(2,612 Views)

indeed the RUN CONTINOUSLY is not recommended. from now on im gonna use the RUN ONCE from the toolbar. i was just wondering if theres any way to place a RUN button on my front panel.

 

regarding the numeric indicators im using, is there any way to reset them with a button or something??. the only way i know is to right click on each of them, go to data operations and click on reinitialize to default value.i was thinking in a button that could reset all of them.

 

thanks

0 Kudos
Message 7 of 9
(2,606 Views)
Solution
Accepted by topic author moreins

You will still have to hit the run button on the toolbar, unless you set the properties to run automatically when opened.

 

You can create an initialization portion of your program (perhaps the 1st frame of a flat sequence,while your current code is in the next frame) that sets controls using local variables to whatever you want.  You can also create a while loop with a small wait statement that ends once the "front panel run button" is pressed, then the rest of your code will follow.  An event structure would be an even better choice.

0 Kudos
Message 8 of 9
(2,603 Views)

thanks a lot!

will take your ideas into account

0 Kudos
Message 9 of 9
(2,599 Views)