OBJECTIVE You will build a VI that simulates a testing application. When the VI starts, a subVI opens a front panel and prompts the user to enter a name and to verify the date and time. The front panel remains open until the user clicks on Continue.
First, you must build a VI that pops open its front panel, prompts the user for information, and waits until the user clicks on a Boolean button. You then will use this VI as a subVI in the block diagram of the main VI.
Chapter 7 Customizing VIs
LabVIEW Tutorial Manual 7-4 © National Instruments Corporation
Front Panel
1. Open a new front panel and build the front panel shown in the preceding illustration.
Block Diagram
1. Build the block diagram shown in the preceding illustration.
Not function (Functions»Boolean). In this exercise, the Not function inverts the value of the Continue button so that the While Loop executes repeatedly until you click on the Continue button.
(The default state of the button is FALSE.)
Chapter 7 Customizing VIs
© National Instruments Corporation 7-5 LabVIEW Tutorial Manual
2. Create the icon for the VI as shown at left. To access the Icon Editor, pop up on the icon pane of the front panel and select Edit Icon.
3. Switch to the connector pane by popping up on the icon pane and selecting Show Connector.
4. Build the connector. When you build the connector, notice that the default connector pane is not what you see illustrated to the left.
To get the correct connector pane, choose Patterns from the pop-up menu on the connector. Choose the pattern with two inputs and three outputs. Then choose Flip Horizontal. Now you can connect the Date and Time Controls to the two connectors on the left side of the icon, and the Name Answer, Date Answer, and Time Answer indicators to the three connectors on the right side of the icon, as illustrated by the following Help window. After you create the connector, return to the icon display.
5. Save the VI as MyGetOperatorInfo.vi. Now you can customize the VI with the VI setup options to make it look like a dialog box.
Chapter 7 Customizing VIs
LabVIEW Tutorial Manual 7-6 © National Instruments Corporation
Configure the Execution Options as shown in the previous illustration.
Then change to Window Options and configure it as shown in the following illustration.
6. After you finish with the VI Setup options, resize the front panel as shown in the following illustration so you do not see the three string indicators.
7. Save the VI and close the VI. You will use this VI as a subVI soon.
Chapter 7 Customizing VIs
© National Instruments Corporation 7-7 LabVIEW Tutorial Manual
Front Panel
1. Open a new front panel.
2. Place a Waveform Chart (Controls»Graph) on the front panel and label it Temperature Data.
3. Modify the scale of the chart, so that its upper limit is set to 90.0 and its lower limit is set to 70.0.
4. Build the rest of the front panel as shown in the preceding illustration.
5. Pop up on the rectangular stop button and select Mechanical Action»Latch When Released.
The chart displays the temperature as it is acquired.
Chapter 7 Customizing VIs
LabVIEW Tutorial Manual 7-8 © National Instruments Corporation
Block Diagram
6. Build the block diagram as shown in the preceding illustration.
7. Add a Sequence structure and add the following to frame 0.
The Get Date/Time String function (Functions»Time & Dialog) outputs the current date and time.
The Get Operator Info VI (Functions»Select a VI...) pops open its front panel and prompts the user to enter a name, the date, and the time.
Boolean constant (Functions»Boolean) controls whether the input date and time string are true. To set this option to True, click on the constant with the Operating tool.
8. Pop up on the Sequence structure and select Add Frame After from the pop-up menu.
9. Place a While Loop inside frame 1 of the Sequence structure.
Chapter 7 Customizing VIs
© National Instruments Corporation 7-9 LabVIEW Tutorial Manual
10. Add the objects shown in the following illustration to frame 1.
The Digital Thermometer VI (Functions»Tutorial). Returns one temperature measurement from a simulated temperature sensor or the My Thermometer VI (Functions»Select a VI…) you built in Chapter 2.
Wait Until Next ms Multiple function (Functions»Time & Dialog) causes the For Loop to execute in ms.
Numeric constant (Functions»Numeric). You can also pop up on the Wait Until Next Tick Multiple function and select Create Constant to automatically create and wire the numeric constant. The numeric constant delays execution of the loop for 500 ms (0.5 seconds).
Not function (Functions»Boolean) inverts the value of the Stopbutton so that the While Loop executes repeatedly until you click on Stop.
11. Save the VI. Name it MyPop-upPanelDemo.vi.
12. Run the VI. The front panel of the Get Operator Info VI opens and prompts you to enter your name, the date, and the time. Click on the Continue button to return to the calling VI. Then temperature data is acquired until you click on the STOP button.
Note: The front panel of the Get Operator Info VI opens because of the options you selected from the VI Setup... dialog box. Do not try to open the front panel of the subVI from the block diagram of the My Pop-up Panel Demo VI.
13. Close all windows.
Chapter 7 Customizing VIs
LabVIEW Tutorial Manual 7-10 © National Instruments Corporation