You are on page 1of 25

Computer Programming

LabVIEW Programming

Lecture 1 - Introduction

Dr. Nader Ragab Ammar

Naval Architecture and Marine Engineering Department


Faculty of Engineering, Alexandria University

1
Course Goals
Become comfortable with the LabVIEW environment and data flow
execution
Use LabVIEW to solve problems
Learn LabVIEW concepts
a) Acquiring, saving and loading data
b) Finding and using math and complex analysis functions
c) Working with data types, such as arrays and clusters
d) Displaying and printing results

Grading
Lab. sections (30 Marks)
Midterm exam (30 Marks)
Final examination (90 Marks)

2
Course Materials
Lecture Slides

Reference Books:

1. LabView Manual
2. National Instruments Corporation, LabVIEWTM Basics I
Introduction Course Manual, 2006 Edition, Part
Number 320628P-01.
3. Telemark University College, Introduction to LabVIEW,
Faculty of Technology, Postboks 203, Kjlnes ring 56,
N-3901 Porsgrunn, Norway.

3
Programming
Text Based Programming
Visual Basic
C, C++
Fortran
Matlab

Graphical Based Programing


LabVIEW

4
LabVIEW programming
LabVIEW (Laboratory Virtual Instrument
Engineering Workbench) is a development
environment based on graphical
programming.

LabVIEW relies on graphical symbols rather


than text-based language to describe
programming actions.

5
LABVIEW BASICS

Each VI has two main components:

a) Front Panel - How the user interacts with the VI.


b) Block Diagram - The code that contains graphical
representations of functions to control the Front Panel
objects may contain sub-VIs.

6
In Front Panel, means of interactions are:

a) Controls = Inputs to the program (numerals, strings, etc.)


b) Indicators = Outputs of the program (numerals, strings, plots,
etc.)
In Block Diagrams are:
a) Icons Means of representing operations and sub-VIs, have
terminals defining inputs and outputs to the operations, the
sub-VIs and representations of controls and indicators in
Front Panel, are wired to each other or to constants.
b) Wires Means of connecting operations and VIs to other
operations, VIs, inputs and outputs, controls and indicators.

7
Programming
Item Graphical Based Programing Text Based Programming

Displaying data Controls, constants, and Indicators Input and output

Performing Nodes Statements, operators,


specific functions, and subroutines
operations
Code repeating Structures loops and case statements
and executing

8
Example of a Block Diagram and Corresponding Front
Panel

9
LabVIEW Programs

Each VI has 2 windows:


Front Panel
User interface (UI) A LabView Front Panel
Controls = inputs
Indicators = outputs
Block Diagram
Graphical code
Data travels on wires from controls
through functions to indicators
A LabView .Block Diagram
Blocks execute by data flow

10
LABVIEW PALETTES
Tools Palette
Control Palette Function Palette

Used in both:

Front Panel and


Block Diagram Used in : Used in :
Use tab button to move Front Panel Block Diagram
between tools Use right click to Use right click to
show this palette show this palette 11
Tools Palette

12
Front Panel Controls Palette

Controls Palette

Contains the most commonly used controls


All Controls Palette
Shows all controls

13
Block Diagram Functions Palette

Functions Palette

Contains the Express VIs (interactive VIs with


configurable dialog page) and the most commonly
used functions.
All Functions Palette
Shows all functions

14
Front Panel and Block Diagram Toolbars (Status Toolbar)

Run button Font ring


Continuous Run button Alignment ring
Abort button Distribution ring
Pause/Continue button Resize ring
Reorder ring
Additional Buttons on the Block
Diagram Toolbar Context Help Button
Warning indicator Execution Highlighting button
Enter button Step Into button
Step Over button
Broken Run button
Step Out button

15
Context Help Window
Help > Show Context Help
press the <Ctrl-H> keys
Hover cursor over object to update window

Additional Help
Right-click on the VI icon
and choose Help, or
Choose Detailed help
on the context help window

16
Basic Wire Types
A wire is a data path between nodes. Wires
are colored according to the kind of data each
wire carries.

Numeric ex. Numbers, Boolean ex. True or false, String ex. text
17
Wiring Techniques Hot Spot

Use Edit >> Remove broken wires to Clean Up wrong Wires

Right-click terminals
and select Visible
ItemsTerminals

View the terminal connections to a function

18
Some shortcuts

19
Example- Converting K to F

Click on New
VI to open a
new file

20
Composition of a new VI

Diagram (D)
Front Panel (FP)

21
Creating a VI Front Panel
Build the front panel with controls (inputs)
and indicators (outputs)

Examples of Boolean inputs and outputs


Numeric
Owned Indicator
Labels

Increment
Buttons Numeric
Boolean Boolean Control
Control Indicator

22
Creating the Front Panel
Create this Front Panel using the Controls Palette

23
Shortcut Menus for Front Panel Objects
Right-click the digital display
to access its shortcut menu

Right-click the label to


access its shortcut menu

24
Creating a VI Block Diagram
Front Panel

Control Indicator

Block Diagram
Control
Terminal

Indicator
Constant Wires Nodes Terminal 25

You might also like