SoftwareGuide_LabVIEW
SoftwareGuide_LabVIEW
Value
Thick outer entered on
border Front Panel
Output Statements:
Outputs in LabVIEW are accomplished by placing Indicators on the Front Panel. There are
different types of Indicators that allow you to display different types of information (numeric,
string, Boolean, etc.). All Indicators can be accessed via the Controls Palette by selecting the
type of data you wish to display, then selecting type of Indicator you wish to use. You place the
Indicator on the Front Panel by simply left clicking on the item in the Controls Palette followed
by left clicking at the location on your Front Panel where you would like to place the Indicator.
Indicators placed on the Front Panel are automatically linked to the Block Diagram. You can
identify an item on the Block Diagram as an Indicator because it will only have one input
terminal, indicating that it takes a value from your program.
Value to be
Thin outer
displayed on
border
Front Panel
The Formula block can be found at the following location on the Functions Palette:
• Express\Arithmetic & Comparison
When the Formula block is placed on the Block Diagram, the following Configure Formula
window appears. This window allows you to type in a formula, using up to 8 input values from
your program and returning a single computed value.
Conditional Structures:
The primary method for implementing conditional flow within a LabVIEW program is through
the Case Structure, which can be found at the Programming\Structures location of the Functions
Palette. By default, the Case Structure allows for a Boolean input, which determines whether a
true case or a false case is executed when the program is run. However, other data types can be
connected to the Case Structure to allow for selection from more than two cases. Additional
cases can be added to the Case Structure by right clicking on the case view at the top and
selecting Add Case After or Add Case Before.
Case view
For Loops:
For loops are implemented using the For Loop block, which can be found at the
Programming\Structures location of the Functions Palette. The For Loop accepts an integer
value to the input at the top left of the loop, which determines how many times the loop will
repeat. The i terminal in the bottom left provides the count of iteration of the loop, starting at 0.
Number of
Iterations Input
Count of
Iterations Output
While Loops:
While loops are implemented using the While Loop block, which can be found at the
Programming\Structures location of the Functions Palette. The While Loop has an i terminal
that provides the count of iterations, just like the For Loop. Instead of a number of iterations
input, it has a conditional input that can be set to either stop when it receives a true or continue
when it receives a true. This allows the While Loop to continue to repeat until some event
occurs.
Count of Count of
Iterations Output Iterations Output
Stop terminal Stop terminal
While Loop with Stop Terminal Set to While Loop with Stop Terminal Set to
Stop If True Continue If True
Multidimensional arrays can be created by right clicking on the array and selecting “Add
Dimension.”
Array Container Placed Inside Produces
Front Panel
Block Diagram
SubVIs:
SubVIs are LabVIEW’s answer to functions, which are common in traditional text-based
languages. SubVIs allow you to take a LabVIEW VI and use it inside another VI by creating a
unique icon for the VI and linking its inputs and outputs to terminals. Inputs and outputs are
linked by clicking on locations on the Connector Pane in the upper right corner of the Front
Panel and clicking on a Control or Indicator on the Front Panel. The VI icon is edited by right
clicking on the VI icon in the upper right corner of the Front Panel and selecting Edit Icon.
You can import your SubVI into another VI by selecting “Select a VI…” on the Functions
Palette and selecting the VI file for your SubVI.
Connector Pane
VI Icon Editor
SubVI Created by Linking Controls and SubVI Imported into Second VI and Wired
Indicators to Connector Pane into Program
File I/O:
There are three basic steps to either read from or write to a file in LabVIEW:
• Open the file
• Read/Write data
• Close the file
A few notes about File I/O in LabVIEW:
• All data read in or written out will be of type string
• You can toggle reading characters or lines by right clicking on the Read from Text File
VI and unchecking/checking the option for Read Lines
• In order to have multiple lines in a written file, create and array of strings where each
entry in the array is a different line