Lab View Lecture 2

download Lab View Lecture 2

of 25

Transcript of Lab View Lecture 2

  • 8/13/2019 Lab View Lecture 2

    1/25

    LabVIEW Lecture 2

    Programming with LabVIEW (contd.)

  • 8/13/2019 Lab View Lecture 2

    2/25

    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?)

  • 8/13/2019 Lab View Lecture 2

    3/25

    First LabVIEW Program

  • 8/13/2019 Lab View Lecture 2

    4/25

    First LabVIEW Program

  • 8/13/2019 Lab View Lecture 2

    5/25

  • 8/13/2019 Lab View Lecture 2

    6/25

    Types in LabVIEW

    Each type is associated with a different color

  • 8/13/2019 Lab View Lecture 2

    7/25

    Representation

    There are eight types of Integers

    Four types of Float

    Three types of ComplexFloats

    Complex Numbers

    Integers

  • 8/13/2019 Lab View Lecture 2

    8/25

    Representation

    Floats and Complex Numbers are defined by

    their precision.

    Integers are defined by number of digits.

    Floats

    Complex Numbers

    Integers

    You will use

    I32 (Long

    Integer) in

    someproblems.

  • 8/13/2019 Lab View Lecture 2

    9/25

    Manipulation

    You can find all manipulation functions in

    related palettes

  • 8/13/2019 Lab View Lecture 2

    10/25

    Loops, Cases, Sequences

    There are several useful structures to control

    the program flow

  • 8/13/2019 Lab View Lecture 2

    11/25

    Loops, Cases, Sequences

    There are several useful structures to control

    the program flowYou might be familiar with For and

    While loop

  • 8/13/2019 Lab View Lecture 2

    12/25

    Loops, Cases, Sequences

    There are several useful structures to control

    the program flowInstead of IF structure, there is Case

    structure.

  • 8/13/2019 Lab View Lecture 2

    13/25

    Loops, Cases, Sequences

    There are several useful structures to control

    the program flow

    One thing unique to LabVIEW is Flat

    Squence

  • 8/13/2019 Lab View Lecture 2

    14/25

    For Loop

    You feed an integer to N

  • 8/13/2019 Lab View Lecture 2

    15/25

    While Loop

    You need to feed the loop condition as

    boolean.

  • 8/13/2019 Lab View Lecture 2

    16/25

    Case Structure

    Feed a condition that results in True or False.

    Program two cases.

  • 8/13/2019 Lab View Lecture 2

    17/25

    Flat Sequence

    If you want to order the execution you can use

    flat sequence.

  • 8/13/2019 Lab View Lecture 2

    18/25

    Shift Register

    You may need to carry result of one iteration

    to the next. Use shift register.

  • 8/13/2019 Lab View Lecture 2

    19/25

    Shift Register

  • 8/13/2019 Lab View Lecture 2

    20/25

    Shift Register

    You can also use shift register with while loop.

  • 8/13/2019 Lab View Lecture 2

    21/25

    Arrays

    In LabVIEW, arrays are all containers.

    Put an array container first.

  • 8/13/2019 Lab View Lecture 2

    22/25

    Array

    Drop any kind of constant to make an array of

    that tipe

    Empty Array Container An Array of Strings

  • 8/13/2019 Lab View Lecture 2

    23/25

    Array

    You can do the same thing in the front panel.

    Find the Array container in Modern Palette

    It becomes indicator or control depending onwhat you dropped

  • 8/13/2019 Lab View Lecture 2

    24/25

    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.

  • 8/13/2019 Lab View Lecture 2

    25/25

    END OF LECTURE 2