?? msp430x261x_compa_04.c
字號(hào):
//******************************************************************************
// MSP430x26x Demo - Comparator A, Poll input CA0, result in P1.0
//
// Description: The voltage at pin CA0 (Vcompare) is compared with reference
// voltage of diode ref. LED is toggled when Vcompare crosses the ref voltage.
//
// MSP430F261x/241x
// -----------------
// /|\| |
// | | |
// --|RST P2.3/CA0|<--Vcompare
// | |
// | P1.0|-->CAOUT - LED
//
// B. Nisarga
// Texas Instruments Inc.
// September 2007
// Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.42A
//******************************************************************************
#include <msp430x26x.h>
void main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop WDT
CACTL1 = CAON+CAREF_3+CARSEL; //Enable comp, ref = Diode ref
CACTL2 = P2CA0; // Pin to CA0
P1DIR |= 0x001; // P1.0 = o/p direction (CAOUT- LED)
P1SEL |= 0x001; // P1.0 - CAOUT, option select
_BIS_SR(LPM0_bits); // Enter LPM0
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -