Added autoloop to prog2
This commit is contained in:
parent
1e52725d6a
commit
9928a57a08
|
@ -5,16 +5,16 @@ RESET:
|
|||
mov.w #0x400, SP
|
||||
mov.w #WDTPW|WDTHOLD, &WDTCTL
|
||||
mov.b #11110111b, &P1DIR ; all pins outputs except P1.3
|
||||
mov.b #00001000b, &P1REN ; enable resistor for P1.3
|
||||
mov.b #00001000b, &P1REN ; enable resistor pull for P1.3
|
||||
mov.b #00001000b, &P1IE ; P1.3 set as an interrupt
|
||||
mov.w #0x0049, R7 ; R7 = 0000 0000 0100 1001
|
||||
mov.b #00001000b, R7 ; set LEDs off and P1.3 pullup
|
||||
mov.b R7, &P1OUT ; LED1, LED2 on
|
||||
mov.b #0x0041, R8 ; value to xor with R7
|
||||
mov.b #00000001b, R8 ; initial value to xor with R7
|
||||
EINT ; enable interrupts
|
||||
bis.w #CPUOFF, SR
|
||||
PUSH:
|
||||
xor.w R8, R7 ; next LED state
|
||||
xor.w #0x0040, R8 ; 0x0041 -> 0x0001 -> 0x0041
|
||||
xor.b R8, R7 ; next LED state
|
||||
xor.b #01000000b, R8 ; 0x0041 -> 0x0001 -> 0x0041
|
||||
mov.b R7, &P1OUT ; set LEDs to new state
|
||||
bic.b #00001000b, &P1IFG ; interrupt flag P1.3 set to 0
|
||||
reti ; return from interrupt
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
:10C0000031400004B240805A2001F240F700220083
|
||||
:10C01000F2422700F242250037404900C247210082
|
||||
:10C020007840410032D232D0100007E838E04000BA
|
||||
:0AC03000C2472100F2C223000013F2
|
||||
:02FFE4002AC031
|
||||
:10C01000F2422700F24225007742C24721005843EE
|
||||
:10C0200032D232D0100047E878E04000C247210009
|
||||
:06C03000F2C22300001320
|
||||
:02FFE40026C035
|
||||
:02FFFE0000C041
|
||||
:00000001FF
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
.include "msp430g2553.inc"
|
||||
|
||||
org 0x0C000
|
||||
RESET:
|
||||
mov.w #0x400, SP
|
||||
mov.w #WDTPW|WDTHOLD, &WDTCTL
|
||||
mov.b #11110111b, &P1DIR ; all pins outputs except P1.3
|
||||
mov.b #00001000b, &P1REN ; enable resistor pull for P1.3
|
||||
mov.b #00001000b, &P1IE ; P1.3 set as an interrupt
|
||||
mov.b #00001000b, R7 ; set LEDs off and P1.3 pullup
|
||||
mov.b R7, &P1OUT ; LED1, LED2 on
|
||||
mov.b #00000001b, R8 ; initial value to xor with R7
|
||||
EINT ; enable interrupts
|
||||
bis.w #CPUOFF, SR
|
||||
PUSH:
|
||||
xor.b R8, R7 ; next LED state
|
||||
xor.b #01000000b, R8 ; 0x0041 -> 0x0001 -> 0x0041
|
||||
mov.b R7, &P1OUT ; set LEDs to new state
|
||||
mov.w #0xFFFF, R9 ; decrementing delay in R9
|
||||
LOOP:
|
||||
dec R9
|
||||
nop ; the more nops, the longer the delay
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
jnz LOOP
|
||||
jmp PUSH
|
||||
|
||||
org 0xffe4
|
||||
dw PUSH ; interrupt from button goes here
|
||||
|
||||
org 0xfffe
|
||||
dw RESET ; interrupt from reset button goes here
|
|
@ -0,0 +1,7 @@
|
|||
:10C0000031400004B240805A2001F240F700220083
|
||||
:10C01000F2422700F24225007742C24721005843EE
|
||||
:10C0200032D232D0100047E878E04000C247210009
|
||||
:10C03000394319830343034303430343FA23F33F81
|
||||
:02FFE40026C035
|
||||
:02FFFE0000C041
|
||||
:00000001FF
|
Loading…
Reference in New Issue