SlideShare a Scribd company logo
1 of 20
LabVIEW Basics
Based on LabVIEW 2011
Student Edition
Virtual instruments
LabVIEW works on a data flow model in which information within a
LabVIEW program, called a virtual instrument (VI), flows from data
sources to data sinks connected by wires. The data can be modified as
it is passed from source to sink by other VIs. LabVIEW supports two
types of VIs--internal VIs and user created VIs. Internal VIs are
packaged with LabVIEW and perform simple functions like adding
numbers or opening files. User created VIs consist of both a graphical
user interface called the front panel and a code pipeline called the
block diagram. These VIs tend to be much more complex considering
that they can contain any number of internal or user created VIs in an
endless number of configurations.
Virtual instruments - cont.
Consider a simplistic LabVIEW program which takes a single number
from the user and multiplies it by 10. Analyzing such a program reveals
the following data flow structure:
1. The user inputs a number (data source).
2. The program executes an addition VI taking the user's number
and the number 10 as its inputs (data sink).
3. The addition VI returns the result of the addition operation
(data source).
4. The result is displayed on the screen (data sink).
While this example is simplistic, it exemplifies how all LabVIEW VIs
work. Data always flows from data sources to data sinks according to
the block diagram, much like how water flows through a pipe.
Front Panel
Every user created VI has a front panel that contains the graphical
interface with which a user interacts. The front panel can house
various graphical objects ranging from simple buttons to complex
graphs.
Various options are
available for changing the
look and feel of the
objects on the front panel
to match the needs of any
application.
Block diagram
Nearly every VI has a block diagram containing some kind of program
logic that serves to modify data as it flows from sources to sinks. The
block diagram houses a pipeline structure of sources, sinks, VIs, and
structures wired together in order to define this program logic. Most
importantly, every data source and sink from the front panel has its
analog source and sink on the block diagram.
This representation
allows the input values
from the user to be
accessed from the block
diagram. Likewise, new
output values can be
shown on the front
panel by code executed
in the block diagram.
Controls
The most common form of a data source in LabVIEW is a control. This
element appears as some type of graphical element on the front panel
of a VI that can receive input from a user or even another VI. As stated
previously, any data source also has an analog symbol that appears on
the block diagram so that its value can be read and used in the code
pipeline. Controls make no exception to this rule.
Every control has an
associated data type that
determines what kind of data
flows from it on the block
diagram. Every data type also
has an associated color shown
on the block diagram. Typical controls and their associated
data types. In general, any control can
be turned into an indicator and vice-
versa.
Data types
Different data types are indicated with different colors.
• Floating point numbers (decimal numbers) are shown in orange
color. The letters DBL on the icon is for double, which refers to
floating point numbers with double precision, which expresses the
numerical accuracy of the internal representation of the number in
the computer. You can think of floating point numbers as decimal
numbers.
• Integers are shown in blue color. One example is a numeric
constant.
• Boolean data are shown in green color. The letters TF on the icon is
for True/False, which are the two possible boolean (logical) values
of the element. One example is the Stop terminal.
• Textual data are shown in pink color.
• Cluster data are shown in brown color. Clusters are multivariables.
They contain one or more elements of possibly different data types.
Indicators
The most common form of a data sink in LabVIEW is an indicator. This
element appears as some type of graphical element on the front panel
of a VI that can display output to a user or even another VI. As stated
previously, any data sink in LabVIEW also has an analog symbol that
appears on the block diagram so that its value can be updated in the
code pipeline. Indicators make no exception to this rule.
Every indicator also has an
associated data type that determines
what kind of data can be written to it
on the block diagram.
Typical indicators and their
associated data types. In general,
any control can be turned into an
indicator and vice-versa.
The front panel and block diagram for the
simple number plus ten example. It should be
noted that the number control and answer
indicator have their similarly named analogs
on the block diagram.
Palettes
Front panel controls and indicators as well as block diagram VIs are
available from a palettes visible depending on what window is
currently active in the LabVIEW environment. These palettes have
their contents separated into sub-categories containing controls,
indicators, and VIs.
Typical top-level block
diagram and front panel
palettes.
Structures
In addition to controls, indicators, and VIs, the block diagram can also
contain a number of programming structures that modify the
sequence of data flow on the block diagram. These structures perform
traditional functions like looping or case-selection, but many also
provide services that have no clear counterparts in text based
programming languages. LabVIEW currently supports six different
structures -- while-loops, case structures, event structures, for-loops,
sequence structures, and formula nodes.
While-loops
One of the most common structures encountered on a block diagram
is the while-loop. Much like in text-based languages, the LabVIEW
while-loop continually executes until a given boolean condition is met.
Unlike in text-based languages, the LabVIEW while-loop contains its
own loop counter that provides the current loop iteration starting at
zero.
Three different ways of using a while-loop. The first loop continues forever
because the loop conditional never becomes false. The second loop
continues until a button on the front panel is pressed, sending a value of
true to the loop conditional thereby stopping the loop. The third loop also
continues forever, but also displays the current loop counter value in an
indicator on the front panel. (It is important to note that these three loops
will execute in parallel because their inputs are not dependent on each
other.)
While-loops - cont
The while-loop is typically used in LabVIEW to continue some
operation until either the user or some code event indicates that the
operation should stop. Normally, some kind of millisecond delay is also
inserted into the loop so that it doesn't occupy all of the computer's
CPU time.
A while-loop that will stop when the loop iterator passes
1000 or when the user presses the stop button. A loop
delay is also used to ensure that the loop operation doesn't
occupy all of the CPU time.
While-loops - cont
Nearly all structures in LabVIEW, including while-loops, can have inputs
and outputs. Wires that pass into and out of while-loops form small
connection points called tunnels on the structure. Various, powerful
options are available for shaping data flowing through tunnels, ie. shift
registers.
Input and output loop tunnels. The while loops takes a numeric
value through an input tunnel and multiplies it times its current
iteration value. When the loop is stopped, the value of the last
multiplication is passed through an output tunnel and displayed
in another indicator.
Case structures
Another common structure encountered in LabVIEW is the case
structure. Like in text-based languages, the case structure executes a
block of code based on the value of a certain variable. In LabVIEW, a
case selector located on the case structure is wired to a data source.
The value fed into the case selector determines what case executes.
Only one case is shown at a time, but the visible case can be cycled by
clicking on the arrows to the left or the right of the case name.
The use of a case structure as a simple boolean if-statement. If the two
numbers entered by the user add to zero, then a string message is displayed
on the front panel saying so. If the two numbers do not add to zero, then a
string message is displayed stating that they do not. The false case of the
case structure is not shown.
For-loops
Another common looping structure encountered on a block diagram is
the for-loop. Much like in text-based languages, the LabVIEW for-loop
continually executes until a given count is reached. Unlike in text-based
languages, the LabVIEW for-loop can only step towards the final count
by increasing the loop counter by one each iteration. To make larger
steps or to step in the negative direction, while-loops with shift
registers must be used.
For-loop counter. The loop runs from zero to ninety-nine
and increases the loop counter by one each iteration.
Formula Nodes
A Formula Node is a box where you enter algebraic formulas directly
into the Block Diagram. It is useful when an equation is complicated or
has many variables. Below is an example of how you would implement
y = x^2 + x + 1 with regular block diagram nodes:
It is much easier to use the Formula Node. Below is an example:
Clusters
Cluster data types are somewhat unique to LabVIEW and act as
containers capable of storing a number of variables of different data
types. In the simplest sense, clusters can be thought of as a group of
data values that are bundled together to form a more complex, and
often more meaningful, data type. From an object oriented
perspective, clusters can be thought of as primitive objects with a
number of properties without any methods to acts on them.
A cluster with a number of elements. This cluster can be thought
of representing a set of properties of a college course that can flow
as a single object through the wires on the block diagram.
Clusters - cont
A number of operations exist for clusters, the most important of which
are the bundling and unbundling operations. Individual pieces of data
flowing through different wires can be bundled together to form a
cluster that flows through a single wire. Likewise, a cluster flowing
through a single wire can be unbundled so that its elements can flow
through their own wires.
Cluster bundling and unbundling. The person cluster is unbundled to reveal its
elements so that the age element can be increased by one. The data is then
bundled again to create a new cluster with the updated values. Notice that the
cluster elements are given by name here.
Clusters - cont
Clustering is commonly used for two purposes. First, clusters help to
logically group related data values together, thus supporting the object
oriented idea of encapsulation. Second, clusters help to minimize the
number of wires on the block diagram that flow into VIs. If clusters did
not exist, VIs with cluster inputs would have to receive all of their data
through separate wires leading to drastic decreases in readability.
details of labviews

