<?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>Debug Exercise (Main) VI</name>
  <metadata>
  <md:version>**new**</md:version>
  <md:created>2004/06/21 16:36:40.654 GMT-5</md:created>
  <md:revised>2004/06/28 15:37:26.115 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>Debug</md:keyword>
    <md:keyword>exercise</md:keyword>
  </md:keywordlist>

  <md:abstract>Practice debugging techniques.</md:abstract>
</metadata>
  
  <content>
    <exercise id="e1">
      <problem>
	<para id="para1">
	  Complete the following steps to load a broken VI and correct the
	  error. Use single-stepping and execution highlighting to step
	  through the VI.
	</para>
	<section id="section1">
	  <name>Front Panel</name>
	  <list id="list1" type="enumerated">
	    <item>
	      <!--needs to be corrected, should be seperate paragraphs-->
	      Select <code>File&gt;&gt;Open</code> and navigate to
	      <code>C:\Exercises\LabVIEW Basics I</code> to open the
	      <code>Debug Exercise (Main)</code> VI.
	      <!--different para-->
	      The front panel shown in <cnxn target="f1"/> appears.
	      <figure id="f1">
		<media type="image/png" src="debugfp.png"/>
	      </figure>
	      <!--different para-->
	      <media id="m1" type="image/png" src="brokrun.png"/>
	      Notice the <code>Run</code> button on the toolbar appears
	      broken, shown in <cnxn target="m1"/>, indicating that the VI
	      is broken and cannot run.
	    </item>
	  </list>
	</section>
	<section id="section2">
	  <name>Block Diagram</name>
	  <list id="list2" type="enumerated">
	    <item>
	      <!--needs to be corrected, should be seperate paragraphs-->
	      Select <code>Window&gt;&gt;Show Block Diagram</code> to display
	      the block diagram shown in <cnxn target="f2"/>.
	      <figure id="f2">
		<media type="image/png" src="debugbd.png"/>
	      </figure>
	      <media type="image/png" src="randnum.png"/>
	      <!--different para-->
	      The <code>Random Number (0-1)</code> function, located on
	      the <code>Functions&gt;&gt;Arithmetic &amp; Comparison&gt;&gt;Express
		Numeric</code> palette, produces a random number between
	      <m:math>
		<m:cn>0</m:cn>
	      </m:math>
	      and
	      <m:math>
		<m:cn>1</m:cn>
	      </m:math>.
	      <media type="image/png" src="multiply.png"/>
	      <!--different para-->
	      The <code>Multiply</code> function, located on the
	      <code>Functions&gt;&gt;Arithmetic &amp; Comparison&gt;&gt;Express
		Numeric</code> palette, multiplies the random number by
	      <m:math>
		<m:cn>10.0</m:cn>
	      </m:math>.
	      <!--different para-->
	      <media type="image/png" src="numconst2.png"/>
	      The <code>numeric constant</code>, located on the
	      <code>Functions&gt;&gt;Arithmetic &amp; Comparison&gt;&gt;Express
		Numeric</code> palette, is the number to multiply by the
	      random number.  
	      <!--different para--> 
	      <media type="image/png" src="debugsub.png"/> The
	      <code>Debug Exercise (Sub)</code> VI, located in the
	      <code>C:\Exercises\ LabVIEW Basics I</code> directory, adds
	      <m:math>
		<m:cn>100.0</m:cn>
	      </m:math> and calculates the square root
	      of the value.
	    </item>
	    <item>
	      Find and fix each error.
	      <list id="list3" type="enumerated">
		<item>
		  Click the broken <code>Run</code> button to display the
		  <code>Error list</code> window, which lists all the
		  errors.
		</item>
		<item>
		  Select an error description in the <code>Error
		    list</code> window. The <code>Details</code> section
		  describes the error and in some cases recommends how to
		  correct the error.
		</item>
		<item>
		  Click the <code>Help</code> button to display a topic in
		  the <cite>LabVIEW Help</cite> that describes the error
		  in detail and includes step-by-step instructions for
		  correcting the error.
		</item>
		<item>
		  Click the <code>Show Error</code> button or double-click
		  the error description to highlight the area on the block
		  diagram that contains the error.
		</item>
		<item>
		  Use the <code>Error list</code> window to fix each error.
		</item>
	      </list>
	    </item>
	    <item>
	      Select <code>File&gt;&gt;Save</code> to save the VI.
	    </item>
	    <item>
	      Display the front panel by clicking it or by selecting
	      <code>Window&gt;&gt;Show Front Panel</code>.
	    </item>
	  </list>
	</section>
	<section id="section3">
	  <name>Run the VI</name>
	  <list id="list4" type="enumerated">
	    <item>
	      Click the <code>Run</code> button to run the VI several times.
	    </item>
	    <item>
	      Select <code>Window&gt;&gt;Show Block Diagram</code> to display
	      the block diagram.
	    </item>
	    <item>
	      Animate the flow of data through the block diagram.
	      <list id="list5" type="enumerated">
		<item>
		  <media id="m2" type="image/png" src="exehilit.png"/> Click the
		  <code>Highlight Execution</code> button, shown in <cnxn target="m2"/>, on the toolbar to enable execution
		  highlighting.
		</item>
		<item>
		  <media id="m3" type="image/png" src="stepinto.png"/>
		  Click the <code>Step Into</code> button, shown in <cnxn target="m3"/>, to start single-stepping. Execution
		  highlighting shows the movement of data on the block
		  diagram from one node to another using bubbles that move
		  along the wires. Nodes blink to indicate they are ready
		  to execute.
		</item>
		<item>
		  <media id="m4" type="image/png" src="stepover.png"/>
		  <!--needs to be corrected, should be seperate paragraphs-->
		  Click the <code>Step Over</code> button, shown in <cnxn target="m4"/>, after each node to step through the
		  entire block diagram. Each time you click the <code>Step
		    Over</code> button, the current node executes and pauses
		  at the next node.
		  <!--different para-->
		  Data appear on the front panel as you step through the
		  VI. The VI generates a random number and multiplies it
		  by <m:math> <m:cn>10.0</m:cn> </m:math>. The subVI adds
		  <m:math><m:cn>100.0</m:cn> </m:math> and takes the
		  square root of the result.
		</item>
		<item>
		  <media id="m5" type="image/png" src="stepout.png"/>
		  When a blinking border surrounds the entire block
		  diagram, click the <code>Step Out</code> button, shown
		  in <cnxn target="m5"/>, to stop single-stepping through
		  the <code>Debug Exercise (Main)</code> VI.
		</item>
	      </list>
	    </item>
	    <item>
	      Single-step through the VI and its subVI.
	      <list id="list6" type="enumerated">
		<item>
		  Click the <code>Step Into</code> button to start
		  single-stepping.
		</item>
		<item>
		  <media type="image/png" src="runsubvi.png"/> When the
		  <code>Debug Exercise (Sub)</code> VI blinks, click the
		  <code>Step Into</code> button. Notice the run button on
		  the subVI.
		</item>
		<item>
		  <media id="m6" type="image/png" src="debugbdglyph.png"/> Display the <code>Debug
		    Exercise (Main)</code> VI block diagram by clicking
		  it. A green glyph, shown in <cnxn target="m6"/>, appears
		  on the subVI icon on the <code>Debug Exercise
		    (Main)</code> VI block diagram, indicating that the
		  subVI is running.
		</item>
		<item>
		  Display the <code>Debug Exercise (Sub)</code> VI block
		  diagram by clicking it.
		</item>
		<item>
		  Click the <code>Step Out</code> button twice to finish
		  single-stepping through the subVI block diagram. The
		  <code>Debug Exercise (Main)</code> VI block diagram is
		  active.
		</item>
		<item>
		  Click the <code>Step Out</code> button to stop
		  single-stepping.
		</item>
	      </list>
	    </item>
	    <item>
	      Use a probe to check intermediate values on a wire as a VI
	      runs.
	      <list id="list7" type="enumerated">
		<item>
		  <!--needs to be corrected, should be seperate
		  paragraphs-->
		  <media id="m7" type="image/png" src="probe.png"/> Use
		  the <code>Probe</code> tool, shown <cnxn target="m7"/>,
		  to click any wire. A window similar to <cnxn target="f3"/> appears.
		  <figure id="f3">
		    <media type="image/png" src="probewin.png"/>
		  </figure>
		  <!--different para-->
		  LabVIEW numbers the <code>Probe</code> window
		  automatically and displays the same number in a glyph on
		  the wire you clicked.
		</item>
		<item>
		  Single-step through the VI again. The <code>Probe</code>
		  window displays data passed along the wire.
		</item>
	      </list>
	    </item>
	    <item>
	      Place breakpoints on the block diagram to pause execution at
	      that location.
	      <list id="list8" type="enumerated">
		<item>
		  <media id="m8" type="image/png" src="brkpoint.png"/>
		  Use the <code>Breakpoint</code> tool, shown in <cnxn target="m8"/>, to click nodes or wires. Place a
		  breakpoint on the block diagram to pause execution after
		  all nodes on the block diagram execute.
		</item>
		<item>
		  Click the <code>Run</code> button to run the VI. When
		  you reach a breakpoint during execution, the VI pauses
		  and the <code>Pause</code> button on the toolbar appears
		  red.
		</item>
		<item>
		  <media id="m9" type="image/png" src="pause.png"/> Click
		  the <code>Continue</code> button, shown <cnxn target="m9"/>, to continue running to the next
		  breakpoint or until the VI finishes running.
		</item>
		<item>
		  Use the <code>Breakpoint</code> tool to click the
		  breakpoints you set and remove them.
		</item>
	      </list>
	    </item>
	    <item>
	      Click the <code>Highlight Execution</code> button to disable
	      execution highlighting.
	    </item>
	    <item>
	      Select <code>File&gt;&gt;Close</code> to close the VI and all open
	      windows.
	    </item>
	  </list>
	</section>
      </problem>
    </exercise>
  </content>
  
</document>
