You are on page 1of 20

MOSTLY MISSED QUESTION IN LABVIEW CLAD EXAM

Execute 0 times If N is a negative To zero Always Execute 1

error if no time out event configured

Timeout every 1sec if Boolean button was not pressed.

SWITCH

Latch when released generate only one event. Reset to its orignial state

Switch when released mimic the window dialog Switch until released: two events click and released.

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

Comparision

Error occurred once at end

Wont run if close file Path dont wire

No error occurred since file is created

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 an existing cluster.

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

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.

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 type 6 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, the control 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 VI reads it once. At this point, the control reverts to its default value, even if we continue to prese the mouse button. This action is useful for stopping a while loop or getting the VI to perform an actionl only 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 VI reads 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.

What Are Strings Code Display: display more details of the ASCII characters and all nondisplayable 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.

While Loops: Repeating the code Always execute once. Iteration terminal indicator can tell us how many times the loop has executed. However, its important 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. 3. Loop count does not exist in while loop. A While loop can run zero times. False

For Loop
loop iteration starts from 0, similar with while loop. Ultimiately the value will be one less than the number of times the loop executes. A while loop can execute zero times, whereas a while loop will always executes at least once.

The loop will only execute once without regard to whether or not the condition was met.
Right click border, and select conditional terminal

A For Loop Can Run 0 time

Stop if true or continue if true.

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 multiple loops 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.

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.

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

And if arrays of different sizes are wired to auto-indexed tunnels, the actual number of iterations becomes the smallest of the choices.

3 Row and 4 columns

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.

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

Plot Data

Click on plot legend >> color

Chart update a constant rate. Chart have 3 update modes: strip chart, scope chart, and sweep chart. Right click chart >> advance >> update modes Strip chart: flow left to right scope chart: plot data from left to right, and when it reaches the right border. Labview erases the data and Begin plotting again from left border. Similar to an oscilloscope 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 to assemble X data and Y data.

Sweep chart: similar to scope but veritical separate. Not erase data.

Type Definition Type definitions can be used as controls, indicators, and constants. three types: control, type def, and strict type def.

1. Save the control 2. 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 the same size.

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 called text 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, including date 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 file contains 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.