rendered paste body .cdecls C,LIST,"msp430g2231.h"
;-------------------------------------------------------------------------
.text ;Program Start
;-------------------------------------------------------------------------
RESET mov.w #280h,SP ;Initialize SP
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ;Stop WDT
bic.b #8,&P1SEL ;Select GPIO mode
bis.b #41h,&P1DIR ;Set P1.0 and P1.6 as Outputs
bic.b #8,&P1DIR ;Set P1.3 as Input
bic.b #41h,&P1OUT ;Turn off LEDs
bis.b #1,&P1OUT ;Turn on red LED
bis.b #8,&P1IE ;Enable local interrupt
eint
mov.w #60000,R15 ;Delay
mov.w R15,R14 ;
MainLoop xor.b #41h,&P1OUT ;Toggle LEDs
Delay dec.b R14 ;Wait
jnz Delay ;
mov.w R14,R15 ;
jmp MainLoop ;
;--------------------------------------------------------------------------
; PushButton Interrupt
;--------------------------------------------------------------------------
PushInt bic.b #8,&P1IFG ;Clear Interrupt Flag
sub.w #10000,R14 ;Lower Delay
jnz EndInt ;
add.w #60000,R14 ;
EndInt reti
;--------------------------------------------------------------------------
; Interrupt Vectors
;--------------------------------------------------------------------------
.sect ".reset" ;MSP430 Interrupt Vector
.short RESET ;
.sect ".int02" ;PushButton Interrupt Vector
.short PushInt ;
.end