You are on page 1of 25

LabVIEW Lecture 2

Programming with LabVIEW (contd.)

First LabVIEW Program


Take a number from the user Multiply it by 2 Add 246 Divide it by 2 Subtract the original number Display the result (is it 123?)

First LabVIEW Program

First LabVIEW Program

Types in LabVIEW
LabVIEW supports four basic types:
Integers: Whole numbers Floats: Numbers with decimal points Strings: Texts Complex Numbers Booleans: True or false

Types in LabVIEW
Each type is associated with a different color

Representation
There are eight types of Integers Four types of Float Three types of Complex

Floats Integers

Complex Numbers

Representation
Floats and Complex Numbers are defined by their precision. Integers are defined by number of digits.

Floats Integers

You will use I32 (Long Integer) in some problems.

Complex Numbers

Manipulation
You can find all manipulation functions in related palettes

Loops, Cases, Sequences


There are several useful structures to control the program flow

Loops, Cases, Sequences


There are several useful structures to control the program flow
You might be familiar with For and While loop

Loops, Cases, Sequences


There are several useful structures to control the program flow
Instead of IF structure, there is Case structure.

Loops, Cases, Sequences


There are several useful structures to control the program flow
One thing unique to LabVIEW is Flat Squence

For Loop
You feed an integer to N

While Loop
You need to feed the loop condition as boolean.

Case Structure
Feed a condition that results in True or False. Program two cases.

Flat Sequence
If you want to order the execution you can use flat sequence.

Shift Register
You may need to carry result of one iteration to the next. Use shift register.

Shift Register

Shift Register
You can also use shift register with while loop.

Arrays
In LabVIEW, arrays are all containers. Put an array container first.

Array
Drop any kind of constant to make an array of that tipe

Empty Array Container

An Array of Strings

Array
You can do the same thing in the front panel. Find the Array container in Modern Palette It becomes indicator or control depending on what you dropped

You should invest some time to get used to the LabVIEW structures. Design you program in some language you know, and port that code to LabVIEW.

END OF LECTURE 2

You might also like