CHAPTER 1: Getting Started with LabVIEW Virtual Instruments

Opening a New VI from a Template
LabVIEW displays two windows: the front panel window and the block diagram window. The user interface, or front panel, appears with a gray background and includes controls and indicators. The title bar of the front panel indicates that this window is the front panel for the Generate and Display VI.

The block diagram appears with a white background and includes VIs and structures that control the front panel objects. The title bar of the block diagram indicates that this window is the block diagram for the Generate and Display VI. Stop the VI by clicking the front panel STOP button.




Adding a Control to the Front Panel
If you are a new LabVIEW user, the Controls palette opens with the Express palette, visible by default. If you do not see the Express palette, click Express on the Controls palette to display the Express palette. When you move the cursor over icons on the Controls palette, the name of the subpalette, control, or indicator appears in a tip strip below the icon.



Changing a Signal Type
The block diagram has a blue icon labeled Simulate Signal. This icon represents the Simulate Signal Express VI. An Express VI is a component of the block diagram that you can configure to perform common measurement tasks. The Simulate Signal Express VI simulates a sine wave by default. When a double-headed arrow appears, shown at left, click and drag the border of the Express VI to add two rows. When you release the border, the Amplitude input appears.



Wiring Objects on the Block Diagram
To use the knob to change the amplitude of the signal, you must connect two objects on the block diagram. The terminals inside the loop are representations of front panel controls and indicators. Terminals are entry and exit ports that exchange information between the front panel and block diagram. The cursor becomes a wire spool, or the Wiring tool. Use the Wiring tool to wire objects together on the block diagram.

Running a VI
The amplitude of the sawtooth wave changes as you turn the knob. As you change the amplitude, the Operating tool displays a tip strip that indicates the numeric value of the knob. The y-axis on the graph scales automatically to account for the change in amplitude. To indicate that the VI is running, the Run button changes to a darkened arrow, shown at left. You can change the value of most controls while a VI runs, but you cannot edit the VI in other ways while the VI runs.

The STOP button stops the VI after the loop completes its current iteration. The Abort Execution button, shown at left, stops the VI immediately, before the VI finishes the current iteration. Aborting a VI that uses external resources, such as external hardware, might leave the resources in an unknown state by not resetting or releasing them properly. Design the VIs you create with a stop button to avoid this problem.


Modifying a Signal
In the block diagram, use the Positioning tool to click the wire that connects the Simulate Signal Express VI to the Waveform Graph terminal.  If the Functions palette is not visible, select View»Functions Palette to display it. The Functions palette opens with the Express palette visible by default. If you have selected another palette, you can return to the Express palette by clicking Express on the Functions palette. 

If you place an object too close to another object on the block diagram, auto wiring might wire the two objects together. Delete the wires if the automatic wiring is wrong. To configure auto wiring select Tools»Options then select Block Diagram from the Category list. Remove the checkmark from the Enable auto wiring checkbox to turn off auto wiring. 

The Formula help topic describes the Express VI, the configurationdialog box options, and the inputs and outputs of the Express VI. EachExpress VI has a corresponding help topic you can access by clicking the Help button in the configuration dialog box or by right-clicking theExpress VI and selecting Help from the shortcut menu.

You can right-click any wire and select Clean Up Wire from the shortcut menu to have LabVIEW automatically find a route for the wire around existing objects on the block diagram. LabVIEW also routes a wire to decrease the number of bends in the wire. You also can click the Clean Up Diagram button on the block diagram toolbar to have LabVIEW automatically reroute all existing wires and rearrange objects on the block diagram to generate a cleaner look.


Displaying Two Signals on a Graph
The Merge Signals function, appears where the two wires connect. A function is a built-in execution element, comparable to an operator, function, or statement in a text-based programming language. The Merge Signals function takes the two separate signals and combines them so that both can display on the same graph.


Customizing a Knob Control
Right-click the front panel knob and select Properties from the shortcut menu to display the Knob Properties dialog box. Reopen the Knob Properties dialog box and experiment with other properties of the knob. For example, on the Scale page, try changing the colors for the Marker text color by clicking the color box.



Customizing a Waveform Graph
Right-click the waveform graph and select Properties from the shortcut menu to display the Graph Properties dialog box. Reopen the Graph Properties dialog box and experiment with other properties of the graph. For example, on the Scales page, try disabling automatic scaling and changing the minimum and maximum value of the y-axis.



Comments

Popular Posts