How can gloal vairables can be shared in subvi?

I have a question about global variables. no found answer in Forum.
i want to share some global variables in different subvi: Starting first subvi from main,
and set variables,then in second vi, use these variables.
In my test, if i run it from labview , everything is ok. If build  an exe file, the first subvi
 cannot be exited. If exit, the value of global variabels are cleared.  I don't know why?
Can i use like this? please help me.
Thanks.
attached my main app. For subvi exit, just call FP.Close.
Solved!
Go to Solution.
Attachments:
Main.vi ‏22 KB

The way I underrstand the problem:
There is a main VI (main.vi) which successively runs two different VIs via a VI reference.
Let's call them A.vi and B.vi. Both access the same global variable.
The main VI does not know about the global variable.
First A is runs, then quits. Later B runs and is expected to access the global variable with data left by A earlier. I have not explored this, but I guess that once A quits, the global variable also leaves memory, forgetting everything
My suggestion was to place an instance of the global variable in the main VI, forcing it to remain in memory as long as the main VI is running. Apparenlty, this solves the problem.
mmm2006 wrote:
Should i update global variable in main vi? There are many setting and  I don't want to display them.
I would guess it will be sufficient to place the global variable in the main VI to keep it in memory. There is no need to read it or display it's content. Another solution might be to specify the global variable as "startup VI"? I have not tried this.
These are just speculations, because I virtually never use globals so my experience is limited. I probably would have A.vi write the data to a file which B.vi later can access, for example.
Message Edited by altenbach on 12-26-2009 09:47 AM
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • TS2972 Bug:How can Home sharing be turned off and all items in my library cleared without my intervention? This is the SECOND time this happens since end of March 2013. A permanent solution will be appreciated

    Bug:How can Home sharing be turned off and all items in my library cleared without my intervention? This is the SECOND time this happens since end of March 2013. A permanent solution will be appreciated

    See this post.
    Assuming AVG is involved there is a new patch which may resolve the issue. Update AVg before attempting to recover the library.
    tt2

  • How can I specify relative SubVI file path in VIs?

    I use LabVIEW 2009 Service Pack 1.
    SubVIs are referenced by absolute paths, so when I move them to a new folder I may need to set their paths again.
    How can I make a SubVI reference a relative path so that I don't have to set its path after moving VIs to a new folder or a new drive?
    Solved!
    Go to Solution.

    altenbach wrote:
    [...]Where did you encounter any problems?
    From my experience, most of those problems occur when moving VI files directly on disk (Windows File Explorer) individually.
    @OP:
    Altenbach brought up a good point: When moving/copying the project, take care that all project related sources are within a single project folder. Move/copy the whole project folder, keeping its internal setup. In most cases, that is doing fine.
    When moving individual files (VIs), make sure that you use the LV Project Explorer to do so. Add all files used in the project into a single lvproj and then swap to the "Files" tab. Rightclick the individual VI you want to move and select "Move on Disk" from the context menu. This will auto-update all (known) callers as well.
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How can i know what SubVI is on SubPanel?

    How can i know what SubVI is on SubPanel?
    In the main of my application i have three subpanels that open many different SubVI, i need to know what reference of subvi is actually open
    what could be the best way to do it?
    thanks,
    Andres

    I'm not aware of a way of directly getting the VI reference from the subpanel control after a VI has been inserted into it. Seems like an oversight to me if it's not there. This means you will either have to create a mechanism for saving the reference that's currently open at the time that you invoke the "Insert VI" method, or you can use a roundabout means like getting the run state of a VI or reading an indicator's value, as mentioned in this thread.

  • How can a shared photostreams be viewed

    How can my son look at my shared photostreams on his ipad?

    How to create a Shared Photostream
    http://www.imore.com/how-create-shared-photo-stream-iphone-and-ipad

  • Imovie 11 - how can I shared to idvd a project that I modified and finalized for the second time?

    I finalized a project (iMovie 11), shared with iDVD just as a test. Then I came back to the project, included A LOT of things, finalized again and when I shared to iDVD i just show the first finalized project. How can I work with my hole project in iDVD?
    I tried to save as my project, but there is not this option.
    Please HELP me. The old iMovie was much better. :-(.
    Tks a lot
    Gil

    Try first sharing to Media Browser from iMovie in the Large Size.
    After it is finished, you should be able to see it in the Media browser on the iDVD side of things. Drag it into a new project and continue working in iDVD.

  • How can I Sharing Nikon NEF files from Mac to Windows

    I want to share Nikon NEF and TIFF files between Mac book pro and Windows 7 computers, is this possible and how can I do it ?

    Photoworks6x7 wrote:
    Thanks Shootist007,
    I am planning to buy a MacBook Pro, my main computer runs under windows 7.
    On both computers Photoshop CS6 installed, so this will do the trick?
    Photoworks.
    Yes Certainly. PS has been reading Nikon NEF files for YEARS. The only problem you may run into is with the Newest Nikon cameras. That is if you have the newest Nikon. That is until Adobe updates Adobe Camera RAW to support the newer Nikon cameras.

  • How can I create a subVI that has state?

    I'm trying to simplify a VI that I inherited and I noticed a recurring pattern that IMHO should be a subVI.  The pattern is that we have a digital output line that is controlled by a timer.  Each output has a start time for it to activate and a duration after which it is turned off.  When the state changes, a single line entry is added to a common log file and an indicator shared variable is set so that the remote host VI updates.  We have a big while loop that checks the current time against each of the activation conditions.  To detect when the state has changed, we're using a shift register (for each actuator).  It's one thing to see the same pattern 3 times, but it's worse -- we want to sometimes use a different number of actuators.  If I was writing this in C++ (with which I'm far more comfortable than LabView), I'd write a class for the actuator and instantiate it N times.  The class would have member data to keep track of its state.  I can create a subVI that does the meat of the design pattern, but I can't figure out how to store the previous state in the subVI without requiring it to be passed in.  How do I keep the state and behavior of a VI together?  Surely there's a way to do this because otherwise I can't see how you could implement state-ful algorithms like, say, a PID controller.  But I'm at a loss to figure it out ...
    Thanks.
    Keith.

    To save state in a subVI and not use that state in other subVI calls, make the subVI reentrant.  When a subVI that is reentrant is called it creates a unique memory space for that subVI.  This is called a clone.  That memory space is where state is held for that subVI.  Keep in mind that it also means that the memory footprint is going to be larger.
    To set a subVI to be reentrant, open it and go to File -> VI Properties and select execution.  It will be a choice on the bottom left.
    Hope that this helps,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

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

    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?
    Solved!
    Go to Solution.

    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
    Attachments:
    iteration.jpg ‏43 KB

  • How can I open a subvi when running a vi in an application (executable file)

    I have a vi that I converted into an executable file.  I would like to run it and at the same time be able to open the front panel of one of its subvis.  Does anybody know how to do that?
    Thanks,
    Jerome.

    You can set the SubVI to "Open Front Panel when Called" and "Close Afterward if Originally Closed" - that makes it a pop-up window. When your main calls it, the subVI window opens up. You do stuff, click the DONE button, and it disappears, and the main is up front again. (Make sure your subVI is MODAL if you do this).
    You can use the VI SERVER to load the VI, given a path to it. You can set the subVI to "Open Front Panel when Loaded", or you can set FRONT PANEL.OPEN to TRUE when you want it to appear, and FALSE when you want it to go away.
    You can make a subpanel on your main, and have the subVI inserted into that.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • How can I hide a subvi in the hierarchy window?

    I want to hide a subvi of my top level vi in the hierarchy window. I know by calling it dynamically that it won't be in the hierarchy window until it is called but I want to keep it in the hierarchy. I just don't want to display it in the hierarchy window when a user looks at it. Kinda like an easter egg or like the multitude of vi's that NI hides. Can anyone give me a solution?
    BJD1613
    Lead Test Tools Development Engineer
    Philips Respironics
    Certified LV Architect / Instructor

    This is from the 1/14/03 info-labview digest:
    Hi, Tim
    As you know, to distinguish between public and private methods, GOOP uses the LLB-top-level flag. Public methods are top-level and private method are non-top level.
    But GOOP does one more thing with private method VIs. They are checked as "System VI", a property which make them invisible in the VI hierarchy and in the "VIs in Memory" application property, unless their panels are open. You can upgrade to the new GOOP wizard, downloadable from http://www.endevo.com/default.asp?lang=eng. It doesn't check VIs as system VIs. It is compatible backwards, so perhaps you can "repair" your existing GOOP objects if you use the new wizard, but I'm not sure. S
    ince you can store objects in both directories and in LLBs with the new wizard, perhaps it helps to convert from LLB to directory and back to LLB again.
    If the above doesn't work, you can use these two VIs to uncheck the "System VI" property:
    1) C:\PROGRAM\National Instruments\LabVIEW 6\project\goopwiz.llb\Hide System VIs.vi
    2) C:\PROGRAM\National Instruments\LabVIEW 6\vi.lib\utility\libraryn.llb\Librarian List.vi
    Use (2) to create a list of VIs in your GOOP object LLB. Then loop through all the VIs and use (1) to uncheck the property.
    If you want to read more about this, you can search for the string "Invisible VI ?!?" in http://www.searchview.net/, during 2001, in the info-labview archives. Then read the postings with the subject "Invisible VI ?!?".
    Hope this was helpful!
    Andreas

  • How can I terminate a subVI using dynamic events?

    I've got a VI which can bring up a user-interactive subVI.  The subVI front panel is visible and has event structure associated with it.
    I'd like to programmatically terminate the subVI from an action on the parent VI.  Can I do this through dynamically registered events, or user events, somehow?
    What I'm trying to do is implement a LabView-like Graphical Control Palette (shortcut menus).  The user should be able to kill the subVI (a menu-like VI) by clicking on the main VI.
    My not-so-good approach is to have a short timeout to the subVI and read the value of a control reference which is passed from the main VI.  I'd rather not have to use the timeout for this, though.
    Thanks,
    Tom
    LabView 8.2
    Full Development System.

    Create a user event and use it. You can see an example here.
    Try to take over the world!

  • How can I tell which subVI changed?

    Sometimes I open a VI, and upon opening (i.e., before I do anything), it says the VI has changed.
    If I use File/Revert, it still opens up that way.
    In such cases, LabVIEW also asks if I want to save changes when I close it.
    When I look at the changes using File/VI Properties... under Category: General, by clicking on the "Current Changes" button, it says:
    VI recompiled
    SubVI call(s) modified.
    I understand that this means something changed in a subVI, but I don't always know what changes prompted this, and I would like to be able to investigate further.
    What can I do to determine which subVI changed, so that I can investigate if it might adversely impact my VI?

    > When I look at the changes using File/VI Properties... under Category:
    > General, by clicking on the "Current Changes" button, it says:
    > VI recompiled
    > SubVI call(s) modified.
    >
    > I understand that this means something changed in a subVI, but I don't
    > always know what changes prompted this, and I would like to be able to
    > investigate further.
    One easy way to investigate it is to click on ring at the top of the
    Explain Changes dialog. This will list the other VIs with changes.
    One of these is the subVI, and selecting it from the ring will list its
    changes. It is likely a version or platform change.
    Greg McKaskle

  • How can I call the SubVI like a child window one or more times in the front panel of my main VI ? See the example atached...

    I would like to create a aplication where I call dynamically the same SubVi many times in the front panel of my main VI ... I saw this kind of programmation in other languages like Delphi, C++ Builder and Visual Basic.
    For explanation: I have 10 channels to read in the list, but I would like to see only 3 channels ... Then I will click in the channels choosed of my list and will open the same SubVI 3 times, where each one will show the individual channel.
    Thanks for attention...
    Cleber
    Attachments:
    Opening SubVi many times.jpg ‏118 KB

    TiTou certainly pointed you down the right path... For a few more details, refer to my post to this thread:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=141811
    You could use the same technique, except instead of opening the clone's front panel, use the VI reference you have to it to poke it into a subpanel. Please note: I have never actually tried building a VI with more than one subpanel on its front panel, but it should work. Also you will not want to close the VI references because you will need them to stop the clones when you shutdown your application.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How can I have two devices with separate iTunes accounts on the same computer without sharing libraries?

    I have an iPhone 3s and my sister has an iPhone 3.  We use them only as iPods.  We each have our own iTunes account, but we have to share a computer.  How can we both syn our devices without sharing our music and app libraries?

    The most reliable way would be to set up individual user accounts in WIndows. Then each of your iTunes libraries will be completely separate.
    Regards.

