Question: ; This program should blink the Green LED every half second but the Red LED ; remains lit instead. Use basic debugging techniques to correct

; This program should blink the Green LED every half second but the Red LED ; remains lit instead. Use basic debugging techniques to correct the program ; behavior: Line Step, Register Inspection, Breakpoints and CPU Timing. ; ; Hint: The errors can be found in either the 'Port 1 Setup' or 'Main Loop' ; sections. You may alter but not add or delete any of the code. ; ; Change the operation or the arguments but not both. ;-------------------------------------------------------------------------------

;------------------------------------------------------------------------------- ; MSP430 Assembler Code Template for use with TI Code Composer Studio ; ; ;------------------------------------------------------------------------------- .cdecls C,LIST,"msp430.h" ; Include device header file ;------------------------------------------------------------------------------- .def RESET ; Export program entry-point to ; make it known to linker. ;------------------------------------------------------------------------------- .text ; Assemble into program memory. .retain ; Override ELF conditional linking ; and retain current section. .retainrefs ; And retain any sections that have ; references to current section.

;------------------------------------------------------------------------------- RESET mov.w #__STACK_END,SP ; Initialize stackpointer StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer

; Problems start here:

;------------------------------------------------------------------------------- ; Port 1 Setup ;------------------------------------------------------------------------------- mov.b #001h, R4 mov.b R4, &P1DIR mov.b R4, &P1OUT bis.b R4, &P1OUT

;------------------------------------------------------------------------------- ; Main Loop ;------------------------------------------------------------------------------- MAIN mov.w #0186Ah, R5 mov.w #00000h, R6 mov.w #0000Ah, R7

ROUTINE rra.w R6 cmp.w R5, R6 jnz ROUTINE mov.w R5, R8

DELAY dec.w R7 mov.w R5, R8 LOOP dec.w R5 cmp.w #00000h, R5 jnz LOOP cmp.w #00000h, R7 jnz DELAY

LED xor.b R4, &P1OUT

jmp MAIN

; Problems end here.

;------------------------------------------------------------------------------- ; Stack Pointer definition ;------------------------------------------------------------------------------- .global __STACK_END .sect .stack ;------------------------------------------------------------------------------- ; Interrupt Vectors ;------------------------------------------------------------------------------- .sect ".reset" ; MSP430 RESET Vector .short RESET

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!