?? fet440_tb_05.c
字號(hào):
//******************************************************************************
// MSP-FET430P440 Demo - Timer_B, Toggle P5.1, CCR0 Up Mode ISR, 32kHz ACLK
//
// Description: Toggle P5.1 using software and the TB_0 ISR. Timer_B is
// configured for up mode, thus the the timer overflows when TBR counts
// to CCR0. In this example, CCR0 is loaded with 1000-1. LED toggles every
// 30.5ms.
// ACLK = LFXT1 = 32768Hz, MCLK = SMCLK = default DCO = 32 x ACLK = 1048576Hz
// //* An external watch crystal between XIN & XOUT is required for ACLK *//
//
// MSP430F449
// ---------------
// /|\| XIN|-
// | | | 32kHz
// --|RST XOUT|-
// | |
// | P5.1|-->LED
//
// M. Buccini / A. Dannenberg
// Texas Instruments Inc.
// May 2005
// Built with Code Composer Essentials Version: 1.0
//******************************************************************************
#include <msp430x44x.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP14PF; // Configure load caps
P5DIR |= 0x02; // Set P5.1 to output direction
TBCCTL0 = CCIE; // TRCCR0 interrupt enabled
TBCCR0 = 1000-1;
TBCTL = TBSSEL_1 + MC_1; // ACLK, up mode
_BIS_SR(LPM3_bits + GIE); // Enter LPM3 w/ interrupt
}
// Timer B0 interrupt service routine
__interrupt void Timer_B (void);
TIMERB0_ISR(Timer_B)
__interrupt void Timer_B (void)
{
P5OUT ^= 0x02; // Toggle P5.1 using exclusive-OR
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -