Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .cdecls C,List, "msp430g2231.h"
- ;------------------------------------------------------------------------
- .text ;Program Start
- ;------------------------------------------------------------------------
- RESET mov.w #0280h, SP ;Initialize SP
- StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ;Turn off WDT
- bis.b #01000001,&P1DIR ;Set Pins
- and.b #0,&P1OUT ;Turn Off Leds
- call SUB_1 ;call Subroutine
- END jmp END ;Finish Loop
- ;------------------------------------------------------------------------
- ; Subroutine_1
- ;------------------------------------------------------------------------
- SUB_1 cmp.w &0A47h,&0A47h ; Diferential
- jz L1 ; Green Light Loop
- jnz L2 ; Red Light Loop
- L1 mov.w #10,R14 ;5 Blinks Loop
- Equal xor.b #01000000b,&P1OUT ;
- mov.w #50000,R15 ; Period
- Loop dec.w R15 ; Delay
- jnz Loop ;
- dec.w R14 ;
- jnz Equal ;
- jmp END ;
- L2 mov.w #6,R14 ;3 Blinks Loop
- Different xor.b #00000001b,&P1OUT ;
- mov.w #50000,R15 ;
- Wait dec.w R15 ;
- jnz Wait ;
- dec.w R14 ;
- jnz Different ;
- ret ;Pop PC and SP
- ;------------------------------------------------------------------------
- ; Interrupt Vectors
- ;------------------------------------------------------------------------
- .sect ".reset" ;
- .short RESET ;
- .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement