TAMPL REU 99 LabVIEW Tutorial

LabVIEW Tutorial 2: Simple Programs

Goal of this tutorial: To become more familiar with programming in LabVIEW by completing simple exercises. Each exercise is followed by a brief description of the program’s function and the techniques needed to complete it. Asterisks following the exercise indicates its difficulty (* - easiest, *** - most difficult).

 Exercise 1: Simple Calculator * Make a program which lets the user input two numbers, choose an operation (one of add, subtract, multiply, or divide), and display the result. This program includes arithmatic operations and case structure. For additional exercise, make this calculator into a sub-vi with three inputs (the two numbers and the operation) and one output, and demonstrate that it works by using it in another program.

 Exercise 2: Sine-Wave Generator ** This program should allow the user to input the amplitude and wavelength (period), generate the specified wave from x = 0 to 10, and plot it on a graph. Programming techniques used include arrays, arithmatic operations, for-loops, graphing. [Hint: The sin(x) in LabVIEW is at Functions  Numeric  Trignometric  Sine.] For additional exercise, save the result in a 2-column spreadsheet file and plot it on Excel.

 Exercise 3: Stop Watch * Make a program that starts counting time when you click on “run.” It should have a switch that you can click on to stop the program, at which time the total elapsed time in displayed in seconds. You will need while loops and sequence structure with sequence locals for this program.

 Exercise 4: De-bugging Exercise *** Goto the website: www.tufts.edu/as/tampl/program99/, and follow the link to Tutorials page. Download the debugging exercise. There have been several syntax and runtime errors built into the program. Using error list, lightbulb, and probes, debug the program so that it performs the task it was meant to do. [Hint: first correct all the syntax errors so that the program can compile, then run the program to detect runtime errors.] The text box in the front panel explains what the program was meant to do.

Check the web for solutions: www.tufts.edu/as/tampl/program99/  follow link to Tutorials