CSE-471 Lab 04

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Kingdom of Saudi Arabia

‫اﻟﻤــﻤـــــــــﻠﻜــــﺔ اﻟﻌـﺮﺑﯿﺔ اﻟﺴــــــﻌﻮدﯾﺔ‬


Royal Commission at Yanbu
Colleges & Institutes Division ‫اﻟـــــــﮭـــــــــــﯿـــــﺌﺔ اﻟﻤﻠــــــﻜـــــــﯿﺔ ﺑــﯿﻨﺒﻊ‬
‫ﻗــــﻄـــﺎع اﻟـﻜــــــــــــﻠــﯿﺎت واﻟـﻤــﻌــﺎھـﺪ‬
Yanbu University College ‫ﻛـــــﻠﯿﺔ ﯾﻨﺒﻊ اﻟﺠــــــــــــــــﺎﻣـــــــــــﻌﯿﺔ‬
Computer Science & Engineering Dept. ‫ﻗﺴﻢ ﻋﻠﻮم وھﻨﺪﺳﺔ اﻟﺤﺎﺳﺐ اﻷﻟﻲ‬
Information & Computer Technology Dept. ‫ﻗﺴﻢ ﺗﻘﻨﯿﺔ اﻟﻤﻌﻠﻮﻣﺎت واﻟﺤﺎﺳﺐ اﻵﻟﻲ‬
LAB 4

ACADEMIC YEAR 1439/1440 H (2018/2019 G), SEMESTER II (182)

MICROCOMPUTER INTERFACING &


DATA ACQUISITION
CSE471
START TIME: 8:15 AM
DATE: Tuesday, 05 February, 2019
FINISH TIME: 10:05 AM

STUDENT NAME: _________________________________________________________

STUDENT ID: SECTION: 1

FOR INSTRUCTOR USE ONLY GENERAL INSTRUCTIONS

MAX MARKS
Q. No. CLOs
MARK OBTAINED

1
2
3
4
5
6
7

TOTAL MARKS

MARKED BY: Signature:

CHECKED BY: Signature:


LAB MANUAL
LAB EXPERIMENT - 04: GRAPHS IN LABVIEW

GRAPHS IN LABVIEW

PERFORMANCE OBJECTIVES:
Upon completion of this laboratory exercise, the student technicians/engineers will be able to:
1. Visualize the results of experiments in LABVIEW in form of graphs.
EQUIPMENT:

1 LABVIEW equipped PC

DISCUSSION:
A chart is able to receive individual data points and continuously update the presentation of the
data. A Waveform Chart, for example, is typically used during data acquisition to monitor the
data as they are being collected. A graph receives a complete data set (as an array) before
preparing the graphical display. LABVIEW provides a number of charting and graphing
options for producing data plots, such as:
Chart Types Graph Types
• Waveform chart • Waveform graph
• Intensity chart • XY graph
• Intensity graph
• Digital waveform graph
• Mixed signal graph
• 3D surface graph
• 3D parametric graph
• 3D curve graph

LABVIEW provides
• Graph and chart indicators for 1D plotting (assuming uniformly spaced x values)
• Graph indicator for 2D plotting (XY Graph)
• Graph indicators for 3D plotting

CSE 471 – MICROCOMPUTER INTERFACING & DATA ACQUISITION


1
LAB MANUAL
LAB EXPERIMENT - 04: GRAPHS IN LABVIEW

TASK-1
SIMULATED TEMPERATURE - GRAPHS AND CHARTS IN LABVIEW
Design a VI to simulate a thermometer the reading of which is updated every 500 milliseconds.
Use graph and chart functions to show the readings. There should be provision for stopping the
simulation anytime.
PROCEDURE:
1. On front panel place the following controls: (see figure 4.1)
a. Control palette >> Graph >> Waveform graph
b. Control palette >> Graph >> Waveform chart
c. Control palette >> Numeric >> Thermometer control
d. Control palette >> Boolean >> Stop button
2. On the block diagram place the following functions: (see figure 4.2)
a. Programming >> Structures >> While loop
b. Programming >> Timing >> Wait (ms)
c. Programming >> Numeric >> Random number (0-1)
3. Set the random generator to generate values between -20 to 100. For this purpose multiply
the randomly number generated by 120 and then subtract 20 from it. See figure 4.2.
4. Connect the output of the step 3 to the input of thermometer and waveform chart.
5. Since waveform graph requires complete data set to display, therefore it is located outside the
while loop. Hence the waveform graph will display the result of an experiment at the
completion.
6. Indexing must be enabled at the border of while (tunnel). To do this right click on the square
that appears on the border when a connection is made between the waveform graph and the
output of step 3.
7. Set the time delay to 500 ms by typing 500 in the numeric input of the wait (ms) function.
8. Connect the stop button to the conditional terminal of the while loop. (see figure 4.2)
9. On the front panel set the lowest value by double clicking on the zero and type -20.
10. Also change the labels waveform chart and waveform graph as Temperature chart and
Temperature chart respectively.
11. On the Y axis of both, replace the scale label amplitude by Temperature.
12. Run the VI. Temperature chart will be updated after every 500 ms interval whereas to
Temperature graph is blank.
13. The temperature graph will be updated when the stop button is depressed to stop simulation.
14. The attribute of the plots such as line width, color etc can be adjusted using plot legend. To
change these right click on the plot legend shown just above on the top right corner of the
graph and chart.
15. The grid style on the Temperature chart can be set in the properties. Right click on the plot
area, then select x Scale and then select the properties and then setting the major and minor
ticks.
16. Alternatively the steps 14 and 15 can directly be performed just by selecting the chart
properties and graph properties respectively.

