)
should be on the desktop. Be patient, it takes a while to start up. 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.

This section of code will step you through the writing of a simple program that flashes an LED, downloading the code to the MSP430 and running it.
#include <msp430x20x2.h>
void main(void) {
volatile int i;
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR = P1DIR | 0x01; // Set P1.0 to output direction
// Note: 0x01 = 0000 0001 binary (the LSB is set).
while (1) { //Do this forever
P1OUT = P1OUT ^ 0x01; // Toggle P1.0 using exclusive-OR
for (i=1; i<30000; i=i+1) {} //Delay
}
}

Things to try:
).
Reset the processor (
).
Single step through the code (
)- notice that the variable "i" shows up in the
"Local" tab and you can see it increasing as you step through the
"for" loop. Change "i" to 29998 and
iterate a few times.
icon in the "Registers" pane). Observe P2IN as you push the
button on the I/O board. Turn "Continuous Refresh" off before
continuing.The previous program blinked an LED with no user input. Let's change that so you interact with the program. First note that there is a pushbutton switch on the E15 I/O board connected to P2.6. When the button is not pushed, the pin is tied to Vdd through a resistor (logic high). When the button is pushed, the pin is connected directly to ground (logic low).
#include <msp430F2012.h>
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog
P1DIR = P1DIR | BIT0; // P1.0 output
// note: BIT0 is predefined to be 0x01=0000 0001 binary (BIT 0)
P2SEL = P2SEL & ~BIT6; //Clear select bit (makes P2.6 an input)
// note: BIT6 is predefined to be 0x40=0100 0000 binary (BIT 6)
while(1) {
if (!(P2IN & BIT6)) { // If button is pushed (P2.6 is low)
P1OUT = P1OUT | BIT0; // ... turn on LED
} else {
P1OUT = P1OUT & ~BIT0; // ... else turn it off.
}
}
}
Please contact me if there is a problem with this web page (e.g., errors, or sections that are unclear).