Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 3561 - Lecture 1 1 Code Composer Department of Electrical and Computer Engineering The Ohio State University ECE 2560.

Similar presentations


Presentation on theme: "ECE 3561 - Lecture 1 1 Code Composer Department of Electrical and Computer Engineering The Ohio State University ECE 2560."— Presentation transcript:

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

2 ECE Lecture 1 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 User’s Guide Will allow you to navigate to assembler Language tools users guide In 1.1 is the diagram ECE Lecture 1 3

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. ECE Lecture 1 4

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 ECE Lecture 1 5

6 CCS starting project (2) In the device area Choose the MSP 430 for Family: Most likely this is the only option Variant: Leave 1 st box blank Variant: 2 nd 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 ECE Lecture 1 6

7 Under Advanced You need to have the correct linker command file – Here : lnk_msp430g2553 When selected – click OPEN ECE Lecture 1 7

8 Under Project Templates Choose Empty Assembler-only Project Click on Finish ECE Lecture 1 8

9 The first window for project Have several areas Project Coding Problems ECE Lecture 1 9

10 Some first code For first coding load values into some registers $0004 into R4 $F012 into R5 $0066 into R6 ECE Lecture 1 10

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 ECE Lecture 1 11

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

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 ECE Lecture 1 13

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

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 ECE Lecture 1 15

16 Watch the action Can see PC incrementing Can see SP being set Can see values loaded into registers ECE Lecture 1 16

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 0’s Register Mode MOV #0xFOO4,R4 Immediate addressing mode MOV #0x0060,R6 Another immediate addressing mode instruction Note way in which hexadecimal is specified ECE Lecture 1 17

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 ECE Lecture 1 18

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 ECE Lecture 1 19

20 The other addressing modes Indirect Register Mode Example 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 ECE Lecture 1 20

21 Indexed mode addressing First clear the registers Memory was set up as follows Addresslblcontents 0234hd10011h 0022h 0238hd20033h 0044h 023Chd30055h 0066h ECE Lecture 1 21

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 ECE Lecture 1 22

23 Indirect autoincrement Do some loading of R7 using R4 with autoincrement. Can watch this in emulation on a chip ECE Lecture 1 23

24 ECE Lecture 1 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


Download ppt "ECE 3561 - Lecture 1 1 Code Composer Department of Electrical and Computer Engineering The Ohio State University ECE 2560."

Similar presentations


Ads by Google