-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBottomLEDAsm.asm
More file actions
64 lines (53 loc) · 2.45 KB
/
BottomLEDAsm.asm
File metadata and controls
64 lines (53 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
;-------------------------------------------------------------------------------
; MSP430 Assembler Code Template for use with TI Code Composer Studio
;
;
;-------------------------------------------------------------------------------
.cdecls C,LIST,"msp430.h" ; Include device header file
;-------------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-------------------------------------------------------------------------------
.text ; Assemble into program memory.
.retain ; Override ELF conditional linking
; and retain current section.
.retainrefs ; And retain any sections that have
; references to current section.
;-------------------------------------------------------------------------------
RESET mov.w #__STACK_END,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer
;-------------------------------------------------------------------------------
; Main loop here
;-------------------------------------------------------------------------------
SW_LEDS: bis.b #BIT0, &P1DIR
bic.b #BIT0, &P1OUT
bis.b #BIT7,&P4DIR
bic.b #BIT7,&P4OUT
bic.b #BIT1,&P2DIR
bis.b #BIT1,&P2REN
bis.b #BIT1, &P2OUT
bic.b #BIT1, &P1DIR
bis.b #BIT1,&P1REN
bis.b #BIT1,&P1OUT
call #START
START: bit.b #BIT1,&P2IN
jz REDSET
bic.b #BIT0,&P1OUT
jmp GREENTEST
REDSET: bis.b #BIT0,&P1OUT
GREENTEST: bit.b #BIT1, &P1IN
jz GREENSET
bic.b #BIT7, &P4OUT
jmp START
GREENSET: bis.b #BIT7,&P4OUT
jmp START
;-------------------------------------------------------------------------------
; Stack Pointer definition
;-------------------------------------------------------------------------------
.global __STACK_END
.sect .stack
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short RESET