Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. .cdecls C,List, "msp430g2231.h"
  2. ;------------------------------------------------------------------------
  3. .text ;Program Start
  4. ;------------------------------------------------------------------------
  5. RESET mov.w #0280h, SP ;Initialize SP
  6. StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ;Turn off WDT
  7. bis.b #01000001,&P1DIR ;Set Pins
  8. and.b #0,&P1OUT ;Turn Off Leds
  9. call SUB_1 ;call Subroutine
  10. END jmp END ;Finish Loop
  11. ;------------------------------------------------------------------------
  12. ; Subroutine_1
  13. ;------------------------------------------------------------------------
  14. SUB_1 cmp.w &0A47h,&0A47h ; Diferential
  15. jz L1 ; Green Light Loop
  16. jnz L2 ; Red Light Loop
  17. L1 mov.w #10,R14 ;5 Blinks Loop
  18. Equal xor.b #01000000b,&P1OUT ;
  19. mov.w #50000,R15 ; Period
  20. Loop dec.w R15 ; Delay
  21. jnz Loop ;
  22. dec.w R14 ;
  23. jnz Equal ;
  24. jmp END ;
  25. L2 mov.w #6,R14 ;3 Blinks Loop
  26. Different xor.b #00000001b,&P1OUT ;
  27. mov.w #50000,R15 ;
  28. Wait dec.w R15 ;
  29. jnz Wait ;
  30. dec.w R14 ;
  31. jnz Different ;
  32. ret ;Pop PC and SP
  33. ;------------------------------------------------------------------------
  34. ; Interrupt Vectors
  35. ;------------------------------------------------------------------------
  36. .sect ".reset" ;
  37. .short RESET ;
  38. .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement