Jump to content

Sub VI Problems


Recommended Posts

Hi,

I've got quite a few working VI's now... and I'd like to add them as a Sub VI's to a larger VI which is basically a user interface. I know how to access the icon pane and connect my inputs and outputs to the terminals but whenever I insert any of these VI's into the user interface VI they never work! They all work stand-alone, but not when incorporated into the interface VI. Why would this be?

Thanks.

Link to comment

QUOTE (Sonic_Soul @ Nov 12 2008, 04:35 AM)

They all work stand-alone, but not when incorporated into the interface VI. Why would this be?

It's hard to tell without seeing the code or having more information about how the don't work. Can you post a copy of your code with the sub VI's inserted or atleast a screenshot of the block diagram? That would assist in answering your question.

Thanks

Jason

Link to comment

Are your SubVI's part of your GUI? Do you want them to show on your front panel or open when called? Or, are they simply not returning the expected results when placed in your main VI.

QUOTE (Sonic_Soul @ Nov 12 2008, 05:35 AM)

Hi,

I've got quite a few working VI's now... and I'd like to add them as a Sub VI's to a larger VI which is basically a user interface. I know how to access the icon pane and connect my inputs and outputs to the terminals but whenever I insert any of these VI's into the user interface VI they never work! They all work stand-alone, but not when incorporated into the interface VI. Why would this be?

Thanks.

Link to comment

gleichman, jasonw, thanks for replying. I want the objects from the sub vi to show on the front panel and they do - but they don't react when pressed. I've uploaded screenshots of a very simplified GUI I'm using. It's basically a tab control, and on each tab I intend to have objects from different sub-vi's.

main gui.jpg - the GUI.

img capture sub vi.jpg - the sub VI.

The sub VI captures an image from a USB camera and saves it as a BMP file when a button is pushed. It also displays the captured BMP file. I want two things to display on the main GUI; the button to activate the capture, and a display of the captured image. Therefore I've wired these up as an input and output on the connector pane. As I say, the VI (and the other's ive made) will work stand alone. But when I try to incorporate it into a tabbed GUI it doesn't. Any ideas? Thanks for your time peeps.

Link to comment

QUOTE (Sonic_Soul @ Nov 13 2008, 01:06 PM)

As I say, the VI (and the other's ive made) will work stand alone. But when I try to incorporate it into a tabbed GUI it doesn't. Any ideas? Thanks for your time peeps.

Hi,

I think it fails because you already destroy your image inside the subvi,

it is better to create the image outside (before) the while-loop, and destroy it after stopping the while-loop.

Happy wiring...

EDIT: also make sure the Stop-button in your subvi is default set to TRUE, otherwise your "inner"-while-loop (inside the subvi) will NEVER exit !!!

TIP: create an indicator on your index to see your while-loop running...

Link to comment

QUOTE (tnt @ Nov 13 2008, 07:03 AM)

I think it fails because you already destroy your image inside the subvi,

it is better to create the image outside (before) the while-loop, and destroy it after stopping the while-loop.

You're right about that. While the indicator is still there, it refers to a pointer in memory. Destroying the image in the subvi effectively destroys it everywhere as well, except if you've made a copy of it. That goes against dataflow thinking... I prefer to think of IMAQ images more as a reference to a memory space than a linear process.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.