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

1.Use CCSv7 to implement the code in Listings 8.4 in C. Use the CCSv7 debugger f

ID: 3705019 • Letter: 1

Question

1.Use CCSv7 to implement the code in Listings 8.4 in C. 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 BIT3 void main (voia) P?D?R = LED ; P?REN = BUTTON; P1OUTBUTTON while(1) if((Pl1N & BUTTON ) ..delay.cycles(5000) if((Pl1N & BUTTON ) == P1OUT ^= LED ; while ((PIIN & BUTTON ) 0:00){ 0x00){ 0x00);

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.
Chat Now And Get Quote