0% found this document useful (0 votes)
5 views

SoftwareGuide_LabVIEW

The document is a quick guide to programming in LabVIEW, detailing the development environment, including the Front Panel and Block Diagram, as well as the use of Controls and Indicators for input and output. It covers mathematical operations, conditional statements, loops, arrays, SubVIs, and file I/O processes. Each section provides information on how to implement these features within LabVIEW to create functional programs.

Uploaded by

basezero22
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

SoftwareGuide_LabVIEW

The document is a quick guide to programming in LabVIEW, detailing the development environment, including the Front Panel and Block Diagram, as well as the use of Controls and Indicators for input and output. It covers mathematical operations, conditional statements, loops, arrays, SubVIs, and file I/O processes. Each section provides information on how to implement these features within LabVIEW to create functional programs.

Uploaded by

basezero22
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ENED 1100 University of Cincinnati

ENED 1120 Department of Engineering Education

Quick Guide to Programming in LabVIEW®

LabVIEW Development Environment:


In LabVIEW, you develop your programs using two windows: the Front Panel and the Block
Diagram. The Front Panel is where you define the inputs and outputs to your program and
specifies how the user will interact with it. The Block Diagram is where you implement the
logical functionality to determines how the inputs and converted into outputs by connecting VI
blocks in an appropriate sequence to implement the desired functionality.

Front Panel Block Diagram


There are two additional windows that are used to create LabVIEW programs: the Controls
Palette and the Functions Palette. The Controls Palette is where you go to find all of the objects
you can place on your Front Panel to allow input to and output from your program. The
Functions Palette is where you can find all of the VIs and structural elements to implement the
logic for your program.

Controls Palette Functions Palette

1 Last Edited: 2019-01-09


ENED 1100 University of Cincinnati
ENED 1120 Department of Engineering Education
Input Statements:
Inputs in LabVIEW are accomplished by placing Controls on the Front Panel. There are
different types of Controls that allow you to enter different types of information (numeric, string,
Boolean, etc.). All Controls can be accessed via the Controls Palette by selecting the type of data
you wish to enter, then selecting type of Control you wish to use. You place the Control 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 Control.
Controls placed on the Front Panel are automatically linked to the Block Diagram. You can
identify an item on the Block Diagram as a Control because it will only have one output
terminal, indicating that it takes a value from somewhere and makes it available to your program.

Value
Thick outer entered on
border Front Panel

Controls Palette Control Object in Block Diagram

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

Controls Palette Indicator Object in Block Diagram

2 Last Edited: 2019-01-09


ENED 1100 University of Cincinnati
ENED 1120 Department of Engineering Education
Mathematical Statements:
There are two primary options for implementing mathematical operations within LabVIEW:
using discrete mathematical VI blocks or using the Formula VI block. Individual mathematical
blocks can be found at the following two locations on the Functions Palette:
• Programming\Numeric → basic and commonly used mathematical operators
• Mathematics → complex mathematical operators
The order in which operations are performed depends on the order in which the objects are
linked together.

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.

Configure Formula Window Formula VI Block

3 Last Edited: 2019-01-09


ENED 1100 University of Cincinnati
ENED 1120 Department of Engineering Education
Conditional Statements:
Conditional logic statements in LabVIEW are created using traditional logical operators (AND,
OR, Greater Than, Equal To, etc.). Relational logic operators can be found in the
Programming\Boolean area of the Functions Palette and the Comparative logic operators can be
found in the Programming\Comparison area.
Logical statements are constructed by linking together relational and comparative logic operators
together in a specific order to implement the desired logic.

Relational Logic Operators Comparative Logic Operators


Operator LabVIEW VI Operator LabVIEW VI
AND Greater Than
OR Greater Than or Equal to
NOT Less Than
Less Than or Equal to
Equal to
No Equal to

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

Case select input

Case Structure Block

4 Last Edited: 2019-01-09


ENED 1100 University of Cincinnati
ENED 1120 Department of Engineering Education

Boolean Case Structure Numeric Case Structure

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

For Loop Block

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

5 Last Edited: 2019-01-09


ENED 1100 University of Cincinnati
ENED 1120 Department of Engineering Education
Arrays:
Arrays are created by first placing either an Array Container on the Front Panel (to create an
Array Control or Array Indicator) or an Array Constant on the Block Diagram, then placing an
item of the desired data type inside the Array container. For instance, if you want an array of
numbers, you would place either a Numeric Control, Numeric Indicator, or Numeric Constant
inside the array. Array containers can be found in the Modern\Array, Matrix, & Cluster portion
of the Controls Palette and Array Constants can be found in the Programming\Array portion of
the Functions Palette. Arrays can be manipulated and indexed using appropriate VIs from the
Programming\Array area of the Functions Palette. Arrays can also be indexed and created using
an Indexed Tunnel on a looping structure.

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.

6 Last Edited: 2019-01-09


ENED 1100 University of Cincinnati
ENED 1120 Department of Engineering Education

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

Read Data from File

Write Data to File

7 Last Edited: 2019-01-09

You might also like