06-27-2014 01:03 PM
I have a code which programmatically increments a Numerical indicator by 1. I have this code in a case structure that is outside a While Loop that contains my other code. However, I want the increment only at the end of the run, that is when I press the STOP button. I don't want the value to increment when I press Ctrl + R. Currently, my vi increments when I press the Ctrl + R to start my application. What can I do to make it increment only when I press the STOP button to stop the application?
Thanks in advance.
06-27-2014 01:12 PM - edited 06-27-2014 01:17 PM
I am a bit unclear about your end goal, and as to why the case structure needs to be external to the while loop. (This is where uploading code would help!)
Since you want it to only increment at the very end of the while loop, why not simply wire the case structure to the stop boolean, as well? That way it will wait until the while loop completes AND only executes if the stop button was pressed.
Other more complex options are out there. But why not exploit dataflow to simply fix this issue 😄
EDIT:
Do you mean you want something like this?
WHEN the while loop stops and IF the stop button was pressed, it will increment. (Assuming you wire something to the increment function).
06-27-2014 01:12 PM
Show some code.
Sounds like you just want to put your increment on the outside of your while loop.
06-27-2014 01:51 PM
Folks, thanks for your prompt response. I appreciate. I decided to just create a simple vi that kinda replicate my main vi, and what the problem actually is. However, the attached simple vi doesn't successfully run when you click on the Ctrl + R to start the application, but it does illustrate my question much better, in the sense that when you start the application, the value shown on the numeric control immediately increments by "1". My question is how can I make it not increment by "1" when I just press the Ctrl + R, but should only increment by "1" when I stop the application.
I hope am able to ask my question clearly now.
Regards.
06-27-2014 01:58 PM
Below is the screenshot of the vi
06-27-2014 02:04 PM
You have written the code and you don't want to see the result. If this what you expect, why don't you put the increment after the while loop?