E91 - Embedded Systems, Lab 1

Intro to the development system

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

For this first lab you will simply get the development system running, and write a few simple programs.

Setting up:

  1. If your computer doesn't have Code Composer Studio (the free version here), install it (the computers in Hicks should have it).   You only need to install the MSP430 tools.
  2. Plug in the MSP430EZ - the USB drivers should load automatically.
  3. Start Code Composer Studio (CCS), and look through some of the introductory material.  It might be a good idea to do some of the tutorials.  Note that the "hello world" program won't run because the processor doesn't have enough resources.
  4. In CCS, go to File→New→CCS Project (Click >Next).  Choose a Project name (>Next).  Choose "MSP430" as "Project Type" (>Next). There are no "Additional Project Settings" (>Next).  Set the "CCS Project Settings" as shown.

    Click "Finish" and wait a few seconds.
  5. Go to Window→Show View→C/C++ Projects.  Go to File→New→Source File and choose a name for your "C" source file. Make sure it ends in ".c". I called mine "Blinky0823.c"  The file should show up in the "C/C++ Projects" pane.

  6. Enter the following program:
    #include  <msp430x20x3.h>
    
    void main(void) {
    volatile int i;
    	  WDTCTL = WDTPW + WDTHOLD; 		// Stop watchdog timer
    	  P1DIR |= 0x01;            		// Set P1.0 to output direction
    	
    	  while (1) {				//Do this forever
    		P1OUT ^= 0x01;              	// Toggle P1.0 using exclusive-OR
    		for (i=1; i<30000; i++) {}  	//Delay
    	  }
    }
  7. Go to Project →Build Active Project and make sure there is no error. 
  8. Go to Target →Debug Active Project.  The "Perspective" (shown in the upper right) should change to "Debug".
  9. Go to Target →Run.  The LED on the board should blink.

Things to try:

Task 1:

Write a program that makes the LED on the EZ430 glow progressively brighter.  When it gets to full brightness, it should turn off and repeat the cycle continuously.  Brightness can be controlled by varying the percent of time an LED is on with a flash rate too fast for the human eye to perceive.

Task 2:

Get the program to work on the MSP430F2013 on the "MSP430 Experimenter's" board. You may need to look on the TI web site to get this working.  You will certainly want to look at the User's Guide and Schematic.  Note: these resources (and others) are on the course "Resources" page.

Task 3:

Get the program to work with one of the LED's on the MSP430FG4618 on the "MSP430 Experimeter's" board.  Again - you'll need external resources.

Task 4:

Write a program for the "MSP430 Experimeter's" board that lights an LED every time the pushbutton labeled "S1" is pushed.

Task 5:

Connect one of the longer ribbon cables from H7 on the "MSP430 Experimenter's" board to J7 on the "MSP430 Touchscreen I/O" board (schematic) - with the I/O board to the right of the Experimenter's board.  Pin 1 is marked on each, and is also marked by a triangle on the ribbon connector (and by convention, conductor 1 is brown in color, and then follows the same progression as the resistor color code).   Repeat for H8, J8 and a shorter piece of cable.  Write a function with the following prototype:
                void lightLED(int ledNum);
The function takes a number from 1 to 4, and lights the appropriate LED (L1 to L4, respectively).  If ledNum is outside this range, all LED's should be off.

Task 6:

Write a program that makes the four LED's cycle clockwise when the pushbutton on the I/O board is not pressed, and counterclockwise when it is pressed.

Task 7:

Optional:  Build a roulette wheel.  Push down the button to spin the wheel (i.e., the four LED's).  When the button is released, it settles on a random LED.   Random numbers are hard for computers - you can approximate one by timing how long the button is pressed.  Make the roulette wheel click as it spins - the Experimenter's board has a small buzzer that can be used (it is not very loud).

Task 8:

Optional:  Something cooler than task 7.


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