E72 Launchpad Quickstart

This document will step you through writing and downloading a program to the MSP430 Launchpad.


Installing Software

Make sure the computer you are using has Code Composer Studio version 6.1 installed.  A free version is available here.  It is also available on the computers in the lab in 310 and 212 in Hicks. The same development environment works with all TI processors. If you are installing on your own computer you only need the tools for the MSP430.

Running the Demo code

This part is not required. It describes the code that comes preloaded on the LaunchPad.

Plug the Launchpad into a USB port on your computer.  Two LEDS should start flashing (attached to P1.0 (red)  and P1.6 (green).  If you press the left button another section of code runs:

Running your own code.

Start Code Composer Studio (this can take a little while).  When prompted for a "workspace" choose a folder that is on the network somewhere so you can use any computer to work on your code - the "workspace" is a folder that will hold all of your MSP430 code and other files.

There are two view "CCS Edit" and "CCS Debug."  This should be indicated by an icon in the upper right.  Make sure you are in the "Edit" view (you can go to Window→Open Perspective to switch views.

Go to File→New Project.  Pick a project name (below I have chosen "FirstProject") and set other options as shown. Note: the compiler version may be different than that shown.

Click "Finish."

After the project is created, you should see it in the "Project Explorer" window at the left of the "Edit" view.  Open the file "main.c" within that project. Cut and paste the following code into "main.c".

#include <msp430.h>

#define LED	BIT0
#define TGLBIT(p,b) (p ^= (b))  // Toggle bit using xor

void main(void) {
  volatile int i;
  WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
  P1DIR |= LED;             // Set P1.0 to output direction

  while (1) {  //Do this forever
    TGLBIT(P1OUT,LED);         	// Toggle LED
    for (i=0; i<0x5000; i++) {}	// Delay
  }
}

From the "Edit" view go to Run→Debug.  The program will compile, link, and (if there are no errors) load the executable onto the processor.  "Debug" view will open, and you can run the program (Run→Resume).  The LED should blink - your first program is done.