Lab 2 

Objective: Use interrupts and timers
                  Setup and test the tone generation hardware
                  Feasibility study on the notes and frequencies that can be computed in real time by the 8051
                  8051 Assembly language (everything will be 'C' after this)

Instructions
Note: This lab requires more thinking than coding, which is appropriate since we are doing assembly language!

  1. Hook up the 8-bit D/A converter (DAC) to Port 0 of your processor. There is a reason for using port-0 that we will get to later. You will also need to use an extra pin from another port to "strobe" the digital data into the Converter. See the timing waveform on the DAC data sheet.  You can use the 8051's external memory data access capability if you want to, but this isn't necessary and we haven't covered memory mapped I/O yet. So don't worry about that! Go ahead and just use direct port operations to talk to the ADC.
  2. Generate a test sine-wave tone in software and see if you can hear it on the amplified speaker. Use the audio cable that we provide to hook your player to the amp. Follow hookup directions provided by Douglas or discussed in lecture. You might want to look at the output signal with your scope to see if it looks right. Note about the lookup table: the mathematical function sin(x) evaluates to real numbers between -1 and +1, with sin(0) = sin(2PI) = 0. To come up with the lookup table for your program, you should use excel to design a sine-based function that returns values from 0 to 255, such that table[0] = table[256] = 0. Cut these values out of your excel program and install them into your code. 
  3. Extend your (assembly) program to play a single three note chord using only one of the on-chip timers running at a fixed rate. Ask your musical classmates for some chords that should sound nice and look up the frequencies that correspond to the notes in the chord (search the web). Try to stay in a frequency range between 100Hz and 3KHz for the three notes of the chord. 

Turn in