<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="None">
  <name>Temperature Monitor VI</name>
  <metadata>
  <md:version>1.1</md:version>
  <md:created>2004/06/24 10:10:32 GMT-5</md:created>
  <md:revised>2004/07/16 15:14:28.615 GMT-5</md:revised>
  <md:authorlist>
      <md:author id="NationalInstruments">
      <md:firstname>National</md:firstname>
      
      <md:surname>Instruments</md:surname>
      <md:email>certification@ni.com</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="lizzardg">
      <md:firstname>Elizabeth</md:firstname>
      
      <md:surname>Gregory</md:surname>
      <md:email>lizzardg@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="mshiralkar05">
      <md:firstname>Malan</md:firstname>
      
      <md:surname>Shiralkar</md:surname>
      <md:email>mshiralkar05@hotmail.com</md:email>
    </md:maintainer>
    <md:maintainer id="harika">
      <md:firstname>Harika</md:firstname>
      
      <md:surname>Basana</md:surname>
      <md:email>ilsai@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="NationalInstruments">
      <md:firstname>National</md:firstname>
      
      <md:surname>Instruments</md:surname>
      <md:email>certification@ni.com</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>National Instruments</md:keyword>
    <md:keyword>LabVIEW</md:keyword>
    <md:keyword>exercise</md:keyword>
    <md:keyword>Temperature Monitor</md:keyword>
  </md:keywordlist>

  <md:abstract>Use a While Loop and a waveform chart to acquire and display data.</md:abstract>
