<?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>Waveform Example VI</name>
  <metadata>
  <md:version>**new**</md:version>
  <md:created>2004/06/16 16:29:21.171 GMT-5</md:created>
  <md:revised>2004/06/16 16:35:57.990 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>waveforms</md:keyword>
    <md:keyword>VI</md:keyword>
    <md:keyword>exercise</md:keyword>
  </md:keywordlist>

  <md:abstract>In this exercise, the objective is to graph a waveform that an instrument such as a digital oscilloscope returns as an ASCII or binary string.
</md:abstract>
</metadata>
  <!--Note: this module is waiting for CNXML 0.6, where items in lists
  can take para.  Items needing this feature have been marked.-->

  <content>
    <exercise id="e1">
      <problem>
	<para id="p1">
	  For the ASCII waveform string, the waveform consists of 128
	  points. Up to four ASCII characters separated by commas
	  represent each point. The following header precedes the data
	  points:
	  <code type="block">
	    CURVE {12,28,63,...128 points in total...,}CR LF
	  </code>
	</para>
	<para id="p2">
	  For the binary waveform string, the waveform consists of 128
	  points. Each point is represented as a 1-byte unsigned
	  integer. The following header precedes the data points:
	  <code type="block">
	    CURVE % {Bin Count MSB}{Bin Count LSB}{åå¤Å...128 bytes in total...} {Checksum} CR LF
	  </code>
	</para>
	<para id="p3">
	  Complete the following steps to examine a VI that converts the
	  waveform to an array of numbers. The VI graphs the array and
	  reads the waveform string from the NI Instrument Simulator or
	  from a previously stored array.
	</para>
	<section id="s1">
	  <name>NI Instrument Simulator</name>
	  <list id="s1l1" type="enumerated">
	    <item>
	      Power off the NI Instrument Simulator and configure it to
	      communicate through the GPIB by setting <cnxn target="s1l1f1">the switches</cnxn> on the side of the box.
	      <figure id="s1l1f1">
		<media type="image/jpg" src="simgpib.png"/>
	      </figure>
	      These switch settings configure the instrument as a GPIB
	      device with an address of 2.
	    </item>
	    <item>
	      Power on the NI Instrument Simulator. Only the Power and
	      Ready LEDs are lit to indicate that the NI Instrument
	      Simulator is in GPIB communication mode.
	    </item>
	  </list>
	</section>
	<section id="s2">
	  <name>Front Panel</name>
	  <list id="s2l1" type="enumerated">
	    <item>
	      Open the <code>Waveform Example</code> VI located in the
	      <code>C:\Exercises\LabVIEW Basics I</code> directory. The
	      front panel shown in <cnxn target="s2l1f1"/> is already
	      built.
	      <figure id="s2l1f1">
		<media type="image/jpg" src="waveex.png"/>
	      </figure>
	      <term>Data Format</term> specifies an ASCII waveform or a
	      binary waveform. <term>Data Source</term> specifies whether
	      the data is simulated or read from the NI Instrument
	      Simulator through the GPIB.
	    </item>
	  </list>
	</section>
	<section id="s3">
	  <name>Block Diagram</name>
	  <list id="s3l1" type="enumerated">
	    <item>
	      Display and examine the block diagram shown in <cnxn target="s3l1f1"/>.
	      <figure id="s3l1f1">
		<media type="image/jpg" src="waveexbd.png"/>
	      </figure>
	      <list id="s3l1l1">
		<item>
		    <media type="image/jpg" src="strsubseticon.png"/>
		  The <code>String Subset</code>
		    function located on the <code>Functions&gt;&gt;All
		    Functions&gt;&gt;String</code> palette returns a substring of
		  128 elements starting from the fifth byte of the binary
		  waveform string, excluding the header and trailer bytes.
		</item>
		<item>
		    <media type="image/jpg" src="strtobyteicon.png"/>
		  The <code>String to Byte Array</code>
		    function, located on the <code>Functions&gt;&gt;All
		    Functions&gt;&gt;String&gt;&gt;String/Array/Path Conversion</code>
		  palette, converts the binary string to an array of
		  unsigned integers.
		</item>
		<item>
		    <media type="image/jpg" src="strglengthicon.png"/>
		  The <code>String Length</code>
		    function, located on the <code>Functions&gt;&gt;All
		    Functions&gt;&gt;String</code> palette, returns the number of
		  characters in the waveform string.
		</item>
		<item>
		    <media type="image/jpg" src="extrctnumdblicon.png"/>
		  The  <code>Extract Numbers</code> VI,
		  located in the <code>Exercises</code> directory,
		  extracts numbers from the ASCII waveform string and
		  places them in an array. Non-numeric characters, such as
		  commas, separate numbers in the string.
		</item>
		<item>
		  The <code>VISA Write</code> and <code>VISA Read</code>
		  functions, located on the <code>Functions&gt;&gt;All
		    Functions&gt;&gt;Instrument I/O&gt;&gt;VISA</code> palette, query
		  the NI Instrument Simulator for a square wave in either
		  ASCII or 1-byte binary format.
		</item>
		<item>
		    <media type="image/jpg" src="Error.png"/>
		  The <code>Simple Error Handler</code>
		    VI, located on the <code>Functions&gt;&gt;All
		    Functions&gt;&gt;Time &amp; Dialog</code> palette, reports any
		  errors.
		</item>
	      </list>
	    </item>
	    <item><!--needs para tags-->
	      <!--para-->
	      Display the front panel and run the VI.  
	      <!--para-->
	      The True case acquires and converts the binary waveform
	      string to an array of numeric values. The False case
	      acquires and converts the ASCII waveform string to an array
	      of numeric values.
	    </item>
	    <item>
	      Set <code>Data Format</code> to <code>ASCII</code> and run
	      the VI. The ASCII waveform string displays, the VI converts
	      the values to a numeric array, and displays the string
	      length and numeric array.
	    </item>
	    <item>
	      Set <code>Data Format</code> to <code>Binary</code> and run
	      the VI again. The binary waveform string and string length
	      display, the VI converts the string to a numeric array, and
	      displays it in the graph.
	      <note>
		The binary waveform is similar to the ASCII
		waveform. However, the number of bytes in the string is
		significantly lower. It is more efficient to transfer
		waveforms as binary strings than as ASCII strings because
		binary encoding requires fewer bytes to transfer the same
		information.
	      </note>
	    </item>
	    <item>
	      Close the VI. Do not save changes.
	    </item>
	  </list>
	</section>
      </problem>
    </exercise>
  </content>
  
</document>
