11-11-2008 04:13 PM
I have a USB data acquisition application, I would like to put all the graphs on a subvi front panel. When a user clicks on "Graph" button on Main Vi, the subvi should open and keep updating while it's open. But I cannot get the subvi to update when it's open. Attached is a program I wrote to simulate the problem I have. The second loop in the main VI won't execute as along as the subVi is open, therefore the new data is not dequeued. Can someone please take a look at my code and see how I can fix this problem? Thanks.
Solved! Go to Solution.
11-11-2008 04:28 PM
Remove the while loop and "return" button from the subVI.
Right now the subVI stalls the lower event loop since the subVI never completes. Keep the subVI always in the data stream and just show or hide its panel.
(BTW: it seems like a bad idea to grow a 2D array without any upper bounds)
11-11-2008 05:00 PM
Here's a very primitive example that shows the main idea. Remember, you don't need to poll the queue. Just wait for the next element (forever!). The loop will stop once the queue is destroyed.
11-12-2008 08:40 AM
Altenback, thank you, the example does exactly what I want. I am going to apply it to the real application, I will let you know how that goes. Thanks for pointing out the 2D array, because it's a simulation program, I didn't put too much time to get it right. In the real appliation, I initialize the array with a certain dimension and use replace array to fill it.
By the way, with the current subvi, would it be possible to have a few buttons on this panel so the user can switch to different screens such as alarms and statistics that show the max, min, avg?
11-12-2008 09:18 AM
mhdp wrote:By the way, with the current subvi, would it be possible to have a few buttons on this panel so the user can switch to different screens such as alarms and statistics that show the max, min, avg?
You could use a "tab control" and place the various "screens" on different tabs. No code needed.
11-12-2008 09:47 AM
altenbach wrote:
mhdp wrote:By the way, with the current subvi, would it be possible to have a few buttons on this panel so the user can switch to different screens such as alarms and statistics that show the max, min, avg?
You could use a "tab control" and place the various "screens" on different tabs. No code needed.
Excellent idea, this will solve my big problem. I don't need the Graph, alarm, Statistic, etc. buttons any more. The above example is very good, it will come in handy later with other applications. Thank you very much.
11-12-2008 12:01 PM
Hi,
I came across this forum and it seems that it has been resolved. Don't forget to select the "accepted solution".