郭天祥MSP430教程源码-TimerA3.zip
时间:10-27 14:43
查看:1233次
下载:162次
简介:
有关郭天祥MSP430教程源码-TimerA3实验程序设计。
#include <msp430x14x.h>
#include "BoardConfig.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
BoardConfig(0xb8);
P3DIR |= BIT4; // P3.4 output
TACTL = TASSEL_1 + MC_2 + TAIE; // ACLK, contmode, interrupt
_BIS_SR(LPM3_bits + GIE); // Enter LPM3 w/ interrupt
}
// Timer_A3 Interrupt Vector (TAIV) handler
#pragma vector=TIMERA1_VECTOR
__interrupt void Timer_A(void)
{
switch( TAIV )
{
case 2: break; // CCR1 not used
case 4: break; // CCR2 not used
case 10: P3OUT ^= BIT4; // overflow
break;
}
}