Chapter 5 Code Composer Studio

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Chapter 5

Code Composer Studio

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
LAYOUT
 Introduction
 Setup
 Creating a C Project
 Creating an Assembly Project
 Program Execution
 Observing Hardware under CCS
 Terminating the Debug Session and Closing the Project
 Graphical Peripheral Configuration Tool (Grace)
 The Terminal Window

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Introduction
 Code Composer Studio (CCS) is the environment for TI
based DSPs and microcontrollers.

 We will use its code size limited version.

 Although CCS is updated continuously, the user should


start from a version.

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
SETUP
Downloading and installing CCS

 Download the most recent version of CCS from the TI web site.

 After installation, you should see a window like:

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Creating a C Project

Creating a C project is easy under


CCS .

Follow the instructions carefully.

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Creating a C Project
 You can turn off optimization from the options menu.
 This will help us in initial coding.

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Creating a C Project
A sample C code

#include <msp430.h>

int d = 0;

void main(void)
{
WDTCTL = WDTPW|WDTHOLD;

int a = 1;
float b = -255.25;
char c = 'c';
d = d+1;

while(1);
}

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Creating an Assembly Project
A sample assembly code

jmp $
.cdecls C,LIST,"msp430.h"
;------------------------
.text ;Stack Pointer definition
.retain ;------------------------
.retainrefs .global __STACK_END
.sect .stack
RESET
mov.w #WDTPW|WDTHOLD,WDTCTL ;-------------------
mov.w #__STACK_END,SP ;Interrupt Vectors
;-------------------
mov.b #11h,R4 .sect RESET_VECTOR
mov.w #00AAh,R5 .short RESET
and.w R4,R5 .end

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Program Execution
Debug your program before execution.

You can add breakpoint to observe the execution of the code.

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Program Execution

Variables, Expressions, and Registers windows may be used to


observe the most recent value of a variable or a register.

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Observing Hardware under CCS

Memory entries of the MSP430 can also be observed from the memory
browser window.

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Observing Hardware under CCS

Memory entries of the MSP430 can also be observed from the memory
browser window.

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Grace

Grace is the graphical peripheral interface tool for MSP430. It can be


used to program the MSP430 in a visual manner.
Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Grace

Grace is the graphical peripheral interface tool for MSP430. It can be


used to program the MSP430 in a visual manner.

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
Grace
The user can add his or her code under Grace .

/*
* ======== Standard MSP430 includes ========
*/
#include <msp430.h>
/*
* ======== Grace related includes ========
*/
#include <ti/mcu/msp430/Grace.h>
/*
* ======== main ========
*/
int main(void)
{
Grace_init();
// Activate Grace-generated configuration
// >>>>> Fill-in user code here <<<<<
return (0);
}

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace
The Terminal Window

We will use the terminal window under CCS


in digital communication chapter.

Programmable Microcontrollers with Applications: MSP430 LaunchPad with CCS and Grace

You might also like