More Related Content

What's hot

Introduction to lab view 8.6 in 3 hours
Introduction to lab view 8.6 in 3 hoursIntroduction to lab view 8.6 in 3 hours
Introduction to lab view 8.6 in 3 hours
Arihant Jain
 
Lab view introduction-threehour
Lab view introduction-threehourLab view introduction-threehour
Lab view introduction-threehour
e-LabVIEW
 
Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowchart
hermiraguilar
 
The analysis synthesis model of compilation
The analysis synthesis model of compilationThe analysis synthesis model of compilation
The analysis synthesis model of compilation
Huawei Technologies
 

What's hot (20)

Introduction to lab view 8.6 in 3 hours
Introduction to lab view 8.6 in 3 hoursIntroduction to lab view 8.6 in 3 hours
Introduction to lab view 8.6 in 3 hours
 
LabVIEW lecture handout by Prof. d k chaturvedi
LabVIEW lecture handout by Prof. d k chaturvediLabVIEW lecture handout by Prof. d k chaturvedi
LabVIEW lecture handout by Prof. d k chaturvedi
 
Sample instrument using lab view abhijeet agarwal-1
Sample instrument using lab view  abhijeet agarwal-1Sample instrument using lab view  abhijeet agarwal-1
Sample instrument using lab view abhijeet agarwal-1
 
