发表于:2009/2/22 10:49:54
#0楼
#include <msp430x44x.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP14PF;
TBCTL = TBSSEL1 + TBCLR + TBIE +ID_3; // SMCLK, clr. TBR, interrupt
P5DIR |= 0x02; // Set P5.1 to output direction
TBCTL |= MC1; // Start Timer_B in continous
TBCCTL0 |=CCIE;
_EINT(); // Enable interrupts
for (;;)
{
LPM0; // CPU off
_NOP(); // Required only for C-spy
}
}
// Timer_B7 Interrupt Vector (TBIV) handler
#pragma vector=TIMERB0_VECTOR
__interrupt void Timer_B(void)
{
switch( TBIV )
{
case 2: break; // CCR1 not used
case 4: break; // CCR2 not used
case 14: P5OUT ^= 0x02; // overflow
break;
}
}
上面程序中的TBIV的值是怎么确定的啊?
FLL_CTL0 |= XCAP14PF; 有什么用啊?
请高手指点
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP14PF;
TBCTL = TBSSEL1 + TBCLR + TBIE +ID_3; // SMCLK, clr. TBR, interrupt
P5DIR |= 0x02; // Set P5.1 to output direction
TBCTL |= MC1; // Start Timer_B in continous
TBCCTL0 |=CCIE;
_EINT(); // Enable interrupts
for (;;)
{
LPM0; // CPU off
_NOP(); // Required only for C-spy
}
}
// Timer_B7 Interrupt Vector (TBIV) handler
#pragma vector=TIMERB0_VECTOR
__interrupt void Timer_B(void)
{
switch( TBIV )
{
case 2: break; // CCR1 not used
case 4: break; // CCR2 not used
case 14: P5OUT ^= 0x02; // overflow
break;
}
}
上面程序中的TBIV的值是怎么确定的啊?
FLL_CTL0 |= XCAP14PF; 有什么用啊?
请高手指点