TEMPERATURE CONTROL 2 TUTORIAL
INTRODUCTION
In this tutorial, you will add a While Loop to your VI, an On/Off switch to control the loop, a loop iteration counter and a Wait Millisecond function to slow down the loop. You will:
OPEN TEMPERATURE 2.VI AND SAVE AS
Open Temperature_Control_2.vi and Save-As to Temperature_Control_3.vi
ADD A WHILE LOOP
Right-Click in the Block Diagram Window
The Function Palette should appear:
Bring the cursor over the Structures Button
The Structures Sub-Menu should Appear
Bring the cursor over the While Loop > Left-Click on the selection and drag a rectangle around all of the nodes on the Block Diagram.
Your Block Diagram should look like this:
MOVE THE THRESHOLD TERMINAL OUTSIDE THE LOOP AND REWIRE IT
Drag the Threshold Terminal outside the While Loop
Delete the bad wires
Rewire the Threshold terminal to the Greater? function
Your Block Diagram should look like this:
Notice the "Tunnel" for the wire to go to the external terminal
ADD AN ON/OFF SWITCH
On the Front Panel, place a Controls > Boolean > Vertical Switch on the Front Panel just to the upper right of the Thermometer Indicator
Change the label to On/Off
Position the Vertical Switch terminal to the left of the Conditional Terminal of the Loop
Your Front Panel and Block Diagram should look like this:
RUN THE VI ANDOBSERVE THE RESULTS
Change the threshold value to 50 (if you haven't already)
Flip the On/Off switch up to the On position
Note: You may have to select the Operate Value on the Tools Palette instead of Automatic
Click on the Run (Not Run Continuously) button
With the program loop running, change the threshold value to 10
Notice that even though the Threshold control value changes , the program still operates as if the Threshold value was at 50. This is because the control is outside the loop.
Stop the program with by flipping the On/Off switch to the Off position
MOVE THE THRESHOLD TERMINAL BACK INSIDE THE LOOP AND REWIRE
Select the Automatic Tool Selection on the Tools Palette
Drag the Threshold control terminal back inside the loop
Delete the bad wires and tunnel
Re-wire the Threshold control terminal to the Greater? function
Your Block Diagram should look like this:
RUN THE VI AGAIN AND OBSERVE THE RESULTS
Change the threshold value back to 50
Flip the On/Off switch up to the On position
Note: You may have to select the Operate Value on the Tools Palette
Click on the Run (Not Run Continuously) button
With the program loop running, change the threshold value to 10
Notice that changes in the Threshold control,immediately changes the operation of the program because the control is inside the loop.
Stop the program with by flipping the On/Off switch to the Off position
SAVE THE VI AND EXIT LABVIEW
|