Lab view introduction-threehour
Lab view introduction-threehourLab view introduction-threehour
Lab view introduction-threehour
 
222066369 clad-study-guide
222066369 clad-study-guide222066369 clad-study-guide
222066369 clad-study-guide
 
Functional Scala
Functional ScalaFunctional Scala
Functional Scala
 
Unit 1 psp
Unit 1 pspUnit 1 psp
Unit 1 psp
 
Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowchart
 
First fare 2010 lab-view overview
First fare 2010 lab-view overviewFirst fare 2010 lab-view overview
First fare 2010 lab-view overview
 
Flow charts
Flow chartsFlow charts
Flow charts
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 
The analysis synthesis model of compilation
The analysis synthesis model of compilationThe analysis synthesis model of compilation
The analysis synthesis model of compilation
 
Raptor tool
Raptor toolRaptor tool
Raptor tool
 
Programming flowcharts for C Language
Programming flowcharts for C LanguageProgramming flowcharts for C Language
Programming flowcharts for C Language
 
Valuable Information on Lexical Analysis in Compiler Design
Valuable Information on Lexical Analysis in Compiler DesignValuable Information on Lexical Analysis in Compiler Design
Valuable Information on Lexical Analysis in Compiler Design
 
Algorithm and Flowcharts
Algorithm and FlowchartsAlgorithm and Flowcharts
Algorithm and Flowcharts
 
Lesson 2 beginning the problem solving process
Lesson 2 beginning the problem solving processLesson 2 beginning the problem solving process
Lesson 2 beginning the problem solving process
 
Fundamentals of-algorithm
Fundamentals of-algorithmFundamentals of-algorithm
Fundamentals of-algorithm
 
Wmc lab (1)
Wmc lab (1)Wmc lab (1)
Wmc lab (1)
 

Similar to details of labviews

Similar to details of labviews (20)

Virtual instrumentation
Virtual instrumentationVirtual instrumentation
Virtual instrumentation
 
