63 lines
2.9 KiB
NASM
63 lines
2.9 KiB
NASM
;-------------------------------------------------------------------------------
|
|
; MSP430 Assembler Code Template for use with TI Code Composer Studio
|
|
; MSP430G2553 Demo - Software Toggle P1.0
|
|
;
|
|
; Description; Toggle P1.0 by xor'ing P1.0 inside of a software loop.
|
|
; ACLK = n/a, MCLK = SMCLK = default DCO ~ 800k
|
|
;
|
|
; MSP430x1xx
|
|
; -----------------
|
|
; /|\| XIN|-
|
|
; | | |
|
|
; --|RST XOUT|-
|
|
; | |
|
|
; | P1.0|-->LED
|
|
;
|
|
; M.Buccini
|
|
; Texas Instruments, Inc
|
|
; September 2004
|
|
; Built with CCE for MSP430 Version: 1.00
|
|
; Modified and enhanced for the EE365 Kit by Dorin Patru, March 2011;
|
|
; Modified and enhanced for the LaunchPad by Dorin Patru, September 2013
|
|
;-------------------------------------------------------------------------------
|
|
.cdecls C,LIST,"msp430.h" ; Include device header file
|
|
|
|
;-------------------------------------------------------------------------------
|
|
.text ; Assemble into program memory
|
|
.retain ; Override ELF conditional linking
|
|
; and retain current section
|
|
.retainrefs ; Additionally 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
|
|
;-------------------------------------------------------------------------------
|
|
SetupP4 bis.b #001h,&P1DIR ; P1.0 output
|
|
mov.w #0x12EF,r12 ;
|
|
clr.w r13 ;
|
|
clr.w r14 ;
|
|
clr.w r15 ;
|
|
mov.b r12,r13 ;
|
|
mov.w r12,r14 ;
|
|
mov.w r12,r15 ;
|
|
Mainloop xor.b #001h,&P1OUT ; Toggle P1.0
|
|
Wait mov.w #050000,R15 ; Delay to R15
|
|
L1 dec.w R15 ; Decrement R15
|
|
jnz L1 ; Delay over?
|
|
jmp Mainloop ; Again
|
|
;-------------------------------------------------------------------------------
|
|
; Stack Pointer definition
|
|
;-------------------------------------------------------------------------------
|
|
.global __STACK_END
|
|
.sect .stack
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; Interrupt Vectors
|
|
;-------------------------------------------------------------------------------
|
|
.sect ".reset" ; MSP430 RESET Vector
|
|
.short RESET
|