CHAPTER 2: Customizing a VI
Adding an Express VI That Simulates a Signal
Select Help»Show Context Help from the front panel or the block diagram to display the Context Help window. You also can click the Show Context Help Window button, shown at left, on the front panel or block diagram toolbar to display the Context Help window.
Move the cursor over the various options in the Configure Simulate Signal dialog box, such as Frequency (Hz) and Amplitude. Read the information that appears in the Context Help window.
The Context Help window displays information about how you configured the Simulate Signal Express VI in addition to the standard context help description.
Searching the Help and Modifying a Signal
You also can access the LabVIEW Help by right-clicking a VI or function on the block diagram or on a pinned palette and selecting Help from the shortcut menu or by selecting Help»LabVIEW Help.
Click the Search tab, enter sample compression in the Type in the word(s) to search for text box, and press the <Enter> key. You can place quotation marks around the phrase to search for the exact phrase. For example, you can enter "sample compression" to narrow the search results. This word choice reflects what you want this Express VI to do—compress, or reduce, the number of samples in a signal.
Double-click the Sample Compression topic in the search results to display the topic that describes the Sample Compression Express VI.
Customizing a User Interface from the Block Diagram
In previous exercises, you learned to add inputs and outputs by expanding the Express VI using the down arrows. Using the shortcut menu is a different way to display and select the inputs and outputs of an Express VI. Right-click the Enable input and select Create»Control from the shortcut menu to create a switch.
Control terminals have a thicker border than indicator terminals. Also, an arrow appears on the right of the terminal if the terminal is a control, and an arrow appears on the left of the terminal if the terminal is an indicator.
The controls and indicators you added appear in the front panel with labels that correspond to the inputs and outputs from which you created the controls and indicators.
Configuring a VI to Run Continuously until the User Stops It
Click the Search button, on the Functions palette, and enter While in the text box. LabVIEW searches as you type the first few letters and displays any matches in the search results text box. If there are objects with the same name, use the information in the brackets to the right of each object name to decide which object to select. Some objects are located on multiple palettes because you can use them for multiple applications.
The While Loop, shown at left, appears with a STOP button wired to the conditional terminal. This While Loop is configured to stop when the user clicks the STOP button.
The VI now runs until you click the STOP button. A While Loop executes the VIs and functions inside the loop until the user clicks the STOP button.
Using the Error List Window
Display the front panel and move the cursor over the Mean indicator until the Positioning tool appears. Click the Mean indicator, to select it and press the <Delete> key. Display the block diagram. A wire appears as a dashed black line with a red X in the middle. The dashed black line is a broken wire. The Run button, appears broken to indicate the VI cannot run. Click the broken Run button to display the Error list window. The Error list window lists all errors in the VI and provides details about each error. You can use the Error list window to locate errors. In the errors and warnings list, select the Wire: has loose ends error and click the Help button to display more information about the error.
You also can move the Wiring tool over a broken wire to display a tip strip that describes why the wire is broken. This information also appears in the Context Help window when you move the Wiring tool over a broken wire.
Controlling the Speed of Execution
On the block diagram, search for the Time Delay Express VI, shown at left, on the Functions palette and place it inside the While Loop. You can use the Time Delay Express VI to control the execution rate of the VI.
Click the Enable switch and examine the change on the graph. If the Enable switch is on, the graph displays the reduced signal. If the Enable switch is off, the graph does not display the reduced signal.
Using a Table to Display Data
LabVIEW wired the Table terminal to the Build Table Express VI. If the Build Table Express VI and the Table terminal are not selected already, click an open area on the block diagram to the left of the Build Table Express VI and the Table terminal. Drag the cursor diagonally until the selection rectangle encloses the Build Table Express VI and the Table terminal, shown at left. A moving dashed outline, called a marquee, highlights the Build Table Express VI, the Table terminal, and the wire joining the two.
If you drag objects near the border of the While Loop, the loop resizes to enclose the Build Table Express VI and the Table terminal after you add the object to the block diagram.
If the Enable switch is on, the table displays the mean values of every 25 samples of the sine wave. If the Enable switch is off, the table does not record the mean values. Experiment with properties of the table by using the Table Properties dialog box. For example, try changing the number of columns to one.
Comments
Post a Comment