09-03-2009 12:15 PM
I am looking to have a Setup Acquisition state, followed by the View Data state for a project. Each of these states will be a VI that I can call dynamically(I hope!). I want to use some drivers that I have downloaded. One driver in particular has all the setup options along with the output chart. I would like these to be separate (setup options in the Setup VI, chart in the View Data VI). Am I able to use global variables to send the output of the chart, when it is in the setup state, to the View Data VI. Keep in mind that the driver is most nearly contained within a while loop, so simply wiring out the output chart won't work. I know I could just make one VI that could be called "Setup->Acquire->View", but I am aiming for a super user friendly interface, that makes it distinct what the different steps of the experiment process are.
I get the feeling that global's won't help me here. A producer-consumer doesn't seem to make sense either, as it I would still have to get my data out of a while loop. I am looking for some input and insight for how to handle my project.
thanks
09-03-2009 01:01 PM - edited 09-03-2009 01:01 PM
It sounds like you want to use a queue and a state machine. I would create the queue for whatever your data type is, then pass it into an event driven state machine. The timeout case flushes the queue, acquires data, and puts it into the queue. If the user triggers an "acquire" event, then the acquire event pulls data from the queue and pushes it into your chart. A setup event would change acquire conditions and pass them into a shift register, that the read VI would use every timeout.
The attached example is very rough, and only to demonstrate the concepts.
Edit - you could also have the acquire happen in a separate producer loop, so it's not interrupted by user events.
09-03-2009 02:48 PM
Hey Jeff,
You're back! Where have you been?
09-03-2009 05:57 PM
csmrunman wrote:.
I get the feeling that global's won't help me here. A producer-consumer doesn't seem to make sense either, as it I would still have to get my data out of a while loop. I am looking for some input and insight for how to handle my project.
thanks
In this instance an Action Engine for the chart data would seem to be ideal. Allow your driver to "initialize" the chart data in your init case, "Add data" from the drivers while loop in the acquire case and "Get All Data" in the view case. Because the action engine won't be reenterant you will avoid any nasty race conditions and you can call it asynchronously from your several dynamically launched vi'.
09-04-2009 07:26 AM
Hey RavensFan. I've been busy at work doing design stuff, so the LabVIEW has fallen a little by the wayside (not all the way, though; people still need to run tests). I'm almost done with the design and documentation, so now I have to wait for people to come back from vacation before having some kind of technical review on my proposals, hence the free time.
And Jeff, that's an excellent point regarding action engines for dynamically called VIs. The thing I didn't state in my earlier response is that I don't know that, as described, this application would benefit from the extra complexity of calling by reference. It seems fairly straightforward.