• No results found

Coloring Objects

In document LabVIEW Basics I Course Manual (Page 53-58)

You can change the color of many objects but not all of them. For example, block diagram terminals of front panel objects and wires use specific colors for the type and representation of data they carry, so you cannot change them.

Use the Coloring tool and right-click an object or workspace to add or change the color of front panel objects or the front panel and block diagram workspaces. You also can change the default colors for most objects by selecting Tools»Options and selecting Colors from the top pull-down menu.

You also can make front panel objects transparent to layer them. Right-click an object with the Coloring tool and select the box with a T in it to make an object transparent.

Exercise 2-2

Editing Exercise VI

Objective: To edit a VI.

Complete the following steps to modify the existing Editing Exercise VI to look like the following front panel and to wire the objects on the block diagram to make the VI operational.

Note Remember that you can select Edit»Undo if you make a mistake.

Front Panel

1. Select File»Open and navigate toc:\exercises\LV Basics Ito open the Editing Exercise VI.

(Windows, Sun, and HP-UX)If you closed all open VIs, click the Open VI button on the LabVIEW dialog box.

2. Reposition the digital control.

a. Use the Positioning tool, shown at left, to click the digital control and drag it to another location. The control label follows the position of the control.

b. Click a blank space on the front panel to deselect the control. c. Click the label and drag it to another location. The control does not

follow. You can position an owned label anywhere relative to the control. The label follows its owner if you move the owner.

3. Reposition the three slide switches as a group.

a. Use the Positioning tool to click an open area near the three switches and drag a selection rectangle around the switches.

b. Click and drag one of the selected switches to a different location. All the selected switches move together.

4. Align the three LED indicators horizontally and space them evenly. a. Use the Positioning tool to click an open area near the three LEDs

and drag a selection rectangle around the LEDs.

b. Select the Align Objects pull-down menu on the toolbar and select Vertical Centers, shown at left, to align the LEDs horizontally. c. Select the Distribute Objects pull-down menu on the toolbar and

select Horizontal Centers, shown at left, to space the LEDs evenly. 5. Resize the single round LED.

a. Move the Positioning tool over the LED. Resizing circles appear on the LED.

b. Click and drag the cursor to enlarge the LED. Press the <Shift> key while you drag the cursor to keep the LED proportional to the original size.

6. Change the color of the single round LED.

a. By default, the state of the LED is OFF and dark green (FALSE). Use the Operating tool, shown at left, to click the LED and change its state to ON and bright green (TRUE).

b. Use the Coloring tool, shown at left, to right-click the LED and display the color picker.

c. Select a red color to change the ON state to red. 7. Display and edit the owned label of the digital indicator.

a. Use the Labeling tool, shown at left, to right-click the digital indicator and select Visible Items»Label from the shortcut menu. A small box appears, with a text cursor at the left margin, ready to accept typed input.

b. TypeDigital Indicatorin the box.

c. Click anywhere outside the label or click the Enter button on the toolbar, shown at left, to end text entry.

8. Delete the string control.

a. Use the Positioning tool to select the string control. b. Press the <Delete> key or select Edit»Clear.

9. Duplicate the free label.

a. Press the <Ctrl> key and use the Positioning tool to click the label.

(Macintosh)Press the <Option> key.(Sun)Press the <Meta> key.

(HP-UX and Linux)Press the <Alt> key. b. Drag the copy to a new location.

10. Change the text characteristics and hide the box around the free label. a. Use the Positioning tool to select the free label.

b. Select the Text Settings pull-down menu on the toolbar, shown at left, and change the text characteristics.

c. Use the Coloring tool to right-click the label and select T from the color picker.

11. Change the text characteristics and color of the y-axis text. a. Use the Labeling tool to highlight10.0in the y-axis.

b. Select the Text Settings pull-down menu on the toolbar and change the text characteristics and color.

12. Double-click0.0and type-10.0to change the y-axis range.

Block Diagram

13. Select Window»Show Diagram to display the block diagram. Wire the block diagram terminals as shown in the following block diagram.

The Multiply function multiplies a numeric constant,5.00, by the value in the digital control.

The Uniform White Noise VI generates a uniformly distributed, pseudorandom pattern whose values are in the range [–a:a], where a is the absolute value of amplitude,10.00, and passes it to the waveform graph.

The Not function inverts the value of the Boolean switch A and passes the value to the round LED.

14. Right-click the lower left terminal of the Multiply function and select Create»Constant from the shortcut menu to create a numeric constant, shown at left.

15. Type5in the textbox and click the Enter button on the toolbar.

16. Use the Wiring tool, shown at left, and the following techniques to wire the block diagram:

Select Help»Show Context Help to display the Context Help window. Use the Context Help window to determine which terminals are required. Required terminals are bold, recommended connections are plain text, and optional connections are gray. • To identify terminals on the nodes, right-click the icon and select

Visible Items»Terminal from the shortcut menu to display the connector pane. When wiring is complete, right-click the connector pane and select Visible Items»Terminal from the shortcut menu to remove the checkmark.

• To add a branch to a wire, click the location on the wire where you want to start the branch.

• To cancel a wire you started, press the <Esc> key, right-click, or click the source terminal.

17. Select File»Save to save the VI.

18. Display the front panel by clicking it or by selecting Window»Show Panel.

19. Use the Operating tool to change the value of the front panel controls. 20. Click the Run button on the toolbar to run the VI.

21. Select File»Close to close the VI.

End of Exercise 2-2

C. Debugging Techniques

If a VI does not run, it is a broken, or nonexecutable, VI. The Run button often appears broken, shown at left, when you create or edit a VI. If it is still broken when you finish wiring the block diagram, the VI is broken and will not run.

In document LabVIEW Basics I Course Manual (Page 53-58)