Exp4 LabVIEW and Data Acquisition Systems
Exp4 LabVIEW and Data Acquisition Systems
Introduction:
LabVIEW (Laboratory Virtual Instrument Engineering Workbench) is a graphical programming language that
uses icons instead of lines text to create applications. In contrast to text-based programming languages, where
instructions determine the order of program execution, LabVIEW uses dataflow programming, where the flow
of data through the nodes on the block diagram determines the execution order of the VIs and functions. VIs,
or virtual instruments, are LabVIEW program that imitate physical instruments.
In LabVIEW, you build a user interface by using a set of tools and objects. The user interface is known as the
front panel. You then add code using graphical representations of functions to control the front panel objects.
This graphical source code is also known as G code or block diagram code. The block diagram contains this
code. In some ways, the block diagram resembles a flowchart.
A typical DAQ system consists of plug-in DAQ boards, and LabVIEW application software. Examples include
monitoring and controlling complete measurement (or process) system, etc. The combination of a DAQ board
and LabVIEW software makes a virtual instrument (VI). A VI can perform like an instrument and is
programmable by the software with the advantage of flexibility of logging the data that is being measured.
Additional Resources:
1. LabVIEW Fundamentals Manual, National Instruments.
http://www.ni.com/pdf/manuals/374029a.pdf
http://www.ni.com/pdf/manuals/373427c.pdf
Pre-Lab Assignments:
Before coming to the lab, you should read this experiment sheet and try to read the first three chapters from
LabVIEW fundamentals manual found on the website to be more familiar with labVIEW environment.
Page 1 of 9
Objectives:
The aim of this experiment is to familiarize the student with LabVIEW software, and Data Acquisition Systems
(DAQ) through building and running several LabVIEW programs.
Equipments:
Personal computer.
LabVIEW software.
PC plug-in Data Acquisition (DAQ) board.
Thermocouple sensor.
You will create a VI that takes a number representing degrees Centigrade and converts it to a number
representing degrees Fahrenheit.
1. Run the LabVIEW program that on your PC.
2. Open a new front panel by selecting the New VI button from the startup window. Double
Click on Blank VI to open the window.
3. You will now build the front panel and block diagram shown below.
A. FRONT PANEL
1. Create the Numeric Control. You will use this control to enter the value for degrees Centigrade.
When the left (front panel) window is active, the Tools palette and the Controls palette should be visible.
To make them visible, select Show Tools Palette and/or Show Controls Palette from the Windows
menu. (Alternatively, you can choose not to show the controls palette and right click on the control panel
window to bring it up only when you need it. This also works for the Functions palette which will be
discussed in the next section).
a. Select Numeric Control from the Numeric subpalette of the Controls palette.
b. Drag the Control to where you want it and release the mouse button.
c. Type deg C inside the label and press the Enter Button (check mark) on the Toolbar. If you want
to change the label text in the future, select the Text Tool on the Tools Palette and use it to
highlight the text. Then type in the desired text in the box and press the Enter Button. You can
make the label appear or disappear by popping up on the Numeric Control and selecting or
deselecting Label from the Visible Items menu.
2. Create the Numeric Indicator. You will use this indicator to display the result from a calculation to
convert temperature from degrees Centigrade to degrees Fahrenheit.
a. Select Numeric Indicator from the Numeric subpalette of the Controls palette. If the Controls
palette is not visible, pop-up in an open area of the Panel window.
b. Drag the indicator to where you want it and then release the mouse button.
Page 2 of 9
c. Type deg F inside the label and click outside the label when finished.
NOTE THAT: Each time you create a new control or indicator, LabVIEW automatically creates the
corresponding terminal in the Diagram window. The terminal symbols suggest the data type of the
control and indicator.
B. BLOCK DIAGRAM
1. Select Window Show block diagram to display the block diagram. When the right (block diagram)
window is active, the Tools palette and the Functions palette should be visible. To make them visible,
select Show Tools Palette and/or Show Functions Palette from the Windows menu.
2. Select the Multiply and Add functions one at a time from the Numeric subpalette of the Functions
palette and place them in the diagram window.
3. You can activate the help window by choosing Show Context Help from the Help menu. Placing any
of the editing tools on a node displays the inputs and outputs of the function in the Help window when
the diagram window is active. Use this to look at the inputs and outputs of the multiply and add function
icons.
4. Select the two numeric constants one at a time from the Numeric subpalette of the Functions palette.
When you first place the numeric constant on the Diagram window, it is highlighted so you can type a
value into it. Type 1.8 into one constant and 32.0 into the other one. If you moved the constants before
you typed a value into them, you can use the Text Tool (Tools palette) to enter the values.
5. Using the Wiring Tool from the Tools palette, wire the icons as shown in the block diagram above.
To wire from one terminal to another, click the Wiring tool on the first terminal, move the tool to the
second terminal, and click on the second terminal. It does not matter at which terminal you start.
The objective of this exercise is to learn to create your own VI icons. These icons are essentially sub-VIs
(subroutines) that can be used within other VIs. In order to be used, icons must have terminals for wiring them
into a VI. In this exercise, you will create an icon for the Convert C to F VI and assign the terminals of the icon
to the digital control and indicator. You will use this VI again later.
Page 3 of 9
window. The icon represents the VI in the block diagram of other VIs. An icon can be a pictorial
representation of the VIs purpose, or it can be a textual description of the VI or its terminals.
6. In the Front Panel window (note: this will not work in the Diagram window), define the connector
terminal pattern by popping up in the Icon pane and choosing Show Connector from the pop-up
menu.
7. LabVIEW will select a terminal pattern based on the number of controls and indicators on the front
panel. In this example, there are two terminalsthe deg C digital control and the deg F digital indicator.
8. Assign the terminals to the digital control and digital indicator using the Wiring tool. Click on the left
terminal in the connector and then on the deg C control. The left terminal should turn a dark orange
color. Now click on the right terminal in the connector and then on the deg F indicator. Now the right
terminal will turn dark orange.
9. When you click in an open area of the panel, both terminals on the connector should be orange. This
shows that both terminals are connected to floating-point values.
10. A common LabVIEW convention is that the terminals connected to front panel controls are located at
the left side of the connector pane, while the terminals connected to front panel indicators are located at
the right side of the connector pane. In other words, your input terminals are at the left on the connector
pane, and your output terminals are at the right on the connector pane.
11. Save the VI under the same name and close it.
You will build a VI for acquiring and continuously displaying a thermocouple signal. The VI also will have the
option to display the temperature in degrees Fahrenheit rather than degrees Celsius. The sensor will be
connected to Channel 0 of the DAQ device.
A. FRONT PANEL
1. Open a blank VI and read the following steps to build
the front panel that shown.
B. BLOCK DIAGRAM
Page 4 of 9
5. Place the DAQ Assistant Express VI, located on the Functions Input palette, on the block diagram.
When you place this Express VI on the block diagram the DAQ Assistant configuration dialog box
appears.
a. Select Acquire signals Analog InputTemperatureThermocouple for the type of
measurement to make.
b. Specify the Physical Channel where you have connected the thermocouple referring to Pin-
Connection datasheet shown in the last page.
c. Enter the Minimum and Maximum temperature values in degrees C that you expect to measure.
A smaller range will allow a more accurate measurement.
d. Specify the type of the thermocouple you are using.
e. Specify the CJC value* (Cold-Junction Compensation) in degrees C (usually room temperature).
f. Select the Acquire 1 Sample option on the Task Timing tab. Click the OK button.
6. Place the Convert C to F VI on the block diagram. Select a VI subpalette. Select the VI you wrote:
Convert C to F. The icon you created can then be placed in the diagram as a sub-routine.
7. Place the Select function, located on the Functions Arithmetic & Comparison Express
Comparison palette, on the block diagram. This function returns either the Fahrenheit (FALSE) or
Celsius (TRUE) temperature value, depending on the value of Temp Scale.
8. Using the Positioning tool, place the icons as illustrated on the diagram and wire them together with the
Wiring tool.
*Q1: the measured temperature depends not only upon the unknown temperature but room
temperature as well, is this desirable? Explain why?
6. Save the VI in your folder and name it: Thermometer.vi. This VI is now complete and ready for use as
a subVI in other VIs. The icon represents the VI in the block diagram of the calling VI. The connector
(with two terminals) outputs the temperature. Close the VI by choosing Close from the File menu.
You will build a VI to measure temperature and display it on the waveform chart. This VI will measure the
temperature using the Thermometer VI you built in the previous part as a subVI.
You will use this VI later, so be sure to save it as the instructions describe.
A. FRONT PANEL
Now open a new panel and build the front panel below using the instructions that follow.
Page 5 of 9
1. Place a vertical slide switch (Boolean subpalette) in the Panel window. Label the switch Enable. You
will use the switch to stop the acquisition. Popup on the switch and choose Boolean Text from the
Visible Items. Use the Positioning tool to move the text to the right of the switch.
2. Place a Waveform Chart* (Graph subpalette) in the Panel window. Label the waveform chart
Temperature History. The waveform chart will display the temperature in real time.
*Q2: A Waveform Chart is different from a Waveform Graph Search about the difference
and write it in your report.
B. BLOCK DIAGRAM
Create the block diagram using the instructions that follow.
Page 6 of 9
3. Stop the acquisition by clicking on the vertical switch. This action causes the loop condition to be
FALSE (OFF) and the loop ends.
4. Now add timing to the loop so that it takes a data point every second. When you ran the VI, the While
Loop executed as quickly as possible. However, you may want to take data at certain intervals, such
as once per second or once per minute.
You can control loop timing using the Wait Until Next ms Multiple function (Time & Dialog
subpalette). This function ensures that no iteration is shorter than the specified number of
milliseconds.
5. Modify the VI as shown below then save and run the program for a period of time and then hold the
thermocouple tip between your fingers and note the temperature variation
You will modify the Temperature Monitor VI you created to detect when a temperature is out of range. If the
temperature exceeds the set limit, a front panel LED will turn on and a beep will sound.
1. Open the Temperature Monitor VI that you created earlier. Select Save As from the File menu, and
rename the VI Temperature Control.vi.
2. Modify the front panel so it looks like the
figure shown at right.
The High Limit digital control specifies the
upper temperature limit. The WARNING
LED indicates if the temperature exceeds
this limit. The Round LED can be found in
the Boolean subpalette.
You create the numeric digital display
values by popping up on the Temp
History chart and selecting Visible Items
Digital Display.
Page 7 of 9
Greater? function (Comparison subpalette). In this exercise, this function returns a TRUE if the
temperature measured exceeds the temperature you specify in the High Limit control; otherwise, the
function returns a FALSE.
Beep VI (Graphics and Sound >> Sound subpalette). In this exercise, this VI sounds a beep if the
selection terminal of the Case structure receives a TRUE.
After wiring the icons the block diagram should appear similar
to the figure at right.
4. Now run the program for a period of time and then hold the
thermocouple tip between your fingers and note the
temperature variation, change the value of the High Limit
control until the warning lamp turns on.
Now, you are asked to build your LabVIEW program using some of instructions followed previously to:
A. Acquire voltage generated by the thermocouple and display it.
B. Note that the voltage generated has a small value, so modify the scale by multiplying the signal by a
certain factor (100 or 1000) before displaying it.
Lab Report:
Your report should include the following:
1. Answer the questions mentioned previously in this manual.
2. All exercises results, including the screen shots, with a brief description.
3. Summary of what you did and achieved in your own words.
4. Conclusions.
Page 8 of 9
Pin Connection (PCI-6221 68 Pin)
Page 9 of 9