Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. Use CCSv7 to implement the code in Listings 8.4 using MSP430 Assembly languag

ID: 3705025 • Letter: 2

Question

2. Use CCSv7 to implement the code in Listings 8.4 using MSP430 Assembly language. Use the CCSv7 debugger functions that you know about in order to examine what the code does when it executes. Comment each line of code (instructions, labels, and directives) describing it's purpose in the program.

Listing 8.4 Toggling the green LED when the push button is pressed, for MSP430 LaunchPad Rev.1.5. # include define LED B1T6 define BUTTON B1T3 void main (void) P1DIR = LED ; P?REN = BUTTON ; P1OUTBUTTON; while(1) if((Pl1N & BUTTON ) == 0x00){ ..delay cycles(5000); if( (PIIN & BUTTON ) 0x00){ P1OUT ^= LED ; while ((PIIN & BUTTON ) 0x00); 1

Explanation / Answer

.cdecls C,LIST, "msp430.h"

.text

.retain

.retainrefs

RESET

mov.w #WDTPW|WDTHOLD,WDTCTL

mov.w #__STACK_END,SP

mov.w #0005h,R5

mov.w #0006h,R6

  mov.w #0007h,R7

call #Replace

jmp $

Replace :

mov.w R6,R7

  

  mov.w R5,R6

   mov.w R7,R5

ret

;------------------------------------------

; Stack Pointer Definition

;-------------------------------------------

.global __STACK_END

.sect .stack

;--------------------------------------------------------------

; Interrupt Vectors

;--------------------------------------------------------------

.sect RESET_VECTOR

.short RESET

.end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote