Added notes and comments; halved blinking rate in blink.asm
This commit is contained in:
parent
277d10acfd
commit
6bb8095fcc
|
@ -1,21 +1,23 @@
|
||||||
|
|
||||||
|
|
||||||
.include "msp430g2553.inc"
|
.include "msp430g2553.inc"
|
||||||
|
|
||||||
org 0xC000
|
org 0xC000
|
||||||
start:
|
start:
|
||||||
;mov.w #0x5a80, &WDTCTL
|
;mov.w #0x5a80, &WDTCTL
|
||||||
mov.w #WDTPW|WDTHOLD, &WDTCTL
|
mov.w #WDTPW|WDTHOLD, &WDTCTL
|
||||||
mov.b #0x41, &P1DIR
|
mov.b #0x41, &P1DIR ; #01000001b (P1.6 == LED2, P1.0 == LED1)
|
||||||
mov.w #0x01, r8
|
mov.w #0x01, r8 ; #00000001b (start on LED1)
|
||||||
repeat:
|
repeat:
|
||||||
mov.b r8, &P1OUT
|
mov.b r8, &P1OUT
|
||||||
xor.b #0x41, r8
|
xor.b #0x41, r8 ; #00000001b -> #01000000b -> ... (LED0 -> LED1 -> ...)
|
||||||
mov.w #40000, r9
|
mov.w #40000, r9 ; counts to decrement before blink
|
||||||
waiter:
|
mov.w #40000, r10 ; counts to decrement (2nd dec, since 16-bit max value is 65536)
|
||||||
|
waiter1:
|
||||||
dec r9
|
dec r9
|
||||||
jnz waiter
|
jnz waiter1 ; r9 not yet 0
|
||||||
jmp repeat
|
waiter2:
|
||||||
|
dec r10
|
||||||
|
jnz waiter2 ; r10 not yet 0
|
||||||
|
jmp repeat ; r9, r10 == 0; blink other LED
|
||||||
|
|
||||||
org 0xfffe
|
org 0xfffe
|
||||||
dw start ; set reset vector to 'init' label
|
dw start ; set reset vector to 'init' label
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
:10C00000B240805A2001F240410022001843C24849
|
:10C00000B240805A2001F240410022001843C24849
|
||||||
:10C01000210078E041003940409C1983FE23F73F1E
|
:10C01000210078E041003940409C3A40409C19831F
|
||||||
|
:08C02000FE231A83FE23F33F07
|
||||||
:02FFFE0000C041
|
:02FFFE0000C041
|
||||||
:00000001FF
|
:00000001FF
|
||||||
|
|
|
@ -8,12 +8,17 @@ START:
|
||||||
mov.b #11110111b, &P1DIR
|
mov.b #11110111b, &P1DIR
|
||||||
|
|
||||||
; set digits
|
; set digits
|
||||||
|
;mov.b #DDDDxAASb &P1OUT ; DDDD (alternate from S = 0 to S = 1 to strobe)
|
||||||
|
|
||||||
mov.b #01100000b, &P1OUT ; xxx6
|
mov.b #01100000b, &P1OUT ; xxx6
|
||||||
mov.b #01100001b, &P1OUT ; xxx6
|
mov.b #01100001b, &P1OUT ; xxx6
|
||||||
|
|
||||||
mov.b #01000010b, &P1OUT ; xx46
|
mov.b #01000010b, &P1OUT ; xx46
|
||||||
mov.b #01000011b, &P1OUT ; xx46
|
mov.b #01000011b, &P1OUT ; xx46
|
||||||
|
|
||||||
mov.b #00010100b, &P1OUT ; x146
|
mov.b #00010100b, &P1OUT ; x146
|
||||||
mov.b #00010101b, &P1OUT ; x146
|
mov.b #00010101b, &P1OUT ; x146
|
||||||
|
|
||||||
mov.b #01000110b, &P1OUT ; 4146
|
mov.b #01000110b, &P1OUT ; 4146
|
||||||
mov.b #01000111b, &P1OUT ; 4146
|
mov.b #01000111b, &P1OUT ; 4146
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
:10C0000031400004B240805A2001F240F700220083
|
:10C0000031400004B240805A2001F240F700220083
|
||||||
:10C01000F24060002100F24061002100F240420045
|
:10C01000F24060002100F24061002100F240C200C5
|
||||||
:10C020002100F24043002100F24014002100F240C0
|
:10C020002100F240C3002100F24014002100F24040
|
||||||
:10C0300015002100F24046002100F2404700210097
|
:10C0300015002100F24046002100F2404700210097
|
||||||
:04C0400032D01000EA
|
:04C0400032D01000EA
|
||||||
:02FFFE0000C041
|
:02FFFE0000C041
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
Commands:
|
||||||
|
- Compile .asm to .hex: `naken430asm -o <name>.hex <name>.asm`
|
||||||
|
- Flash to microprocessor: `mspdebug rf2500`, then enter `prog <name>.hex`
|
||||||
|
|
||||||
|
Note to self:
|
||||||
|
- microprocessor should be grounded; do NOT connect voltage to VCC!
|
||||||
|
- remember to connect +5V to 7-segment display
|
||||||
|
- connect all wires to microprocessor, then flash, then exit mspdebug!!
|
||||||
|
program will not run without exiting
|
||||||
|
- max value of a word is 2^16 = 65536, so halving blink rate by double dec count of 40000
|
||||||
|
means adding another decrementation of 40000 in another register
|
Loading…
Reference in New Issue