MSP430LaunchPad

M430G2553 Launchpad and Energia Programming

Note: This article is a blurb. Help expand it.

Tags

Tutorial

The Launchpad MSP430 come with on-boad LEDs, push buttons and a temperature sensor. This tutorial will show you how to access them using Energia. All this information can be found in the pre-loaded example which can be found under File->Examples.

The following was tested on Rev 1.5 with M430G2553. I will assume that you have already finished the first tutorial and have successfully blinked the LEDs.

Enable Serial Communication Hardware Setup

You might need to change your RX and TX jumpers on your board to allow serial communication. Serial communication will allow your board to send information into Energia's Serial Monitor window.

My board was delivered in the SW|UART configuration as follows:

Click to enlarge

I had to change it to the HW | UART configuration, by turning the two jumpers by 90 degrees to enable the serial monitor output. My final configuration was:

Click to enlarge

Serial Communication

  1. Connect your Launchpad to your computer via the USB cable and start Energia.
  2. Select your Board Type, by clicking Tools->Board->[Your Board Type]. Your board type is printed on the physical chip on your board and begins with '''M430....."
  3. Type in the following script:
    The setup() function is run once after the board powers up and the loop() function is run repeatedly after that. The Serial.begin(9600); command initializes a serial communication with your computer. The serial communication allows you to send information to your computer via the Serial.print(" "); command.
  4. Verify (Sketch->Verify / Compile) and upload (File->Upload) your code to the LaunchPad.The status window should say "Erasing.." and "Programming " and then "Done" if the upload was successful.
  5. You will need to indicate the proper COM port for communication, prior to using the Serial Monitor. Click Tools->Serial Port-> COM X, where X is your Launchpad connection. If you have multiple COM ports, select one and try the next step. If you don't get any output, return to this step and try a different port.
  6. The Serial Monitors is a window that displays the Serial Communication. To start it click Tools-> Serial Monitor or press [Ctrl]+[Shift]+[M]. If your connection was successful you should see:

Push-Button Input

The MSP430G2 comes with two onboard push-buttons one to reset the board and one to collect user input. The pin for the user-push button is stored in the PUSH2 variable. The following code illustrates the button functionality:

  1. Type the code into a new sketch (File->New).
  2. You have to ensure that you select the correct board type (MSP430G2553), as the pin assignment in the PUSH2 variable will be wrong otherwise (Tools->Board->...).
  3. Verify and Upload the sketch to the board.
  4. Once successful, bring up the Serial Monitor (Tools->Serial Monitor). You should see the monitor display "Button: 1" when nothing is pressed and "Button: 0" when you press the button. When you press the button labeled RESET, the sketch is restarted and the serial monitor will display "Starting Program".

Temperature Sensor Readout

The temperature sensor pin is stored internally as TEMPSENSOR. You will need to download some sample code that decodes the information received from the sensor. I got the library from Github, where you can go to download the latest version. I have compiled the files into a single folder to make things easier

  1. Download the Thermometer Code Here: Thermometer.zip (3 KB). The file contains a .ino file and the thermometer library.
  2. Open the Thermometer.ino in Energia
  3. Select the proper board type (This code will only work on the M430G2553 chip) via (Tools->Board->...).
  4. Verify and Upload the code.
  5. Open a Serial Monitor (Tools->Serial Monitor) and you should see something like this:

    The numbers display temperature measurements of the chip itself. I did not verify the accuracy of these measurements.

Conclusion

There you have it. You now know how to get user data, blink the LEDs, measure the internal temperature and send information back to the computer.