LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple paths in Labview

As a rookie th Labview I have not so far found the right way to solve some problems which would have been easy to solve in normal programming.
 
One of these is when I would like to start a program, then decide by pushin one of 10 buttons which measurement is supposed to start.
So what I would like to do is:
1. start the program
2. Make it wait for user interaction (without consuming 100% of processor performance running in some kind of silly loop)
3. Start running along one of many paths and when finished returning to the same state waiting for the next user interaction.
0 Kudos
Message 1 of 6
(2,939 Views)
Hi
 
I think what you need is a combination of the producer consumer pattern and a state-machine.
 
This would look like this: Two loops - one containing an event structure to react on user events. Each of these events enqueues a state to a queue. This queue is fed also to the second loop, which contains a case-structure. Place a dequeue element vi to extract the enqueued elements and feed them to the case-structure.
 
Hope this helps.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 6
(2,936 Views)
Thomas is right.

Loops are your friend. To avoid consuming lots of CPU time, put a Wait (ms) function in each loop. LabVIEW's internal scheduler will then allow other things to execute during the wait. The event structure does not consume CPU time until an event occurs.

Lynn
0 Kudos
Message 3 of 6
(2,929 Views)
If you are using one of the current versions of LabVIEW (7.x, 8.0 when it is released) you can use the event structure to sit waiting for the operator to make a selection, essentially using no cpu until that happens.
 
P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 4 of 6
(2,912 Views)
Here is some example code to get you on your way, from a 2004 NI-Week presentation.
0 Kudos
Message 5 of 6
(2,891 Views)
Here is the 7.1 version, it is a bit more complete.
0 Kudos
Message 6 of 6
(2,889 Views)