📄 msp430x24x_of_xt2.s43
字号:
;******************************************************************************
; MSP430x24x Demo - XT2 Oscillator Fault Detection
;
; Description: System runs normally in LPM3 with Timer A clocked by
; ACLK. Basic Timer interrupt causes an exit from LPM3, and toggles P1.0.
; If an XT2 oscillator fault occurs, NMI is requested, pausing execution and
; flashing LED quickly until fault is resolved. Assumed only XT2 as NMI
; source - code does not check for other NMI sources. MCLK is buffered on
; P5.4. If fault occurs for crystal osc sourcing the MCLK, MCLK is
; automatically switched to DCO for its clock source
; MCLK = XT2 = 8MHz normally, within ISRs MCLK = DCO freq ~1045kHz
; //* An external 8MHx crystal is required between XT2 and XT2OUT , and
; an external 32kHz crystal is required between XIN and XOUT. *//
;
; MSP430x249
; -----------------
; /|\| XIN|-
; | | | 32KHz
; --|RST XOUT|-
; | |
; | XT2IN|-
; | | 8MHz
; | XT2OUT|-
; | |
; | P1.0|-->LED
; | P5.4/MCLK|-->MCLK = XT2 HFXTAL
;
; B. Nisarga
; Texas Instruments Inc.
; September 2007
; Built with IAR Embedded Workbench Version: 3.42A
;******************************************************************************
#include <msp430x24x.h>
;-------------------------------------------------------------------------------
RSEG CSTACK ; Define stack segment
;-------------------------------------------------------------------------------
RSEG CODE ; Assemble to Flash memory
;-----------------------------------------------------------------------------
RESET mov.w #SFE(CSTACK),SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupBC bic.b #XT2OFF,&BCSCTL1 ; Activate XT2 high freq xtal
bis.b #XT2S_2,&BCSCTL3 ; 3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -