Workshop
2: Making a Simple Program
To become more familiar with LabVIEW and it's functions,
work in groups of two to make one of the following three programs:
- Make a program to plot the function f(x) = A sinBx, where A and B are user inputs. Plot the
interval between x=0 and x=10, at 0.1 increment. (Use Functions-Arithmetic-Sine&Cosine)
- Change the program so that he number of points or the interval can be specified.
- Save the results on a spreadsheet file.
- Have the program add three sine waves, each with different A and B. A and B inputs should be
arrays. Plot the individual functions and the sum on the same graph. Save all curves in a spreadsheet
file.
- On the graph, change the line color so that each of the four curves look different.
- Revise the program so that the chart is plotted progressively from x=0 at some user-specified
interval, until the user clicks on a STOP button. Update the graph every 100ms.
- Revise the program so that the number of sine functions to add can be specified.
- Change the A and B inputs to random numbers generated by the computer.
- Add an option in the program to allow the user to choose whether to save the results or not (CASE
structure).
Plotting data in LabVIEW: LabVIEW
has three types of plots, and they are not interchangeable. Each type takes
in different input formats, and you must choose the best one that suits
the data format you have. Here are some guidelines:
- Waveform Chart: generally
used when you need to update your plot inside a loop. Data must be equally
spaced.
- Waveform Graph: used for
equally spaced data.
- XY Graph: the most versatile
graph; does not require equally spaced data.
General Tips:
- Use the Help Window to find out how an icon works.
- Right-Clicking on a window or icon displays many additional
options.
- Lightbulb Mode is a helpful debugging tool.
- Use the Quick Reference Sheet
provided to find some of the most useful functions.