E91 - Embedded Systems, Lab 3

Clock Module, Timer B, and Interrupts

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

Task 1:

Write a program on the MSP430F2013 on the "Experimenters Board" that sets MCLK to 1 MHz and generates a 500kHz square wave on the SMCLK output (use the clock module with the pin set up as SMCLK - don't just oscillate P1.4). 

Useful info:

Task 2:

The default speed for the MSP430FG4618 is nominally 1.048576 MHz.  Set up Timer A so that it generates an interrupt every second and alternately flashes LED1, then LED2...

Task 3:

Change the code (and use Timer B) so that the buzzer is alternately excited by tones of 1 kHz and 2 kHz (buzzer datasheet) every 1 second (also use IRQ from Task 2).  Get an oscilloscope printout of each frequency.  Again, you have easy access on the appropriate jumper, JP1.

Task 4:

Change the code so that the buzzer starts at 200Hz and increments in equal logarithmic steps up to 20 kHZ (i.e., the steps are equidistant on a log scale) in about 40 steps (i.e., approx 20 steps per decade), changing frequency 4 times per second.  After it reaches the highest frequency it should go start again with the lowest.  This can be done in (at least) two ways (pick one):

  1. Precompute the necessary values for the timer, and store them in an array.
  2. Start with a large value in the TBCRRx register (to maintain precision), and successively decrement by 1/8 (note 1/8 of a number can be calculated without division by shifting right three times).  I calculate that this will take 35 (+/-) iterations.

Task 5 (Optional):

Change the code so that the buzzer starts at 2 kHz and increments or decrements in equal logarithmic steps (up to 20 kHZ, and down to 200 Hz) as you push the two buttons on the board (i.e., one for up, and one for down).  Use interrupts to sense button pushes.

Task 6 (Optional):

Use PWM to change the intensity of the LED's on the board cyclically (as in labs 1 and 2).  One LED should get brighter as the other gets dimmer.

Task 7 (Optional):

Redo one of the tasks from above that uses interrupts as a pure assembly language project.


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