Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

; 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Support For Data Mining Applications Discovering Knowledge With Inductive Queries Lnai 2682

Authors: Rosa Meo ,Pier L. Lanzi ,Mika Klemettinen

2004th Edition

3540224793, 978-3540224792

More Books

Students also viewed these Databases questions