E91 - Embedded Systems, Lab 5

D/A and OA

Back to Embedded Systems Page

Please contact me if there is a problem with this web page (e.g., errors, or sections that are unclear).

Don't forget to check out available sample code.

Task 1:

Download the program ecDA_noints.c. Interpret the first five elements of x[] as Q7 numbers and verify that they form the first quadrant of a sine wave.  Show your work for at least one of the non-zero elements.

Task 2:

Add (and comment) code to set the clock rate (MCLK) to 8 MHz.  Run the code both with and without the Sallen-Key filter and observe the output (there should be a few cables in Hicks 310 with a mini-jack on one end). 

At this point keep the "Touchscreen I/O board" disconnected.  There are some conflicts with the I/O board and the analog I/O on the "Experimenter's" board.

 
adapted from: : http://www.techpowerup.com/reviews/Razer/m100/images/minijack.jpg

Since there are 16 points in one period, and the update rate is about 8 kHz, the signal should be about 500 Hz.

Task 3:

Change the code so it uses interrupts to update the D/A.  Have the oscilloscope measure the frequency (it should be 500 Hz) of the signal and then take images with and without the low pass filter.

At this point keep the "Touchscreen I/O board" disconnected.  There are some conflicts with the I/O board and the analog I/O on the "Experimenter's" board.

Task 4:

Keep the interrupt at 8 kHz, but change the program so it generates a 264 Hz sine wave (or as close as possible) using 8 bits numbers and recursion.  Have the oscilloscope measure the frequency of the signal and then take images with and without the low pass filter.  Use recursion on 8-bit fixed point numbers to generate the signal (i.e., don't use table look up).

Use recursion relationship:

where

This is non-trivial.  You may want to start with a loop that generates the values and step through it to make sure it works as you expect.  Don't forget that Code Composer Studio will show variable values in "Q" format.

Beware of overflow (the largest number in Q7 is just less than 1).  Solutions: start recursion with a value a little less than sin(T) or use Q6(less precision, but maximum is just less than 2).

At this point keep the "Touchscreen I/O board" disconnected.  There are some conflicts with the I/O board and the analog I/O on the "Experimenter's" board.

Task 5:

Figure out and explain how the code in the "noSK()" function works.  Draw the signal path on an image of the OA module, then make a simplified schematic of the equivalent op-amp circuit.  Describe how the simplified circuit works.  (If you are unclear on op-amp theory, I can help with the last part - you should be able to do the rest)

Task 6:

Figure out and explain how the code in the "useSK()" function works.  Draw the signal path on images of the OA modules, then make a simplified schematic of the equivalent op-amp circuit.  Describe how it works (but you don't need to derive the LPF transfer function).  (If you are unclear on op-amp theory, I can help with the last part - you should be able to do the rest)

Task 7:

Use the A/D converter and the touchscreen to control the volume of the signal. 

You can't use the potentiometer as an input because it uses P6.5 which is shared by OA2 (which is connected to "MIC OUT").

Set the potentiometer on the "Touchscreen I/O" board to its middle position because it shares P6.5 with OA2 (the op-amp that drive the "MIC OUT" signal).

Use the "nosk()" function, because the 2nd order low-pass Sallen-Key filter uses pin P6.3 that is the output of the op-amp (OA1) used by the filter.  P6.3 is also used by the touchscreen.

Task 8:

Use the A/D converter and the touchscreen to control the frequency of the signal so that as you move your finger you get one of 8 frequencies. 

You can't simply change "a" and "b" in the recursion relationship because the initial conditions (i.e., the two starting values) won't be correct and the amplitude of the wave may not be what you expect.  It is probably easiest to just restart the recursion as you move from one region of the touchscreen to another.  (I have a couple of papers that describe solutions to this problem).

Set the potentiometer on the "Touchscreen I/O" board to its middle position because it shares P6.5 with OA2 (the op-amp that drive the "MIC OUT" signal).

Use the "nosk()" function, because the 2nd order low-pass Sallen-Key filter uses pin P6.3 that is the output of the op-amp (OA1) used by the filter.  P6.3 is also used by the touchscreen.

Task 9:

Use the touch screen to vary frequency (left-right) and volume (up-down) of signal. 

Set the potentiometer on the "Touchscreen I/O" board to its middle position because it shares P6.5 with OA2 (the op-amp that drive the "MIC OUT" signal).

Use the "nosk()" function, because the 2nd order low-pass Sallen-Key filter uses pin P6.3 that is the output of the op-amp (OA1) used by the filter.  P6.3 is also used by the touchscreen.

Task 10:

Determine the lowest frequency that you can generate with the recursive method and 8-bit Q7 numbers.


To turn in:

Back to Embedded Systems Page

Please contact me if there is a problem with this web page (e.g., errors, or sections that are unclear).