\documentstyle[11pt]{article}
\voffset=-.75in
\setlength{\textheight}{8.25in}
\hoffset=-.5in
\setlength{\textwidth}{6.4in}
\begin{document}
\begin{center} 
{\bf EE 451 } \\[.1in]
{\bf Lab 2:  Sampling and Aliasing in Real Time with the
Motorola DSP56002 EVM}
\end{center}

For experimentation in real-time signal processing, we will use the
following equipment:  

\begin{itemize}
\item Motorola DSP56002 EVM, with a sampling rate of 48~kHz.

\item An oscilloscope.  

\item A function generator.

\item A source of audio (e.g., a CD player with headphones).

\end{itemize}

\begin{enumerate}

\item Use the 56000 assembly-language program {\tt play.asm}.  
To assemble this, first copy the files {\verb+ada_init.asm+} and
{\verb+txrx_isr.asm+} from the {\verb+C:\EVM+} directory to your
directory.  The codec is a complicated chip, and these pre-written
routines do the work necessary to sample the input signal.  This will be
discussed further in lab.

Assemble the program using the following command: \\
{\tt ASM56000 -a -b -l lab2.asm}

\item Set the function generator to give a 2-volt peak-to-peak, 5~kHz
sine wave.  Connect the output with the mono cable to the input of the
A/D converter.  Connect the outputs of the D/A converter to two channels
of an oscilloscope.  Run the program {\tt EVM56K} on the PC.  Give the
command {\tt load lab2}, which will load the attached program into the
56002.  The command {\tt disassemble \$40} should show you the
instructions as loaded into the 56002.  {\tt go \$40} will run the
program.  The two outputs should look the same.

\item Vary the frequency of the function generator, and observe the
response of the D/A converter.

\item Connect your audio source to the input of the A/D.  Listen to the
output through headphones.  Note the quality of the sound.

\item Stop the 56002.  Modify the program to put out the left channel
every sample interval, but put out the right channel only every 12th
sample interval.  This output of the right channel will then have a
sampling rate of 4~kHz. The easiest way to do this is with a {\tt DO}
instruction.  Set up the {\tt DO} instruction to read execute the
sampling code 11 times without putting the input value into Accumulator
B, then add sampling code to put the input value into both A and B, and
finally loop back to the {\tt DO} instruction.

Connect the function generator back to the A/D, and run this modified
program.  Vary the frequency of the function generator, and compare the
two outputs of the D/A converter.  Observe aliasing for high
frequencies.  At what frequency does aliasing begin?

\item Modify the above program so both channels put out every 48th sample,
giving a sampling frequency of 1~kHz.
Connect your audio source to the input of the A/D.  Listen to the
output through headphones.  Note the quality of the sound.

\end{enumerate}


\begin{verbatim}
;****************************************************************************
;PLAY: 
;WILL PASS AUDIO FROM LEFT CHANNEL STRAIGHT THROUGH TO 
;BOTH LEFT AND RIGHT CHANNELS
;***************************************************************************


START   EQU     $40

        org     p:$0
        jmp     START

        org     p:$000c
        jsr     ssi_rx_isr      ;SSI receive data
        jsr     ssi_rx_isr      ;SSI receive data with exception
        jsr     ssi_tx_isr      ;SSI transmit data
        jsr     ssi_tx_isr      ;SSI transmit with exception

        org     p:START

        movep   #$261009,x:PLL  ;these labels are defined in the 
        movep   #0000,x:BCR     ;ada_init.asm program
        ori     #3,mr           ;mask interrupts
        movec   #0,sp           ;clear hardware stack pointer
        move    #0,omr          ;operating mode 0
        move    #$40,r6         ; initialise stack pointer
        move    #-1,m6          ; linear addressing

        include 'ada_init.asm'

TONE_OUTPUT     EQU     HEADPHONE_EN+LINEOUT_EN+(4*LEFT_ATTN)+(4*RIGHT_ATTN)
TONE_INPUT      EQU     MIC_IN_SELECT+(15*MONITOR_ATTN)

loop_1
        
        jset    #2,x:SSISR,*    ;wait for frame sync to pass
        jclr    #2,x:SSISR,*    ;wait for frame sync

        move    x:RX_BUFF_BASE,a        ;receive left
        move    x:RX_BUFF_BASE,b        ;receive left
        
        move    a,x:TX_BUFF_BASE        ;transmit left
        move    b,x:TX_BUFF_BASE+1      ;transmit right
        
        move    #TONE_OUTPUT,y0         ;set up control words
        move    y0,x:TX_BUFF_BASE+2
        move    #TONE_INPUT,y0
        move    y0,x:TX_BUFF_BASE+3
        nop

        jmp     loop_1                  ;go back to the beginning

        include 'txrx_isr.asm'

        end
\end{verbatim}
\end{document}
