How can Global variables can be shared in Subvi?

I have a question about global variables. not found an answer in the Forum.

I want to share a few global variables in the different Subvi: starting Subvi first hand.

define variables, then in second vi, use these variables.

In my test, if I run LabVIEW, everything is ok. If building an exe, the first sub - VI

cannot be exited. If the output, the value of global variabels is deleted.  I don't know why?

Can I use like this? Please help me.

Thank you.

attached is my main application. For the release of sub - VI, just call FP. Close.

The way I underrstand problem:

There is a main VI (main.vi) that will successively two different screws through a VI reference.

Let's call them A.i and B.vi. The two access to the same global variable.

The main VI does not have the global variable.

At first is short, then closes. B later runs and is expected to access the global variable with the data left by an earlier. I haven't explored it, but I guess that once A ends, the global variable also leaves in memory, forgetting everything

My suggestion is to place an instance of the global variable in the main VI, forcing them to remain in memory as long as the main VI is running. Apparenlty, this action solved the problem.

mmm2006 wrote:

Can I update a global variable in main vi? There are a lot of adjustment, and I don't want to display them.

I guess it will be sufficient to place the global variable in the main VI to keep in memory. There is no need to read or view its content. Another solution might be to specify the global variable as 'start VI "? I have not tried.

These are just speculation, because I almost never use globals so my experience is limited. I probably would have A.i write the data to a file B.vi later access, for example.

Tags: NI Software

Similar Questions

  • How can I use a Subvi in the background when a sequence is running in the main VI

    I want to do this

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

    My problem is that the Subvi #1 does not run when I press the button. The sequence works well. How can I run the sequence and the Subvi in the simultaneously?

    Hi Hugo,.

    When the sequence and your Subvi have not all dependencies given, they will work in parallel...

    Mind to attach some code or images of block diagram?

  • How can link shared to me by a friend, I tell if I'm sure?

    An old friend of mine, that I have not talked to long sent me a link, it has been shortened with google... like for example goo.gl/r9494randomletters94fjrjg/skypeID = MyName, then I clicked it and it was an advertisement. This person is very good with computers for them to get hacked is therefore quite surprising. I now wonder if in some way I had downloaded anything or how to protect myself?

    I work from home to a lot of my contacts are working so I would hate for this to spread to so many people.

    So far I have not seen all messages out, I erased my browser history and everything using the CCleaner and I have avast did a scan. Is there anything else that you might suggest?

    Jesper592 wrote:

    I had the opposite problem. My account send these messages to almost all my contacts list. At least I can tell you that I was not aware of the messages sent, so there must be something wrong with the computer of shippers. I'll change the passwords I use regularly and scan my computer, don't know what else to do at the moment, pending responses from the forums.

    Hi, Jesper592,

    Please see this continuous topic (thread) for more information:

    http://community.Skype.com/T5/security-privacy-trust-and/spoofed-message-from-contact/TD-p/4026578

    Kind regards

    Elaine

    __________________________________________________________________________________________________
    Your question has been answered? Please click on the link to accept as a Solutionfor everyone can quickly find what works! As a post or want to say, 'Thank You ' -? Click on the button of congratulations!
    Reliable information: Brian Krebs: 3 basic rules for online safety

  • How the Global Variable in the window of the FP?



  • global variables shared between several targets of RT

    Hello

    I'm looking for some information about variables shared between RT communication network.

    Scenario: a PXI 'master' and several 'slave' PXIs running that screw RT. data is available in the form of a cluster of definied type on each slave PXIs (inside a non deterministic while loop). I guess I create global variables of network shared for each PXI slaves. A variable for each slave. I only write data in these variables in one place (above mentioned, while loops), on the PXIs slave. I need to read that data in a way with loss (I just need that value the most recent, as tags) from the master PXI.

    Question: can I simply use "network shared variable" settings by default? I mean, I do not enable the option RT FIFO (single element), because I think that for a cluster that is a no go in the case of RT (variable length)?

    What do you think? Or would you have better idea how to share data between slaves and masters RT targets (I do not have deterministic/losless transmissions, only these last values)?

    I think that the way to proceed is to use the shared Variable Aliasing/binding - they allow you to 'link' shared variables in any of the multiple targets. https://forums.ni.com/t5/LabVIEW/Bind-Alias-shared-variable-to-scan-engine-variable/td-p/3290043.

    You can also use shared variables of programming access to access running on another target: http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/usingdynvarapi/

    With regard to the other methods - you could always disseminate data via UDP multicast (or with a TCP/IP connection manager).

  • How can I specify relative path to file Subvi to screw?

    I use LabVIEW 2009 Service Pack 1.

    SubVIs are referenced by absolute paths, so when I move to a new folder I may need to adjust their paths again.

    How can I make a Subvi make reference to a relative path that I do not have set his path after you move the screw in a new folder or a new player?

    I think that the SubVIs are referenced internally by relative paths. Once you move the whole project in a new place, he should find everything in the new relative paths.

    Where have you encountered problems?

  • How can I create a shared variable to store the data of 2D image?

    I would like to store as a shared variable 2D image data, but there is no data type to do! How can I do?

    You will need to use the picture to Pixmap VI to get a set of image data that you use with a shared variable. Take a look at the other screw in the photo on the block diagram features palette.

  • LV/CVI how can I access variables 'unique process' shared by his name?

    LabviewCVI 9.0, how can I access a variable shared 'unique process' by his name?

    Hi jenstl,

    If you are referring to a LabVIEW shared variable project unique process, then I don't think that you can access it (directly) from the CVI. As its name suggests, the variable is related to a single process, i.e., LabVIEW.

    If you want to share a variable between LabVIEW and CVI, you could try a shared Variable of published network. Not only is it really easy to convert a process unique to a network shared Variable shared Variable, but there is also an example on their share between LabVIEW and CVI.

    Community: CVI and LabVIEW shared Variables published network

    For more information on Variables shared:

    Developer Zone tutorial: use the LabVIEW shared Variable

    Also, I originally said that you cannot use a single shared Variable directly from the ICB process. I added the 'directly' in there because in all likelihood, you might happen to a (potentially convoluted) workaround involving the use of ActiveX to call the LabVIEW ActiveX Server and communicate to the Variable shared in this way.

    Hope that helps!

  • How can I dynamically select the shared Variable API programming data type?

    I am trying to create a configuration of open connections of variable shared using the programming API. It seems to me that the cleanest way to do would be to put one "open and check" routine in a loop, then call it for each variable in the library.

    The question that I am running is that I have different types of data in my library (to help a server Modbus i/o and data types 'boolean' and 'single' in my library.) How can I dynamically select the data type of the shared variable API?

    See the attached snipit.

    Thank you

    What I ended up doing was doing a Subvi to open, read, write, and close each data type, I use the packaged in 4 polymorphic SubVIs (polymorphic Open, read, etc...)

    Now all I have to do I drop in the polymorphic Subvi and it switches automatically to the appropriate data type

  • How can I create a function using variables TestStand and call from Meadow step Expression?

    In one sequence, I have dozens of prior Expressions, which are almost the same thing, like this...

    Locals.tagID = (Parameters.singlePhaseEnabled? ('L': "D") & Str (Locals.phase) & "006".

    .. and the only thing different is this three-digit string in the end ("006" may vary). How can I write a function that I can call from Meadow step Expression then it should look like this? ...

    Locals.tagID = MyNewFunction("006")

    You can not write custom expressions for commands.

    That being said, there are two options:

    • Create a sous-suite with a single step. Use a setting of the sequence as "function parameter.

    • Create a step type custom including a lower level module that implements the function. Add a step edit to allow the user to the steptype graciously change the setting.

    • Store the variable setting in a local global variable / file and change the value in each step. This will, at least, keep the same 'function' for each step.

    Norbert

  • How can I protect some files of the icloud sharing in the sierra?

    How can I protect certain files from the desktop to icloud and sharing documents in the sierra?  Some of my data is private and I don't want it in the cloud.

    Do not put them in the Documents folder or on the desktop.

  • How can I download photos in an album shared to a pc?

    How can I download photos and videos from a shared PC album?

    You will need to save these items to your camera first. You cannot import photos or videos on a computer from anywhere except the film.

  • How can I recharge my personal credit card, being a member of a family shared account?

    How can I recharge my personal credit card, being a member of a family shared account?

    You cannot, with the family share that only cards of the Organizer will be used (if you have a balance on your account that will be used for your purchases, if that card organizer will be charged)

  • How can I get rid of the AddThis Social Bookmarking sharing button widget?

    When I click on the "Sharing" tab on a Web site to send a page by e-mail, the widget AddThis Social Bookmarking sharing button stupid page with no way to stop. How can I get rid of this terrible page and make sure that it never comes back?

    You can try to disable pop-ups in Firefox: https://support.mozilla.org/en-US/kb/pop-blocker-settings-exceptions-troubleshooting?redirectlocale=en-US & redirectslug = popup + blocker #w_pop-up-blocker-settings.

    If that's not enough, you must block the AddThis functionality with the addition of NoScript (AdBlockPlus, perhaps?).

    If you just want to share the link to the page, use the option from file menu E-mail link (if you do not want to manually, copy and paste this link into your address bar).

  • How can I see history in-app purchase for members of the family sharing?

    I use the sharing of family and try to view the purchase history of my family members.  I know that I can tap into "updates" and discover complete an individual family members buying it in the App Store (on my phone).  But I don't see a way of watching the in-app purchases made by these people.  App iTunes on my computer, the purchase history displays only purchases made by my personal Apple ID.

    How can I view the purchase history WHOLE (including in-app purchases) for members of the family share?

    You can see total buying an iTunes via the computer iTunes account: see your purchase history in iTunes on Mac or PC - Apple Support store

    You can also view past purchases for 90 days by http://reportaproblem.apple.com

    (What shows in the updates is not necessarily a complete list of bought/downloaded apps - applications that have been removed from the store will not show, more than apps that the person has hidden from the cloud not show incompatible applications.)

Maybe you are looking for