📄 msp430x24x_compa_02.s43
字号:
;******************************************************************************
; MSP430x24x Demo - Comparator A, Poll input CA0, CA exchange, result in F249
;
; Description: The Voltage at pin CA0 (Vcompare) is compared with reference
; voltage of 0.5*Vcc. LED is toggled when Vcompare crosses the ref voltage.
;
; MSP430F249
; -----------------
; /|\| |
; | | |
; --|RST P2.3/CA0|<--Vcompare
; | |
; | P1.0|-->CAOUT - LED
;
; 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
mov.b #CAEX+CAON+CAREF_2+CARSEL, &CACTL1 ; Enable comp,
; ref=0.5*Vcc, CA exchange
mov.b #P2CA0, &CACTL2 ; Pin to CA0
SetupP1 bis.b #BIT0,&P1DIR ; P1.0 = output direction
bis.b #BIT0,&P1SEL ; P1.0 = CAOUT
;-----------------------------------------------------------------------------
COMMON INTVEC ; Interrupt Vectors
;-----------------------------------------------------------------------------
ORG RESET_VECTOR ; RESET Vector
DW RESET ;
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -