fet200_lpm3.s43

来自「德州仪器(TI) 的超低功耗16 位RISC 混合信号处理器的MSP430 平台」· S43 代码 · 共 59 行

S43
59
字号
;******************************************************************************
;   MSP-FET430x200 Demo - BasicClcok LPM3 Using WDT ISR, 32kHz ACLK
;
;   Description; This program operates MSP430 normally in LPM3, pulsing P1.0
;   at 4 second intervals. WDT ISR used to wake-up system. All I/O configured
;   as low outputs to eliminate floating inputs. Current consumption does
;   increase when LED is powered on P1.0. Demo for measuring LPM3 current.
;   ACLK = LFXT1/4 = 32768/4, MCLK = SMCLK = default DCO ~ 800kHz
;   //*External watch crystal installed on XIN XOUT is required for ACLK*//   
;
;                MSP430F2011
;             -----------------
;         /|\|              XIN|-
;          | |                 |
;          --|RST          XOUT|-
;            |                 |
;            |             P1.0|-->LED
;
;   M.Buccini
;   Texas Instruments, Inc
;   August 2005
;*****************************************************************************
#include  "msp430x20x1.h"
;------------------------------------------------------------------------------
            ORG     0F800h                  ; Program Start
;------------------------------------------------------------------------------
RESET       mov.w   #280h,SP                ; Initialize 'x2011 stackpointer
SetupWDT    mov.w   #WDT_MDLY_32,&WDTCTL    ; WDT 32000 MCLK interval timer
SetupBC     bis.b   #DIVM_3+DIVS_3,&BCSCTL2 ; SMCLK/8/ MCLK/8
            bis.b   #WDTIE,&IE1             ; Enable WDT interrupt
SetupP1     mov.b   #0FFh,&P1DIR            ; All P1.x outputs
            clr.b   &P1OUT                  ; All P1.x reset
SetupP2     mov.b   #0FFh,&P2DIR            ; All P2.x outputs
            clr.b   &P2OUT                  ; All P2.x reset

Mainloop    bis.w   #OSCOFF+CPUOFF+GIE,SR   ; Enter LPM, enable interrupts
            bis.b   #001h,&P1OUT            ; Set P1.0
            push.w  #5000                   ; Delay to TOS
Delay       dec.w   0(SP)                   ; Decrement TOS
            jnz     Delay                   ; Delay over?
            incd.w  SP                      ; Clean stack
            bic.b   #001h,&P1OUT            ; Reset P1.0
            jmp     Mainloop                ; Again
                                            ;
;------------------------------------------------------------------------------
WDT_ISR  ;  Exit LPM3 on reti
;------------------------------------------------------------------------------
            bic.w   #CPUOFF,0(SP)           ; Clear LPM from TOS
            reti                            ;
                                            ;
;------------------------------------------------------------------------------
;           Interrupt Vectors Used MSP430x20x1
;------------------------------------------------------------------------------
            ORG     0FFFEh                  ; MSP430 RESET Vector
            DW      RESET                   ;
            ORG     0FFF4h                  ; WDT Vector
            DW      WDT_ISR                 ;
            END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?