MSP430 LaunchPad: Demo – Graphical programming with Grace 3

Around one year ago Texas Instruments launched a new ultra low cost MCU platform for it’s MSP430 series, the LaunchPad. You can get it for just 4,30$ in the TI eStore.

When I first tried to get started with the LaunchPad, I had some difficulties with the Code Composer Studio, the software IDE for the microcontroller. I got compilation errors and whatever. But I think that is quite a common issue with Eclipse based IDEs. I also had my problems with ALTERAs NIOS II Studio.

Now half a year later, I tried the current version of the Code Composer Studio. And I had much more success.

You can download the IDE here [Link]. I had some compiling problems with the new beta So you may try the version instead.

Code Composer Studio also comes with a nice graphical programming tool, called Grace. Link to Grace introduction. Grace helps you with configuring the registers of the controller without to study the datasheet. Next to register configuration, it also gives code examples how to access the controllers peripherals with the C code.

In this tutorial we use the 3 on board peripherals, that are accessible by the microcontroller: two LEDs and one switch.
The LED at P1.6 will be toggled every 100ms and the LED at P1.0 will be controlled by the state of the switch at P1.3.


I assume, you have installed Code Composer Studio and you have one LaunchPad.
I installed the IDE at C:\ti\ and I put the Eclipse workspace at C:\ti\workspace_v5_1.


To create a new project you go to the menu and select File->New->CCS Project.

Choose a project name – e.g. grace_test.

Then you select the populated MCU in your LaunchPad (just read the ICs marking) – e.g. MSP430G2231.

Then select in „Project templates and examples“ -> Grace Examples -> Blink LED from the CPU.


Then open the led.cfg file (for the Grace GUI) (1.). Select Device Overview, then left click on the Port P1 (2.)


Then you click on „Pinout TSSOP/PDIP“.
P1.0 and P1.6 must be configured as outputs. The other pins of Port P1 are inputs.

Now we finished the register configuration with Grace and can start to write some software code.


Open the led.c file in the project explorer. You can replace your code with this.

// Blink LED Example
// Description: Toggles P1.6 by xor’ing P1.6 inside of a software loop.
// Additionally the LED at P1.0 is controlled by the switch
// at P1.3.
// MSP430
// —————–
// /|\| XIN|-
// | | |
// –|RST XOUT|-
// | |
// | P1.0|–>LED
// | P1.6|–>LED
// switch–>|P1.3 |
//, S. Schuster, 03/11/12

* ======== Standard MSP430 includes ========
#include <msp430.h>

* ======== Grace related includes ========
#include <ti/mcu/msp430/csl/CSL.h>

* ======== main ========
void main(void)
CSL_init(); // Activate Grace-generated configuration

while (1) {
P1OUT ^= BIT6; // Toggle LED on P1.6

// Check P1.3 input status
if (!(P1IN & BIT3)) {
// P1.3 input level = logic high
// Drive P1.0 output high
P1OUT |= (BIT0);

// Check P1.3 input status
if (P1IN & BIT3) {
// P1.3 input level = logic low
// Drive P1.0 output low
P1OUT &= ~(BIT0);
__delay_cycles(100000); // Wait ~100ms at default DCO of ~1MHz


Save every altered file (led.c and led.cfg) and then click the Debug button, wait till the project is compiled and downloaded into your LaunchPad. Then hit the start/play button.


Your Launchpad should now do this:

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

3 Gedanken zu “MSP430 LaunchPad: Demo – Graphical programming with Grace

  • vivud

    Why does the MSP430 have to be a *duino killer ? Why can t hobbyists have more than one microcontroller to choose from? As I see it, four big advantages of the MSP430 are its low cost, low support component count (internal oscillator, even), its low power consumption, and that it doesn t require expensive hardware to flash a bootloader. That $5 Launchpad is all you need to program a fistful of microprocessors.