YANBU UNIVERSITY COLLEGE


2
LAB MANUAL
LAB EXPERIMENT - 04: GRAPHS IN LABVIEW

Figure 4.1 Front panel simulated temperature VI.

Figure 4.2 Block Diagram of simulated temperature VI.

CSE 471 – MICROCOMPUTER INTERFACING & DATA ACQUISITION


3
LAB MANUAL
LAB EXPERIMENT - 04: GRAPHS IN LABVIEW

TASK-2
INTENSITY CHART
Write the block diagram as shown in figure 4.3 and answer the following questions.

Figure 4.3 Block Diagram Task 2

Q Explain the operation of nested for loops in the above code.

Q Explain the function of array index function in figure 4.2.

YANBU UNIVERSITY COLLEGE


4
LAB MANUAL
LAB EXPERIMENT - 04: GRAPHS IN LABVIEW

TASK-3
MULTICURVE XY GRAPH USING LABVIEW
There are many data analysis situations (and some data acquisition situations) where the data to
be plotted do not have uniformly spaced points in the x direction. When this is the situation, one
must provide both an X array and a Y array, and use LABVIEW XY Graph indicator to
accurately plot non-uniformly spaced values.
As an example consider the following set of data as shown in table 4.1 which must be shown
using LABVIEW XY graph function.

X Y1 Y2
1 2 4
2 5 6
4 8 9
6 15 15
9 25 17
10 36 44
13 45 50

PROCEDURE:
In order to develop the XY graph follow the given steps:
1. On the front panel create 3 arrays namely X, Y1 and Y2 respectively.
2. On the function palette select Programming >> Cluster, Class & Variants >> Bundle
and use it to bundle X and Y1.
3. Repeat step 2 to bundle X and Y2.
4. Use Build Array function to combine the above two pairs of bundled data (X, Y1) and
(X, Y2) respectively. The Build Array function can be located using Programming >>
Array >> Build Array.
5. Once the VI is executed, graphs will be updated. See figure 4.4.

CSE 471 – MICROCOMPUTER INTERFACING & DATA ACQUISITION


5
LAB MANUAL
LAB EXPERIMENT - 04: GRAPHS IN LABVIEW

Figure 4.4 Block Diagram (top) and Front Panel (bottom) for Task 3

YANBU UNIVERSITY COLLEGE


6
LAB MANUAL
LAB EXPERIMENT - 04: GRAPHS IN LABVIEW

REVIEW QUESTIONS
1. Plot the XY graph of the equation:.
−𝒕
𝒗𝒄 (𝒕) = 𝟏𝟎 �𝟏 − 𝒆 𝟐 � 𝑽𝒐𝒍𝒕𝒔

t [Seconds] 𝒗𝒄 (𝒕) [𝑽𝒐𝒍𝒕𝒔]


0
1
2
3
4
5
6
7
8
9
10
11
12

From the graph locate the value of the time constant?

Enter the following values into four 1D arrays and create an XY graph with two
2.
curves: (X1, Y1) and (X2 and Y2). Estimate the point of intersection of the two curves.

X1 Y1 X2 Y2
1 12 1 1.5
2 9 3 4.6
3 7 5 7.0
4 5.4 7 8.4
7 1.9 9 9.0
8 1.3
9 1.0

FINAL CHECKLIST
All the students must make sure, before they leave the Lab:
1. Clean your equipment, materials, and work benches before you leave.
2. Return all equipment and materials to their proper storage area.
3. Submit your lab report and answers to the questions, together with your data,
calculations (if any) and results before the next laboratory sessions.

CSE 471 – MICROCOMPUTER INTERFACING & DATA ACQUISITION


7

You might also like