LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Global Variables in TS40 OI

I noticed that the LabVIEW version of the TestStand 4.0 Operator Interface makes extensive use of Global Variables.  I'm usually not a proponent of them, but man did it clean things up.  The block diagram is soooo much easier to look at and work with.  I do have a question about these Globals.  In the case of the OI (above) they placed quite a few references/controls on the front panel of Full OI - Control Globals.vi.  What I'm wondering is... When you create your first global variable and double click it, it opens up a blank front panel, to which you add your control(s), references, etc.  If you drop down another global variable, how do you associate it with the VI of the first global you created (assuming that VI has the control/reference you're wanting to associate with)?  OR, is it custom to just copy/paste from a global variable that was made from the original, and from its drop down, pick the desired reference?
0 Kudos
Message 1 of 6
(3,165 Views)
mrbean,

the sentence you stated after "OR" is ok. you can do it like that. But there is another way too:
Global variables in LV are stored in a "special type of vi" wich does not contain a blockdiagram (so no functions except datastorage). So you can create a new global "reference" by selecting the global vi and the choose the global vi. After that, just select the variable from the dropdown...
But please be aware that variables of this kind are exposed to race conditions, so be careful about what you do with them.....

hope this helps,
Norbert B.
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 6
(3,163 Views)

I'm having a slight chicken-egg situation (see attached picture)

If in my TopLevel VI I want to add a couple of TestStand UI ExpressionEdit Controls (One to eventually display the description attached to a sequence File and one for the description of a sub-sequence), how do I do that.  I started by adding these two controls to the Front Panel of TopLevel VI, then I added a Global in Top Level, but when I double click and go to Full OI - Control Globals.vi, I'm not sure how to link the two.

0 Kudos
Message 3 of 6
(3,148 Views)
From Creating Global Variables in the Labview help files:

Complete the following steps to use a global variable in other VIs.

  1. Click the Select a VI icon on the Functions palette, navigate to the directory where you saved the global VI, and double-click the VI.
  2. Place the global variable on the block diagram. By default, the global variable is associated with the first front panel object with an owned label you placed in the global VI.
  3. Right-click the global variable node you placed on the block diagram and select a front panel object from the Select Item shortcut menu to associate the global variable with the data from another front panel object.

That, or if you already have a variable from that global, copy and paste it.  Then right click to select another variable from that global VI to change it to what you want.

Message Edited by Ravens Fan on 08-23-2007 11:07 PM

Message 4 of 6
(3,144 Views)
I'm still a bit confused.  In the Help, it starts with dropping down a global variable, dbl-clicking it, adding controls & indicators to the front panel of the Global VI.
 
However, in the case of the Top Level VI, it seems these steps weren't performed quite as outlined.  Take the ListBar or Entry Point 2 Button, (see previous attachment) - on the Control Globals.vi front panel, the controls on the front panel are Automation Refnums, not true controls in the sense that I wouldn't actually manipulate the Listbar or Entry Point front here.  So, how do I duplicate these types of activities for (1) controls that already exist on the Top Level VI, (2) new controls I want to add.
0 Kudos
Message 5 of 6
(3,114 Views)


@mrbean wrote:
[...]In the Help, it starts with dropping down a global variable, dbl-clicking it, adding ,[...]



That's the way to create a complete new global, not using an existing one. As stated before, if you want to use an existing global, you have to drag and drop the icon of the global variable VI into the blockdiagram of your VI, not the control you want to use.....




@mrbean wrote:
[...]So, how do I duplicate these types of activities for (1) controls that already exist on the Top Level VI, (2) new controls I want to add.




See (1) above, and regarding (2), you have two choices:
a) You can have as many global variable "vis" as you like. So you can create a new global variable vi for really every global variable you want to add...
b) Use an existing global variable VI. Just add the control you want to use to the global variable VI, use the mechanics already explained to "transfer" the variable to your sourcecode and then select the control the variable should refer to.


Since you seem to have some difficulties to use the global just by descriptions in this post (the descriptions are correct and imho understandable), you should really ponder to attend a LV-training class....



hope this helps,

Norbert B.
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 6
(3,102 Views)