JCB30304 Data Acquisition System: Chapter 3: Structures
JCB30304 Data Acquisition System: Chapter 3: Structures
CHAPTER 3: STRUCTURES
CHAPTER 3 STRUCTURES
LOOPS SEQUENCES
CASE
STRUCTURES
4 LOCAL
VARIABLES
"A positive attitude awakens inner strength, energy, motivation and initiative."
SEQUENCES
The only difference between a good day and a bad day is your attitude. ~Dennis S. Brown
Sequence Structures
But in LabVIEW, you can’t always predict the order
of execution. For example, in this code, which
function executes first: the Subtract or the Greater
Than?
A local variable
icon for the object
appears on the
block diagram
Local Variables
Another way is to select the Local Variable from the Structures palette.
Create the front panel and select a local variable from the Functions
palette and place it on the block diagram. The local variable node, shown
as follows, is not yet associated with a control or indicator.
To associate a local variable with a control or indicator, right-click the local
variable node and select Select Item from the shortcut menu.
LabVIEW uses owned labels to associate local variables with front panel
objects, so label the front panel controls and indicators with descriptive
owned labels.
Owned label becomes variable name and select whether you want to read
or write to the local variable.
Local Variables
The expanded shortcut menu lists all the front panel
objects that have owned labels as shown in Figure.
Global Variables
Use global variables to access and pass data among several VIs
that run simultaneously.
When you create a global variable, LabVIEW automatically creates
a special global VI, which has a front panel but no block diagram.
Add controls and indicators to the front panel of the global VI to
define the data types of the global variables it contains.
In effect, this front panel is a container from which several VIs can
access data.
Global Variables
Select a global variable, shown as follows, from the Functions palette
and place it on the block diagram.
Double-click the global variable node to display the front panel of
the global VI. Place controls and indicators on this front panel the
same way you do on a standard front panel.
LabVIEW uses owned labels to identify global variables, so label
the front panel controls and indicators with descriptive owned labels.
You can create several single global VIs, each with one front panel
object, or if you want to group similar variables together, you can
create one global VI with multiple front panel objects.
Global Variables
After you finish placing objects on the global VI front panel, save it
and return to the block diagram of the original VI. You must then
select the object in the global VI that you want to access. Click the
global variable node and select a front panel object from the
shortcut menu. The shortcut menu lists all the front panel objects in the
global VI that have owned labels. You also can right-click the global
variable node and select a front panel object from the Select Item
shortcut menu.
If you create a copy of a global variable node, LabVIEW associates
the new global variable node with the global VI of the variable
node you copy it from.
EXERSICE AND EXAMPLE
THANK YOU…