<?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="m10657">
  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Communications: Using Direct Digital Synthesis</name>
  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
  <md:version xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2.5</md:version>
  <md:created xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2002/06/09</md:created>
  <md:revised xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2003/07/29 11:47:54.898 GMT-5</md:revised>
  <md:authorlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:author xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="mjberry">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Matthew</md:firstname>
      <md:othername xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">J.</md:othername>
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Berry</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">mjberry@uiuc.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="mjberry">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Matthew</md:firstname>
      <md:othername xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">J.</md:othername>
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Berry</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">mjberry@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="butala">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Mark</md:firstname>
      <md:othername xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">D.</md:othername>
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Butala</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">butala@uiuc.edu</md:email>
    </md:maintainer>
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="rlmorris">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Robert</md:firstname>
      <md:othername xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">L.</md:othername>
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Morrison</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">rlmorris@uiuc.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">communications</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">wireless</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">direct digital synthesis</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">transmitter</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">digital signal processing</md:keyword>
  </md:keywordlist>

  <md:abstract xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">This module introduces Direct Digital Synthesis with prepared code that transmits arbitrary input as an FM radio signal.  The module then explains how to program the DDS hardware and concludes with a simple Frequency Shift Keying exercise.  </md:abstract>
</metadata>


  <content xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <section 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="new0">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Introduction</name>
      <para 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="introduction">
	<term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Direct Digital Synthesis</term> (<term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">DDS</term>) is a
	method for generating a desired waveform (such as a sine wave)
	by using the technique described in <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="fig1"/> below.
      </para>

      <figure 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="fig1">
	<media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="image/png" src="fig1.png"/>
	<caption xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Direct digital synthesis (DDS) (<cite xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" src="#reference1">Couch</cite>)</caption>
      </figure>

      <para 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="para2">
	Quantized samples of a desired waveform are stored in the memory
	of the microprocessor system.  This desired waveform can then be
	generated by "playing out" the stored words into the
	digital-to-analog converter.  The frequency of this waveform is
	determined simply by how fast the stored words are read from
	memory, and is thus programmable.  Likewise, the phase and
	amplitude of the generated waveform are programmable.
      </para>

      <para 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="para3">
	The DDS technique is replacing analog circuits in many
	applications.  For example, it is used in higher-priced
	communication receivers to generate local oscillator signals.
	It can also be used to generate sounds in electronic pipe organs
	and music synthesizers.  Another application is its use by lab
	instrument manufacturers to generate output waveforms in
	function generators and arbitrary waveform generators (<cite xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" src="#reference1">Couch</cite>).
      </para>

      <para 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="para4">
	In this lab you will familiarize yourself with the capabilities
	of the Analog Devices AD9854 DDS.  The DDS board is installed
	between the 6-channel card and the DSP card at some (not all)
	lab stations.  You can tell which boxes have them by the way the
	6-channel card sits higher inside the metal box.
      </para>
    </section>
    <section 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="fm">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Frequency Modulation (FM) Radio Exercise</name>

      <para 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="para5">
        To get your feet wet and see a demonstration of the DDS,
        perform the following exercise. Copy the files
        <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">FM.asm</code> (downloadable <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="para9">here</cnxn>) and <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">mod.asm</code> from the
        <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">v:\ece320\54x\dds\</code> directory.  Assemble and run
        the frequency modulation (FM) program <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">FM.asm</code>.
        Next, plug an audio source into one of the two DSP input
        channels that you've been using all semester.  If you have a
        CD on you, pop it into the computer and use that.  If not, use
        a music web site on the Internet as your audio source.
        Connect the computer to the DSP by using a male-male audio
        cable and an audio-to-BNC converter box (little blue box),
        both of which are in the lab. The computer has three audio
        outputs on the back; use the middle jack.  Ask your TA if you
        can't find the cable and/or box or don't see how to make the
        connection.  Next, connect a dipole antenna to the output of
        the DDS (port \#1 on the back of the DDS board).  A crude but
        effective dipole antenna can be formed by connecting together
        a few BNC and banana cables in the shape of a <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">T</code>.
        There should be one or two of these concoctions in the
        lab. Once the connections are made, turn on the black receiver
        in the lab, and tune it to 104.9 MHz (wide band FM).  You
        should be able to hear your audio source!  <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="note">If your audio sounds distorted, it's most likely
        due to the volume of your audio source being too loud and
        getting clipped by the DSP analog-to-digital converter.</note>
      </para>

      <section 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="new1">
	<name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Spectral Copies</name>
	<para 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="para6">
	  Spectral Copies: The digital-to-analog converter on the DDS is
	  unfiltered, which means that there is no anti-imaging filter
	  to remove the spectral replicas.  To see this, plug the output
	  of the DDS board directly into the vector signal analyzer
	  (VSA), and observe the spectrum.  Use 104.9 MHz as the center
	  frequency, and set the span wide enough so that you can see
	  the spectra of the replicas to the left and right of the 104.9
	  MHz signal.  Use the marker to find the peaks of the other
	  replicas, and record their frequencies.  Once you've done
	  that, reattach the antenna to the DDS output, and tune the
	  receiver to the frequencies you just recorded.  You should be
	  able to hear your audio on each of the other frequencies.
	  <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="Note">The clock rate of the DDS is 60MHz, which corresponds to
	  <m:math>
	    <m:apply>
	      <m:times/>
	      <m:cn>2</m:cn>
	      <m:pi/>
	    </m:apply>
	  </m:math> in digital frequency.</note> Therefore, the 104.9
	  MHz signal you just listened to is roughly equivalent to
	  <m:math>
	    <m:apply>
	      <m:divide/>
	      <m:apply>
		<m:times/>
		<m:cn>7</m:cn>
		<m:pi/>
	      </m:apply>
	      <m:cn>2</m:cn>
	    </m:apply>
	  </m:math> in digital frequency. What are the digital
	  frequencies of the other copies you saw on the VSA?
	</para>
      </section>
    </section>

    <section 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="sec2">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">How to use the DDS</name>

      <para 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="para7">
        The DDS has several different modes of operation: single-tone,
        unramped <term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Frequency Shift Keying</term>
        (<term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">FSK</term>), ramped FSK, chirp, and <term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Binary Phase
        Shift Keying</term> (<term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">BPSK</term>).  In this lab we will
        use the DDS in single-tone mode.  Single-tone mode is easy to
        use, and is powerful enough to create many different kinds of
        waveforms, including FM and FSK.
      </para>

      <section 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="sec2sub1">
        <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">FM code</name>
        <para 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="para7sub1">
          The FM code you just ran (also listed <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="apprendix">here</cnxn>) is fairly
          straightforward. The program first calls the
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">radioinit</code> subroutine.  This routine sets the
          DDS to single-tone mode and turns off an inverse-sinc filter
          to conserve power.  Following <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">radioinit</code>, the
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">setcarrier</code> subroutine is called.  This routine
          sets the frequency of the DDS output by writing to the two
          most significant 8-bit frequency registers of the 48-bit
          frequency-tuning word on the DDS<note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="footnote">Communication between the DSP and the DDS is
          done through a parallel bus.</note>.  Although the
          frequency-tuning word on the DDS has 48 bits of resolution,
          the upper 16 bits provide us with enough resolution for the
          purposes of this lab, and so we will only be writing to the
          two most significant registers.  See <cite xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">page 26</cite> in
          the DDS data sheet for a layout of the frequency-tuning
          word.
	</para>

        <para 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="para7sub2">
          To set the carrier frequency, we first need to determine what 
          frequency word has to be written to the frequency registers on
          the DDS.  This can be done using <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="eq1"/>:

          <equation 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="eq1">
            <m:math display="block">
              <m:apply>
                <m:eq/>
		<m:ci>Frequency word</m:ci>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:divide/>
		    <m:ci>baseband frequency</m:ci>
		    <m:ci>
		      <m:mrow>
			<m:mn>60</m:mn>
			<m:mo> </m:mo>
			<m:mi>MHz</m:mi>
		      </m:mrow>
		    </m:ci>
		  </m:apply>
		  <m:apply>
		    <m:power/>
		    <m:cn>2</m:cn>
		    <m:cn>48</m:cn>
		  </m:apply>
		</m:apply>
              </m:apply>
            </m:math>
          </equation>
          where <term xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">baseband frequency</term> corresponds to the
          desired frequency that lies in the range of 0-30 MHz.  For
          example, to get the DDS to transmit at 104.9 MHz, you would
          choose the baseband frequency to be 15.1 MHz since 104.9 MHz
          is one of the unfiltered spectral replicas of 15.1 MHz.
          Then, using <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="eq1"/>, the frequency word for
          15.1 MHz (and 104.9 MHz) would be equal to <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">406D 3A06
          D3D4h</code>.  But since we only write to the two most
          significant registers of the frequency-tuning word, we only
          need the first 4 hexadecimal numbers of this result,
          i.e. <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">406Dh</code>.  The first two of those,
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">40h</code>, need to get written to the most
          significant 8-bit frequency register, while the second two
          hex numbers, <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">6Dh</code>, need to get written to the
          second-most significant 8-bit frequency register.  This is
          where the <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">40h</code> and <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">6Dh</code> in the
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">setcarrier</code> subroutine of the FM code come from.
        </para>

        <para 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="para7sub3">
          Writing to the frequency registers is accomplished using the
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">portw</code> instruction.  To write to the frequency
          or phase registers on the DDS, the second operand of the
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">portw</code> instruction must be
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">10xxxxxx</code>, where the lower six bits are the
          address of the specific register to be written to.  The
          address of the most significant frequency register on the
          DDS is <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">04h</code>, and the address of the second most
          significant frequency register on the DDS is
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">05h</code> (see <cite xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">page 26</cite> in the data
          sheet).  It is important to note that the way our DDS boards
          were built, you will not be allowed to make two consecutive
          writes.  To solve this problem, a subroutine called
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">nullop</code> is called to waste some CPU time between
          writes.  <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">nullop</code> does this by simply repeating
          the <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">nop</code> instruction 128 times.
        </para>

        <para 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="para7sub4">
          After the program returns from the <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">setcarrier</code>
          subroutine, it enters an infinite loop in which it waits for
          a serial interrupt to occur.  The serial interrupt occurs
          every time a new sample is acquired from one of the two
          input channels and is transmitted to the DSP via the serial
          port.  When the interrupt occurs, an interrupt service
          routine called <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">ANALOG_IFC</code> (see
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">core_mod.asm</code> executes and calls the
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">handle_sample</code> subroutine.  The
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">handle_sample</code> subroutine reads in the acquired
          sample from the serial port and scales that sample so that
          it can be "mapped" to a frequency in the range of ±75
          kHz<note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="footnote">In FM radio, the amplitude of the
          message signal being transmitted determines the amount of
          frequency deviation from the carrier frequency of the
          passband signal.  ±75 kHz is the largest frequency
          deviation allowed.</note>.  The scaled sample therefore
          determines the frequency deviation and is added to
          <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">6Dh</code>.  The last step is to write the result to
          the second most significant frequency register so that the
          frequency of the DDS output can be updated.
        </para>
      </section>

      <section 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="sec2sub2">
        <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Programming the Phase</name>
	
        <para 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="para7sub5">
          The process for changing the phase of the DDS output is the
          same as it was for changing the frequency of the DDS output.
          To change the phase, you need to write a phase word to a
          phase-adjust register on the DDS.  The phase-adjust register
          is 14 bits wide and is split up into two smaller registers
          that you can write to (see <cite xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">page 26</cite> in the data
          sheet).  The upper 6 bits have address <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">00h</code>, and
          the lower 8 bits have address <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">01h</code>.  The phase
          word can be calculated using <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="eq2"/>:

          <equation 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="eq2">
            <m:math display="block">
              <m:apply>
                <m:eq/>
		<m:ci>Phase word</m:ci>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:divide/>
		    <m:ci>Carrier phase</m:ci>
		    <m:apply>
		      <m:times/>
		      <m:cn>2</m:cn>
		      <m:pi/>
		    </m:apply>
		  </m:apply>
		  <m:apply>
		    <m:power/>
		    <m:cn>2</m:cn>
		    <m:cn>14</m:cn>
		  </m:apply>
		</m:apply>
              </m:apply>
            </m:math>
          </equation>

          Once you've calculated the phase word, you can write it to
          the DDS using the <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">portw</code> instruction as before.
          Just make sure you use the correct address for the phase
          register.
        </para>
      </section>

      <section 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="sect2sub3">
        <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Programming the Amplitude</name>
        <para 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="para7sub6">
          The DDS also allows you to program the amplitude, but this
          functionality is not addressed in this lab.  You will be
          able to implement a digital communication system in ECE320
          without having to program the amplitude.  Interested readers
          are referred to the data sheet.
        </para>
      </section>
    </section>

    <section 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="sec3">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">FSK exercise</name>

      <para 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="para8">
        Now that you know how to use the DDS in single-tone mode,
        implement a simple FSK system that uses 2 frequencies: 120.005
        MHz, and 120.011 MHz.  You don't need to encode any data for
        this exercise.  In other words, your DDS output should just
        continuously alternate between the two frequency symbols.
        Also, the DDS automatically ensures continuous phase, so you
        won't have to keep track of it.  Use a symbol length of
        approximately 725μs (the same length as your lab 5
        symbols).  Timer interrupts are an elegant way to control the
        symbol lengths, but in this lab we will keep things simple and
        control the symbol lengths by creating a second (longer)
        <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">nullop</code> subroutine and calling it between writes
        to the DDS.  The second <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">nullop</code> subroutine should
        waste approximately 725μs worth of time.  <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="Note">Since we're not using input or output from the
        DSP, you don't need to use the WaitData or WaitAudio
        macros.</note>
      </para>

      <section 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="sec3sub1">
        <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Testing</name>

        <para 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="para8sub1">
          Note that the corresponding baseband frequencies for 120.005
          MHz and 120.011 MHz are 5 kHz, and 11 kHz, respectively.
          Since these baseband frequencies lie within the 22.05 kHz
          bandwidth of the DSP, you will be able to view your FSK
          signal in real time on the oscilloscope
          <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">without</emphasis> the contribution from the
          spectral replicas.  Just feed the output of the DDS into a
          second DSP (the anti-aliasing filter on the DSP will get rid
          of the spectral replicas), and pass it through to the output
          and the scope.  You should be able to verify that there is
          continuous phase between frequency symbols, and that your
          symbol length is approximately 725μs.  You should also
          view the spectrum of your DDS output on the VSA to verify
          that your symbols have the correct frequencies.
        </para>
      </section>
    </section>
    <section 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="appendix">
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Appendix</name>
      <para 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="para9">
	<link xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" src="http://cnx.rice.edu/modules/m10657/latest/FM.asm">FM.asm</link>
      </para>
    </section>

  </content>
  <bib:file>
    <bib:entry id="reference1">
      <bib:book>
	<bib:author>Leon W. Couch, II</bib:author>
	<bib:title>Digital and Analog Communication Systems</bib:title>
	<bib:publisher>Prentice Hall</bib:publisher>
	<bib:year>1995</bib:year>
	<bib:address>Upper \\ Saddle River, New Jersey, 07458</bib:address>
	<bib:edition>3rd edition</bib:edition>
      </bib:book>
    </bib:entry>
  </bib:file>

</document>
