MSP430LaunchPad

M430F5529 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 an 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 board with chip M430F5529. I will assume that you have already finished the first tutorial and have successfully blinked the LEDs.

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.
  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 MSP430F5529 comes with four onboard push-buttons one to reset the board, two to collect user input and one for ???. The pins for the user-push button are stored in the PUSH1 and PUSH2 variables. 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 (MSP430F5529), as the pin assignment in the PUSH1 and PUSH2 variables 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 serial monitor display something like this:

    The "BTN 1" refers to the button labeled P2.1 and "BTN 2" refers to the button labeled P1.1. The state show "1" when the button is not pressed and "0" when the button is pushed. When you press the button labeled RST, 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 can initialize the pin as an an input using pinMode(TEMPSENSOR,INPUT); and read the pin via the analogRead(TEMPSENSOR); function. I have yet to compile code for this or determine any calibration values.