Jump to content

Passing data from one local variable to another Vi


Recommended Posts

The easiest way is to use a global.

Drop a global from the structures palette on the diagram and double click it to open a Globals VI. All controls in these VIs can be accessed through the globals. Create the control you need, wire the data into it in one loop and copy the global to the other VI and read it there. You should note that using globals can be dangerous if not used properly, because you can easily get race conditions.

Another global option you can look for is LV2 style globals, which are somewhat safer in the race conditions department.

You should look up some LV tutorials which explain these things.

Link to comment
Hi Freinds,

I want to acess the data of one Vi (which is local to that loop) in the other loop ,How can i do this ?

My both Vis are running in parellal.

Harsh

5826[/snapback]

Make your choice:

1. Function global

2. Queue

3. Control reference

4. Local variable

5. Global variable

Link to comment
  • 1 month later...

Globals = BAD code in LV

Use LV2 style! Do not get into the practice of using globals. There is no need for them. You'll hate yourself when you have to debug your own code.

Check out this simple example of an LV2 style global.

Launch Master then notice how slave will close when master closes. And master will not close with slave.

Basically an LV2 style global is nothing but an uninitialized shift register.

If you need more info just search around. There is alot of info on this style of global throughout the web and even on NIs site.

Download File:post-3219-1129607862.zip

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
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.