LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I run a SubVi in background when a sequence is running in the main VI

Solved!
Go to solution

What I want to do is this

When I push a button on the main VI, a SubVI (#1) must run and take data.
At the same time, a sequence, in which there are other subVIs must run.

My problem is that the subVI #1 does not run when I push the button. The sequence is running well. How can I run both the sequence and the subVI at the simultaneously?

0 Kudos
Message 1 of 13
(5,949 Views)

Hey Hugo,

 

Sounds like you'll just want to do some parallel loops. I'll attach a screenshot of a VI that has a sequence where the counter goes up to 3, then restarts, each time it reads the iteration count from the subVI above. (The subVI is just a while loop with the iteration count attached to the global)

 

Each iteration of the sequence shows an increased count from the subVI via a global variable.

 

Is this what you are looking for?

 

 

 

Keep in mind that I just threw this together to show functionality, its got a lot of rough edges to it.

Message Edited by Chris_VH on 03-30-2009 03:59 PM
Chris Van Horn
Applications Engineer
0 Kudos
Message 2 of 13
(5,943 Views)
Solution
Accepted by topic author Hugo Lemieux

Hi Hugo,

 

when the sequence and your subvi don't have any data dependencies, they will run parallel...

Do you mind to attach some code or pictures of block diagram?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 13
(5,941 Views)
I tried to copy the whole code of the subvi #1 in the main vi, then erased the subvi. It worked well.
0 Kudos
Message 4 of 13
(5,898 Views)

Hi Hugo,

 

if you did as described then it should have worked before too...

Anything else that may help others to solve such problems too?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 13
(5,880 Views)

Yes, please!

 

I run subvi from parallel loop as described above... But when subvi runs, main vi is NOT operational (can't press no buttons, or alter anything).

 

Is there a way to keep subvi running and also be able to keep using MAIN vi?

 

Thanks!

0 Kudos
Message 6 of 13
(5,745 Views)

If you really have parallel loops with no data dependency, then the main will run. You need to attach your code so someone can see what you've done wrong.

 

It's also a good idea to create a new question instead of posting to a 'Solved' thread.

Message Edited by Dennis Knutson on 05-05-2009 10:42 AM
0 Kudos
Message 7 of 13
(5,736 Views)

My main vi is very large. No way I can paste it here 😞 But parallel loop is very small - just button calling subVi inside.

 

I can't think of any data dependency unless it is that button? ('rozplyw 2' is located on main vi's frontpanel. naah...

main vi freezes while subvi is showing. Just picture on subvi's front panel - nothing more.

 

PS: Sorry if I post at wrong place, but it seems natural to me to continue just the same thread, especially there was:


Anything else that may help others to solve such problems too?

 

 

0 Kudos
Message 8 of 13
(5,716 Views)
Sorry, I can't view your image. Why didn't you simply attach it to your post?
0 Kudos
Message 9 of 13
(5,704 Views)

I think I've just done so... But here's the link anyway: http://www.freeimagehosting.net/uploads/e921245685.jpg

Thanks!

0 Kudos
Message 10 of 13
(5,693 Views)