38180007 Sarish Wadkar.pptx
38180007 Sarish Wadkar.pptx38180007 Sarish Wadkar.pptx
38180007 Sarish Wadkar.pptx
 
Design the implementation of Forward Dynamic for PUMA560.
Design the implementation of Forward Dynamic for PUMA560.Design the implementation of Forward Dynamic for PUMA560.
Design the implementation of Forward Dynamic for PUMA560.
 
38180007 Sarish Wadkar.pdf
38180007 Sarish Wadkar.pdf38180007 Sarish Wadkar.pdf
38180007 Sarish Wadkar.pdf
 
System verilog important
System verilog importantSystem verilog important
System verilog important
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
 
Design the implementation of Anytime D Star on an Occupancy Grid
Design the implementation of Anytime D Star on an Occupancy GridDesign the implementation of Anytime D Star on an Occupancy Grid
Design the implementation of Anytime D Star on an Occupancy Grid
 
Design the implementation of NMEA Get GPS Data from Record
Design the implementation of NMEA Get GPS Data from RecordDesign the implementation of NMEA Get GPS Data from Record
Design the implementation of NMEA Get GPS Data from Record
 
Ni labview y multisim
Ni labview y multisimNi labview y multisim
Ni labview y multisim
 
AUTOMATIC VOLTAGE CONTROL OF TRANSFORMER USING MICROCONTROLLER AND SCADA POWE...
AUTOMATIC VOLTAGE CONTROL OF TRANSFORMER USING MICROCONTROLLER AND SCADA POWE...AUTOMATIC VOLTAGE CONTROL OF TRANSFORMER USING MICROCONTROLLER AND SCADA POWE...
AUTOMATIC VOLTAGE CONTROL OF TRANSFORMER USING MICROCONTROLLER AND SCADA POWE...
 
Ur/Web Programing Language: a brief overview
Ur/Web Programing Language: a brief overviewUr/Web Programing Language: a brief overview
Ur/Web Programing Language: a brief overview
 
advanced computer architesture-conditions of parallelism
advanced computer architesture-conditions of parallelismadvanced computer architesture-conditions of parallelism
advanced computer architesture-conditions of parallelism
 
Programming Without Coding Technology (PWCT) Features - Programming Paradigm
Programming Without Coding Technology (PWCT) Features - Programming ParadigmProgramming Without Coding Technology (PWCT) Features - Programming Paradigm
Programming Without Coding Technology (PWCT) Features - Programming Paradigm
 
Interaction overview and Profile UML Diagrams
Interaction overview and Profile UML DiagramsInteraction overview and Profile UML Diagrams
Interaction overview and Profile UML Diagrams
 
SystemVerilog-20041201165354.ppt
SystemVerilog-20041201165354.pptSystemVerilog-20041201165354.ppt
SystemVerilog-20041201165354.ppt
 
Programming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentProgramming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) Environment
 
Mule soft meetup_charlotte_4__draft_v2.0
Mule soft meetup_charlotte_4__draft_v2.0Mule soft meetup_charlotte_4__draft_v2.0
Mule soft meetup_charlotte_4__draft_v2.0
 
1.My Presentation.pptx
1.My Presentation.pptx1.My Presentation.pptx
1.My Presentation.pptx
 
