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

MECH 430 – Process Instrumentation and Measurement

Assignment II

Instructions:
Make sure to submit a separate VI for each problem.
The VI should be named with your AUBnet name (e.g. nk64) followed by the problem number (i.e.
nk64_assignment2_problem1).
Zip all the files into a single file. The filename should be in the same format as before (e.g.
nk64_assignment2).

Problem 1:
Write a LabVIEW program that will randomly generate an integer in the range 1 to 10, and guides you in
correctly guessing the integer. When the VI is running, the user will type his/her guessed integer into the
Guess control and then click on the OK Button labeled Enter Guess. The program should display a
feedback about the guess (e.g. too low, too high, correct) in the Message indicator.
The program keeps running until the user guesses the number.

Problem 2:
a) Plot on an XY-graph two functions:
1. 𝑌 = 0.2𝑥 + 1 for 𝑥 = 0 to 10 with increments of 0.1
2. 𝑍 = 5𝑠𝑖𝑛(𝑥) for 𝑥 = 0 to 10 with increments of 0.1

b) Find the points of intersection between these two plots and display them in two array indicators
(the first array shows the x-values and the second array shows the y-values). [For the two
functions given you should have a total of four elements in the arrays since there are four points
of intersection – see figure below]
An easy approach to finding the point of intersection is to locate the instances where one line
crosses over the other. One approach is shown below:

1. Take two consecutive points x(i) and x(i+1)


2. Calculate the differences (y(i) – z(i)) and (y(i+1) – z(i+1))
3. If the two differences have the same sign (either both are positive or both are
negative) then the 2 lines do not cross one another between those two points
4. If the two differences have different sign (one is positive while the other negative) then
the two lines have crossed one another between those two points
5. When the two lines cross one another between two points x(i) and x(i+1), assume that
the point of intersection was actually x(i) and y(i) and display those values on the front
panel arrays (i.e. No need to calculate the exact point of intersection).

Problem 3:
Write a VI whose front panel has an array of five Round LED labeled 0 through 4, as shown below.
Develop a program that lights these LEDs one at a time in the order 0-1-2-3-4, and keeps repeating this
sequence until the Stop Button is clicked. Make each LED stay lit for 0.2 second, so that an entire 0-1-2-
3-4 sequence occurs once every second. When the Stop Button is pressed all LEDs should turn off before
the program ends. DO NOT USE LOCAL VARIABLE.

Have fun.

You might also like