msp430g2xx1 lpm3

1 89 0
msp430g2xx1 lpm3

Đang tải... (xem toàn văn)

Thông tin tài liệu

//****************************************************************************** // MSP430G2xx1 Demo - Basic Clock, LPM3 Using WDT ISR, 32kHz ACLK // // Description: This program operates MSP430 normally in LPM3, pulsing P1.0 // at 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 *// // // // MSP430G2xx1 // // /|\| XIN|// | | | 32kHz // |RST XOUT|// | | // | P1.0| >LED // // D Dang // Texas Instruments Inc // October 2010 // Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10 //****************************************************************************** #include void main(void) { BCSCTL1 |= DIVA_2; WDTCTL = WDT_ADLY_1000; IE1 |= WDTIE; P1DIR = 0xFF; P1OUT = 0; P2DIR = 0xFF; P2OUT = 0; } while(1) { int i; P1OUT |= 0x01; for (i = 5000; i>0; i ); P1OUT &= ~0x01; _BIS_SR(LPM3_bits + GIE); } #pragma vector=WDT_VECTOR interrupt void watchdog_timer (void) { _BIC_SR_IRQ(LPM3_bits); } // // // // // // // ACLK/4 WDT 1s/4 interval timer Enable WDT interrupt All P1.x outputs All P1.x reset All P2.x outputs All P2.x reset // // // // Set P1.0 LED on Delay Reset P1.0 LED off Enter LPM3 // Clear LPM3 bits from 0(SR)

Ngày đăng: 26/12/2017, 07:23

Tài liệu cùng người dùng

Tài liệu liên quan