Maybe you are looking for

  • Error [..\..\src\Command.cpp-2519]

    Hi, when I try to apply any of the presets to my source files I get this error. For instance, I can't use "MPEG2 1080p 24fps High Quality" to render my videos. I heard it might have something to do with my processor. Hope not. Help! Thanks.

  • Google search keeps doing a custom search using "Özel Arama"... HOW do i return it to default search???

    When I click in the search area and choose a google search (taskbar), it returns with a bogus "Özel Arama" The url is: http://www.google.com/cse?cx=partner-pub-9588033570232632:rhmyra-cwbb&q=%22%C3%96zel+Arama%22+%22is+pissing+me+off%22&ie=utf-8&oe=u

  • Fillable Forms Frustration

    I created a survey form in Adobe Designer and added the "Submit by Email" button. It asks you to put in the email address you want your form to be sent to. I put in mailto:[email protected] as it was suggested. However, it doesn't work. When I fill i

  • Web Page with shapes...

    Dear web mates, sometimes I have seen some "pop-ups" which are built in Flash. However these ones have SHAPES.. I mean they are not contained in a browser, but they have, for example an Animal,Object or any other Shape, also they can be dragged on th

  • Logo on left side of ALV Header

    Is it possible to put a logo at left side of ALV Header? if so how?