Mostly Missed CLAD

Embed Size (px)

Citation preview

  • 7/29/2019 Mostly Missed CLAD

    1/20

    MOSTLY MISSED QUESTION IN LABVIEW CLAD EXAM

    Execute 0 times

    If N is anegative

    To zero

    error if no time out event

    configured

    Timeout every 1sec if Booleanbutton was not pressed.

    Always

    Execute 1

  • 7/29/2019 Mostly Missed CLAD

    2/20

    SWITCH

    Latch when releasedgenerate only oneevent. Reset to itsorignial state

    Switch when released mimic the window dialog

    Switch until released: two events click and released.

  • 7/29/2019 Mostly Missed CLAD

    3/20

    I8 (byte)= 1 byte

    U8 (unsigned byte) = 1 byte

    I16 (word) = 2 bytes

    U16 (unsigned word) = 2 bytes

    I32 (long) = 4 bytes

    U32 (unsigned long) = 4 bytes

    I64 (quad) = 8 bytes

    U64 (unsigned quad) = 8 bytes

    SGL (single precision) = 4 bytes

    DBL (double precision) = 8 bytes

    EXT (extended precision) = 10a/12b/16c

    CSG (complex single) = 8 bytes

    CDB (complex double) = 16 bytes

    CXT (complex extended) = 20a/24b/32c

  • 7/29/2019 Mostly Missed CLAD

    4/20

    Comparision

  • 7/29/2019 Mostly Missed CLAD

    5/20

    Error occurred once at end Wont run if close file Path dont wire

    No error occurred since file is created

  • 7/29/2019 Mostly Missed CLAD

    6/20

    Use bundle function to assemble individual into a cluster (or to create new cluster)

    Bundle by name can not create new cluster. It can only replace an element in anexisting cluster.

    These cannot be wired together because their data types (numeric, array) do not match.

  • 7/29/2019 Mostly Missed CLAD

    7/20

    Once string value change, the even structure interact with the event.Stop button wont stop the loop. Program must use Stop button on

    menu bar to stop the loop.

  • 7/29/2019 Mostly Missed CLAD

    8/20

    DATA TYPES

    U8 (positive only) : all 8 bits are being used to represent the value of the number.For example 2-8 = 250 because 2^8 = 256 6

    I8: first bit is used to denote the sing of the number. 7 bits remaining to represent the value -128 to 127

    Coersion always select the larger data type.

    For more information about data type

    Go to Labview help >> search >> ente rdata types table

    boolean : 8 bits data type6 choices of mechanical actions:

    Switch When Pressed: change control value each time we click it with the operating tool

    Switch when released: only after we release the mouse button during a mouse click.

    Switch until released: retains the new value until we release the mouse button. At this time, thecontrol reverts to its default value, as is the case with the operation of a door buzzer.

    Latch when pressed: change the value of the control when we click it and retain the value unitl the VIreads it once. At this point, the control reverts to its default value, even if we continue to prese themouse button. This action is useful for stopping a while loop or getting the VI to perform an actionlonly once each time we se the control

    Latch when released: changes the control value only after we release the mouse button. (dialog box).When the VI reads once, it reverts to its default value.

    Latch until released: changes the control value when we click it and retains the value until the VIreads it once or we release the mouse button depending on which one occurs last.

    Undefined numeric number NaN : not a number (operation divide by 0)

    Error Cluster Includes the following

    Status : boolean data type returns true if an error occurs

    Code : signed 32 bits integer that identifies the error numerically. Code 0 indicates everything is fine

    String: explain error or warnings

    Use Simple Error Handling to pop up the dialog.

  • 7/29/2019 Mostly Missed CLAD

    9/20

    What Are Strings

    Code Display: display more details of the ASCII characters and all non-displayable characters as their backslash code. This includes spaces, tabs,linefeeds, and the like.

    Hex display is useful to communicate with instruments.

    Dynamic Data

    Dynamic data stores the information generated or acquired by an Express VI.

    Most other Vis and functions in LabVIEW do not accept the dynamic data types.

    Therefore to be used, the data must be converted.

    For the numeric, waveform, and boolean terminals, this conversion is automatically handle by LabVIEW.

  • 7/29/2019 Mostly Missed CLAD

    10/20

    While Loops: Repeating the code

    Always execute once.

    Iteration terminal indicator can tell us how many times the loop has executed. However, itsimportant to know that the value being displayed will always be one less than the number of

    times the codes has been executed because loop starts from 0

    CLAD QUIZ

    1. Condition terminal accepts a boolean data type:

    Stop when error occur

    2. Loop count does not exist in while loop.

    3. A While loop can run zero times.

    False

  • 7/29/2019 Mostly Missed CLAD

    11/20

    For Loop

    loop iteration starts from 0, similar with while loop. Ultimiately the value will be one less than thenumber of times the loop executes.

    A while loop can execute zero times, whereas a while loop will always executes at least once.

    Right click border, and selectconditional terminal

    Stop if true or continue if true.

    The loop will only execute oncewithout regard to whether or not thecondition was met.

    A For Loop Can Run 0 time

  • 7/29/2019 Mostly Missed CLAD

    12/20

    Why use timing function?

    Use Wait (ms) function in loop to prevent the memory usage

    Use Wait Until Next ms Multiple when you want to synchronize different activities across multipleloops or for setting a sampling rate. To achieve this, the specified amount must be larger than the

    amount of time it takes for the loop to execute its code.

    Stacked shift register need to wire to avoid broken run button

    A prefered method to pass data between loop iterations is using shift registers.

    Integer, double, or boolean data type can be used in a shift register.

  • 7/29/2019 Mostly Missed CLAD

    13/20

    Arrays An arry can have one or more dimension and as many as (2^31 -1) elements per dimension.

    Contain same data type.

    Can not create array within an array

    Array range is n-1, where n is the number of elements in the array.

    Top control changes the index of the row.

    Bottom index changes the index of the column.

    3 Row and 4 columns

    One thing to note is that if the count terminal is wired

    And if arrays of different sizes are wired to auto-indexedtunnels, the actual number of iterations becomes thesmallest of the choices.

  • 7/29/2019 Mostly Missed CLAD

    14/20

    Creating an Icon By double click on terminal on the right corner of the front panel

    Or by right click on the icon, edit icon

    Save template

    The maximum number of terminals that we can use is 28

    In general we should not use more than 16 terminals as this makes it more difficult to wire the block diagram.

  • 7/29/2019 Mostly Missed CLAD

    15/20

  • 7/29/2019 Mostly Missed CLAD

    16/20

    Clusters

    Clusters group together data elements of mixed types.

    Cluster differ from arrays in that they are a fixed size and the elements that make up a cluster

    Must be added individually.

    Cluster can not contain a mixture of control and indicator.Use reorder cluster control

    Use bundle to assemble elements into the cluster

    use bundle by name to store a new cluster

  • 7/29/2019 Mostly Missed CLAD

    17/20

    Plot Data

    Chart update a constant rate.

    Chart have 3 update modes: stripchart, scope chart, and sweep chart.Right click chart >> advance >>

    update modes

    Strip chart: flow left to right

    scope chart: plot data from left toright, and when it reaches the rightborder. Labview erases the data and

    Begin plotting again from left border.Similar to an oscilloscope

    Sweep chart: similar to scope butveritical separate. Not erase data.

    Click on plot legend >> color

    Waveform graph: plot all points at once.to, dt, and y (data). Distribute evenly in time.

    XY graph: spacing of data is non-uniform. A bundle is used toassemble X data and Y data.

  • 7/29/2019 Mostly Missed CLAD

    18/20

  • 7/29/2019 Mostly Missed CLAD

    19/20

    Type Definition

    Type definitions can be used as controls, indicators, and constants.

    1. Save the control2. apply the changes.

    In Customize mode, we can move and resize the individual components of the control.

    In Customize mode, we can also import picture with thesame size.

    three types: control, type def, and strict typedef.

    O

  • 7/29/2019 Mostly Missed CLAD

    20/20

    File I/O

    Include 3 steps as shown above where errors may not be needed.

    Types of files: Binary Files, ASCII, LVM, TDMS

    Binary Files: are the underlying file format of all other file formats, least amount of overhead associated with the data.This means they take less space and write faster.

    ASCII File is a specific type of binary file that is a standard used by most programs, conists of ASCII codes, also calledtext file. Tab delimited to separate columns.

    LVM: the labview measurement data file is a tab-delimited text file you can open with a spreadsheet application, includingdate and time that the data was generated.

    TDMS file format: is a specific type of binary file created for NI products. It contains two separate files: a binary filecontains data and a binary index file that provides details about the information stored in the binary file.

    Append to file? True: append new file to end of file. False:overwrite data.