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>>Decorations
palette, on the front panel. This decoration visibly groups theAnalysis
items. - Create a duplicate of the
Power
Boolean switch. Label the new switchANALYSIS
. Right-click the switch and selectMechanical Action>>Switch When Pressed
from the shortcut menu. - Place a numeric control, located on the
Controls>>Numeric Controls
palette, on the front panel. Label the controlHigh Limit
. - Place a round LED, located on the
Controls>>LEDs
palette, on the front panel. Label the indicatorWarning
. - Place a numeric indicator from the
Controls>>Numeric Indicators
palette, on the front panel. Label the indicatorHigh Value
. - Right-click the chart display and select
Visible Items>>Digital Display
from the shortcut menu to display the digital values.
- Place a horizontal smooth box, located on the
- Select
File>>Save As
to save the VI asTemperature Control.vi
in theC:\Exercises\LabVIEW Basics I
directory.
1.B) Block Diagram
- Modify the block diagram as shown Figure 2. Enlarge the
While Loop
to create space for the new items.Figure 2 - Place the
Case
structure, located on theFunctions>>Execution Control
palette, on the block diagram. Wire theAnalysis
control to theselector
terminal. Click thedecrement
orincrement
button to select theTrue
case. - Place two
Greater?
functions, located on theFunctions>>Arithmetic & Comparison>>Express Comparison
palette, on the block diagram. This function returnsTrue
if the temperature exceedsHigh Limit
. Otherwise, the function returnsFalse
. - Place the
Select
function, located on theFunctions>>Arithmetic & Comparison>>Express Comparison
palette, 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
decrement
orincrement
button to select theFalse
case.
- Place the
- Complete the
False
case of theCase Structure
, shown in Figure 3.Figure 3 - Right-click the tunnel that connects to the
Warning Indicator
and selectCreate>>Constant
. Use theOperating
tool to change the Boolean constant toFalse
. - Right-click the tunnel that connects to the
High Value
indicator and selectCreate>>Constant
. Enter-99999
for 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
80
inHigh Limit
, and run the VI. IfANALYSIS
is off, the VI turns off theWarning
LED and displays a value of-99999
forHigh Value
. IfANALYSIS
is on, the VI turns on theWarning
LED when the temperature is aboveHigh Limit
and displays the currentHigh Value
. - Close the VI.
No comments:
Post a Comment