Hi guys I'm trying to do this question for an assignment using the msp430 -ez430-f2013 but the value at the memory address I'm moving to stays at 0xFFFFh.The code I'm using seems correct(at the bottom of this post). Is there something I'm missing ?
Q1.) Using assembly language at the start (beginning) of your code, initialize R6 to 0010h. Then, store the value of 0015h into the location
010A6h in memory using an appropriate addressing mode. Then, relocate this value again using an appropriate addressing mode, retrieve the value from location 010A6h in code and ADD that value to register R6. Use this value as half the number of times to blink (flash) the LED.
#include <msp430.h>
;-------------------------------------------------------------------------------
ORG 0F800h ; Program Reset
;-------------------------------------------------------------------------------
RESET mov.w #0280h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupP1 bis.b #001h,&P1DIR
; P1.0 outputall
Initialize mov.w #0010h,R6
mov.w #010A6h,R7
Move mov.w #0015h,0h(R7)
Moveagain mov.w @R7+,8(R7)
add.w 8(R7),R6
L2 dec.w R6
Mainloop xor.b #001h,&P1OUT ; Toggle P1.0
Wait mov.w #02,R15 ; Delay to R15
L1 dec.w R15 ; Decrement R15
jnz L1 ; Delay over?
cmp.w #000,R6
jne L2
cmp.w #000,R6
jge Stop
Stop bis.w #LPM0|GIE,SR ; Enable ints and low power mode 0
jmp Stop
; Again
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
END