Documente Academic
Documente Profesional
Documente Cultură
tio
No na
t fo l In
r D str
ist um
rib en
uti ts
on
Complete the exercise in this lesson to reinforce the concepts you learn in Lesson 4 of LabVIEW Core 1.
Exercises
Exercise 4-1
National Instruments
| 4-1
Na
tio
No na
t fo l In
r D str
ist um
rib en
uti ts
on
Goal
Na
tio
No na
t fo l In
r D str
ist um
rib en
uti ts
on
Exercise 4-1
Create the icon and connector pane for a VI so that you can use the VI as a subVI.
Scenario
You have created a VI that determines a warning string based on the inputs given. Create an icon and a connector pane so that you can use this VI as a subVI.
Design
Inputs
Current Temperature
Max Temperature
Min Temperature
Error In
Outputs
Warning Text
Warning?
Error Out
Use the standard connector pane terminal pattern to assure room for future expansion.
Implementation
2. Open Temperature Warnings VI from the Project Explorer window. You created the Temperature Warnings VI in Exercise 3-1 and modified it in
Exercise 3-6.
National Instruments
4-3
Lesson 4
ni.com
4-4
Na
tio
No na
t fo l In
r D str
ist um
rib en
uti ts
on
3. Connect the inputs and outputs to the connector pane as shown in Figure 4-1.
Figure 4-1. Connector Pane Connections for Temperature Warnings VI
Connector PaneLocated in the upper right corner of the VI window, the connector pane displays potential terminals for the VI. The connector pane shown here
displays the standard pattern of terminals. You can right-click the connector pane and select Patterns to choose different terminal designs.
ConnectionsThe Context Help window displays the connections for the VI.
Using the Wiring tool, click the upper-left terminal of the connector pane.
Click the corresponding front panel control, Current Temperature.
Notice that the connector pane terminal fills in with a color to match the data type of the control connected to it.
Click the connector pane terminal below the Current Temperature terminal.
Click the corresponding front panel control, Max Temperature.
Continue wiring the connector pane until all controls and indicators are wired, and the Context Help window matches that shown in Figure 4-1.
Na
tio
No na
t fo l In
r D str
ist um
rib en
uti ts
on
4. Create an icon.
Use the tools in the Icon Editor dialog box to create an icon. Make the icon as simple or as complex as you want, however, it should be representative of the
function of the VI. Figure 4-2 shows a simple example of an icon for this VI.
Tip Double-click the Selection tool to select the existing graphic. Press the <Delete> key to delete the graphic. Then, double-click the rectangle tool to
automatically create a border for the icon.
Tip
Double-click the Text tool to modify fonts. You can select Small Fonts to choose fonts smaller than 9 points in size.
National Instruments
4-5
Tip
ni.com
4-6
Select the Glyphs tab and filter the glyphs by the keyword warning. Then drag a warning glyph onto your icon.
Na
tio
No na
t fo l In
r D str
ist um
rib en
uti ts
on
Lesson 4
5. Click OK when you are finished to close the Icon Editor dialog box.
6. Save and close the VI.
Test
1. Add files to the Weather Warnings LabVIEW project as shown in Figure 4-3.
Add an auto-populating folder to the Weather Warnings LabVIEW project. LabVIEW continuously monitors auto-populating folders and updates the folder
in the Project Explorer window according to changes made in the project and on disk.
Right-click My Computer in the Weather Warnings project and select AddFolder (Auto-populating) from the shortcut menu.
Navigate to <Exercises>\LabVIEW Core 1\Shared Files and click the Select Folder button.
The Shared Files folder contains shared files that you use in this and future exercises.
Na
tio
No na
t fo l In
r D str
ist um
rib en
uti ts
on
Navigate to <Exercises>\LabVIEW Core 1\Weather Warnings\Test VIs\SubVI Tester.vi and click Add File.
2. Open the SubVI Tester VI and complete the block diagram as shown in Figure 4-4.
Thermometer (Demo)Locate this VI in the Shared Files folder in the Project Explorer window, drag it to the block diagram and wire it as shown. This VI
generates sample temperature values.
Temperature WarningsBecause of the modifications you made to Temperature Warnings VI, you can use it as a subVI. Wire the Temperature Warnings VI
using the connections you just created.
Enum ConstantRight-click the Units (0:Celsius) input of the Thermometer (Demo) VI and select CreateConstant. Creating the enum constant from the
Thermometer (Demo) VI automatically populates the enum with the appropriate choices. Use the Operating tool to select Celsius.
OrUse the Or function to stop the VI if the user clicks the Stop button or if the Temperature Warnings VI outputs an error in the Error Out cluster.
3. On the front panel of the SubVI Tester VI, enter test values for the Max Temperature and Min Temperature controls.
4. Run the VI.
The Thermometer (Demo) VI generates sample temperatures, which the SubVI Tester VI displays on the Thermometer indicator.
National Instruments
4-7
Lesson 4
Na
tio
No na
t fo l In
r D str
ist um
rib en
uti ts
on
5. Notice how the string in the Warning Text indicator change as the temperature rises and falls.
6. After you have finished testing, save and close the VI.
ni.com
4-8