</metadata>
  
  <content>
    <exercise id="e1">
      <problem>
	<para id="p1">
	  Complete the following steps to build a VI that measures temperature
	  and displays it on a waveform chart.
	</para>
	<section id="s1">
	  <name>Front Panel</name>
	  <list id="l1" type="enumerated">
	    <item>
	      Open a blank VI and build the front panel shown in <cnxn target="f1"/>.
	      <figure id="f1">
		<media type="image/png" src="tempmon.png"/>
	      </figure>
	      <list id="l2" type="enumerated">
		<item>      
		  Place the vertical toggle switch, located on the
		  <code>Controls&gt;&gt;Buttons &amp; Switches</code> palette,
		  on the front panel. Label this switch
		  <code>Power</code>. You use the switch to stop the
		  acquisition.
		</item>
		<item>	      
		  Place a <code>waveform chart</code>, located on the
		  <code>Controls&gt;&gt;Graph Indicators</code> palette, on the
		  front panel. Label the chart <code>Temperature
		    History</code>. The <code>waveform chart</code> displays
		  the temperature in real time.
		</item>
		<item>	      
		  <media type="image/png" src="labeling.png"/>
		  The <code>waveform chart</code> <code>legend</code>
		  labels the plot <code>Plot 0</code>. Use the
		  <code>Labeling</code> tool to triple-click <code>Plot
		    0</code> in the chart legend, and change the label to
		  <code>Temp</code>.
		</item>
		<item>
		  The temperature sensor measures room temperature. Use
		  the <code>Labeling</code> tool to double-click
		  <m:math><m:cn>10.0</m:cn> </m:math> in the y-axis and
		  type <m:math><m:cn>90</m:cn> </m:math> to rescale the
		  chart. Leave the x-axis in its default state.
		</item>
		<item>
		  
		  Change 
		  <m:math>
		    <m:apply>
		      <m:minus/>
		      <m:cn>10.0</m:cn>
		    </m:apply>
		  </m:math> in the y-axis to
		  <m:math>
		    <m:cn>70</m:cn>
		  </m:math>.
		</item>
		<item>
		  Label the y-axis <code>Temp (Deg
		    F)</code> and the x-axis <code>Time (sec)</code>.
		</item>
	      </list>
	    </item>
	  </list>
	</section>
	<section id="s2">
	  <name>Block Diagram</name>
	  <list id="l3" type="enumerated">
	    <item>
	      Select <code>Window&gt;&gt;Show Block Diagram</code> to display
	      the block diagram.
	    </item>
	    <item>
	      Enclose the two terminals in a While Loop, as shown in the
	      <cnxn target="f2">block diagram</cnxn>.
	      <figure id="f2">
		<media type="image/png" src="tempmonbd.png"/>
	      </figure>
	    </item>
	    <item>
	      Right-click the <code>conditional</code> terminal and select
	      <code>Continue if True</code>.
	    </item>
	    <item>
	      Wire the objects as shown in <cnxn target="f2"/>.
	      <list id="l4" type="enumerated">
		<item>      
		  <media type="image/png" src="tempicon.png"/>
		  Place the <code>Thermometer</code> VI on the block
		  diagram. Select <code>Functions&gt;&gt;All Functions&gt;&gt;Select a
		    VI</code> and navigate to <code>C:\Exercises\LabVIEW
		    Basics I\Thermometer.vi.</code> This subVI returns one
		  temperature measurement from the temperature sensor.
		  <note type="note">
		    Use the <code>(Demo) Thermometer</code> VI if you do
		    not have a DAQ device available.
		  </note>
		</item>
		<item>    
		  <media type="image/png" src="waitms.png"/>
		  Place the <code>Wait Until Next ms Multiple</code>
		  function, located on the <code>Functions&gt;&gt;All
		    Functions&gt;&gt;Time &amp; Dialog</code> palette, on the
		  block diagram.
		</item>
		<item>
		  <media type="image/png" src="tempmonconst.png"/>
		  Right-click the <code>millisecond multiple</code>
		  input of the <code>Wait Until Next ms
		  Multiple</code> function, select
		  <code>Create&gt;&gt;Constant</code> from the shortcut
		  menu, type <m:math> <m:cn>500</m:cn> </m:math>, and
		  press the <code>&lt;Enter&gt;</code> key. The numeric
		  constant specifies a wait of
		  <m:math>
		    <m:apply>
		      <m:times/>
		      <m:cn>500</m:cn>
		      <m:ci>ms</m:ci>
		    </m:apply>
		  </m:math> so the loop executes once every
		  half-second.
		  <note type="note">
		    To measure temperature in Celsius, wire a Boolean
		    <code>True</code> constant located on the
		    <code>Functions&gt;&gt;Arithmetic &amp; Comparison&gt;&gt;Express
		      Boolean</code> palette to the <code>Temp Scale</code>
		    input of the <code>Thermometer</code> VI. Change the
		    scales on charts and graphs in subsequent exercises to
		    a range of <m:math> <m:cn>20</m:cn> </m:math> to
		    <m:math> <m:cn>32</m:cn> </m:math> instead of <m:math>
		      <m:cn>70</m:cn> </m:math> to <m:math> <m:cn>90</m:cn>
		    </m:math>.
		  </note>
		</item>
	      </list>
	    </item>
	    <item>
	      Save the VI as <code>Temperature Monitor.vi</code> in the
	      <code>C:\Exercises\LabVIEW Basics I</code> directory.
	    </item>
	  </list>
	</section>
	<section id="s3">
	  <name>Run the VI</name>
	  <list id="l5" type="enumerated">
	    <item>
	      Display the front panel by clicking it or by selecting
	      <code>Window&gt;&gt;Show Front Panel</code>.
	    </item>
	    <item>
	      Use the <code>Operating</code> tool to click the vertical
	      toggle switch and turn it to the <code>ON</code> position.
	    </item>
	    <item>
	      <!--needs to be corrected, should be seperate paragraphs-->
	      Run the VI.
	      <!--different para-->
	      The subdiagram within the <code>While Loop</code> border
	      executes until the specified condition is
	      <code>True</code>. For example, while the switch is on
	      (<code>True</code>), the <code>Thermometer</code> VI takes
	      and returns a new measurement and displays it on the
	      <code>waveform chart</code>.
	    </item>
	    <item>
	      Click the vertical toggle switch to stop the
	      acquisition. The condition is <code>False</code>, and the
	      loop stops executing.
	    </item>
	  </list>
	</section>
	<section id="s4">
	  <name>Front Panel</name>
	  <list id="l6" type="enumerated">
	    <item>
	      Format and customize the x- and y-scales of the waveform chart.
	      <list id="l7" type="enumerated">
		<item>     
		  Right-click the chart and select <code>Properties</code>
		  from the shortcut menu to display the <code>Chart
		    Properties</code> dialog box.
		</item>
		<item>      
		  Click the <code>Format and Precision</code> tab. Select
		  <code>Deg F (Y-axis)</code> in the top pull-down
		  menu. Set the <code>Digits of precision</code> to
		  <m:math><m:cn>1</m:cn></m:math>.
		</item>
		<item>      
		  Click the <code>Plots</code> tab and select different
		  styles for the y-axis, as shown in <cnxn target="f3"/>.
		  <figure id="f3">
		    <media type="image/png" src="chartprop2.png"/>
		  </figure>
		</item>
		<item>      
		  Select the <code>Scales</code> tab and select the
		  <code>Time (sec) (X-axis)</code> in the top pull-down
		  menu. Set the scale options as shown in <cnxn target="f4"/>. Set the <code>Multiplier</code> to
		  <m:math><m:cn>0.50</m:cn> </m:math> to account for the
		  <code>500 ms Wait</code> function.
		  <figure id="f4">
		    <media type="image/png" src="chartprop3.png"/>
		  </figure>
		</item>
		<item>      
		  In the <code>Scales</code> tab, select the <code>Deg F
		    (Y-axis)</code> in the top pull-down menu. Set the scale
		  options as shown in <cnxn target="f5"/>.
		  <figure id="f5">
		    <media type="image/png" src="chartprop4.png"/>
		  </figure>
		</item>
		<item>
		  Click the <code>OK</code> button to close
		  the dialog box when finished.
		</item>
	      </list>
	    </item>
	    <item>
	      Right-click the <code>waveform chart</code> and select
	      <code>Data Operations&gt;&gt;Clear Chart</code> from the shortcut
	      menu to clear the display buffer and reset the
	      <code>waveform chart</code>.
	      <note type="tip">
		When a VI is running, you can select <code>Clear
		  Chart</code> from the shortcut menu.
	      </note>
	    </item>
	    <item>
	      Each time you run the VI, you first must turn on the
	      vertical toggle switch and then click the <code>Run</code>
	      button due to the current mechanical action of the
	      switch. Modify the mechanical action of the vertical toggle
	      switch so temperature is plotted on the graph each time you
	      run the VI, without having to first set the toggle switch.
	      <list id="l8" type="enumerated">
		<item>      
		  Stop the VI if it is running.
		</item>
		<item>    
		  Use the <code>Operating</code> tool to click the
		  vertical toggle switch and turn it to the
		  <code>ON</code> position.
		</item>
		<item>     
		  Right-click the switch and select <code>Data
		    Operations&gt;&gt;Make Current Value Default</code> from the
		  shortcut menu. This sets the <code>ON</code> position as
		  the default value.
		</item>
		<item>
		  <media type="image/png" src="latchpress.png"/> 
		  Right-click the switch and select <code>Mechanical
		    Action&gt;&gt;Latch When Pressed</code> from the shortcut
		  menu. This setting changes the control value when you
		  click it and retains the new value until the VI reads it
		  once. At this point the control reverts to its default
		  value, even if you keep pressing the mouse button. This
		  action is similar to a circuit breaker and is useful for
		  stopping <code>While Loops</code> or for getting the VI
		  to perform an action only once each time you set the
		  control.
		</item>
	      </list>
	    </item>
	  </list>
	</section>
	<section id="s5">
	  <name>Run the VI</name>
	  <list id="l9" type="enumerated">
	    <item>
	      Run the VI.
	    </item>
	    <item>
	      Use the <code>Operating</code> tool to click the vertical
	      switch to stop the acquisition. The switch changes to the
	      <code>OFF</code> position and changes back to
	      <code>ON</code> after the <code>conditional</code> terminal
	      reads the value.
	    </item>
	    <item>
	      Save the VI. You will use this VI in the <cnxn document="m12235">Temperature Running Average</cnxn> VI.
	    </item>
	  </list>
	</section>
      </problem>
    </exercise>
  </content>
</document>
