⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fet110_int_p2.s43

📁 msp430p1110
💻 S43
字号:
#include  "msp430x11x1.h"
;******************************************************************************
;   MSP-FET430x110 Demo - Software Port Interrupt Service on P2.0 
;
;   Description; A hi/low transition on P2.0 will trigger P2_ISR which,
;   toggles P1.0.
;   ACLK = n/a, MCLK = SMCLK = default DCO ~ 800k 
;
;                 MSP430F1121
;             -----------------
;         /|\|              XIN|-  
;          | |                 |
;          --|RST          XOUT|-
;      /|\   |                 |
;       --o--| P2.0        P1.0|-->LED
;      \|/
;
;   M.Buccini
;   Texas Instruments, Inc
;   January 2002
;******************************************************************************
;------------------------------------------------------------------------------
            ORG     0F000h                  ; 
;------------------------------------------------------------------------------
RESET       mov.w   #300h,SP                ; Initialize stackpointer
StopWDT     mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
SetupP1     bis.b   #001h,&P1DIR            ; P1.0 output
            bis.b   #001h,&P2IE             ; P2.0 Interrupt enabled
            bis.b   #001h,&P2IES            ; P2.0 hi/low edge 
            bic.b   #001h,&P2IFG            ; P2.0 IFG Cleared 
            eint                            ; General enable interrupts
                                            ;
Mainloop    jmp     Mainloop                ; Do nothing
                                            ;
;----------------------------------------------------------------------------- 
P2_ISR;     Debounce P2.0, toggle P1.0 Output         
;----------------------------------------------------------------------------- 
            xor.b   #001h,&P1OUT            ; P1.0 = toggle
Debounce    push.w  #10000                  ; Delay TOS 
D1          dec.w   0(SP)                   ; 
            jnz     D1                      ;
            incd.w  SP                      ; Clean up stack
            bic.b   #001h,&P2IFG            ; P2.0 IFG Cleared 
            bit.b   #001h,&P2IN             ; P2.0 still low?
            jnc     Debounce                ;
            reti                            ; Return from ISR
                                            ;
;----------------------------------------------------------------------------- 
;           Interrupt Vectors Used MSP430x11x1         
;----------------------------------------------------------------------------- 
            ORG     0FFFEh                  ; MSP430 RESET Vector
            DW      RESET                   ; 
            ORG     0FFE6h                  ; P2.x Vector
            DW      P2_ISR                  ; 
            END     

⌨️ 快捷键说明

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