Sie sind auf Seite 1von 15

Pete Attayek

Global variables are almost identical to local


variables and can be used in the exact same
situations
A global variable is used to pass information
from one VI to another

The global variables is


located under structures

Once a global variable


is placed on the block
diagram of a VI, double
click on it to open the
front panel of the Global
variable
The global variable only
has a front panel with no
block diagram

Save and close the global


variable when finished
*if a certain data type is needed, the indicator representation
must be changed within the Global Variable VI

In order to select a Global


Variable that has already
been created, right click
on the block diagram and
select select a VI

Locate the created Global


Variable and place it on the
block diagram

All information within a Global Variable will


be saved only as long as a program is open that
uses the variable
Once all programs are closed that use the
variable, the information stored within it is
cleared
If you want to save information in a Global
Variable, you must open the Global Variables
front panel and set the information within to
default before closing all programs.

Multiple indicators can be


added to a Global Variable

Click on the global variable


to select the indicator wanted

It is good practice to put all


indicator variables needed
in one global variable in order
to limit the number of extra
VIs

Complex access patterns can create race


condition where the global variable is being
accessed by multiple processes at the same
time
LabVIEW is a parallel programming language
Example: error log
Can fix by adding a SubVI or creative programming

Complex datatypes or large arrays can cause


performance problems (slow the program to a
crawl)

Das könnte Ihnen auch gefallen