You are on page 1of 3

Extra LabVIEW Exercises

1. Build a VI that compares two numbers and turns on an LED if the first number is
greater than or equal to the second number.
Tip Use the Greater Or Equal? function located on the Functions»Comparison palette.
Save the VI as Compare.vi.

2. Build a VI that generates a random number between 0.0 and 10.0 and divides the
random number by a number specified on the front panel. If the number input is 0, the
VI should turn on a front panel LED to indicate a divide by zero error.
Save the VI as Divide.vi.

3. Using only a While Loop, build a combination For Loop andWhile Loop that stops
either when it reaches a number of iterations specified with a front panel control, or when
you click a stop button.
Save the VI as Combo While-For Loop.vi.

4. Build a VI that continuously measures the temperature once per second and displays
the temperature on a scope chart. If the temperature goes above or below limits specified
with front panel controls, the VI turns on a front panel LED. The chart plots the
temperature and the upper and lower temperature limits. You should be able to set the
limit from the following front panel.
Save the VI as Temperature Limit.vi.

5. Modify the VI you created in Exercise 4-8 to display the maximum and minimum
values of the temperature trace. Tip Use shift registers and two Max & Min functions
located on the Functions»Comparison palette.
Save the VI as Temp Limit (max-min).vi.

6. Build a VI that reverses the order of an array containing 100 random numbers. For
example, array[0] becomes array[99], array[1] becomes array[98], and so on.
Tip Use the Reverse 1D Array function located on the Functions»Array palette to
reverse the array order.
Save the VI as Reverse Random Array.vi.

7. Build a VI that first accumulates an array of temperature values using the


Thermometer VI, which you have already built. Set the array size with a control on the
front panel. Initialize an array using the Initialize Array function of the same size where
all the values are equal to 10. Add the two arrays, calculate the size of the final array, and
extract the middle value from the final array. Display the Temperature Array,
Initialized Array, Final Array, and Mid Value.
Save the VI as Find Mid Value.vi.
8. Build a VI that generates a 2D array of three rows by 10 columns containing random
numbers. After generating the array, index each row and plot each row on its own graph.
The front panel should contain three graphs.
Save the VI as Extract 2D Array.vi.

9. Build a VI that simulates the roll of a die with possible values 1–6 and records the
number of times that the die rolls each value. The input is the number of times to roll the
die and the outputs include the number of times the die falls on each possible value. Use
only one shift register.
Save the VI as Die Roller.vi.

10. Build a VI that generates a 1D array and then multiplies pairs of


elements together, starting with elements 0 and 1, and returns the
resulting array. For example, the input array with values 1 23 10
5 7 11 results in the output array 23 50 77.
Tip Use the Decimate 1D Array function located on the Functions»Array palette.
Save the VI as Array Pair Multiplier.vi.

11. Build a VI that uses the Formula Node to calculate the following equations:
y1 = x3 + x2 + 5
y2 = mx + b
Use only one Formula Node for both equations and use a semicolon (;) after each
equation in the node.
Save the VI as Equations.vi.

12. Build a VI that functions like a calculator. On the front panel, use digital controls to
input two numbers and a digital indicator to display the result of the operation (Add,
Subtract, Divide, or Multiply) that the VI performs on the two numbers. Use a slide
control to specify the operation to perform.
Save the VI as Calculator.vi.

13. Build a VI that has two inputs, Threshold and Input Array, and one output, Output
Array. Output Array contains values from Input Array that are greater than
Threshold.
Save the VI as Array Over Threshold.vi.

Create another VI that generates an array of random numbers between 0 and 1 and uses
the Array Over Threshold VI to output an array with the values greater than 0.5.
Save the VI as Using Array Over Threshold.vi.
14. Build a VI that generates a 2D array of 3 rows 100 columns of random numbers and
writes the data transposed to a spreadsheet file. Add a header to each column. Use the
high-level File I/O VIs located on the Functions»File I/O palette.
Tip Use the Write Characters To File VI to write the header and the Write To
Spreadsheet File VI to write the numeric data to the same file.
Save the VI as More Spreadsheets.vi.

15. Build a VI that converts tab-delimited spreadsheet strings to comma-delimited


spreadsheet strings, that is, spreadsheet strings with columns separated by commas and
rows separated by end of line characters. Display both the tab-delimited and comma-
delimited spreadsheet strings on the front panel. Tip Use the Search and Replace String
function.
Save the VI as Spreadsheet Converter.vi.

You might also like