Table of Contents
MSP430 LaunchPad Development Kit
- For a mere $4.30, the LaunchPad is the entry into the world
of MSP430 μCs. The μC is the MSP430G2231IN14
(2kB Flash, 128B RAM, 10 GPIO, 1x 16-bit timer, WDT, BOR, 1x USI (I2C/SPI) 8ch 10-bit ADC), and the board has a
USB interface.
Buy one for yourself and follow the software links to download CCS or msp430_gcc/mspdebug on your own machines.
- Download the LaunchPad documentation directly from the
LaunchPad site.
Microcontroller Functionality and Organization
Assembly Language Programming
C and C++ Programming
Python Programming
Understanding the MSP430
Initial Operation of the LaunchPad
- Open the TI Code Composer Studio v5.1.1. If a license query appears, click the "code limited" option. If a working directory query
appears, change it to "...\Desktop\ccs\workspace" or whatever you prefer, and make it the default directory.
- You must begin by creating a new project. On the top menu, follow the path Project -> new CCS project. On the pop-up window
enter a useful project name and specify the variant of the MSP430 that you are using, in this case MSP430G2231. Under "project templates and examples",
select the "blink the LED" example and click on "Finish".
- Configure your project to produce assembly language files. On the top menu, follow the path Project -> options -> build -> MSP430 compiler -> advanced options -> assembler options
and check the "keep the generated assembly language" and "generate listing file" boxes. Click "OK".
- Plug the LaunchPad into a USB port. The program currently in the flash memory will be executed. Watch it blink.
Blink LaunchPad blink. Whoopee! The blinking program should be the same as the project program.
- Open the C header file for the device by double-clicking on msp430g2231.h in the include subdirectory of the
project explorer. Participate in the group discussion of the statements in blink.c and msp430g2231.h.
- Modify blink.c so that the board blinks as frequently as possible by commenting the lines comprising the delay loop.
To compile into machine code and download the code into the flash memory in the device, follow Project -> build project.
To download the code, Run -> run debug. CCS provides "perspectives" of your project under the Window menu.
To switch between the editor perspective and the debug perspective follow Window - > Open Perspective. At this point, the code is loaded, but the device is not operating.
To reset the device, follow Run -> resume. The LED will now be blinking too rapidly to be seen. Connect P1.0 to
an oscilloscope and observe the square-wave driving the LED. Be sure to go to the acquire menu and set the acquisition
mode to "sample". You will also want to try averaging over 4 to 64 samples. Data from a single sweep will appear to be
clean, while an average over a few sweeps will exhibit ragged edges on the waveform. The MCU should be executing a very simple loop, so the
waveform should be "perfectly" regular. Is it? If not, is the irregularity an uncertainty noise, that is, zero on
average, or is there an accumulated error? To answer this question you will need to use Marina™ to
acquire waveforms with many cycles. Determine quantitatively the standard deviation of the fluctuation and
the accumulated error, if possible. To understand these observations, one must read Section 5.2.6
"DCO Modulation" in the family guide, in which it presents the startling operational behavior of frequency "dithering"
to spread the EM radiation noise over a broader bandwidth. The frequency of the square-wave also needs to be explained. Can you measure
the clock frequency? Explain the observed period of the output waveform in terms of the clock period, the program
and the number of clock cycles per instruction. It will be necessary to consult the
MSP4302x31 datasheet.
Assembly Language
- Look at two files generated by the compiler: blink.asm and blink.lst. The compiler generates assembly language code
which is then operated upon by the assembler to generate machine code in an object file. The assembly code is
given in blink.asm and the assembly code plus the actual machine code to be loaded is given in blink.lst. How many
bytes comprise the entire pogram in machine code?
- Assembly code can be inserted into a C program using the compiler directive asm("...code..."). Assembly code is
of the following form:
label opcode operands The label is optional, as it is used for jumps to that
location within the program and calls of a function defined at that location within the program. The operands consists
of a set of registers, memory locations or numbers appropriate for the opcode and separated by commas.
Copy the assembly
code from blink.asm or blink.lst into blink.c. Comment all other code lines except the first and last.
Build the project and load the code into your LaunchPad.
|
Site Navigation
Services
OSU Links
|