E91 - Embedded Systems, Lab 4

A/D

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:

Write a program that reads a voltage from the potentiometer on the I/O board.  When the pot is to the left, L3 should be lit.  As you rotate the pot clockwise, the LED's should also light in a clockwise direction.  Use interrupts for the A/D conversions.  Have processor stay in LPM mode and do all processing in ISR.

Task 2:

Read about touch screens.  Look at the I/O board schematic.  Write a program that reads the vertical position from the touch screen and lights LED's as in Task 1. Don't forget to set the voltages at the top and bottom of the pot.  This time, keep all calculations, etc... in the main routine. 

Task 3:

Write a program that samples the A/D at 8 kHz in which you read the x-y position of the touch screen and light the LED's to show which quadrant you are in.  For example, if you are touching in the upper right quadrant, L4 is lit.  Note: the interrupt should run at 8kHz.  It is OK to update x-y at 4kHz (e.g., read x one cycle and y the next).

Task 4:

Write a program that samples the A/D at 8 kHz (use the touch screen because P3.5 is needed by the pot, but is used to drive the speaker).   As you change the voltage, the frequency of the buzzer should change (from about 200 Hz to 20 kHz - either linear or log steps).

Task 5:

Write a program that samples the A/D and controls the brightness of an LED using hardware PWM.  Don't use any interrupts.

Task 6: (Optional)

Have the buzzer sound at 2 kHz, but change the volume by using PWM on the signal when it is high.  Control volume with input from A/D.  There may be many ways to do this - I would try interrupting at 4 kHz, and either send 0 to the buzzer, or a PWM signal whose duty cycle is determined by the A/D.

in which you read the x-y position of the touch screen and light the LED's to show which quadrant you are in.  For example, if you are touching in the upper right quadrant, L4 is lit.

Task 7: (Optional)

There is code online for the experimenter's board that uses the microphone for a voice recorder.  Adapt (simplify) so that an LED lights when a loud sound occurs.

Task 8: (Optional)

Do something that goes significantly beyond tasks 1-5.


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).