<?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>Accessing Previous Data VI</name>
  <metadata>
  <md:version>**new**</md:version>
  <md:created>2004/06/23 13:56:45.811 GMT-5</md:created>
  <md:revised>2004/07/14 09:41:50.041 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:abstract>To observe the use of shift registers and feedback nodes to hold data from previous iterations of a For Loop.
</md:abstract>
</metadata>
  
  <content>
    <exercise id="e1">
      <problem>
	<section>
	  <name> Front Panel </name> 
	  <list id="pain" type="enumerated">
	    <item> 

	      Open the <code>Feedback</code> VI located in the
	      <code>C:\Exercises\LabVIEW Basics I </code> directory. The
	      front panel shown in <cnxn target="imagin1"/> is already
	      built.
	      <figure id="imagin1">
		<media type="image/png" src=" feedbackfp.png"/>
	      </figure>
	      
	    </item> 
	  </list>
	</section>
	
	
	<section>
	  <name> Block Diagram </name> 
	  
	  <list id="pain1" type="enumerated">
	    <item> 
	      <!--para-->
	      Display the <cnxn target="imagin2">block diagram</cnxn> and
	      make sure both the front panel and block diagram are
	      visible. If necessary, close or move the <code>Tools</code>
	      and <code>Functions</code> palettes.
	      <figure id="imagin2">
		<media type="image/png" src="feedbackbd.png"/>
	      </figure>
	      The <code>1</code> wired to the left terminals on the
	      <code>For Loop</code> initializes the <code>Feedback
		Node</code> to <code>1</code>.
	      <!--para-->
	      The <code>Wait Until Next ms Timer</code> slows the
	      operation of the code. You also could use <code>Highlight
		Execution</code> instead of the wait function to slow the
	      operation.
	      <!--para-->
	      The same code is used twice in this block diagram with the
	      <code>Feedback Node</code> in a different portion of the
	      wire.
	    </item>
	  </list>
	</section>

	<section>
	  <name> Run the VI </name> 
	  <list id="pain2" type="enumerated">
	    
	    <item>
	      <!--para-->
	      Run the VI.
	      <!--para-->
	      The top section of the code reads the initialized
	      <code>Feedback Node</code> and passes this value to the
	      <code>Multiply</code> function.
	      <!--para-->
	      The bottom section of the code reads the initialized
	      <code>Feedback Node</code> and passes this value to the
	      indicator. This <code>Multiply</code> function does not
	      execute until the next iteration of the loop.  
	    </item>
	    <item>
	      <media id="m1" type="image/png" src="exehilit.png"/>
	      Click the <code>Highlight Execution</code> button, shown in
	      <cnxn target="m1"/>, to enable execution highlighting. Run
	      the VI again to observe the order of execution. Turn off
	      execution highlighting when you understand the execution
	      order. The VI continues executing at normal speed.  
	    </item>
	    
	    <item> 
	      Replace the bottom <code>Feedback Node</code> with a
	      <code>shift register</code>, as shown in <cnxn target="imagin3"/>.
	      <figure id="imagin3">
		<media type="image/png" src="feedbackbdedit.png"/>
	      </figure> 
	      <list id="pain3" type="enumerated">
		<item> 
		  Select the bottom <code>Feedback Node</code> and press
		  the <code>&lt;Delete</code> key to delete it.
		</item>
		<item> 
		  Right-click the border of the <code>For Loop</code> and
		  select <code>Add Shift Register</code>.  
		</item>    
		<item> 
		  Initialize the <code>shift register</code> by wiring
		  <code>1</code> to the left <code>shift register</code>.
		</item>
		<item> 
		  Change the label of the bottom indicator to <code>Shift
		    Register</code> and the top indicator to <code>Feedback
		    Node</code>.
		</item>    
	      </list>
	    </item> 
	    <item> 
	      <!--para-->
	      Run the VI.
	      <!--para-->
	      Notice that both the <code>Feedback Node</code> and the
	      <code>shift register</code> portions of the block diagram
	      have the same functionality.  </item>
	    <item> 
	      If time permits, complete the following optional steps;
	      otherwise, close the VI and do not save changes.
	    </item>
	  </list>  
	</section>   
	<section>     
	  <name>Optional</name> 
	  <list id="pain4" type="enumerated">
	    <item>  
	      Revise the <code>shift register</code> to display the last
	      three iterations of the <code>For Loop</code> data, as shown
	      in <cnxn target="imagin4"/>.
	      <figure id="imagin4">
		<media type="image/png" src="moreiterations.png"/>
	      </figure> 
	      <list id="painla" type="enumerated">
		<item> 
		  Resize the left <code>shift register</code> to three
		  elements. Right-click the <code>shift register</code>
		  and select <code>Add Element</code> from the shortcut
		  menu to add each <code>shift register</code>.
		</item>	    
		<item> 
		  Initialize each elements of the <code>shift
		    register</code> to <code>1</code>.
		</item>
		<item>
		  Right-click each element of the <code>shift
		  register</code> and select
		  <code>Create&gt;&gt;Indicator</code>. Label each
		  indicator.
		</item>
	      </list>
	    </item> 
	    <item> 
	      Run the VI.
	    </item> 
	    <item> 
	      Close the VI. Do not save changes.
	    </item> 
	  </list>
	</section>
      </problem>
    </exercise>
  </content>
  
</document>
