Code%20Composer - PowerPoint PPT Presentation

About This Presentation
Title:

Code%20Composer

Description:

ECE 2560 Code Composer Department of Electrical and Computer Engineering The Ohio State University * ECE 3561 - Lecture 1 – PowerPoint PPT presentation

Number of Views:112
Avg rating:3.0/5.0
Slides: 25
Provided by: Joann277
Category:
Tags: 20composer | code | vals

less

Transcript and Presenter's Notes

Title: Code%20Composer


1
Code Composer
ECE 2560
  • Department of Electrical and
  • Computer Engineering
  • The Ohio State University

2
The Code Composer
  • Code Composer
  • An interactive compiler, assembler, debug system
    for development of programs for the MSP 430.
  • Developing an assembler program in Code Composer
  • Demo of a simple program

3
Documentation
  • You can bring up help in CCS
  • Brings up a new window
  • You can do a search on assembler language or 430
    Compiler Users Guide
  • Click at top of page on Compiler Version x.x
    Users Guide
  • Will allow you to navigate to assembler Language
    tools users guide
  • In 1.1 is the diagram

4
A top level view
  • Where assembler language fits
  • As the assembler is part of a code development
    system it is more sophisticated than typical
    assemblers.

5
CCS assembler
  • Using code composer for assembler
  • Launch CCS
  • Select New Project
  • Give the project a name
  • End name with .asm
  • Output type leave as Executable
  • Choose a location by unclicking use default and
    select your directory

6
CCS starting project (2)
  • In the device area
  • Choose the MSP 430 for Family
  • Most likely this is the only option
  • Variant Leave 1st box blank
  • Variant 2nd Box should be MSP430G2553
  • This is the 430 that is on the launchpad
  • As we will be using the debugger this is very
    important
  • Should be USB1 the default

7
Under Advanced
  • You need to have the correct linker command file
  • Here lnk_msp430g2553
  • When selected click OPEN

8
Under Project Templates
  • Choose Empty Assembler-only Project
  • Click on Finish

9
The first window for project
  • Have several areas
  • Project
  • Coding
  • Problems

10
Some first code
  • For first coding load values into some registers
  • 0004 into R4
  • F012 into R5
  • 0066 into R6

11
The project name
  • Rename main.asm
  • Go to the Project Explorer Window
  • Expand it and you will see main.asm
  • Right click, choose rename and do a rename
  • You will see the new_name.asm at the top of the
    coding window now.
  • BE SURE YOU HAVE .asm extension

12
The coding window
  • Time to enter code
  • Discussion of code sections
  • Entering code - get some free lines first
  • END CODE WITH INSTRUCTION
  • Loop JMP Loop
  • This is so the program ends. This instruction is
    called an endless loop.

13
First Instructions
  • Assembler instruction format
  • Label Instr op1,op2 comment
  • They are
  • MOV 0x0004,R4 comment
  • MOV 0xF012,R5 note sign
  • MOV 0x0060,R6 note hex representation
  • MOV R4,R7
  • Enter and compile

14
Chip demo
  • Now compile and download to chip
  • Connect the launchpad
  • Choose DEBUG under RUN selection
  • New window format appears

15
Run code
  • Can run code to end or step instruction by
    instruction
  • STEP can be done by using F5 as seen in RUN menu
  • Also want to watch registers
  • Expand the core registers listing
  • NOTE window is CCS Debug also have the CCS
    Edit which may be hidden

16
Watch the action
  • Can see PC incrementing
  • Can see SP being set
  • Can see values loaded into registers

17
So what is this showing use
  • When executing
  • To restart your code you can do a hard reset
  • The initial instructions
  • CLR Rx - clears register x to 0s
  • Register Mode
  • MOV 0xFOO4,R4
  • Immediate addressing mode
  • MOV 0x0060,R6
  • Another immediate addressing mode instruction
  • Note way in which hexadecimal is specified

18
More on addressing
  • MOV R4,R7
  • Register mode Copies the value in R4 to R7 so
    they have the same value
  • MOV R7,buf
  • Move the contents of R7 to the address indicated
    by buf. buf is user defined symbol and has a
    value (next slide)
  • What is the value of buf
  • MOV buf,R6 shows what the value of buf is
  • Note that buf has a value of 200
  • And that value is in R6

19
Data/variables for your progam
  • Where is buf?
  • To set up the area for variables/constants
  • After your code, i.e., after Loop JMP Loop
  • Start line .data
  • buf .word 0
  • vals .byte 14,3,12

20
The other addressing modes
  • Indirect Register Mode
  • Example MOV _at_R6,R4
  • Note that the address of buf is 0200 and it has
    been loaded into register R6
  • The memory location at address buf has contents
    F004
  • Note R4 after execution

21
Indexed mode addressing
  • First clear the registers
  • Memory was set up as follows
  • Address lbl contents
  • 0234h d1 0011h
  • 0022h
  • 0238h d2 0033h
  • 0044h
  • 023Ch d3 0055h
  • 0066h

22
Indexed addressing mode
  • MOV 2(R4),R6
  • This should move the contents of the word stored
    at 2 past the value in R4
  • R4 contains value 0234h which labeled d1
  • At memory address 0234h 0011h
  • At memory address 0236h 0022h
  • So instruction should move 0022h to R6

23
Indirect autoincrement
  • Do some loading of R7 using R4 with
    autoincrement.
  • MOV _at_R4,R7
  • Can watch this in emulation on a chip

24
Summary - Assignment
  • Saw an initial demo of how to use CCS
  • A look ahead
  • Will cover some basics on instructions - Like
  • What is the instruction to load a value of 7h
    into R8?
  • Write the instruction to add R4 to R9 with the
    result going to R9.
  • HW 2 is on the webpage
Write a Comment
User Comments (0)
About PowerShow.com