You are on page 1of 39

MOSTLY MISSED QUESTION IN LABVIEW CLAD EXAM

Execute 0 times
If N is a
negative
To zero
Can Run if no Time out event
added in the event structure
Will trigger Timeout event if no
mouse click or event occur on front
Panel object.
Always
Execute 1
CLAD EXAM MISSED QUESTIONS
1. 0 sec, press run button, switch at False initially
2. After 5 sec, press Switch When Press
3. After 15 sec, release button
What is the boolean indicator display?
A. False, False
B. True, False
C. False, True
D. True, True
What is the value of numeric indicator?
A. 2
3. What is the value of next multiple ms wait if 10ms wired to the input at
the next iteration, supposedly after the end of the 4
th
iteration the time
was 37ms.
A. 10ms
B. 100ms
C. 370ms
D. 470ms
CLAD MISSED QUESTIONS
1) What type of graph to use if 100 points of uneven data plot over a period time.
A. Chart
B. Graph
C. XY Graph
D. Intensity Graph
2) What is the value of x=y? indicator ?
CLAD Missed Questions
What is the value of the numeric indicator?
A. Indefinitely
B. 0
C. 2
D. 1
What is the value of the result if the numeric is
set at 10?
A. 12
B. unknown
C. 17
D. 20
1. Which is the file format type to access random data in LabVIEW?
TDMS file.
2. Use datalog files to access and manipulate data only in LabVIEW and to store complex data
structures quickly and easily.
3. Producer and consumer loop can be synchronous or asynchronous (queue).
CLAD
QUESTIONS:
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.
Latch when released Boolean is the most commonly use. It changes
after you release the mouse button and reverts to the old value.
Local variables can not be used with latch action
For complex machine control, use switch
Use latch for dialogs and switch for machine control
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
3 row 2 coln
2x2
Feedback Node: use to store the initialization value.
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 element into a cluster (or to
create/replace cluster)
When wire the cluster to bundle function, bundle function display all data inputs,
where bundle by name function does not display all by default. See Figure 1
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.
Figure 1:
Can not run if
bundle by name
does not wire.
Solution:
You can run if
bundle by name
input wired.
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.
Note
that
latch
button
will
not
work
with
local
variab
le
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.
While Loops: Repeating the code
While Loop 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. Loop count does not exist in while loop.
3. 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 For loop can execute zero times, whereas a while loop will always executes at least once.
Right click border, and select
conditional terminal
Stop if true or continue if true.
The loop will only execute once
without regard to whether or not the
condition was met.
A For Loop Can Run 0 time
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 array 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-indexed
tunnels, the actual number of iterations becomes the
smallest of the choices.
POLYMORPHISM
Array + Scalar = Array Array + Array = Array
Can not add 2D array to 1D
array
you can create 1D array of cluster
With multiple elements.
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

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
Sweep chart: similar to scope but
veritical 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 to
assemble X data and Y data.
Both chart and graph are used to
display even sampled data.
Type Definition
Type definitions can be used as controls, indicators, and constants.
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.
three types: control, type def, and strict type
def.
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.
File I/O
LabVIEW can use or create the following file formats: binary, ASCII, LVM, and TDM:
Binary Files are the underlying file format of all other file formats
ASCII file is a specific type of binary file that is a standard used by most programs. They are also called text
files.
LVM is a tab delimited text file you can open with spreadsheet application
TDM binary file created for national instruments. It is usually consists of two separate files: an XML and
binary file for waveform.
When to Use Test (ASCII) Files
Use text format files for your data to make it available to other users or applications if disk space and file I/O
speed are not crucial.
Text Files normally takes more memory than binary and datalog files since its ASCII takes one byte for
each character.
For example: -123.4567 takes 9 bytes
WHAT IS DAQ?
There are 3 pieces of DAQ sosftware that we will explore in this module:
1. Measurement and Automation Explorer (which is called MAX for short). Any installed DAQ
acquisition devices would automatically appear under this tab.
2. NI-DAQmx is the driver level software that can be installed with LabVIEW. Most importantly the NI-
DAQmx installed the DAQmx API, which is a set of Vis used to program DAQ applications.
DAQ assistant log data in tdms format.
1000/10000 = 1/10
USING SUBVI
Drag an drop the terminal into the block diagram to create a subVI
CTL + Double Click to go to subVI block diagram.
Required option terminal is only available for inputs, and not for outputs. (appear in bold)
Optional showed dim with no labels.

Instrument control
PCs usually offer multiple bus options for instrument control:
General Purpose Interface Bus (GPIB)
Serial
Ethernet
Universal Serial Bus (USB)
IEEE 1394 (FireWire)
If instrument does not natively have the bus that the instrument uses, it can usually be added as a plug-in board or
an external converter.
Generally instrument driver Vis communicate with an instrument using the LabVIEW VISA application programming
interface, or API.
Using Sequential programming
Wiring the error wire through Vis and SubVIs is a very common and preferred method for ensuring
sequential execution.
Flat sequence/stack sequence executes frame after frame.
What Is State Machine?
State Machine is a very common and useful design pattern

Create
Constant
Using State Machine

Parallelism
LabVIEW can run in parallel.
One of the benefit in parallelism is that running tasks completely in parallel means that one loop will not prevent the
other from running.
It allows us to keep one loop running continuously while we interact with the first loop.
This example shows that first loop only
Run when we click cancel on the dialog
Box.
Use variables to pass data between loop.
What is Modularity?
Code is easily written, easily debugged, and can be easily modified.
Modularity refers to the degre to which a program is composed of discrete modules, such that a
change to one module has minimal impact on other modules.
Modularity means that well be able to build code faster using reusable pieces.
It also allow us to change the code quickly in one location, instead of multiple places and debug small
pieces of code at a time.
Example: Changing a type definition in one place, changes all instances of it automatically (control,
indicators, and constants)
VARIABLES
Variables pass data from one place to another without wires.
Local variables store data in front panel controls and indicators.
functional global variable store data in while loop shift registers
Boolean controls that are used with local variables can not use the latch action and must use switch
action.
A Shared Variable share data among multiple VIs. Have to create in LabVIEW Project.
Shared variable is similar to local variable, but they can share data across a network (multiple VIs).
To use the shared variable, drop a
Shared variable shell into the block
Diagram (in program structure)
Race condition is difficult to debug because the outcome depends upon the order in which the operating system
executes scheduled tasks.
An ideal way to avoid race conditions is to simply allow only one section of the code to write to any one variable
whenever possible. (use Functional Global Variable or Semaphores) only one task enter at a time
Functional Global Variable
FGV is similar to shared variable, but programmer uses them very often due to the flexibilty to control
data in the shift register.
FGV is a subVI that must not be set to be re-entrant, meaning only one call to the subVI can occur at
a time.
Prevent race conditions.
When we use Cluster, we should turn it into a type def as well.

You might also like