<?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>File Reader VI</name>
  <metadata>
  <md:version>**new**</md:version>
  <md:created>2004/06/22 09:56:23.054 GMT-5</md:created>
  <md:revised>2004/06/22 09:57:48.482 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="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="lizzardg">
      <md:firstname>Elizabeth</md:firstname>
      
      <md:surname>Gregory</md:surname>
      <md:email>lizzardg@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>VI</md:keyword>
  </md:keywordlist>

  <md:abstract>In this exercise, the objective is to build a VI that reads data from a file. Complete the following steps to build a VI that reads the file created previously and displays the information in a string indicator.
</md:abstract>
</metadata>

  <content>
    <exercise id="e1">
      <problem>
	<section id="s1">
	  <name>Front Panel</name>
	  <list id="s1l1" type="enumerated">
	    <item>
	      Open a blank VI and build the front panel shown in <cnxn target="s1l1f1"/> using the file path control located on
	      the <code>Controls&gt;&gt;Text Controls</code> palette and a
	      string indicator located on the <code>Controls&gt;&gt;Text
	      Indicators</code> palette.
	      <figure id="s1l1f1">
		<media type="image/png" src="filereader.png"/>
	      </figure>
	    </item>
	  </list>
	</section>
	<section id="s2">
	  <name>Block Diagram</name>
	  <list id="s2l1" type="enumerated">
	    <item>
	      Build the block diagram shown in <cnxn target="s2l1f1"/>.
	      <figure id="s2l1f1">
		<media type="image/png" src="filereaderbd.png"/>
	      </figure>
	      <list id="s2l1l1" type="enumerated">
		<item>
		  <media type="image/png" src="OpenFileIcon.png"/>

		  Place the <code>Open/Create/Replace File</code> VI,
		  located on the <code>Functions&gt;&gt;All Functions&gt;&gt;File
		  I/O</code> palette, on the block diagram. This VI
		  displays a dialog box that you use to open or create
		  a file. Right-click the <code>prompt</code> input,
		  select <code>Create&gt;&gt;Constant</code> from the
		  shortcut menu, and type <code>Select Filename</code>
		  in the constant. Right-click the
		  <code>function</code> input, select
		  <code>Create&gt;&gt;Constant</code> from the shortcut
		  menu, and click the constant with the
		  <code>Operating</code> tool to select
		  <code>open</code>.
		</item>
		<item>
		    <media type="image/png" src="ReadFileIcon.png"/>
		  Place the <code>Read File</code> function, located
		  on the <code>Functions&gt;&gt;All Functions&gt;&gt;File
		  I/O</code> palette, on the block diagram. This
		  function reads <code>count</code> bytes of data from
		  the file starting at the beginning of the file.
		</item>
		<item>
		    <media type="image/png" src="CloseFileIcon.png"/>
		  Place the <code>Close File</code>
		  function, located on the <code>Functions&gt;&gt;All
		  Functions&gt;&gt;File I/O</code> palette, on the block
		  diagram. This function closes the file.
		</item>
		<item>
		    <media type="image/png" src="Error.png"/>
		  Place the <code>Simple Error
		  Handler</code> VI, located on the
		  <code>Functions&gt;&gt;All Functions&gt;&gt;Time &amp;
		  Dialog</code> palette, on the block diagram. This VI
		  checks the error cluster and displays a dialog box
		  if an error occurs.
		</item>
		<item>
		  Complete the block diagram as shown in <cnxn target="s2l1f1"/>.
		</item>
	      </list>
	    </item>
	    <item>
	      Save the VI as <code>File Reader.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="s3l1" type="enumerated">
	    <item>
	      Display the front panel and use the
	      <code>Operating</code> tool to click the
	      <code>Browse</code> button in the path control.
	    </item>
	    <item>
	      Navigate to <code>demofile.txt</code> and click the
	      <code>Open</code> or <code>OK</code> button.
	    </item>
	    <item>
	      Run the VI. <code>String Read from File</code> displays
	      the contents of the file.
	    </item>
	    <item>
	      If time permits, complete the <cnxn target="s4">challenge step</cnxn>. Otherwise, save and
	      close the VI.
	    </item>
	  </list>
	</section>
	<section id="s4">
	  <name>Challenge</name>
	  <list id="s4l1" type="enumerated">
	    <item>
	      Modify the VI so it parses the numeric value and
	      displays the numeric value in a numeric indicator. After
	      you finish, save and close the VI.
	      <note type="tip">
		Use the <code>Match Pattern</code> function to search
		for the first numeric character.
	      </note>
	    </item>
	  </list>
	</section>
      </problem>
    </exercise>

  </content>
  
</document>
