<?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>Digital Example VI</name>
  <metadata>
  <md:version>**new**</md:version>
  <md:created>2004/06/18 13:28:45.222 GMT-5</md:created>
  <md:revised>2004/06/18 13:29:56.138 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 Instrument</md:keyword>
    <md:keyword>LabVIEW</md:keyword>
    <md:keyword>exercise</md:keyword>
    <md:keyword>VI</md:keyword>
    <md:keyword>digital</md:keyword>
  </md:keywordlist>

  <md:abstract>In this exercise, the objective is to control the digital I/O lines on the DAQ device. Complete the following steps to complete a VI that turns on the LEDs of Port 0 on the DAQ Signal Accessory based on the digital value set on the front panel. Each LED is wired to a digital line on the DAQ device. The lines are numbered 0, 1, 2, and 3, starting with the LED on the right.
</md:abstract>
</metadata>

  <content>
    <exercise id="e1">
      <problem>
	<note>
	  The LEDs use negative logic. That is, writing a <code>1</code> to the LED
	  digital line turns off the LED. Writing a <code>0</code> to the LED
	  digital line turns on the LED.
	</note>
	<list id="l1" type="enumerated">
	  <item><!--needs para--> 
	    <!--para--> 
	    Open the <code>Digital Example</code> VI, located in the
	    <code>C:\Exercises\LabVIEW Basics I</code> directory, and
	    modify the block diagram as shown in <cnxn target="l1f1"/>.
	    <figure id="l1f1">
	      <media type="image/png" src="digitalexamplebd.png"/>
	    </figure>
	      <media type="image/png" src="DAQAssistantIcon.png"/>
	    <!--para-->
	    Place the <code>DAQ Assistant</code> Express
	    VI, located on the <code>Functions&gt;&gt;Input</code>
	    palette, in the <code>While Loop</code>. Complete the
	    following steps to configure the counter to perform event
	    counting.
	    <list id="l1l1" type="enumerated">
	      <item>
		Select <code>Digital I/O&gt;&gt;Port Output</code> for the
		measurement to make.
	      </item>
	      <item>
		Select <code>Dev1&gt;&gt;port0</code> for the physical
		channel and click the <code>Finish</code> button.
	      </item>
	      <item>
		In the <code>Digital Output Port Task
		Configuration</code> dialog box that appears, select
		<code>Invert All Lines In Port</code> because the LEDs
		use negative logic.
	      </item>
	      <item>
		Click the <code>OK</code> button to close the
		configuration dialog box. All of the settings
		specified for the task are saved internally in the <code>DAQ
		Assistant</code> VI.
	      </item>
	    </list>
	      <media type="image/png" src="BuildArrayicon.png"/>
	    <!--para--> 
	    Place the <code>Build Array</code> function,
	    located on the <code>Functions&gt;&gt;All
	    Functions&gt;&gt;Array</code> palette, on the block
	    diagram. Wire the <code>Build Array</code> function to the
	    <code>DAQ Assistant</code>. Complete the wiring of the block diagram.
	    <!--para--> 
	    The Boolean buttons on the front panel are stored in an
	    array to simplify the code. The <code>Array Subset</code>
	    function extracts only the first four elements in the
	    array. The output of the array subset needs to be reversed
	    because element 0 of the array is the most significant
	    bit. The array is then converted to a number with the
	    <code>Boolean Array to Number</code> function, and
	    converted into an array of one element. This value is
	    passed to the <code>DAQ Assistant</code> Express VI to
	    write that value to the port.
	  </item>
	  <item>
	    Save the VI.
	  </item>
	  <item>
	    Display the front panel and run the VI. Turn the Boolean
	    LEDs on and off and observe the changes on the DAQ Signal
	    Accessory.
	  </item>
	  <item>
	    Stop and close the VI.
	  </item>
	</list>
      </problem>
    </exercise>
	    
	      

  </content> 
</document>
