LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loops help and general thoughts

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

0 Kudos
Message 1 of 5
(2,813 Views)

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.

Message Edited by JeffOverton on 09-03-2009 02:01 PM
0 Kudos
Message 2 of 5
(2,797 Views)

Hey Jeff,

 

You're back!  Where have you been?Smiley Happy

0 Kudos
Message 3 of 5
(2,775 Views)

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


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 5
(2,751 Views)

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.

0 Kudos
Message 5 of 5
(2,722 Views)