12-12-2012 04:23 PM
Hi All, I have a multi-page program. One of it is used to read some analog signal via a USB block continuously.
What I want is when clicking this page, this while loop is activated. Then we can monitor the data. When we click other pages or "Stop" button, this while loop will be terminated. And we can use the other pages to do something else.
Right now I got difficuties in stop the while loop. I do not want to stop the running of the whole program, just want to jump out of this while loop then do other operation.
Could anyone give me some advise how to do it? Thank you very much!
12-12-2012 04:51 PM
Your program is inside out.
You should have the while loop outside of the case structure.
Generally, there is no need for that tab control to be wired up to a case structure. Usually, the tab control is just there to organize the view of the controls and indicators for a user into logical groups. It usually isn't intended to change the actual execution of the program. Suppose you had data in a tab control being passed to a waveform chart. Wouldn't you want that chart to be updated with the latest data even if the user wasn't looking at that tab page at a particular time?
12-12-2012 04:57 PM
Hi RavensFan, thank you for your reply.Actually this is not my real code because the original one is very very compliacted.
In real code, the tab control you see in inside the bigger while loop, that loop makes the whole program work.
And as what I pointed, the purpose is when I click this tab (if we do not want it to trigger, we can place another "START" button to trigger), an internal while loop inside begins to run. This while loop keeps showing the real time analog signal.
And if I do not want to use this "real time monitoring" function, I want to click somewhere (or doing anything else that can work) to jump out of this internal while loop and keep on using some other functions of the program.
Could you advise about that? Thank you very much!
12-12-2012 07:14 PM
Do not put the while loop inside the case structure. I'm curious as to why you say you are using an event case in the subject line of your message, while you code does not show the use of an event structure at all.
If you need something to run continuously, then you should put that code in its own while loop.
I recommend you search the forums for examples of code using a producer/consumer architecture. There are templates and examples within LabVIEW such as Producer/Consumer events that would be a better basis for your code.
12-12-2012 08:53 PM
Hi RavensFan, sorry what I tried to say is a case sturcture, not an event case. I will search for producer/consumer architecture as you advised.