Summary: In this exercise, the objective is to use the Case structure in a VI. Complete the following steps to build a VI that allows the user to analyze data for limit testing and to determine the highest value.
EXERCISE 1
1.A) Front Panel
- Open the Temperature Running Average VI.
- Modify the front panel as shown in Figure 1.
Figure 1 - Place a horizontal smooth box, located on the
Controls>>All Controls>>Decorationspalette, on the front panel. This decoration visibly groups theAnalysisitems. - Create a duplicate of the
PowerBoolean switch. Label the new switchANALYSIS. Right-click the switch and selectMechanical Action>>Switch When Pressedfrom the shortcut menu. - Place a numeric control, located on the
Controls>>Numeric Controlspalette, on the front panel. Label the controlHigh Limit. - Place a round LED, located on the
Controls>>LEDspalette, on the front panel. Label the indicatorWarning. - Place a numeric indicator from the
Controls>>Numeric Indicatorspalette, on the front panel. Label the indicatorHigh Value. - Right-click the chart display and select
Visible Items>>Digital Displayfrom the shortcut menu to display the digital values.
- Place a horizontal smooth box, located on the
- Select
File>>Save Asto save the VI asTemperature Control.viin theC:\Exercises\LabVIEW Basics Idirectory.
1.B) Block Diagram
- Modify the block diagram as shown Figure 2. Enlarge the
While Loopto create space for the new items.Figure 2 Place the
Casestructure, located on theFunctions>>Execution Controlpalette, on the block diagram. Wire theAnalysiscontrol to theselectorterminal. Click thedecrementorincrementbutton to select theTruecase.Place two
Greater?functions, located on theFunctions>>Arithmetic & Comparison>>Express Comparisonpalette, on the block diagram. This function returnsTrueif the temperature exceedsHigh Limit. Otherwise, the function returnsFalse.Place the
Selectfunction, located on theFunctions>>Arithmetic & Comparison>>Express Comparisonpalette, on the block diagram. This function returns the greater of the two input values.- Wire the True case as shown in Figure 2.
- Click the
decrementorincrementbutton to select theFalsecase.
- Complete the
Falsecase of theCase Structure, shown in Figure 3.Figure 3 - Right-click the tunnel that connects to the
Warning Indicatorand selectCreate>>Constant. Use theOperatingtool to change the Boolean constant toFalse. - Right-click the tunnel that connects to the
High Valueindicator and selectCreate>>Constant. Enter-99999for the value of the constant.
- Right-click the tunnel that connects to the
- Save the VI. You will use this VI later in the course.
1.C) Run the VI
- Display the front panel, type
80inHigh Limit, and run the VI. IfANALYSISis off, the VI turns off theWarningLED and displays a value of-99999forHigh Value. IfANALYSISis on, the VI turns on theWarningLED when the temperature is aboveHigh Limitand displays the currentHigh Value. - Close the VI.
No comments:
Post a Comment