From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make this a sub VI

Solved!
Go to solution

I have a VI that came with this light filter wheel. It works fine on its own. But I would like to use it as a sub VI. When I make a sub VI out of it by hooking up a connector pane, it doesn't work at all. Attached is the functioning VI. Where am I going wrong. I connect up the inputs and outputs to the connector pane. But it will not work. Help.

 

LeatherNeck,

New LabVIEW programmer.

Mark R Rivet
0 Kudos
Message 1 of 19
(3,053 Views)

I see that VI is set to run when opened.  That is an annoying setting to have for VI's posted to the forums.  And it may also be the cause of your problem when called from another VI as it might already be running.

 

Normally subVI's don't show their front panel.  But if this is a subVI, it needs to show its front panel because it requires user interaction.

 

How are you calling this as a subVI?

0 Kudos
Message 2 of 19
(3,047 Views)

well, actually I wanted to drop it into my main while loop in another program I'm writing. Just use it as part of my main program, that is contained in a while loop.

Mark R Rivet
0 Kudos
Message 3 of 19
(3,044 Views)

But even if I just create a new blank VI and try to use that other as a sub VI it won't work. When ever I read about creating sub VI's it all made perfect sense to me. But go ahead and try it, ha.

Mark R Rivet
0 Kudos
Message 4 of 19
(3,040 Views)

So I just finished core1 and core2 earlier this year. Not sure they discussed this kind of thing. Except for creating very simple sub VI's.

Mark R Rivet
0 Kudos
Message 5 of 19
(3,034 Views)

I don't have LV 2017 on my PC.  Is there a broken arrow?  Does it run and lock up?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 19
(3,017 Views)
Solution
Accepted by topic author LeatherNeck

Without changing and code (except adding a somewhat dangerous feedback loop to maintain the original functionality) i've wired together the functions so i could remove the sequence frames and locals. Iremoved the event structure and connected the outputs (and the singular input) to the connector pane and then it should be a subvi.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 19
(3,012 Views)

My advice is to rewrite this VI. It looks terrible and non-maintainable. If you do want to use it as a subVI remove the Stop in the last frame otherwise everything will stop.

 

The other thing is this VI has an event structure in it, it is waiting for front panel interaction. So you need to open the front panel as Ravensfan suggested.

 

mcduff

0 Kudos
Message 8 of 19
(3,008 Views)

Wow, so much for reusable code. So many times that I find code that does what its supposed to do, I will not be able to use it without re-writing the code; nice. 

0 Kudos
Message 9 of 19
(2,999 Views)

That's a superb job. When I get back to work to morrow I will try it. So it looks like this is what I will have to do with a lot of code that comes with devices. Like this was an optical filter wheel. I need to use one of these in my test setup. But in order to use this, I would have to do what you did in order to be able to use it in my own application; wow.

0 Kudos
Message 10 of 19
(2,998 Views)