LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

open variable connection function

I'm trying to understand when I would use the Open Variable Connection Function (in the Data Communication :: Shared Variable pallete in LV2009).  I currently have a LabVIEW project where I have a couple of shared variables defined.  I have a sort of client/server situation, and in those VIs I click and drag (from the project) the shared variable to those VIs and write/read them as necessary.  I then saw this Shared Variable pallete, and was not sure how that would help me (if at all).  I'm just looking for a better understanding on how to use the VIs in that palette.
0 Kudos
Message 1 of 4
(3,158 Views)

Hi mrbean,

 

The Shared Variable pallete that you have found is useful in certain cases, namely if you would like to create a large number of shared variables programmatically, or if you would like to be able to programmatically change which shared variable you write to.  Using the LabVIEW Shared Variable details some of these use cases near the middle of the document (search for programmatic access) to quickly jump there. 

 

Hope this helps!

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 2 of 4
(3,142 Views)

Hi, 

 

Thanks for the description but I am still not able to understand what does  "open variable connection" or "close variable connection" does. It seems "write" or "read" alone will work. Plus, I can construct illogical block like this:

 

Example.png

0 Kudos
Message 3 of 4
(2,825 Views)

Opening takes ms, reading takes usecs. To prevent the first call of read or write from taking an unusually long amount of time, you can open everything up front and close everything down at the end -- this can be especially bad in time critical code.

 

The API also helps keep  your code organized and understandable: to put it simply, you dont *want* to make illogical code like that, so you follow the open read/write close pattern instead.

Message 4 of 4
(2,810 Views)