08-19-2013 03:35 PM
Hello,
I am trying to output data from subVI to the main program in real time. But I found the the value can be only trasferred when the subVI is finished.
I make some research and I think using queue is the best, but global variable.Can you any give me some tip on using queue to transfer data from subVI to the main program in real time?
Thank you!
Solved! Go to Solution.
08-19-2013 03:52 PM
I would need to see your VI in order to advise you which data transfer mechanism would be best for your scenario but I'll try to answer your question about queues.
A queue is a reference based object in LabVIEW, this breaks data flow in LabVIEW as passing the queue wire around does not pass the actual data. In order for you to get the data in "real time" as you say, then your sub vi must be in parallel to the other code in your main VI. LabVIEW 2012 ship with a really good example of this, called the "Continuous Measurement and Logging" Sample project. This should give you an idea of how to have multiple asynchronous pieces of code communicating through queues.
08-19-2013 03:58 PM
Basically, the subVI can measure Vout in a loop and I want transfer those data to the main program and also display them on UI.
Thanks !
08-19-2013 06:30 PM
The EASY way to get what you want is to pass a reference to the indicator on the Main block diagram to the SubVI. The SubVI can use this reference to update the Main front panel programmatically. Follow these steps:
**Disclaimer** Please note that I said this is the easiest way. From what I can see of your code, it would benefit from a complete restructure to utilize a standardized architecture.
08-19-2013 09:14 PM
Additionally, if you have many values you want to pass, consider creating an array of your references and then pass only the array. This way you can avoid numerous having endless inputs in your sub VI.
Im wondering now, what is the problem with using a global variable to pass the data? Is there a time delay?
Best regards!
08-20-2013 10:32 AM
Hi Charles,
Thank you for your answer.
But I am confused what do you the "control terminal"?
Also I followed your step, I can only create anther control but not a indicator.
Thanks !
08-20-2013 10:58 AM
When you place a control/indicator on the front panel, it also places a terminal on the block diagram. This block diagram terminal is the terminal that has the "Create" -> "Reference" right-click menu option.
08-20-2013 11:42 AM
Hi Chales,
I am still kind of confused your steps.
I just made a simple program and followed your steps. Do you mind to point out the error?
Thanks !
08-20-2013 12:08 PM
No problem.
08-20-2013 12:45 PM
Thank you. It works!
In your step 4, I should choose " creat the property node for digital class" but not the "value".
Kudo is given.