Reputation: 2176
i have a ex1.vi which has 2 inputs
1).Signal(boolean)
2).Message(String)
has 1 output
Parsed message(String)
now this vi has a while loop where it detects the changes in input and should give the output. this ex1.vi itself is in a message loop in a main.vi that instantiates it. this main.vi produces the Sensor and message data and consumes Parsed message.
eg. the main.vi gives Signal = true
and message = "hello"
the ex1.vi will give parsed message = "hi"
. since the ex1.vi is in while loop how will i give the output? if i update a local variable and wire that to the output main.vi is still not able to consume because ex1.vi has not completed. how can i achieve this without the use of global variables?
Upvotes: 0
Views: 1442
Reputation: 3609
You could utilize a functional global variable, this is likely the quicker solution. See here: Functional Global Variables
Message queues could also work well, my choice would likely be one of these two depending on application. See here: Queued Message Handler
Which is the better solution is really application dependent and you should weigh the benefits based on the big picture.
Upvotes: 1
Reputation: 66
Use queues or user-events to share messages between running VIs.
I'm confused how you have your ex1.vi setup. For each call to the subVI you can only have one set of inputs and one output -- you can't monitor an input. If the input data is coming in through a queue then you're halfway there. You just need a queue to return messages to the calling VI.
As you already know, the output of a VI is the same as a return function so you can't return and keep running.
Upvotes: 1