Search code examples
labview

updating output from within while loop


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?


Solution

  • 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.