06-24-2014 08:08 AM
Hi,
I know that I am probably going to invoke the wrath of the labview gods with this request by not going through my tutorials again but I am unfortunately stuck and
getting a bit of a brain freeze on this one.
I have a VI for a flow meter, that runs perfect when I hit run continously but I need to add this to another VI that just runs once so I am trying to convert.
I have had previous suggestions in another thread to replace the for loop with a while loop. Add a Stop button on the front panel and wire it to the Stop it True terminal in the loop.
Move the Waveform Chart and Flow Rate terminals inside the loop. I have done this but the VI does not run correctly, the dial just keep accumalating/adding and not resetting.
Any alternate approaches that I can try would be greatly appreciated.
Thank you.
06-24-2014 08:32 AM
You also need to add a button to stop the counter task. Then the next iteration it will be created again and should be reset.
06-24-2014 08:41 AM
Thanks, I have added a boolean switch and yes it resets when pressed manually, is there a way I can have it reset automatically for each iteration. I have added a revised VI.
06-24-2014 09:11 AM
Hello Evan117,
for what I have seen, I can suggest you that instead of using 2 stop buttons you can use only one and create a local variable of that to wire it on the other loop, so you will only have one stop button.
Also, if you wire the "stop" input of the express vi this is what you are going to get:
Maybe you can follow the instructions and when you stop the loop by the stop button, you will automatically going to stop the express vi.
Hope you can find usefull this comment, good luck!
06-24-2014 09:20 AM
Evan,
If you only want the while loops to run once then just wire a "Equal to 0?" comparison to the "loop iteration" counter. The output will be true, which you can wire to the loop condition "Stop if true".
Is that what you need?
06-24-2014 09:26 AM - edited 06-24-2014 09:26 AM
I tried to do some cleanup and got away from that stupid Express VI. Your loops really should be combined otherwise you have one nasty race condition with your local variable. I also found a nice property node for the counter to reset its count.
06-24-2014 10:27 AM
Thank you for the suggestions, it is home time now so I will try these tomorrow, thanks again.