|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Labview SubVI return and continue looping
We wish to have several VIs running simultaneously, and we want each one to loop continuously. We would have one section which would quickly return, and another than loops indefinitely. While I do not believe this is possible, other team members and mentors say they saw how to do it but have since forgotten. Is this possible, and how is it possible if so?
|
|
#2
|
|||||
|
|||||
|
Re: Labview SubVI return and continue looping
Quote:
If you want to stop all the processes at the same time just use a stop button control to one of the while loops condition terminal and create local variables of that stop button and place them in the other loops. That way when one stops they all should stop. |
|
#3
|
|||
|
|||
|
Re: Labview SubVI return and continue looping
I thought the "cleanest" method that would work well would be to store inputs and results in a global or shared variable, then in the loops they would access the variable.
|
|
#4
|
|||||
|
|||||
|
Re: Labview SubVI return and continue looping
Quote:
![]() |
|
#5
|
||||
|
||||
|
Re: Labview SubVI return and continue looping
LabVIEW runs highly parallel. If you look at the Basic Robot Main.vi you can see 3 loops, 2 of them are infinite.
The first one does the DS comms and motor control and handles auto and all that jazz. It's where you put most of your code (and subVI calls) Below that is the camera code. If you want to access camera data in other loops, you have to use global variables The loop below -that- is a timer loops. It is an infinite loop with a wait timer so it only executes the commands in it depending on what the timer value is. Again, to get data from this loop you have to use global variables. Modifying global variables from multiple VIs is tricky.. race conditions are also bad, so you must be careful. |
|
#6
|
|||
|
|||
|
Re: Labview SubVI return and continue looping
To the original question, a subVI cannot return until its whole diagram is complete and all of its outputs are ready. So you cannot have it be partly running and partly returning.
Your choice is to have the loop in the caller, making many calls to give and get data from the subVI, or you can push the loop into the subVI. The template shows both. Using globals is fine as long as you have only one writer, but be careful when you want more than one loop to write. You can safely have as many reader as you want, but of course they may not always be in sync with each other. Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Looping a function | Tz0m | Programming | 14 | 20-02-2007 11:22 |
| Looping Atonomous | BobcatProgramer | Programming | 2 | 24-02-2004 14:06 |
| Continue the Story Game | robot180 | Chit-Chat | 2 | 16-06-2003 21:24 |
| THE RUMBLE WILL CONTINUE! | archiver | 2000 | 8 | 23-06-2002 22:56 |
| control program looping??? | ctartist236 | Programming | 1 | 08-02-2002 10:09 |