<< Chapter < Page Chapter >> Page >
To create a VI and the icon and connector pane needed to use as a subVI.

Complete the following steps to create a VI that takes a number representing degrees Celsius and converts it to a numberrepresenting degrees Fahrenheit.

Front panel

  • Open a blank VI and begin building the following front panel.
  • (Optional) Select Window>>Tile Left and Right to display the front panel and block diagram side by side or Window>>Tile Up and Down to display the front panel and block diagram stacked.
  • Create a numeric control. You will use this control to enter the value for degrees Celsius.
    • Select Controls>>Numeric Controls to display the Numeric Controls palette. If the Controls palette is not visible, right-click an open space on the front panel workspace todisplay it.
    • Select the Numeric Control . Move the control to the front panel and click to place thecontrol.
    • Type deg C in the label of the control and press the <Enter> key or click the Enter button, shown in , on the toolbar. If you do not type the name immediately,LabVIEW uses a default label.
    You can edit a label at any time by double-clicking thelabel, using the Labeling tool, or right-clicking and selecting Properties from the shortcut menu to display the property dialog box.
  • Create a numeric indicator. You will use this indicator to display the value for degrees Fahrenheit.
    • Select the Numeric Indicator located on the Controls>>Numeric Indicators palette.
    • Move the indicator to the front panel and click to place the indicator.
    • Type deg F in the label and press the <Enter> key or click the Enter button.

Block diagram

  • Display the block diagram by clicking it or by selecting Window>> Show Block Diagram . LabVIEW creates corresponding control and indicatorterminal icons on the block diagram when you place controls and indicators on the front panel. Theterminals represent the data type of the control or indicator. You should see two double-precision,floating-point terminals on the block diagram, one indicator, and one control.
    Control terminals have a thicker border than indicator terminals.
  • Place the Multiply function, located on the Functions>>Arithmetic&Comparison>>Express Numeric palette, on the block diagram to the right of the deg C indicator. If the Functions palette is not visible, right-click an open space on the block diagram workspace to display it.
  • Place the Add function, located on the Functions>>Arithmetic&Comparison>>Express Numeric palette, on the block diagram to the right of the Multiply function.
  • Place a Numeric Constant , located on the Functions>>Arithmetic&Comparison>>Express Numeric palette, to the lower left of the Multiply function. Type 1.80 in the constant. When you first place a numeric constant, it ishighlighted so you can type a value. If the constant is no longer highlighted, double-click the constant to activatethe Labeling tool.
  • Place a Numeric Constant , located on the Functions>>Arithmetic&Comparison>>Express Numeric palette, to the left of the Add function. Type 32.0 in the constant.
  • Use the Wiring tool, shown in , to wire the icons as shown in .
    • To wire from one terminal to another, use the Wiring tool to click the first terminal, move the tool to the second terminal, and click thesecond terminal. You can start wiring at either terminal.
    • You can bend a wire by clicking to tack down the wire and moving the cursor in a perpendiculardirection. Press the spacebar to toggle the wire direction.
    • To identify terminals on the nodes, right-click the Multiply and Add functions and select Visible Items>>Terminals from the shortcut menu to display the connector pane on theblock diagram. Return to the icons after wiring by right-clicking the functions and selecting Visible Items>>Terminals from the shortcut menu to remove the checkmark.
    • When you move the Wiring tool over a terminal, the terminal area blinks, indicating thatclicking will connect the wire to that terminal and atip strip appears, displaying the name of the terminal. If the Context Help window is open, the terminal area also blinks in the Context Help window.
    • To cancel a wire you started, press the <Esc> key, right-click, or click the terminal where you started the wire.
  • Display the front panel by clicking it or by selecting Window>>Show Front Panel .
  • Save the VI as Convert C to F.vi in the C:\Exercises\LabVIEW Basics I directory.

Run the vi

  • Enter a number in the numeric control and run the VI.
    • Use the Operating tool, shown in , or the Labeling tool to double-click the numeric control and type a new number.
    • Click the Run button, shown at left, to run the VI.
    • Try several different numbers and run the VI again.

Icon and connector pane

  • Right-click the icon in the upper right corner of the front panel window and select Edit Icon from the shortcut menu. The Icon Editor dialog box appears.
  • Double-click the Select tool, shown in , on the left side of the Icon Editor dialog box to select the default icon.
  • Press the <Delete> key to remove the default icon.
  • Double-click the Rectangle tool, shown in , to redraw the border.
  • Create the icon in .
    • Double-click the Text tool, shown in , and change the font to Small Fonts .
    • Use the Text tool to click the editing area where you will begin typing.
    • Type C and F . While the text is active, you can move the text by pressing thearrow keys.
    • Use the Pencil tool, shown in , to create the arrow.
      To draw horizontal or vertical straight lines, press the <Shift> key while you use the Pencil tool to drag the cursor.
    • Use the Select tool and the arrow keys to move the text and arrow you created.
    • Select the B&W icon and click the 256 Colors button in the Copy from section to create a black and white icon, which LabVIEW uses for printing unless you have a colorprinter.
    • Select the 16 Colors icon and click the 256 Colors button in the Copy from section.
    • When you complete the icon, click the OK button to close the Icon Editor dialog box. The icon appears in the upper right corner of thefront panel and block diagram.
  • Right-click the icon on the front panel and select Show Connector from the shortcut menu to define the connector pane terminal pattern. LabVIEW selects a defaultconnector pane pattern based on the number of controls and indicators on the front panel. For example, this front panelhas two terminals, deg C and deg F , so LabVIEW selects a connector pane pattern with two terminals, shown in .
  • Assign the terminals to the numeric control and numeric indicator.
    • Select Help>>Show Context Help to display the Context Help window.
    • Click the left terminal in the connector pane. The tool automatically changes to the Wiring tool, and the terminal turns black.
    • Click the deg C control. A marquee highlights the control on the front panel.
    • Click an open space on the front panel. The marquee disappears, and the terminal changes to the data typecolor of the control to indicate that you connected the terminal.
    • Click the right terminal in the connector pane, and click the deg F indicator.
    • Click an open space on the front panel. Both terminals of the connector pane are orange.
    • Move the cursor over the connector pane. The Context Help window shows that both terminals are connected to double-precision, floating-pointvalues.
  • Save and close the VI. You will use this VI later in the course.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Labview graphical programming. OpenStax CNX. Apr 09, 2015 Download for free at https://legacy.cnx.org/content/col11408/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Labview graphical programming' conversation and receive update notifications?

Ask