11-28-2012 03:53 AM
Hi,
I have an application that command a DAQ via tcp.
In the main loop I wait for instruction (listening for new tcp connection) and, if i read a particular string, I start the acquisition using a sub VI.
If I read another string I need to stop the subVI and return a result.
I'm able to do that, but only with a push button (switch when pressed), and I don't understand why it doesn't work with boolean values (in the pentagon: if I read "OF0" I will stop the program)..
I attach an image of my program.
Thanks to all,
Veronica
(The main VI is a modify of Multiple connections - server.vi example.)
Solved! Go to Solution.
11-28-2012 10:37 AM - edited 11-28-2012 10:37 AM
Is there anyone?
11-28-2012 10:59 AM
Dear Veronica,
Thank you for providing those screenshots of your program. As a word of advice I wouldn't put while loops or event structures in a sub-vi. You will run into difficulties such as the ones you describe. Looking at your code; I think you are making life difficult for yourself with this architecture.
The common use for booleans and event structures are inside a while loop with the boolean control inside the event structure. If you see Example 1 - RW.vi when the button Generate Data is pressed it returns to it's false state. Whereas in Example 2 - RW.vi the button has a switch behaviour even though it has a latch mechanical action.
I hope this information is useful.
Kind Regards,
11-28-2012 11:49 AM
@Rob_Ward wrote:
Dear Veronica,
Thank you for providing those screenshots of your program. As a word of advice I wouldn't put while loops or event structures in a sub-vi. You will run into difficulties such as the ones you describe. Looking at your code; I think you are making life difficult for yourself with this architecture.
<snip>
I disagree. As long as you really understand event structures and while loops, you are actually making life difficult by NOT placing them in sub-VIs. But perhaps you meant that those particular structures inside a sub-VI should be as independant as possible from events occuring outside of it? That would make more sense :).
11-28-2012 03:54 PM
Iwould be in some serious trouble if I couldn't put event structures of while loops in subVIs.
11-29-2012 02:31 AM
Thanks for replies.
I can't open these examples because I have labview 2010.
A practical idea? I hope that what I want to do is possible, because this is a little part of a big project and I hope that I will not have to change everything!
11-29-2012 10:21 AM
Who said me that is possible, can explain me how?? Please!!
12-03-2012 02:54 AM
Anyone that can help me??? PLEASE!!
I don't understand why I can stop a while into a subVI with a button (and references) and not with a variable!
I wait for an expert
12-03-2012 10:40 AM
@Skeggy88 wrote:
Anyone that can help me??? PLEASE!!
I don't understand why I can stop a while into a subVI with a button (and references) and not with a variable!
I wait for an expert
I think you will find the tutorials on state machines fascinating reading. 😉
12-03-2012 12:03 PM
You may want to look at Ben's post here too.