PhillDubya
New Member
Hey guys,
New here, and a total newb at assembly code. I am a university elec. engineering student, and mostly have experience with C++.
However, I am trying to do a simple "loop and end" code with an MSP430 uC, using assembly.
With this code, I should be able to blink a light, with a delay of 500000, which is both my ON, and OFF time. There should be a total of ten times on, and subsequently, 10 counts off; however, the loop never ends... Am I ending the code with the wrong statement, e.g. "END Mainloop"?
Thanks in advance for your time!
Phill
New here, and a total newb at assembly code. I am a university elec. engineering student, and mostly have experience with C++.
However, I am trying to do a simple "loop and end" code with an MSP430 uC, using assembly.
Code:
#include "msp430x20x3.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 output
;
;
;
// Function 1 ------------------------------------------------------------------
Counter mov.w #20, R14 ; Set counter (R14) to 10 ON counts
;
Mainloop xor.b #001h,&P1OUT ; Toggle P1.0
Wait mov.w #050000,R15 ; Delay to R15
L1 dec.w R15 ; Decrement R15
jnz L1 ; Finished Time Delay?
dec.w R14 ; Finished Mainloop?
jnz Mainloop ;
;
;
;
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET ;
END Mainloop ;
With this code, I should be able to blink a light, with a delay of 500000, which is both my ON, and OFF time. There should be a total of ten times on, and subsequently, 10 counts off; however, the loop never ends... Am I ending the code with the wrong statement, e.g. "END Mainloop"?
Thanks in advance for your time!
Phill
Last edited: