LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start Button and loop while inside loop while

Hi

I aquire signals from PCMCIA and USB NI cards, now I want to control the input data by means of a start /stop button, so, this is a good way to make a Panel Control (Starts and Stops button)???, because I use a while loop inside a while loop, and I dont know if this make more slowly my program. What advice can you give me

please someone can help me??

0 Kudos
Message 1 of 6
(4,352 Views)

At a minimum I recommend you look at using an event structure. The event structure goes inside a while loop and its purpose is to catch UI events (such as a button press). This is a cleaner way to look for button presses than simply polling them. A better approach would be to look at the examples for a producer/consumer architecture. This generally consists of two loops. One loop contains the event structure to process UI events. You can also create your own events (user events) if necessary. The second loop uses a queue and a case statement. This loop is basically a state machine design which does the actual processing. For example, when the start button is pressed you would have an event (Value change) for the start button. This would queue up a message for the consumer loop to begin processing. Similarly you would handle your stop event when the stop button is pressed.

 

Also, for performance purposes you may want to consider only starting your DAQ tasks once. When collecting your data do only that. It is not necessary to create and destroy the DAQ tasks every time you perform a data collection.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 6
(4,344 Views)

Please, you have un example.

thanks so much

0 Kudos
Message 3 of 6
(4,308 Views)

Here is an example:

 

Paul

0 Kudos
Message 4 of 6
(4,293 Views)

I'm really sorry ; but can you post your VI in labVIEW 2009

Thanks

0 Kudos
Message 5 of 6
(4,288 Views)

Take a look now. I downgraded it for 2009.

 

Just an advice: you can change the String from my VI with queue. It works also this way and it's easier to be understood by beginners.

0 Kudos
Message 6 of 6
(4,276 Views)