08-28-2018 03:27 PM
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.
Solved! Go to Solution.
08-28-2018 03:36 PM
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?
08-28-2018 03:40 PM
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.
08-28-2018 03:44 PM
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.
08-28-2018 03:47 PM
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.
08-28-2018 04:12 PM
I don't have LV 2017 on my PC. Is there a broken arrow? Does it run and lock up?
08-28-2018 04:37 PM
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
08-28-2018 04:41 PM
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
08-28-2018 05:45 PM
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.
08-28-2018 05:49 PM
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.