labview lecture 1 - bilkent universityphysics/phys580/files/labview_lecture_1.pdf · labview...

Post on 19-Aug-2018

224 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

LabVIEW Lecture 1

Ertugrul Karademir

What is LabVIEW?

• Graphical programming environment

• Measurement, testing, control applications

• Hardware control

• Flowchart representation• Flowchart representation

• Object Oriented Approach

What is LabVIEW?

What is LabVIEW?

Virtual Instrument

• LabVIEW programming paradigm

1. Program control with a front panel

2. Algorithm with block diagram

• Easy to debug

• Hard to program

Front Panel

t

Controls Palette

View > Controls Palette

Block Diagram

Functions Palette

View > Functions Palette

Front Panel – Block Diagram

• To toggle between two panels

Ctrl + E

Context Help

Ctrl + H

Detailed help

Three fashions of variables

• Mixture of GUI and console

1. Controls

– User input (In Java: TextBox GUI Component)

2. Indicators2. Indicators

– Program output (In Java: Label GUI Component)

3. Constants

– Predefined constants (In Java: Class variables

with constconstconstconst definer)

Controls

• Selected from Controls Palette

• Usually Express Palette is

enoughenough

Controls

Controls

• Each control has a proxy in the Block

diagram

• Note that proxy has only OUTPUT node

Indicators

• Also Selected from Controls Palette

• Usually Express Palette is

enoughenough

Indicators

Indicators

• Each indicator also has a proxy in the

Block diagram

• Note that proxy has only INPUT node

Constants

• You can use functions

palette to insert constantspalette to insert constants

Constants

• Constants only live in Block diagram

Search

• You can always seach for the item

• Click on the search button on the palettes

Types

• All standard types are present

– Integer (signed, unsigned, long, word, byte, quad)

– Floating point (single precision, double precision,

extended precision)extended precision)

– Boolean

– String

• All of above can be arranged in arrays,

matrices, clusters

Flow Chart Paradigm

• Flow of execution is done by following nodes

in a flow diagram

NODE NODE NODE NODELEVEL 1

NODE NODE NODE NODELEVEL 2 NODE

And so on...

Wiring

• Defines the direction of flow

NODE

NODE

Wiring

• One to many connection is acceptable

• Many to one connection is illegal

Wiring

• Application of algorithm is done by wiring

• Color of the wire indicates type• Blue: Integer , Orange: Floating Point

• Purple: String, Green: Boolean

Red dot indicates

that “wrong type

has wired but it’s

OK, he has made

the type-casting”.

Algorithm Construction

All algoritm structures lies in Programming

Sub-Palette

Algorithm Construction

Program flow structures are under Structures

Sub-sub-palette

Program Control

PAUSE

RUN RUN

CONTINUOUSLY

STOP

PAUSE

Debugging

HIGHLIGHT

EXECUTION

Debugging

• Broken Arrow Means ERROR

• Click to see Error List

Program Flow Control

• For loops

• While loops

• Sequences

– Flat sequence– Flat sequence

– Stacked sequence

• And many more

• Compansates for: Event handling, Top-to-

bottom execution, OOP, etc.

For loop

• Loop for limited

iterations

• Must know the iteration

amount before-handamount before-hand

• Loop count can-not be

change once set

For loop

Another way to create

variables: Right clicking

onto the node

For loop example

• Get some number from the user

• Add 3 to it 10 times

• Display the result

For loop example

For loop example

Shift registers convey

result of one iteration

to the next iteration

For loop example

For loop example

Do not limit your

imagination

For loop example

User only interacts with three objects

While loop

•Loops until the loop

condition is satisfied

•Or while the loop

condition is not

satisfiedsatisfied

•Select by clicking

on the loop

condition

While loop example

While loop example

Employ boolean and comparison palette

controls to manage loop condition

While loop example

Flat sequence

Executes contents of each

frame one by one

Flat sequence

Flat sequence

top related