Mini Project- ROM Based Sine Wave Generator
Mini Project- ROM Based Sine Wave GeneratorMini Project- ROM Based Sine Wave Generator
Mini Project- ROM Based Sine Wave Generator
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Recently uploaded (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

details of labviews

  • 1. LabVIEW Basics Based on LabVIEW 2011 Student Edition
  • 2. Virtual instruments LabVIEW works on a data flow model in which information within a LabVIEW program, called a virtual instrument (VI), flows from data sources to data sinks connected by wires. The data can be modified as it is passed from source to sink by other VIs. LabVIEW supports two types of VIs--internal VIs and user created VIs. Internal VIs are packaged with LabVIEW and perform simple functions like adding numbers or opening files. User created VIs consist of both a graphical user interface called the front panel and a code pipeline called the block diagram. These VIs tend to be much more complex considering that they can contain any number of internal or user created VIs in an endless number of configurations.
  • 3. Virtual instruments - cont. Consider a simplistic LabVIEW program which takes a single number from the user and multiplies it by 10. Analyzing such a program reveals the following data flow structure: 1. The user inputs a number (data source). 2. The program executes an addition VI taking the user's number and the number 10 as its inputs (data sink). 3. The addition VI returns the result of the addition operation (data source). 4. The result is displayed on the screen (data sink). While this example is simplistic, it exemplifies how all LabVIEW VIs work. Data always flows from data sources to data sinks according to the block diagram, much like how water flows through a pipe.
  • 4. Front Panel Every user created VI has a front panel that contains the graphical interface with which a user interacts. The front panel can house various graphical objects ranging from simple buttons to complex graphs. Various options are available for changing the look and feel of the objects on the front panel to match the needs of any application.
  • 5. Block diagram Nearly every VI has a block diagram containing some kind of program logic that serves to modify data as it flows from sources to sinks. The block diagram houses a pipeline structure of sources, sinks, VIs, and structures wired together in order to define this program logic. Most importantly, every data source and sink from the front panel has its analog source and sink on the block diagram. This representation allows the input values from the user to be accessed from the block diagram. Likewise, new output values can be shown on the front panel by code executed in the block diagram.
  • 6. Controls The most common form of a data source in LabVIEW is a control. This element appears as some type of graphical element on the front panel of a VI that can receive input from a user or even another VI. As stated previously, any data source also has an analog symbol that appears on the block diagram so that its value can be read and used in the code pipeline. Controls make no exception to this rule. Every control has an associated data type that determines what kind of data flows from it on the block diagram. Every data type also has an associated color shown on the block diagram. Typical controls and their associated data types. In general, any control can be turned into an indicator and vice- versa.
  • 7. Data types Different data types are indicated with different colors. • Floating point numbers (decimal numbers) are shown in orange color. The letters DBL on the icon is for double, which refers to floating point numbers with double precision, which expresses the numerical accuracy of the internal representation of the number in the computer. You can think of floating point numbers as decimal numbers. • Integers are shown in blue color. One example is a numeric constant. • Boolean data are shown in green color. The letters TF on the icon is for True/False, which are the two possible boolean (logical) values of the element. One example is the Stop terminal. • Textual data are shown in pink color. • Cluster data are shown in brown color. Clusters are multivariables. They contain one or more elements of possibly different data types.
  • 8. Indicators The most common form of a data sink in LabVIEW is an indicator. This element appears as some type of graphical element on the front panel of a VI that can display output to a user or even another VI. As stated previously, any data sink in LabVIEW also has an analog symbol that appears on the block diagram so that its value can be updated in the code pipeline. Indicators make no exception to this rule. Every indicator also has an associated data type that determines what kind of data can be written to it on the block diagram. Typical indicators and their associated data types. In general, any control can be turned into an indicator and vice-versa. The front panel and block diagram for the simple number plus ten example. It should be noted that the number control and answer indicator have their similarly named analogs on the block diagram.
  • 9. Palettes Front panel controls and indicators as well as block diagram VIs are available from a palettes visible depending on what window is currently active in the LabVIEW environment. These palettes have their contents separated into sub-categories containing controls, indicators, and VIs. Typical top-level block diagram and front panel palettes.
  • 10. Structures In addition to controls, indicators, and VIs, the block diagram can also contain a number of programming structures that modify the sequence of data flow on the block diagram. These structures perform traditional functions like looping or case-selection, but many also provide services that have no clear counterparts in text based programming languages. LabVIEW currently supports six different structures -- while-loops, case structures, event structures, for-loops, sequence structures, and formula nodes.
  • 11. While-loops One of the most common structures encountered on a block diagram is the while-loop. Much like in text-based languages, the LabVIEW while-loop continually executes until a given boolean condition is met. Unlike in text-based languages, the LabVIEW while-loop contains its own loop counter that provides the current loop iteration starting at zero. Three different ways of using a while-loop. The first loop continues forever because the loop conditional never becomes false. The second loop continues until a button on the front panel is pressed, sending a value of true to the loop conditional thereby stopping the loop. The third loop also continues forever, but also displays the current loop counter value in an indicator on the front panel. (It is important to note that these three loops will execute in parallel because their inputs are not dependent on each other.)
  • 12. While-loops - cont The while-loop is typically used in LabVIEW to continue some operation until either the user or some code event indicates that the operation should stop. Normally, some kind of millisecond delay is also inserted into the loop so that it doesn't occupy all of the computer's CPU time. A while-loop that will stop when the loop iterator passes 1000 or when the user presses the stop button. A loop delay is also used to ensure that the loop operation doesn't occupy all of the CPU time.
  • 13. While-loops - cont Nearly all structures in LabVIEW, including while-loops, can have inputs and outputs. Wires that pass into and out of while-loops form small connection points called tunnels on the structure. Various, powerful options are available for shaping data flowing through tunnels, ie. shift registers. Input and output loop tunnels. The while loops takes a numeric value through an input tunnel and multiplies it times its current iteration value. When the loop is stopped, the value of the last multiplication is passed through an output tunnel and displayed in another indicator.
  • 14. Case structures Another common structure encountered in LabVIEW is the case structure. Like in text-based languages, the case structure executes a block of code based on the value of a certain variable. In LabVIEW, a case selector located on the case structure is wired to a data source. The value fed into the case selector determines what case executes. Only one case is shown at a time, but the visible case can be cycled by clicking on the arrows to the left or the right of the case name. The use of a case structure as a simple boolean if-statement. If the two numbers entered by the user add to zero, then a string message is displayed on the front panel saying so. If the two numbers do not add to zero, then a string message is displayed stating that they do not. The false case of the case structure is not shown.
  • 15. For-loops Another common looping structure encountered on a block diagram is the for-loop. Much like in text-based languages, the LabVIEW for-loop continually executes until a given count is reached. Unlike in text-based languages, the LabVIEW for-loop can only step towards the final count by increasing the loop counter by one each iteration. To make larger steps or to step in the negative direction, while-loops with shift registers must be used. For-loop counter. The loop runs from zero to ninety-nine and increases the loop counter by one each iteration.
  • 16. Formula Nodes A Formula Node is a box where you enter algebraic formulas directly into the Block Diagram. It is useful when an equation is complicated or has many variables. Below is an example of how you would implement y = x^2 + x + 1 with regular block diagram nodes: It is much easier to use the Formula Node. Below is an example:
  • 17. Clusters Cluster data types are somewhat unique to LabVIEW and act as containers capable of storing a number of variables of different data types. In the simplest sense, clusters can be thought of as a group of data values that are bundled together to form a more complex, and often more meaningful, data type. From an object oriented perspective, clusters can be thought of as primitive objects with a number of properties without any methods to acts on them. A cluster with a number of elements. This cluster can be thought of representing a set of properties of a college course that can flow as a single object through the wires on the block diagram.
  • 18. Clusters - cont A number of operations exist for clusters, the most important of which are the bundling and unbundling operations. Individual pieces of data flowing through different wires can be bundled together to form a cluster that flows through a single wire. Likewise, a cluster flowing through a single wire can be unbundled so that its elements can flow through their own wires. Cluster bundling and unbundling. The person cluster is unbundled to reveal its elements so that the age element can be increased by one. The data is then bundled again to create a new cluster with the updated values. Notice that the cluster elements are given by name here.
  • 19. Clusters - cont Clustering is commonly used for two purposes. First, clusters help to logically group related data values together, thus supporting the object oriented idea of encapsulation. Second, clusters help to minimize the number of wires on the block diagram that flow into VIs. If clusters did not exist, VIs with cluster inputs would have to receive all of their data through separate wires leading to drastic decreases in readability.