Documente Academic
Documente Profesional
Documente Cultură
• For example, if you pass the data using a wire, the loops are no longer
parallel.
Sharing Data:
• In the multiple sine wave example, if you want to share a single stop button
between the loops.
• The Boolean control is a data input to both loops, therefore the Loop
Control terminal is read only once, before either While Loop begins
executing.
• If False is passed to the loops, the While Loops run indefinitely. Turning
off the switch does not stop the VI because the switch is not read during the
iteration of either loop. (Incorrect Method)
Sharing Data:
• Move the Loop Control terminal inside Loop 1 so that it is read in each
iteration of Loop 1.
• Although Loop 1 terminates properly, Loop 2 can not execute until it
receives all its data inputs.
• Loop 1 does not pass data out of the loop until the loop stops, so Loop 2
must wait for the final value of the Loop Control, available only after Loop
1 finishes.
• Therefore, the loops do not execute in parallel. Also, Loop 2 executes for
only one iteration (Incorrect Method).
Sharing Data: Solution 1
• If you could read the stop button from a file, you would no longer have a
dataflow dependency between the loops, as each loop can independently
access the file.
• A local variable icon for the object appears on the block diagram.
• You also can select a local variable from the Functions palette and place it on the
block diagram.
• To associate this local variable with a control or indicator, right-click the local
variable node and select >> Select Item from the shortcut menu. The expanded
shortcut menu lists all the front panel objects that have owned labels.
Reading and Writing to Variables
• After you create a local or global variable, you can read data
from a variable or write data to it.
• Use a global variable to terminate both loops with a single Boolean control.
Creating Global Variables
• For every global variable, LabVIEW creates a special global VI, which has a front
panel but no block diagram.
• Add controls and indicators to this front panel to define the data types of the global
variables it contains. This front panel is a container, which can be accessed by
several VIs.
1. Select a global variable from the Functions palette and place it on the block
diagram.
2. Double-click the global variable node to display the front panel of the global VI.
Creating Global Variables
3. Place controls and indicators on this front panel the same way you do on
a standard front panel.
4. Save it an name.vi and return to the block diagram of the original VI.
5. Select the object in the global VI that you want to access. Right-click the
global variable node and select a front panel object from the Select Item
shortcut menu. The shortcut menu lists all the front panel objects in the
global VI that have owned labels.
Creating Global Variables
If you want to use this global variable in other VIs.
• Select Select a VI from the Functions palette.